drewgenai commited on
Commit
8b32ebd
Β·
1 Parent(s): 109e529

alphabetic order initial docs change

Browse files
app.py CHANGED
@@ -42,17 +42,17 @@ USER_EMBEDDINGS_NAME = "user_embeddings"
42
  os.makedirs(UPLOAD_PATH, exist_ok=True)
43
 
44
  # NIH HEAL CDE core domains
45
- NIH_HEAL_DOMAINS = [
46
- "Pain intensity",
47
- "Pain interference",
48
- "Physical functioning/quality of life (QoL)",
49
- "Sleep",
50
- "Pain catastrophizing",
51
- "Depression",
52
  "Anxiety",
 
53
  "Global satisfaction with treatment",
54
- "Substance Use Screener",
55
- "Quality of Life (QoL)"
 
 
 
 
 
56
  ]
57
 
58
  # Initialize Qdrant (in-memory)
@@ -289,7 +289,7 @@ def search_excel_data(query: str, top_k: int = 3) -> str:
289
 
290
  @tool
291
  def identify_heal_instruments(protocol_text: str = "") -> str:
292
- """Identify instruments used in the protocol for each NIH HEAL CDE core domain.
293
 
294
  Args:
295
  protocol_text: Optional text from the protocol to analyze
@@ -318,7 +318,7 @@ def identify_heal_instruments(protocol_text: str = "") -> str:
318
  # For each domain, search for relevant instruments
319
  domain_instruments = {}
320
 
321
- for domain in NIH_HEAL_DOMAINS:
322
  # Search for instruments related to this domain in the protocol
323
  query = f"What instrument or measure is used for {domain} in the protocol?"
324
 
@@ -372,7 +372,7 @@ system_message = """You are a helpful assistant specializing in NIH HEAL CDE pro
372
 
373
  You have access to:
374
  1. Excel data through the search_excel_data tool
375
- 2. A tool to identify instruments in NIH HEAL protocols (identify_heal_instruments)
376
 
377
  WHEN TO USE TOOLS:
378
  - When users ask about instruments, measures, assessments, questionnaires, or scales in a protocol, use the identify_heal_instruments tool.
@@ -460,14 +460,14 @@ async def on_chat_start():
460
  user_vectorstore = await process_uploaded_files(files)
461
 
462
  if user_vectorstore:
463
- analysis_msg = cl.Message(content="Analyzing your protocol to identify instruments for NIH HEAL CDE core domains...")
464
  await analysis_msg.send()
465
 
466
  # Use the identify_heal_instruments tool to analyze the protocol
467
  config = {"configurable": {"thread_id": cl.context.session.id}}
468
 
469
  # Create a message to trigger the analysis
470
- analysis_request = HumanMessage(content="Please analyze the uploaded protocol and identify instruments for each NIH HEAL CDE core domain.")
471
 
472
  final_answer = cl.Message(content="")
473
 
 
42
  os.makedirs(UPLOAD_PATH, exist_ok=True)
43
 
44
  # NIH HEAL CDE core domains
45
+ NIH_HEAL_CORE_DOMAINS = [
 
 
 
 
 
 
46
  "Anxiety",
47
+ "Depression",
48
  "Global satisfaction with treatment",
49
+ "Pain catastrophizing",
50
+ "Pain interference",
51
+ "Pain intensity",
52
+ "Physical functioning",
53
+ "Quality of Life (QoL)",
54
+ "Sleep",
55
+ "Substance Use Screener"
56
  ]
57
 
58
  # Initialize Qdrant (in-memory)
 
289
 
290
  @tool
291
  def identify_heal_instruments(protocol_text: str = "") -> str:
292
+ """Identify instruments (CRF questionaires) used in the protocol for each NIH HEAL CDE core domain.
293
 
294
  Args:
295
  protocol_text: Optional text from the protocol to analyze
 
318
  # For each domain, search for relevant instruments
319
  domain_instruments = {}
320
 
321
+ for domain in NIH_HEAL_CORE_DOMAINS:
322
  # Search for instruments related to this domain in the protocol
323
  query = f"What instrument or measure is used for {domain} in the protocol?"
324
 
 
372
 
373
  You have access to:
374
  1. Excel data through the search_excel_data tool
375
+ 2. A tool to identify instruments (CRF questionaires) in NIH HEAL protocols (identify_heal_instruments)
376
 
377
  WHEN TO USE TOOLS:
378
  - When users ask about instruments, measures, assessments, questionnaires, or scales in a protocol, use the identify_heal_instruments tool.
 
460
  user_vectorstore = await process_uploaded_files(files)
461
 
462
  if user_vectorstore:
463
+ analysis_msg = cl.Message(content="Analyzing your protocol to identify instruments (CRF questionaires) for NIH HEAL CDE core domains...")
464
  await analysis_msg.send()
465
 
466
  # Use the identify_heal_instruments tool to analyze the protocol
467
  config = {"configurable": {"thread_id": cl.context.session.id}}
468
 
469
  # Create a message to trigger the analysis
470
+ analysis_request = HumanMessage(content="Please analyze the uploaded protocol and identify instruments (CRF questionaires) for each NIH HEAL CDE core domain.")
471
 
472
  final_answer = cl.Message(content="")
473
 
{initial_embeddings β†’ initial_embeddings overflow}/Heal-nih-cde-Instruments_Definitions.xlsx RENAMED
File without changes
{initial_embeddings β†’ initial_embeddings overflow}/adult-demographics-cdes.xlsx RENAMED
File without changes
{initial_embeddings β†’ initial_embeddings overflow}/bpi-pain-severity-7d-cde-pediatric.xlsx RENAMED
File without changes
{initial_embeddings β†’ initial_embeddings overflow}/bpi-pain-severity-cdes.xlsx RENAMED
File without changes
{initial_embeddings β†’ initial_embeddings overflow}/gad2-cdes.xlsx RENAMED
File without changes
{initial_embeddings β†’ initial_embeddings overflow}/nida-modified-assist-cdes.xlsx RENAMED
File without changes
{initial_embeddings β†’ initial_embeddings overflow}/patient-health-questionnaire-8-cde.xlsx RENAMED
File without changes
{initial_embeddings β†’ initial_embeddings overflow}/patient-health-questionnaire-9-cde.xlsx RENAMED
File without changes
{initial_embeddings β†’ initial_embeddings overflow}/pcs-child-cdes.xlsx RENAMED
File without changes
{initial_embeddings β†’ initial_embeddings overflow}/pcs-parent-cdes.xlsx RENAMED
File without changes
{initial_embeddings β†’ initial_embeddings overflow}/pediatric-demographic-cdes.xlsx RENAMED
File without changes
{initial_embeddings β†’ initial_embeddings overflow}/pgic-cdes.xlsx RENAMED
File without changes
{initial_embeddings β†’ initial_embeddings overflow}/pgis-cdes.xlsx RENAMED
File without changes
{initial_embeddings β†’ initial_embeddings overflow}/phq2-cdes.xlsx RENAMED
File without changes
initial_embeddings/CDE_domains_CRFs_elements v1.0 mod.xlsx ADDED
Binary file (24.7 kB). View file