Jonas commited on
Commit
a7f1030
·
1 Parent(s): 79d7705

Add Gradio interface for README content and update tabbed interface to include 'About' section.

Browse files
Files changed (2) hide show
  1. app.py +13 -2
  2. gradio_readme.md +31 -0
app.py CHANGED
@@ -177,6 +177,16 @@ def report_source_tool(drug_name: str):
177
 
178
  # --- Gradio Interface ---
179
 
 
 
 
 
 
 
 
 
 
 
180
  interface1 = gr.Interface(
181
  fn=top_adverse_events_tool,
182
  inputs=[
@@ -211,6 +221,7 @@ interface1 = gr.Interface(
211
  description="Find the most frequently reported adverse events for a specific medication.",
212
  examples=[["Lisinopril"], ["Ozempic"], ["Metformin"]],
213
  #cache_examples=True,
 
214
  )
215
 
216
  interface3 = gr.Interface(
@@ -277,8 +288,8 @@ interface5 = gr.Interface(
277
  )
278
 
279
  demo = gr.TabbedInterface(
280
- [interface1, interface3, interface2, interface4, interface5],
281
- ["Top Events", "Serious Outcomes", "Event Frequency", "Time-Series Trends", "Report Sources"],
282
  title="Medication Adverse-Event Explorer"
283
  )
284
 
 
177
 
178
  # --- Gradio Interface ---
179
 
180
+ with open("gradio_readme.md", "r") as f:
181
+ readme_content = f.read()
182
+
183
+ interface_about = gr.Interface(
184
+ fn=lambda: readme_content,
185
+ inputs=[],
186
+ outputs=gr.Markdown(),
187
+ title="About the Medication Adverse-Event Explorer",
188
+ )
189
+
190
  interface1 = gr.Interface(
191
  fn=top_adverse_events_tool,
192
  inputs=[
 
221
  description="Find the most frequently reported adverse events for a specific medication.",
222
  examples=[["Lisinopril"], ["Ozempic"], ["Metformin"]],
223
  #cache_examples=True,
224
+ allow_flagging="never",
225
  )
226
 
227
  interface3 = gr.Interface(
 
288
  )
289
 
290
  demo = gr.TabbedInterface(
291
+ [interface_about, interface1, interface3, interface2, interface4, interface5],
292
+ ["About", "Top Events", "Serious Outcomes", "Event Frequency", "Time-Series Trends", "Report Sources"],
293
  title="Medication Adverse-Event Explorer"
294
  )
295
 
gradio_readme.md ADDED
@@ -0,0 +1,31 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ # Medication Adverse-Event Explorer
2
+
3
+ Welcome to the Medication Adverse-Event Explorer, an interactive tool for exploring data from the FDA Adverse Event Reporting System (FAERS).
4
+
5
+ ***
6
+
7
+ ### About This Tool
8
+
9
+ This application provides a user-friendly interface to query and visualize data on adverse events reported for various medications. It is designed to help researchers, healthcare professionals, and the public explore trends and patterns in post-market drug safety data. It also functions as an MCP (Machine-Composable Protocol) server, allowing it to be used as a tool by language models.
10
+
11
+ ### Data Source
12
+
13
+ All data is sourced directly from the **[openFDA](https://open.fda.gov/)** API, which provides public access to the FAERS database. This database contains information on adverse event and medication error reports submitted to the FDA.
14
+
15
+ ### Disclaimer
16
+
17
+ **This tool is for informational and research purposes only and is not a substitute for professional medical advice.** The data presented here is based on spontaneous reports, which have not been scientifically verified and do not prove causation. Always consult a qualified healthcare professional for any medical concerns or before making any decisions about your treatment.
18
+
19
+ ***
20
+
21
+ ### How to Use the Tabs
22
+
23
+ The explorer is organized into several tabs, each providing a different view of the data:
24
+
25
+ - **Top Events:** Find the most frequently reported adverse events for a specific drug. You can filter the results by patient sex and age range.
26
+ - **Serious Outcomes:** See a breakdown of the most serious outcomes (e.g., hospitalization, death) reported for a drug.
27
+ - **Event Frequency:** Get the total number of reports for a specific combination of a drug and an adverse event.
28
+ - **Time-Series Trends:** Plot the number of adverse event reports over time for a specific drug and event pair.
29
+ - **Report Sources:** View a pie chart showing the breakdown of who reported the adverse events (e.g., Consumer, Physician, Pharmacist).
30
+
31
+ **A Note on Drug Names:** For demonstration purposes, a small number of common brand names (e.g., 'Tylenol') are automatically converted to their generic equivalents (e.g., 'acetaminophen'). For the most accurate results, it is always best to use the generic name of a drug.