Run with python app.py, install deps like flask, pysqlite3 and the rest
pip install flask pysqlite3 flask_restful
python app.py
Below are some sample curl commands that demonstrate how to interact with the API endpoints defined in the provided Flask application
curl -X GET http://localhost:5000/appointment
curl -X POST http://127.0.0.1:5000/appointment -H "Content-Type: application/json" -d "{\"pat_id\": \"2\",\"doc_id\": \"2\",\"appointment_date\": \"2024-04-01\"}"
curl -X GET http://localhost:5000/appointment/2
curl -X DELETE http://localhost:5000/appointment/2
curl -X PUT http://127.0.0.1:5000/appointment/7 -H "Content-Type: application/json" -d "{\"pat_id\": \"2\",\"doc_id\": \"4\"}"
curl -X GET http://127.0.0.1:5000/department
curl -X POST http://127.0.0.1:5000/department -H "Content-Type: application/json" -d "{\"department_id\":34,\"name\":\"New dept\",\"head_id\":1,\"doctors\":[1,2,3]}"
curl -X GET http://127.0.0.1:5000/department/1
curl -X PUT http://127.0.0.1:5000/department/1 -H "Content-Type: application/json" -d "{\"name\":\"New Department Name\",\"head_id\":2}"
curl -X GET http://127.0.0.1:5000/department/1/doctors
curl -X POST http://127.0.0.1:5000/department/1/doctors -H "Content-Type: application/json" -d "{\"doctors\":[4,5,6]}"
curl -X GET http://127.0.0.1:5000/doctor
curl -X POST http://127.0.0.1:5000/doctor -H "Content-Type: application/json" -d "{\"doc_first_name\":\"John\",\"doc_last_name\":\"Doe\",\"doc_ph_no\":\"1234567890\",\"doc_address\":\"123 Main St\"}"
curl -X GET http://127.0.0.1:5000/doctor/1
curl -X PUT http://127.0.0.1:5000/doctor/1 -H "Content-Type: application/json" -d "{\"doc_first_name\":\"Jane\",\"doc_last_name\":\"Smith\",\"doc_ph_no\":\"9876543210\",\"doc_address\":\"456 Elm St\",\"patients_assigned\":\"2,3\"}"
curl -X PATCH http://127.0.0.1:5000/doctor/1/patients/assign/2
curl -X PATCH http://127.0.0.1:5000/doctor/1/patients/delete/2
curl -X GET http://127.0.0.1:5000/doctor/availability
curl -X GET http://127.0.0.1:5000/doctor/1/patients
curl -X GET http://127.0.0.1:5000/patient
curl -X POST http://127.0.0.1:5000/patient -H "Content-Type: application/json" -d "{\"pat_first_name\":\"John\",\"pat_last_name\":\"Doe\",\"pat_insurance_no\":\"1234567890\",\"pat_ph_no\":\"9876543210\",\"pat_address\":\"123 Main St\"}"
curl -X GET http://127.0.0.1:5000/patient/2
curl -X PUT http://127.0.0.1:5000/patient/1 -H "Content-Type: application/json" -d "{\"pat_first_name\":\"Jane\",\"pat_last_name\":\"Smith\",\"pat_insurance_no\":\"0987654321\",\"pat_ph_no\":\"1234567890\",\"pat_address\":\"456 Elm St\"}"
curl -X POST http://127.0.0.1:5000/patient/2 -H "Content-Type: application/json" -d "{\"medical_history\":\"High blood pressure\"}"
curl -X GET http://127.0.0.1:5000/patient/2/history
curl -X GET http://127.0.0.1:5000/patient/2/appointment
curl -X PATCH http://127.0.0.1:5000/patient/3 -H "Content-Type: application/json" -d "{\"appointment\":\"('Dr. White', '2024-04-02')\"}"
curl -X GET "http://127.0.0.1:5000/search/patients?query=John"
curl -X GET "http://127.0.0.1:5000/search/doctors?query=Geeta"
curl -X GET "http://127.0.0.1:5000/search/departments?query=Physiotherapy"
curl -X GET "http://127.0.0.1:5000/doctor/1/patients"
And others present in the app.py as per the requirements