Spaces:
Runtime error
Runtime error
Create app.py
Browse files
app.py
ADDED
|
@@ -0,0 +1,38 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
import gradio as gr
|
| 2 |
+
import datetime
|
| 3 |
+
|
| 4 |
+
# In-memory storage (you can replace with a DB)
|
| 5 |
+
doctors = []
|
| 6 |
+
patients = []
|
| 7 |
+
appointments = []
|
| 8 |
+
lab_tests = []
|
| 9 |
+
lab_reports = []
|
| 10 |
+
skip_process_data = []
|
| 11 |
+
staff = []
|
| 12 |
+
billing = []
|
| 13 |
+
|
| 14 |
+
# Doctor Registration
|
| 15 |
+
def register_doctor(specialty, qualification):
|
| 16 |
+
doctors.append({"specialty": specialty, "qualification": qualification})
|
| 17 |
+
return f"Doctor with specialty '{specialty}' registered."
|
| 18 |
+
|
| 19 |
+
# Patient Registration
|
| 20 |
+
def register_patient(name, age, gender, address, contact):
|
| 21 |
+
if not name or not age or not contact:
|
| 22 |
+
return "Name, Age, and Contact Number are mandatory."
|
| 23 |
+
patient_id = f"PID{len(patients)+1:03}"
|
| 24 |
+
patients.append({
|
| 25 |
+
"id": patient_id, "name": name, "age": age, "gender": gender,
|
| 26 |
+
"address": address, "contact": contact
|
| 27 |
+
})
|
| 28 |
+
return f"Patient Registered with ID: {patient_id}"
|
| 29 |
+
|
| 30 |
+
# Book Appointment
|
| 31 |
+
def book_appointment(patient_id, specialty, doctor_name, datetime_slot):
|
| 32 |
+
if not patient_id or not specialty or not doctor_name or not datetime_slot:
|
| 33 |
+
return "All fields are mandatory for booking an appointment."
|
| 34 |
+
patient = next((p for p in patients if p['id'] == patient_id), None)
|
| 35 |
+
if not patient:
|
| 36 |
+
return "Invalid Patient ID"
|
| 37 |
+
appointments.append({
|
| 38 |
+
"
|