Spaces:
Sleeping
Sleeping
neerajkalyank
commited on
Commit
β’
424b0ea
1
Parent(s):
4aa24c7
Update app.py
Browse files
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":
|
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;'
|
81 |
-
|
82 |
-
with gr.Tab("Patient Registration"):
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
96 |
-
|
97 |
-
|
98 |
-
|
99 |
-
|
100 |
-
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
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>")
|