Patient Portal is a basic Patient management system, where the user (ie. receptionist) should do the folowing tasks:
- List Patients:
- List Patients with a given name:
- Read a Patient with certain id:
- Create a Patient:
- Update the data of a Patient:
- Delete a Patient:
- Install Python (recommended version >= 3.10)
- Install Gitbash (Optional)
To install the repository requirements, follow these steps:
You have the option to either fork the repository or clone it.
-
Fork this Repository
Visit https://github.com/gerelee357/patients-portal-for-students and click on the "Fork" button.
Once forked, rename the repository to patients-portal and click "Create Fork".
-
Clone the Forked Repository:
git clone https://github.com/<your-username>/patients-portal.git- Navigate to the Repository:
cd patient-portalThis will allow you to download and set up the repository on your local machine.
- Clone the Repository:
git clone https://github.com/gerelee357/patients-portal-for-students- Navigate to the Repository:
cd patients-portal-for-studentsThis will allow you to download and set up the repository on your local machine.
- Create a virtual environment
python -m venv venv- Activate the virtual environment
In linux (gitbash)
source venv/bin/activateIn windows
source venv/Scripts/activate- Install Python packages to run the application
python -m pip install -r requirements.txtFirst Run the flask server by running the API_CONTROLLER (src/api_controller.py) directly or using Linux command:
python src/api_controller.pyWith both the server and database now prepared, the next step involves finalizing the API interface by completing the function definition in src/api_controller.py. This interface serves as the bridge between the database and the client, ensuring seamless communication and interaction between the two.
- Replace the placeholder
passstatements with the necessary code to fulfill the requirements specified for each function. - Make sure your functions handle any potential exceptions.
Point Allocation:
Each function definition is valued at 3 points, totaling 15 points.
Once these functions are properly implemented, the Patient Portal application will be capable of enabling users, such as receptionists, to perform a range of tasks including creating, reading, updating, and deleting patient records.
Next, you can test out the application. You can use the provided scripts or just try it out using a web browser.
In Terminal :
First Run the flask server by running the API_CONTROLLER (src/api_controller.py) directly or using linux command:
python src/api_controller.pyOnce the Flask server is running, open a new terminal and keep the server running in the first one.
Then,
cd testing-api-templatesThen,
bash create_patient.shIf it returns the patient_id in the response then meaning that Patient has been created successfully and added to the database.
Then for listing the created patients,
bash list_patients.shThen for listing the created patients with *name* as parameter,
bash list_patient_by_name.shThen to get a patient's details with a certain ID,
bash get_certain_patient.shThen, to update the patient,
bash update_patient.shFinally, to delete the created patient,
bash delete_patient.shIf you encounter an error stating that port 5000 is already being used by another program when attempting to run a server, you can resolve this by following these steps:
- Use the
lsofcommand to identify the process ID (PID) associated with port 5000:
lsof -i :5000- Once you have the PID, you can stop the process using the
killcommand. For example, if the PID is 1234, you would execute:
kill -9 1234Replace "1234" with the actual PID you obtained from the lsof command.
Flask Documentation: https://flask.palletsprojects.com/en/3.0.x/quickstart/#routing
Flask Cheatsheet: https://s3.us-east-2.amazonaws.com/prettyprinted/flask_cheatsheet.pdf
Swagger Editor (Playground): https://editor.swagger.io/
Python OOP : https://docs.python.org/3/tutorial/classes.html
If you need more clarification, please ping me. I will update the readme file.
This task has been created by Aadarsh Mehdi.
LinkedIn Profile: Aadarsh Mehdi