kenlkehl commited on
Commit
b6071fa
·
verified ·
1 Parent(s): d1d3fa0

Upload app.py

Browse files
Files changed (1) hide show
  1. app.py +7 -6
app.py CHANGED
@@ -103,7 +103,7 @@ def match_clinical_trials_dropdown(patient_summary: str):
103
  # Build the dropdown choices, e.g., "NCT001 - Some Title"
104
  dropdown_options = []
105
  for this_index, row in out_df.iterrows():
106
- option_str = f"{this_index} - {row['nct_id']} - {row['trial_title']}"
107
  dropdown_options.append(option_str)
108
 
109
  # Return an update for the dropdown (choices + clear any initial value)
@@ -124,9 +124,10 @@ def show_selected_trial(selected_option: str, df: pd.DataFrame):
124
  return ""
125
 
126
  # Parse NCT ID from "NCT001 - Some Title"
127
- nct_id = selected_option.split(" - ")[0].strip()
128
 
129
- row = df[df['nct_id'] == nct_id]
 
130
  if row.empty:
131
  return "No data found for the selected trial."
132
 
@@ -163,8 +164,8 @@ custom_css = """
163
  with gr.Blocks(css=custom_css) as demo:
164
  # Intro text
165
  gr.HTML("""
166
- <h3>Alpha Version of Clinical Trial Search (Dropdown Results)</h3>
167
- <p>Based on clinicaltrials.gov cancer trials export 10/31/24</p>
168
  <p>Queries take approximately 30 seconds to run.</p>
169
  """)
170
 
@@ -172,7 +173,7 @@ with gr.Blocks(css=custom_css) as demo:
172
  patient_summary_input = gr.Textbox(
173
  label="Enter Patient Summary",
174
  elem_id="input_box",
175
- value="70M with metastatic lung adenocarcinoma, KRAS G12C mutation, PD-L1 high, previously treated with pembrolizumab."
176
  )
177
 
178
  # Button to run the matching
 
103
  # Build the dropdown choices, e.g., "NCT001 - Some Title"
104
  dropdown_options = []
105
  for this_index, row in out_df.iterrows():
106
+ option_str = f"{this_index}\. {row['nct_id']} - {row['trial_title']}"
107
  dropdown_options.append(option_str)
108
 
109
  # Return an update for the dropdown (choices + clear any initial value)
 
124
  return ""
125
 
126
  # Parse NCT ID from "NCT001 - Some Title"
127
+ chosen_index = selected_option.split("\.")[0].strip()
128
 
129
+ #row = df[df['nct_id'] == nct_id]
130
+ row = df.iloc[[chosen_index]]
131
  if row.empty:
132
  return "No data found for the selected trial."
133
 
 
164
  with gr.Blocks(css=custom_css) as demo:
165
  # Intro text
166
  gr.HTML("""
167
+ <h3>Demonstration version of clinical trial search based on MatchMiner-AI</h3>
168
+ <p>Based on clinicaltrials.gov cancer trials export 10/31/24.</p>
169
  <p>Queries take approximately 30 seconds to run.</p>
170
  """)
171
 
 
173
  patient_summary_input = gr.Textbox(
174
  label="Enter Patient Summary",
175
  elem_id="input_box",
176
+ value="metastatic lung adenocarcinoma, KRAS G12C mutation, PD-L1 high, previously treated with pembrolizumab."
177
  )
178
 
179
  # Button to run the matching