neerajkalyank commited on
Commit
424b0ea
β€’
1 Parent(s): 4aa24c7

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +27 -28
app.py CHANGED
@@ -12,7 +12,7 @@ def load_data():
12
  data = json.load(file)
13
  return data.get("patients", {}), data.get("last_sequence", {"year": None, "month": None, "number": 0})
14
  except FileNotFoundError:
15
- return {}, {"year": None, "month": None, "number": 0}
16
 
17
  # Save data
18
  def save_data(patients, last_sequence):
@@ -54,7 +54,6 @@ def registration_interface(name, father_name, age, gender, phone, address):
54
  save_data(patients, last_sequence)
55
  return f"Patient Registered. Patient ID: {patient_id}"
56
 
57
-
58
  # Tests Selection Tab
59
  def test_interface(categories):
60
  available_tests = get_tests_by_category(categories)
@@ -77,32 +76,32 @@ def billing_interface(patient_id):
77
 
78
  # Gradio Interface
79
  with gr.Blocks() as app:
80
- gr.Markdown("<h1 style='text-align: center;'>πŸ‘©πŸ»β€πŸ”¬π”–π”žπ”±π”₯𝔨𝔯𝔲𝔱π”₯π”ž 𝔩𝔦π”ͺπ”°πŸ”¬</h1>", elem_id="header")
81
-
82
- with gr.Tab("Patient Registration"):
83
- gr.Markdown("<h2>Register a New Patient</h2>")
84
-
85
- with gr.Row():
86
- name = gr.Textbox(label="Patient Name", placeholder="Enter patient's full name", elem_id="name_field")
87
- father_name = gr.Textbox(label="Father/Husband's Name", placeholder="Enter father/husband's full name", elem_id="father_name_field")
88
-
89
- with gr.Row():
90
- age = gr.Number(label="Age", value=None, minimum=0, maximum=120, elem_id="age_field")
91
- gender = gr.CheckboxGroup(
92
- choices=["Male", "Female", "Other"],
93
- label="Gender",
94
- elem_id="gender_field"
95
- )
96
-
97
- with gr.Row():
98
- phone = gr.Textbox(label="Phone Number", placeholder="Enter a valid 10-digit phone number", elem_id="phone_field")
99
- address = gr.Textbox(label="Address", placeholder="Enter full address", lines=2, elem_id="address_field")
100
-
101
- register_button = gr.Button("Register Patient", elem_id="register_button")
102
- registration_output = gr.Textbox(label="Registration Output", elem_id="registration_output", interactive=False)
103
-
104
- # Link button click to registration interface function
105
- register_button.click(registration_interface, [name, father_name, age, gender, phone, address], registration_output)
106
 
107
  with gr.Tab("Tests"):
108
  gr.Markdown("<h2>Select Tests for the Patient</h2>")
 
12
  data = json.load(file)
13
  return data.get("patients", {}), data.get("last_sequence", {"year": None, "month": None, "number": 0})
14
  except FileNotFoundError:
15
+ return {}, {"year": None, "month": 0, "number": 0}
16
 
17
  # Save data
18
  def save_data(patients, last_sequence):
 
54
  save_data(patients, last_sequence)
55
  return f"Patient Registered. Patient ID: {patient_id}"
56
 
 
57
  # Tests Selection Tab
58
  def test_interface(categories):
59
  available_tests = get_tests_by_category(categories)
 
76
 
77
  # Gradio Interface
78
  with gr.Blocks() as app:
79
+ gr.Markdown("<h1 style='text-align: center;'>πŸ‘©πŸ»β€πŸ”¬πŸ…’πŸ…πŸ…£πŸ…—πŸ…šπŸ…‘πŸ…€πŸ…£πŸ…—πŸ… πŸ…›πŸ…˜πŸ…œπŸ…’πŸ”¬</h1>", elem_id="header")
80
+
81
+ with gr.Tab("Patient Registration"):
82
+ gr.Markdown("<h2>Register a New Patient</h2>")
83
+
84
+ with gr.Row():
85
+ name = gr.Textbox(label="Patient Name", placeholder="Enter patient's full name", elem_id="name_field")
86
+ father_name = gr.Textbox(label="Father/Husband's Name", placeholder="Enter father/husband's full name", elem_id="father_name_field")
87
+
88
+ with gr.Row():
89
+ age = gr.Number(label="Age", value=None, minimum=0, maximum=120, elem_id="age_field")
90
+ gender = gr.CheckboxGroup(
91
+ choices=["Male", "Female", "Other"],
92
+ label="Gender",
93
+ elem_id="gender_field"
94
+ )
95
+
96
+ with gr.Row():
97
+ phone = gr.Textbox(label="Phone Number", placeholder="Enter a valid 10-digit phone number", elem_id="phone_field")
98
+ address = gr.Textbox(label="Address", placeholder="Enter full address", lines=2, elem_id="address_field")
99
+
100
+ register_button = gr.Button("Register Patient", elem_id="register_button")
101
+ registration_output = gr.Textbox(label="Registration Output", elem_id="registration_output", interactive=False)
102
+
103
+ # Link button click to registration interface function
104
+ register_button.click(registration_interface, [name, father_name, age, gender, phone, address], registration_output)
105
 
106
  with gr.Tab("Tests"):
107
  gr.Markdown("<h2>Select Tests for the Patient</h2>")