Spaces:
Sleeping
Sleeping
neerajkalyank
commited on
Commit
•
01ac39a
1
Parent(s):
c88ed1d
Update app.py
Browse files
app.py
CHANGED
@@ -62,25 +62,9 @@ def registration_interface(name, father_name, age, phone, address, pincode):
|
|
62 |
save_data(patients, last_sequence)
|
63 |
return f"Patient Registered. Patient ID: {patient_id}", patient_id
|
64 |
|
65 |
-
#
|
66 |
-
def
|
67 |
-
|
68 |
-
return gr.update(choices=available_tests) # Update dropdown with available tests
|
69 |
-
|
70 |
-
def confirm_tests_interface(patient_id, selected_tests):
|
71 |
-
patients, last_sequence = load_data() # Load both patients and last_sequence
|
72 |
-
response = select_tests(patient_id, selected_tests, patients) # Update patients directly
|
73 |
-
save_data(patients, last_sequence) # Save both patients and last_sequence
|
74 |
-
return response
|
75 |
-
|
76 |
-
# Billing Tab
|
77 |
-
def billing_interface(patient_id):
|
78 |
-
patients, _ = load_data() # Load patients and ignore last_sequence
|
79 |
-
if patient_id in patients:
|
80 |
-
billing_info = fetch_billing(patient_id, patients)
|
81 |
-
return billing_info
|
82 |
-
else:
|
83 |
-
return "Invalid Patient ID. Please check the ID."
|
84 |
|
85 |
# Gradio Interface
|
86 |
with gr.Blocks() as app:
|
@@ -96,28 +80,24 @@ with gr.Blocks() as app:
|
|
96 |
with gr.Row():
|
97 |
address = gr.Textbox(label="Address", placeholder="Enter address", lines=2)
|
98 |
pincode = gr.Number(label="Pincode", value=None, elem_id="pincode_field")
|
|
|
99 |
register_button = gr.Button("Register Patient")
|
100 |
registration_output = gr.Textbox(label="Registration Output")
|
101 |
-
|
102 |
-
|
103 |
-
|
104 |
-
|
105 |
-
|
106 |
-
|
107 |
-
|
108 |
-
|
109 |
-
|
110 |
-
|
111 |
-
|
112 |
-
|
113 |
-
|
114 |
-
|
115 |
-
|
116 |
-
});
|
117 |
-
}
|
118 |
-
</script>
|
119 |
-
</div>
|
120 |
-
""")
|
121 |
|
122 |
with gr.Tab("Tests"):
|
123 |
patient_id_test = gr.Textbox(label="Patient ID")
|
|
|
62 |
save_data(patients, last_sequence)
|
63 |
return f"Patient Registered. Patient ID: {patient_id}", patient_id
|
64 |
|
65 |
+
# Copy functionality
|
66 |
+
def copy_patient_id(patient_id):
|
67 |
+
return f"{patient_id} copied to clipboard!"
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
68 |
|
69 |
# Gradio Interface
|
70 |
with gr.Blocks() as app:
|
|
|
80 |
with gr.Row():
|
81 |
address = gr.Textbox(label="Address", placeholder="Enter address", lines=2)
|
82 |
pincode = gr.Number(label="Pincode", value=None, elem_id="pincode_field")
|
83 |
+
|
84 |
register_button = gr.Button("Register Patient")
|
85 |
registration_output = gr.Textbox(label="Registration Output")
|
86 |
+
patient_id_display = gr.Textbox(label="Patient ID", interactive=False) # Display Patient ID here
|
87 |
+
copy_button = gr.Button("Copy Patient ID")
|
88 |
+
copy_output = gr.Textbox(label="Copy Status", interactive=False)
|
89 |
+
|
90 |
+
register_button.click(
|
91 |
+
registration_interface,
|
92 |
+
[name, father_name, age, phone, address, pincode],
|
93 |
+
[registration_output, patient_id_display]
|
94 |
+
)
|
95 |
+
|
96 |
+
copy_button.click(
|
97 |
+
copy_patient_id,
|
98 |
+
[patient_id_display], # Pass the Patient ID to the function
|
99 |
+
copy_output
|
100 |
+
)
|
|
|
|
|
|
|
|
|
|
|
101 |
|
102 |
with gr.Tab("Tests"):
|
103 |
patient_id_test = gr.Textbox(label="Patient ID")
|