yougandar commited on
Commit
b26a4f5
·
verified ·
1 Parent(s): c695d86

Create add_patient_reports.py

Browse files
Files changed (1) hide show
  1. add_patient_reports.py +25 -0
add_patient_reports.py ADDED
@@ -0,0 +1,25 @@
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
1
+ import gradio as gr
2
+ import csv
3
+ import os
4
+
5
+ # Hard-coded file path for patient reports
6
+ reports_file_path = "reports.csv"
7
+
8
+ # Function to add patient reports
9
+ def add_patient_report(patient_id, report_details):
10
+ with open(reports_file_path, mode='a', newline='') as file:
11
+ writer = csv.writer(file)
12
+ writer.writerow([patient_id, report_details])
13
+ return f"Report for Patient ID {patient_id} added successfully."
14
+
15
+ # Gradio UI for adding patient reports
16
+ app = gr.Blocks()
17
+
18
+ with app:
19
+ with gr.Tab("Add Patient Reports"):
20
+ patient_id = gr.Textbox(label="Patient ID", placeholder="Enter Patient ID", lines=1)
21
+ report_details = gr.Textbox(label="Report Details", placeholder="Enter report details", lines=3)
22
+ report_output = gr.Textbox(label="Report Status", lines=1)
23
+ gr.Button("Add Report").click(add_patient_report, inputs=[patient_id, report_details], outputs=report_output)
24
+
25
+ app.launch()