Update view_appointments.py
Browse files- view_appointments.py +2 -12
view_appointments.py
CHANGED
|
@@ -42,20 +42,9 @@ def get_appointment_details(patient_id):
|
|
| 42 |
except pd.errors.ParserError:
|
| 43 |
return "Error parsing the appointments file."
|
| 44 |
|
| 45 |
-
# Check if the DataFrame is loaded correctly
|
| 46 |
-
print("Appointments DataFrame:")
|
| 47 |
-
print(appointments_df.head()) # Print only the first few rows for brevity
|
| 48 |
-
|
| 49 |
-
print("Column Names:")
|
| 50 |
-
print(appointments_df.columns)
|
| 51 |
-
|
| 52 |
# Ensure that Patient ID is properly matched
|
| 53 |
appointment = appointments_df[appointments_df["Patient ID"].astype(str).str.strip() == patient_id]
|
| 54 |
|
| 55 |
-
# Check filtered results
|
| 56 |
-
print(f"Filtered Appointment Data for Patient ID {patient_id}:")
|
| 57 |
-
print(appointment)
|
| 58 |
-
|
| 59 |
if appointment.empty:
|
| 60 |
return f"No appointment records found for Patient ID: {patient_id}."
|
| 61 |
|
|
@@ -75,10 +64,11 @@ def gradio_interface():
|
|
| 75 |
"""Create Gradio interface for viewing appointment details."""
|
| 76 |
with gr.Blocks() as demo:
|
| 77 |
with gr.Row():
|
| 78 |
-
with gr.Column():
|
| 79 |
# Input for patient ID
|
| 80 |
patient_id_input = gr.Number(label="Patient ID", precision=0)
|
| 81 |
|
|
|
|
| 82 |
# Auto-generated output for patient name
|
| 83 |
patient_name_output = gr.Textbox(label="Patient Name", interactive=False)
|
| 84 |
|
|
|
|
| 42 |
except pd.errors.ParserError:
|
| 43 |
return "Error parsing the appointments file."
|
| 44 |
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 45 |
# Ensure that Patient ID is properly matched
|
| 46 |
appointment = appointments_df[appointments_df["Patient ID"].astype(str).str.strip() == patient_id]
|
| 47 |
|
|
|
|
|
|
|
|
|
|
|
|
|
| 48 |
if appointment.empty:
|
| 49 |
return f"No appointment records found for Patient ID: {patient_id}."
|
| 50 |
|
|
|
|
| 64 |
"""Create Gradio interface for viewing appointment details."""
|
| 65 |
with gr.Blocks() as demo:
|
| 66 |
with gr.Row():
|
| 67 |
+
with gr.Column(scale=1): # Make this column smaller for Patient ID input
|
| 68 |
# Input for patient ID
|
| 69 |
patient_id_input = gr.Number(label="Patient ID", precision=0)
|
| 70 |
|
| 71 |
+
with gr.Column(scale=3): # Larger column for the outputs
|
| 72 |
# Auto-generated output for patient name
|
| 73 |
patient_name_output = gr.Textbox(label="Patient Name", interactive=False)
|
| 74 |
|