Spaces:
Sleeping
Sleeping
neerajkalyank
commited on
Commit
β’
6bde547
1
Parent(s):
f1270ee
Update app.py
Browse files
app.py
CHANGED
@@ -36,7 +36,7 @@ def generate_patient_id(phone, last_sequence):
|
|
36 |
return patient_id
|
37 |
|
38 |
# Patient Registration Tab
|
39 |
-
def registration_interface(name, father_name, age, phone, address
|
40 |
patients, last_sequence = load_data()
|
41 |
patient_id = generate_patient_id(phone, last_sequence)
|
42 |
|
@@ -44,9 +44,9 @@ def registration_interface(name, father_name, age, phone, address, pincode):
|
|
44 |
"name": name,
|
45 |
"father_name": father_name,
|
46 |
"age": age,
|
|
|
47 |
"phone": phone,
|
48 |
"address": address,
|
49 |
-
"pincode": pincode,
|
50 |
"tests": [],
|
51 |
"total_cost": 0
|
52 |
}
|
@@ -54,6 +54,7 @@ def registration_interface(name, father_name, age, phone, address, pincode):
|
|
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)
|
@@ -79,20 +80,25 @@ 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 |
-
|
83 |
-
|
84 |
-
|
85 |
-
|
86 |
-
|
87 |
-
|
88 |
-
|
89 |
-
|
90 |
-
|
91 |
-
|
92 |
-
|
93 |
-
|
94 |
-
|
95 |
-
|
|
|
|
|
|
|
|
|
|
|
96 |
|
97 |
with gr.Tab("Tests"):
|
98 |
gr.Markdown("<h2>Select Tests for the Patient</h2>")
|
@@ -161,7 +167,7 @@ body {
|
|
161 |
}
|
162 |
|
163 |
/* Form Field Styles */
|
164 |
-
input, select {
|
165 |
max-width: 700px !important;
|
166 |
border: 1px solid #7fffd4 !important;
|
167 |
border-radius: 8px !important;
|
@@ -279,6 +285,27 @@ label {
|
|
279 |
margin-bottom: 5px !important;
|
280 |
}
|
281 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
282 |
/* Responsive Design for Mobile Devices */
|
283 |
@media (max-width: 768px) {
|
284 |
.gradio-container {
|
@@ -293,6 +320,11 @@ label {
|
|
293 |
font-size: 1em !important;
|
294 |
padding: 10px !important;
|
295 |
}
|
|
|
|
|
|
|
|
|
|
|
296 |
}
|
297 |
|
298 |
"""
|
|
|
36 |
return patient_id
|
37 |
|
38 |
# Patient Registration Tab
|
39 |
+
def registration_interface(name, father_name, age, gender, phone, address):
|
40 |
patients, last_sequence = load_data()
|
41 |
patient_id = generate_patient_id(phone, last_sequence)
|
42 |
|
|
|
44 |
"name": name,
|
45 |
"father_name": father_name,
|
46 |
"age": age,
|
47 |
+
"gender": gender, # Updated field for gender
|
48 |
"phone": phone,
|
49 |
"address": address,
|
|
|
50 |
"tests": [],
|
51 |
"total_cost": 0
|
52 |
}
|
|
|
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)
|
|
|
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 |
+
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 |
+
with gr.Row():
|
88 |
+
age = gr.Number(label="Age", value=None, minimum=0, maximum=120, elem_id="age_field")
|
89 |
+
gender = gr.CheckboxGroup(
|
90 |
+
choices=["Male", "Female", "Other"],
|
91 |
+
label="Gender",
|
92 |
+
elem_id="gender_field"
|
93 |
+
)
|
94 |
+
with gr.Row():
|
95 |
+
phone = gr.Textbox(label="Phone Number", placeholder="Enter a valid 10-digit phone number", elem_id="phone_field")
|
96 |
+
address = gr.Textbox(label="Address", placeholder="Enter full address", lines=2, elem_id="address_field")
|
97 |
+
|
98 |
+
register_button = gr.Button("Register Patient", elem_id="register_button")
|
99 |
+
registration_output = gr.Textbox(label="Registration Output", elem_id="registration_output", interactive=False)
|
100 |
+
|
101 |
+
register_button.click(registration_interface, [name, father_name, age, gender, phone, address], registration_output)
|
102 |
|
103 |
with gr.Tab("Tests"):
|
104 |
gr.Markdown("<h2>Select Tests for the Patient</h2>")
|
|
|
167 |
}
|
168 |
|
169 |
/* Form Field Styles */
|
170 |
+
input, select, textarea {
|
171 |
max-width: 700px !important;
|
172 |
border: 1px solid #7fffd4 !important;
|
173 |
border-radius: 8px !important;
|
|
|
285 |
margin-bottom: 5px !important;
|
286 |
}
|
287 |
|
288 |
+
/* Checkbox Group Styling */
|
289 |
+
#gender_field {
|
290 |
+
display: flex !important;
|
291 |
+
flex-direction: row !important;
|
292 |
+
gap: 15px !important;
|
293 |
+
align-items: center !important;
|
294 |
+
margin-top: -10px !important; /* Adjust as needed for alignment */
|
295 |
+
}
|
296 |
+
|
297 |
+
/* Styling for Gender Checkboxes */
|
298 |
+
#gender_field input[type="checkbox"] {
|
299 |
+
margin-right: 5px !important;
|
300 |
+
}
|
301 |
+
|
302 |
+
/* Row Styling for Field Alignment */
|
303 |
+
.gradio-container .gr-row {
|
304 |
+
display: flex !important;
|
305 |
+
gap: 20px !important;
|
306 |
+
align-items: center !important;
|
307 |
+
}
|
308 |
+
|
309 |
/* Responsive Design for Mobile Devices */
|
310 |
@media (max-width: 768px) {
|
311 |
.gradio-container {
|
|
|
320 |
font-size: 1em !important;
|
321 |
padding: 10px !important;
|
322 |
}
|
323 |
+
|
324 |
+
#gender_field {
|
325 |
+
flex-direction: column !important;
|
326 |
+
align-items: flex-start !important;
|
327 |
+
}
|
328 |
}
|
329 |
|
330 |
"""
|