neerajkalyank commited on
Commit
425deb7
1 Parent(s): 9f408a9

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +12 -6
app.py CHANGED
@@ -1,7 +1,7 @@
1
  import gradio as gr
2
  import json
3
  from patient_registration import register_patient
4
- from test_selection import select_tests
5
  from billing import fetch_billing
6
 
7
  # Load data
@@ -26,9 +26,13 @@ def registration_interface(name, father_name, age, phone, address, pincode):
26
  return f"Patient Registered. Patient ID: {patient_id}"
27
 
28
  # Tests Selection Tab
29
- def test_interface(patient_id, categories, selected_tests):
 
 
 
 
30
  data = load_data()
31
- response = select_tests(patient_id, categories, selected_tests, data)
32
  save_data(data)
33
  return response
34
 
@@ -55,11 +59,13 @@ with gr.Blocks() as app:
55
 
56
  with gr.Tab("Tests"):
57
  patient_id_test = gr.Textbox(label="Patient ID")
58
- categories = gr.CheckboxGroup(["Hematology", "Biochemistry"], label="Select Test Categories")
59
- selected_tests = gr.CheckboxGroup([], label="Select Specific Tests")
60
  confirm_button = gr.Button("Confirm Tests")
61
  test_output = gr.Textbox(label="Test Selection Output")
62
- confirm_button.click(test_interface, [patient_id_test, categories, selected_tests], test_output)
 
 
63
 
64
  with gr.Tab("Billing"):
65
  patient_id_bill = gr.Textbox(label="Patient ID")
 
1
  import gradio as gr
2
  import json
3
  from patient_registration import register_patient
4
+ from test_selection import select_tests, get_tests_by_category
5
  from billing import fetch_billing
6
 
7
  # Load data
 
26
  return f"Patient Registered. Patient ID: {patient_id}"
27
 
28
  # Tests Selection Tab
29
+ def test_interface(patient_id, categories):
30
+ available_tests = get_tests_by_category(categories)
31
+ return available_tests
32
+
33
+ def confirm_tests_interface(patient_id, selected_tests):
34
  data = load_data()
35
+ response = select_tests(patient_id, selected_tests, data)
36
  save_data(data)
37
  return response
38
 
 
59
 
60
  with gr.Tab("Tests"):
61
  patient_id_test = gr.Textbox(label="Patient ID")
62
+ categories = gr.CheckboxGroup(["Haematology", "Clinical Pathology", "Biochemistry", "Microbiology", "Specific Diseases", "Serology", "Radiology", "Other Diagnostic Tests"], label="Select Test Categories")
63
+ available_tests = gr.CheckboxGroup(label="Available Tests")
64
  confirm_button = gr.Button("Confirm Tests")
65
  test_output = gr.Textbox(label="Test Selection Output")
66
+
67
+ categories.change(test_interface, categories, available_tests) # Update available tests based on selected categories
68
+ confirm_button.click(confirm_tests_interface, [patient_id_test, available_tests], test_output)
69
 
70
  with gr.Tab("Billing"):
71
  patient_id_bill = gr.Textbox(label="Patient ID")