This project is a hostpital information system that supports the following types of users: administrators, doctors and patients. The information system is build with python Flask and MongoDB.
For running this application the following software is assumed that it is already installed.
- Python: Required for running the Flask application.
- Docker: Docker is required to run the application in containers.
- Docker Compose: Docker Compose is needed to manage multiple Docker containers.
Also, for testing purposes Postman is used for sending the requests.
- Flask: Flask is a lightweight python framework used in thir project for developing all the endpoints that support the required functionalities.
- PyMongo: Pymongo includes tools for working with MongoDB in a python environmnet and in this project it is used as the database interface for the application.
- MongoDB: MongoDB is a NoSQL database that uses JSON-like documents with schema. In this project it is used to store all application data including user information, appointments, etc.
- Docker: Docker is used to containerize the application.
- Docker Compose: Docker-compose is used for running both the Flask application and MongoDB database containers.
hospital/
│
├── flask/
│ ├── app.py
│ ├── Dockerfile
│
├── docker-compose.yml
├── README.md
The app.py is the Flask application file and it contains all the endpoints for the admin, doctor, and patient functionalities. It handles user login, register, logout appointment management, and all the other required functionalities of the application.
This is a Dockerfile that defines the Docker image for the Flask application. It includes the base image, installation of dependencies, and the setup of the application environment.
This is a Docker Compose file to set up and manage both the Flask application and the MongoDB database.
-
Clone the Repository:
git clone https://github.com/jkapsalis/YpoxreotikiErgasia24_E19062_Kapsalhs_Ioannis.git cd YpoxreotikiErgasia24_E19062_Kapsalhs_Ioannis -
Build and Run Docker Containers:
sudo docker-compose up --build
URL: /admin/login
Method: POST
This endpoint allows the admin to log in their account by providing their correct credentials (admin username and password). If the credentials are correct, the session is started and the response is a corresponding message.
Invalid Credentials:
If the credentials are incorrect, the response is informing appropriately.
Missing Fields:
If the request does not include all the necessary fields for the login (in this case the username and the passowrd) then the response informs appropriately.
URL: /admin/logout
Method: POST
This endpoint logs out the admin by ending their session.
URL: /admin/doctors
Method: POST
This endpoint allows the admin to create a new doctor account by providing the necessary indormation in the request. If all the information are provided then the doctor is created and a corresponding message shows up in the response.
Missing Fields:
If some of the necessary fiels for the doctor creation is missing, then the response includes a corresponding message.
Doctor Already Exists:
If a doctor with the same email or username already exists in the database, the creation of the doctor fails and the response includes a coresponfing message.
Unauthorised Admin
This endpoint is only available if the admin has already logged in.

URL: /admin/doctors/<username>/password
Method: PUT
This endpoint allows the admin to change the password for an existing doctor account. The new password must be provided in the request body, while the username of the doctor is part of the constructed URL.
Missing New Password:
If the new password is not provided, the response includes a corresponding message.

Doctor Not Found:
If the docotr's username is not correct, then the responce includes a message that informs about it.

URL: /admin/doctors/<username>
Method: DELETE
This endpoint allows the admin to delete a doctor account by specifying the doctor's username. All appointments of the specified doctor are also deleted.
Doctor Not Found:
If the specified username does not match an existing doctor in the database then the responce informs appropriately.

URL: /admin/patients/<username>
Method: DELETE
This endpoint allows the admin to delete a patient account by specifying the patient's username. All associated appointments are also deleted.
URL: /doctor/login
Method: POST
This endpoint authenticates doctors and starts their session if the provided credentials are correct.
Invalid Credentials:
If the provided credentials are incorrect, the response includes a corresponding message.

Missing Fields:
If one of the fiels is missing the response informs about that with a message.

URL: /doctor/logout
Method: POST
This endpoint logs out doctors by ending their session.
URL: /doctor/password
Method: PUT
This endpoint allows doctors to change their password by providing a new password.
Unauthorised Doctor
This endpoint is only available in doctors that are logged in.

URL: /doctor/appointment-cost
Method: PUT
This endpoint allows doctors to update their appointment cost by including a new cost in the request.
URL: /doctor/appointments
Method: GET
This endpoint allows the doctor to view all their upcoming appointments.
Successful Retrieval:
URL: /patient/register
Method: POST
This endpoint allows a new patient to register by providing these fields: first name, last name, email, AMKA, birthdate, username, and password.
Missing Fields:
If one or more of these fiels does not exist in the request, then the response includes the following message.

Patient Already Exists:
If a patient is already registered with the same email or username then a corresponding message is included in the response.

URL: /patient/login
Method: POST
This endpoint allows patients to log in by providing their username and password.
Successful Login:
If the credentials are correct, the session is started.

Invalid Credentials:
If the provided credentials are incorrect, then the response is the following.

Missing Fields:
If one of the fiels is not included then the following message is included in the response.

URL: /patient/logout
Method: POST
This endpoint logs out patients by ending their session.
URL: /patient/appointments
Method: POST
This endpoint, with the POST method, allows the patient to book an appointment by providing: date, time, specialization, and reason for the appointment.
Missing Fields:
If one of the fiels is missing, the response is the following.

No Available Doctor:
If such a doctor does not exist, then the following message is included in the response.

Unauthorised Patient
If the patient does not have a running session, the response will inform appropriately.

URL: /patient/appointments
Method: GET
This endpoint, with a GET request, allows the patient to view all their upcoming appointments.
URL: /patient/appointments/<appointment_id>
Method: GET
This endpoint allows patients to view the details of a specific appointment they have already made, by providing the appointment ID.
Appointment Not Found:
If the provided ID does not match an existing appointment of this patient, then the response includes the following message.

URL: /patient/appointments/<appointment_id>
Method: DELETE
This endpoint, with the DELETE method, allows the patient to cancel a specific appointment by providing the appointment ID.
























