Spaces:
Sleeping
Sleeping
neerajkalyank
commited on
Commit
•
6afa05d
1
Parent(s):
a1bd855
Update app.py
Browse files
app.py
CHANGED
@@ -19,23 +19,12 @@ def save_data(data):
|
|
19 |
|
20 |
# Patient Registration Tab
|
21 |
def registration_interface(name, father_name, age, phone, address, pincode):
|
22 |
-
|
23 |
-
patient_id = f"{today.year}{today.month:02d}{today.day:02d}{str(phone)[-5:]}"
|
24 |
data = load_data()
|
25 |
-
data[patient_id] = {
|
26 |
-
"name": name,
|
27 |
-
"father_name": father_name,
|
28 |
-
"age": age,
|
29 |
-
"phone": phone,
|
30 |
-
"address": address,
|
31 |
-
"pincode": pincode,
|
32 |
-
"tests": [],
|
33 |
-
"total_cost": 0
|
34 |
-
}
|
35 |
save_data(data)
|
36 |
return f"Patient Registered. Patient ID: {patient_id}"
|
37 |
|
38 |
-
|
39 |
# Tests Selection Tab
|
40 |
def test_interface(categories):
|
41 |
available_tests = get_tests_by_category(categories)
|
@@ -67,7 +56,7 @@ with gr.Blocks() as app:
|
|
67 |
with gr.Row():
|
68 |
address = gr.Textbox(label="Address", placeholder="Enter address", lines=2)
|
69 |
pincode = gr.Number(label="Pincode", value=None, elem_id="pincode_field", precision=0)
|
70 |
-
register_button = gr.Button("Register Patient"
|
71 |
registration_output = gr.Textbox(label="Registration Output")
|
72 |
|
73 |
register_button.click(registration_interface, [name, father_name, age, phone, address, pincode], registration_output)
|
@@ -91,7 +80,7 @@ with gr.Blocks() as app:
|
|
91 |
billing_output = gr.Textbox(label="Billing Information")
|
92 |
fetch_button.click(billing_interface, [patient_id_bill], billing_output)
|
93 |
|
94 |
-
# Custom CSS to adjust field sizes
|
95 |
app.css = """
|
96 |
#name_field, #father_name_field {
|
97 |
max-width: 200px;
|
@@ -108,19 +97,6 @@ app.css = """
|
|
108 |
#pincode_field {
|
109 |
max-width: 100px;
|
110 |
}
|
111 |
-
|
112 |
-
#register_button button {
|
113 |
-
background-color: green;
|
114 |
-
color: white;
|
115 |
-
border: none;
|
116 |
-
padding: 10px 20px;
|
117 |
-
font-size: 16px;
|
118 |
-
cursor: pointer;
|
119 |
-
}
|
120 |
-
|
121 |
-
#register_button button:hover {
|
122 |
-
background-color: darkgreen;
|
123 |
-
}
|
124 |
"""
|
125 |
|
126 |
app.launch()
|
|
|
19 |
|
20 |
# Patient Registration Tab
|
21 |
def registration_interface(name, father_name, age, phone, address, pincode):
|
22 |
+
patient_id = register_patient(name, father_name, age, phone, address, pincode)
|
|
|
23 |
data = load_data()
|
24 |
+
data[patient_id] = {"name": name, "father_name": father_name, "age": age, "phone": phone, "address": address, "pincode": pincode, "tests": [], "total_cost": 0}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
25 |
save_data(data)
|
26 |
return f"Patient Registered. Patient ID: {patient_id}"
|
27 |
|
|
|
28 |
# Tests Selection Tab
|
29 |
def test_interface(categories):
|
30 |
available_tests = get_tests_by_category(categories)
|
|
|
56 |
with gr.Row():
|
57 |
address = gr.Textbox(label="Address", placeholder="Enter address", lines=2)
|
58 |
pincode = gr.Number(label="Pincode", value=None, elem_id="pincode_field", precision=0)
|
59 |
+
register_button = gr.Button("Register Patient")
|
60 |
registration_output = gr.Textbox(label="Registration Output")
|
61 |
|
62 |
register_button.click(registration_interface, [name, father_name, age, phone, address, pincode], registration_output)
|
|
|
80 |
billing_output = gr.Textbox(label="Billing Information")
|
81 |
fetch_button.click(billing_interface, [patient_id_bill], billing_output)
|
82 |
|
83 |
+
# Custom CSS to adjust field sizes
|
84 |
app.css = """
|
85 |
#name_field, #father_name_field {
|
86 |
max-width: 200px;
|
|
|
97 |
#pincode_field {
|
98 |
max-width: 100px;
|
99 |
}
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
100 |
"""
|
101 |
|
102 |
app.launch()
|