neerajkalyank commited on
Commit
a096730
1 Parent(s): f10a2ea

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +53 -119
app.py CHANGED
@@ -74,63 +74,8 @@ def billing_interface(patient_id):
74
  else:
75
  return "Invalid Patient ID. Please check the ID."
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.Markdown(label="Registration Output", elem_id="registration_output")
102
-
103
- register_button.click(registration_interface, [name, father_name, age, gender, phone, address], registration_output)
104
-
105
- with gr.Tab("Tests"):
106
- gr.Markdown("<h2>Select Tests for the Patient</h2>")
107
- patient_id_test = gr.Textbox(label="Patient ID", placeholder="Enter Patient ID")
108
- categories = gr.CheckboxGroup(
109
- ["Haematology", "Clinical Pathology", "Biochemistry", "Microbiology", "Specific Diseases", "Serology", "Radiology", "Other Diagnostic Tests"],
110
- label="Select Test Categories"
111
- )
112
- available_tests = gr.CheckboxGroup(label="Available Tests")
113
- confirm_button = gr.Button("Confirm Selected Tests")
114
-
115
- # Use Markdown for Test Selection Output to allow for auto-expanding content
116
- test_output = gr.Markdown(label="Test Selection Output", elem_id="test_output")
117
-
118
- categories.change(test_interface, inputs=categories, outputs=available_tests)
119
- confirm_button.click(confirm_tests_interface, [patient_id_test, available_tests], test_output)
120
-
121
- with gr.Tab("Billing"):
122
- gr.Markdown("<h2>Billing Information</h2>")
123
- patient_id_bill = gr.Textbox(label="Patient ID", placeholder="Enter Patient ID for Billing")
124
- fetch_button = gr.Button("Fetch Billing Details")
125
-
126
- # Use Markdown for Billing Output to allow for auto-expanding content
127
- billing_output = gr.Markdown(label="Billing Information", elem_id="billing_output")
128
-
129
- fetch_button.click(billing_interface, [patient_id_bill], billing_output)
130
-
131
-
132
  # Custom CSS styling
133
- css="""
134
  @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');
135
 
136
  /* General Page Style */
@@ -261,33 +206,6 @@ input, select, textarea {
261
  color: #2d2d2d;
262
  }
263
 
264
- /* Form Field Hover and Focus */
265
- input:focus, textarea:focus, select:focus {
266
- border-color: #00ffcc;
267
- box-shadow: 0 0 10px rgba(0, 255, 204, 0.6);
268
- transform: scale(1.02);
269
- }
270
-
271
- /* Button Style */
272
- .gr-button {
273
- color: #ffffff;
274
- background: linear-gradient(135deg, #1de9b6, #007aff);
275
- border: none;
276
- border-radius: 12px;
277
- padding: 12px 30px;
278
- cursor: pointer;
279
- font-weight: 600;
280
- font-size: 16px;
281
- transition: 0.3s ease;
282
- box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
283
- }
284
-
285
- .gr-button:hover {
286
- background: linear-gradient(135deg, #005cbf, #00bfa5);
287
- transform: scale(1.05);
288
- box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
289
- }
290
-
291
  /* Tab Styling */
292
  .nav-tabs {
293
  display: flex;
@@ -321,44 +239,60 @@ input:focus, textarea:focus, select:focus {
321
  background-color: rgba(255, 140, 0, 0.1);
322
  padding: 8px 16px;
323
  }
 
324
 
325
- /* Field Labels */
326
- label {
327
- font-size: 1em;
328
- font-weight: 600;
329
- color: #7fffd4;
330
- margin-bottom: 5px;
331
- }
332
 
333
- /* Output Text Styling */
334
- #test_output, #billing_output {
335
- color: #ffffff !important;
336
- background-color: rgba(0, 0, 50, 0.8) !important;
337
- padding: 10px;
338
- border-radius: 5px;
339
- font-weight: bold;
340
- text-align: left;
341
- }
342
 
343
- /* Responsive Design for Mobile Devices */
344
- @media (max-width: 768px) {
345
- .gradio-container {
346
- padding: 20px;
347
- }
348
-
349
- #header {
350
- font-size: 2em;
351
- }
352
 
353
- input, textarea, select, .gr-button {
354
- font-size: 1em;
355
- padding: 10px;
356
- }
 
 
 
357
 
358
- .gr-radio-group {
359
- flex-direction: column;
360
- align-items: flex-start;
361
- }
362
- }
363
- """
364
- app.launch()
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
74
  else:
75
  return "Invalid Patient ID. Please check the ID."
76
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
77
  # Custom CSS styling
78
+ custom_css = """
79
  @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');
80
 
81
  /* General Page Style */
 
206
  color: #2d2d2d;
207
  }
208
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
209
  /* Tab Styling */
210
  .nav-tabs {
211
  display: flex;
 
239
  background-color: rgba(255, 140, 0, 0.1);
240
  padding: 8px 16px;
241
  }
242
+ """
243
 
244
+ # Gradio Interface
245
+ with gr.Blocks(css=custom_css) as app:
246
+ gr.Markdown("<h1 style='text-align: center;'>👩🏻‍🔬丂卂ㄒ卄Ҝ尺ㄩㄒ卄卂 ㄥ丨爪丂🔬</h1>", elem_id="header")
 
 
 
 
247
 
248
+ with gr.Tab("Patient Registration"):
249
+ gr.Markdown("<h2>Register a New Patient</h2>")
 
 
 
 
 
 
 
250
 
251
+ with gr.Row():
252
+ name = gr.Textbox(label="Patient Name", placeholder="Enter patient's full name", elem_id="name_field")
253
+ father_name = gr.Textbox(label="Father/Husband's Name", placeholder="Enter father/husband's full name", elem_id="father_name_field")
 
 
 
 
 
 
254
 
255
+ with gr.Row():
256
+ age = gr.Number(label="Age", value=None, minimum=0, maximum=120, elem_id="age_field")
257
+ gender = gr.Radio(
258
+ choices=["Male", "Female", "Other"],
259
+ label="Gender",
260
+ elem_id="gender_field"
261
+ )
262
 
263
+ with gr.Row():
264
+ phone = gr.Textbox(label="Phone Number", placeholder="Enter a valid 10-digit phone number", elem_id="phone_field")
265
+ address = gr.Textbox(label="Address", placeholder="Enter full address", lines=2, elem_id="address_field")
266
+
267
+ register_button = gr.Button("Register Patient", elem_id="register_button")
268
+ registration_output = gr.Markdown(label="Registration Output", elem_id="registration_output")
269
+
270
+ register_button.click(registration_interface, [name, father_name, age, gender, phone, address], registration_output)
271
+
272
+ with gr.Tab("Tests"):
273
+ gr.Markdown("<h2>Select Tests for the Patient</h2>")
274
+ patient_id_test = gr.Textbox(label="Patient ID", placeholder="Enter Patient ID")
275
+ categories = gr.CheckboxGroup(
276
+ ["Haematology", "Clinical Pathology", "Biochemistry", "Microbiology", "Specific Diseases", "Serology", "Radiology", "Other Diagnostic Tests"],
277
+ label="Select Test Categories"
278
+ )
279
+ available_tests = gr.CheckboxGroup(label="Available Tests")
280
+ confirm_button = gr.Button("Confirm Selected Tests")
281
+
282
+ # Use Markdown for Test Selection Output to allow for auto-expanding content
283
+ test_output = gr.Markdown(label="Test Selection Output", elem_id="test_output")
284
+
285
+ categories.change(test_interface, inputs=categories, outputs=available_tests)
286
+ confirm_button.click(confirm_tests_interface, [patient_id_test, available_tests], test_output)
287
+
288
+ with gr.Tab("Billing"):
289
+ gr.Markdown("<h2>Billing Information</h2>")
290
+ patient_id_bill = gr.Textbox(label="Patient ID", placeholder="Enter Patient ID for Billing")
291
+ fetch_button = gr.Button("Fetch Billing Details")
292
+
293
+ # Use Markdown for Billing Output to allow for auto-expanding content
294
+ billing_output = gr.Markdown(label="Billing Information", elem_id="billing_output")
295
+
296
+ fetch_button.click(billing_interface, [patient_id_bill], billing_output)
297
+
298
+ app.launch()