neerajkalyank commited on
Commit
5915fd6
1 Parent(s): 03aa3d0

Update app.py

Browse files
Files changed (1) hide show
  1. app.py +51 -117
app.py CHANGED
@@ -74,62 +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
  @import url('https://fonts.googleapis.com/css2?family=Poppins:wght@400;600;700&display=swap');
134
 
135
  /* General Page Style */
@@ -260,33 +206,6 @@ input, select, textarea {
260
  color: #2d2d2d;
261
  }
262
 
263
- /* Form Field Hover and Focus */
264
- input:focus, textarea:focus, select:focus {
265
- border-color: #00ffcc;
266
- box-shadow: 0 0 10px rgba(0, 255, 204, 0.6);
267
- transform: scale(1.02);
268
- }
269
-
270
- /* Button Style */
271
- .gr-button {
272
- color: #ffffff;
273
- background: linear-gradient(135deg, #1de9b6, #007aff);
274
- border: none;
275
- border-radius: 12px;
276
- padding: 12px 30px;
277
- cursor: pointer;
278
- font-weight: 600;
279
- font-size: 16px;
280
- transition: 0.3s ease;
281
- box-shadow: 0 6px 15px rgba(0, 0, 0, 0.3);
282
- }
283
-
284
- .gr-button:hover {
285
- background: linear-gradient(135deg, #005cbf, #00bfa5);
286
- transform: scale(1.05);
287
- box-shadow: 0 8px 20px rgba(0, 0, 0, 0.4);
288
- }
289
-
290
  /* Tab Styling */
291
  .nav-tabs {
292
  display: flex;
@@ -320,45 +239,60 @@ input:focus, textarea:focus, select:focus {
320
  background-color: rgba(255, 140, 0, 0.1);
321
  padding: 8px 16px;
322
  }
 
323
 
324
- /* Field Labels */
325
- label {
326
- font-size: 1em;
327
- font-weight: 600;
328
- color: #7fffd4;
329
- margin-bottom: 5px;
330
- }
331
 
332
- /* Output Text Styling */
333
- #test_output, #billing_output {
334
- color: #ffffff !important;
335
- background-color: rgba(0, 0, 50, 0.8) !important;
336
- padding: 10px;
337
- border-radius: 5px;
338
- font-weight: bold;
339
- text-align: left;
340
- }
341
 
342
- /* Responsive Design for Mobile Devices */
343
- @media (max-width: 768px) {
344
- .gradio-container {
345
- padding: 20px;
346
- }
347
-
348
- #header {
349
- font-size: 2em;
350
- }
351
 
352
- input, textarea, select, .gr-button {
353
- font-size: 1em;
354
- padding: 10px;
355
- }
 
 
 
356
 
357
- .gr-radio-group {
358
- flex-direction: column;
359
- align-items: flex-start;
360
- }
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()