Spaces:
Running
Running
endpoints_documentation = { | |
"root": { | |
"path": "/", | |
"method": "GET", | |
"description": "API root endpoint", | |
"parameters": None, | |
"request_body": None, | |
"response": {"message": "Clinic Reservation API - Use /docs for documentation"} | |
}, | |
"get_reservations": { | |
"path": "/reservations", | |
"method": "GET", | |
"description": "Get all reservations", | |
"parameters": None, | |
"request_body": None, | |
"response": { | |
"description": "List of all reservations", | |
"model": "List[Reservation]", | |
"filters": "Only returns reservations with status 'scheduled'" | |
} | |
}, | |
"get_reservations_by_filters": { | |
"path": "/reservations/", | |
"method": "GET", | |
"description": "Get reservations filtered by patient ID and/or doctor name (only scheduled)", | |
"parameters": { | |
"patient_id": { | |
"type": "str", | |
"required": False, | |
"description": "Filter by patient ID" | |
}, | |
"doctor_name": { | |
"type": "str", | |
"required": False, | |
"description": "Filter by doctor name (case-insensitive partial match)" | |
} | |
}, | |
"request_body": None, | |
"response": { | |
"description": "List of matching scheduled reservations", | |
"model": "List[Reservation]", | |
"error": "404 if no scheduled reservations match criteria" | |
} | |
}, | |
"create_reservation": { | |
"path": "/create-reservation", | |
"method": "POST", | |
"description": "Create a new reservation", | |
"parameters": None, | |
"request_body": { | |
"model": "CreateReservation", | |
"required_fields": { | |
"patient_id": "str", | |
"doctor_name": "str", | |
"date_time": "datetime like this 2023-10-16T19:00:00" | |
}, | |
"optional_fields": { | |
"reason": "str (optional)" | |
} | |
}, | |
"response": { | |
"description": "Created reservation with status 'scheduled'", | |
"model": "Reservation", | |
"error": "404 if doctor not found" | |
} | |
}, | |
"reschedule_reservation": { | |
"path": "/reservations/reschedule", | |
"method": "PUT", | |
"description": "Reschedule an existing reservation", | |
"parameters": { | |
"doctor_name": { | |
"type": "str", | |
"required": True, | |
"description": "ID of the reservation to reschedule" | |
}, | |
"new_date_time": { | |
"type": "str", | |
"required": True, | |
"description": "New date/time to reschedule to" | |
} | |
}, | |
"response": { | |
"description": "Updated reservation with new date/time", | |
"model": "Reservation", | |
"error": "404 if reservation not found" | |
} | |
}, | |
"cancel_reservation": { | |
"path": "/reservations/cancel", | |
"method": "PUT", | |
"description": "Cancel a reservation", | |
"parameters": { | |
"doctor_name": { | |
"type": "str", | |
"required": True, | |
"description": "ID of the reservation to cancel" | |
} | |
}, | |
"request_body": None, | |
"response": { | |
"description": "Canceled reservation (status changed to 'canceled')", | |
"model": "Reservation", | |
"error": "404 if reservation not found" | |
} | |
}, | |
"get_doctors": { | |
"path": "/doctors", | |
"method": "GET", | |
"description": "Get list of all available doctors", | |
"parameters": None, | |
"request_body": None, | |
"response": { | |
"description": "List of doctors with their specialties", | |
"model": "List[dict]", | |
"example": [ | |
{"id": 1, "name": "Dr. Smith", "specialty": "General Medicine"} | |
] | |
} | |
}, | |
"get_doctor_availability": { | |
"path": "/doctors/{doctor_id}/availability", | |
"method": "GET", | |
"description": "Get doctor's fake availability slots (30-min intervals from 9am-5pm)", | |
"parameters": { | |
"doctor_id": { | |
"type": "int", | |
"required": True, | |
"description": "ID of the doctor" | |
}, | |
"date": { | |
"type": "str (YYYY-MM-DD)", | |
"required": False, | |
"description": "Date to check availability (default: today)" | |
} | |
}, | |
"request_body": None, | |
"response": { | |
"description": "Doctor's availability slots with random availability", | |
"model": "dict", | |
"example": { | |
"doctor_id": 1, | |
"date": "2023-10-15", | |
"slots": [ | |
{ | |
"start": "2023-10-15T09:00:00", | |
"end": "2023-10-15T09:30:00", | |
"available": True | |
} | |
] | |
}, | |
"error": "404 if doctor not found" | |
} | |
}, | |
"get_patients": { | |
"path": "/patients", | |
"method": "GET", | |
"description": "Get list of all patients", | |
"parameters": None, | |
"request_body": None, | |
"response": { | |
"description": "List of patients with contact information", | |
"model": "List[Patient]", | |
"example": [ | |
{"id": "uuid-123", "name": "John Doe", "phone": "555-0101", "email": "john@example.com"} | |
] | |
} | |
}, | |
"get_patient_reservations": { | |
"path": "/patients/reservations", | |
"method": "GET", | |
"description": "Get my all reservations", | |
"parameters": { | |
"patient_id": { | |
"type": "str", | |
"required": True, | |
"description": "ID of the patient" | |
} | |
}, | |
"request_body": None, | |
"response": { | |
"description": "List of patient's reservations (all statuses)", | |
"model": "List[Reservation]", | |
"note": "Returns empty list if no reservations found (no 404 error)" | |
} | |
}, | |
"get_hospitals": { | |
"path": "/hospitals", | |
"method": "GET", | |
"description": "Get list of all hospitals and thier working hours (start time and end time) and location", | |
"parameters": None, | |
} | |
} |