DoctorFlow is an API designed to streamline the patient management process. It digitizes patient records and enhances communication between doctors and patients.
DoctorFlow is a clinic management system API built with Express.js and Node.js. It uses MongoDB for data storage and Redis for managing authentication tokens. The API provides a comprehensive solution for managing doctor and patient data, handling appointments, and improving clinic operations.
- Profile Management: Create and manage personal profiles.
- Patient Management: Create and manage patient profiles, including general information and medical data.
- Session Logging: Log patient sessions with detailed information such as session date, diagnosis, prescriptions.
- Profile Viewing: View their personal profiles.
- Session History: Access their session history.
- Doctor Information: View basic information about their doctor.
- The "Dev" user cannot be created via the API. A special script
createDev.js
is used to create this user locally. This script requires two environment variables:EMAIL
andPASSWORD
.
The API is intended for other developers who want to integrate DoctorFlow into their websites or applications.
- Backend Framework: Express.js and Node.js for server-side logic and routing.
- Database: MongoDB with Mongoose for data management and schema modeling.
- Authentication: UUID4 tokens for user authentication, managed with Redis for efficient session handling.
- Documentation: JSDoc and Swagger for generating and interacting with API documentation.
- Testing: Postman for API testing and validation.
- Redis: Used for managing authentication tokens and improving session management.
Before you begin, ensure you have the following installed on your machine:
- Node.js: Download Node.js
- npm: Comes with Node.js. Learn more about npm
- Redis: Download Redis
To get started with DoctorFlow, first clone the repository to your local machine:
git clone https://github.com/Drihmia/DoctorFlow.git
- Update System and Install Dependencies:
sudo apt update
sudo apt install redis-server redis-tools
sudo apt install mongodb
- Start Necessary Services:
- Start Redis Server:
sudo service redis-server start
- Start MongoDB (if you are working on a local machine):
sudo service mongod start
Once you have cloned the repository, navigate to the project directory and install the required dependencies:
cd DoctorFlow
npm install
Create a .env
file in the root directory of the project and include the following environment variables:
MONGO_URI=your-mongodb-uri
EMAIL=[email protected]
PASSWORD=your-dev-password
Note: You can use .env file to store environment variables or you can set them directly in the terminal using export command.
export MONGO_URI=your-mongodb-uri
export EMAIL=your-dev-email
export PASSWORD=your-dev-password
MONGO_URL
: Replace your-mongodb-uri with the URI of your MongoDB instance. If you're using MongoDB Atlas, ensure your IP address is added to the database's access white list. Refer to Atlas documentation for more details.EMAIL
andPASSWORD
: Use these for creating a dev account to access dev endpoints.
-
Start Redis Server:
- Ensure Redis is installed and running.
- Start the Redis server with:
redis-server
-
Start the Express Application:
- Start the Node.js application:
npm start
- Start the Node.js application:
-
Create a Dev Account:
- Run the script to create a dev account, which will allow access to the dev endpoints:
npm run dev createDev.js
- This script uses the
EMAIL
andPASSWORD
you set in your.env
file to create the dev account..
- Run the script to create a dev account, which will allow access to the dev endpoints:
Note: Dev account can only access 3 endpoints: /doctors
, /patients
, and /sessions
.
- Access the API Documentation:
We’ve provided an automation script to simplify the installation process. This script handles the majority of the setup steps automatically.
If something doesn’t work during the installation, the script will display messages in different colors to help you troubleshoot and resolve any issues manually.
To run the script, execute the following command:
bash automate_setup_process.bash
Note: We wanted to make sure our project is well-structured and runs smoothly, so we adopted a Test-Driven Development (TDD) approach. By writing tests first, we set ourselves up to improve the code confidently. As the project grew, our tests grew with it, helping us refine both the code and the tests, making sure everything works together seamlessly.
The API can be tested using Postman. The collection and environment files are available in the postman
directory. Click the button below to run the collection in Postman:
Note: Basic environment variables are set in the Postman collection. Update the environment variables with your own values if necessary.
- BaseUrlDF: The base URL of the DoctorFlow API, e.g.,
https://drihmia.tech
- DevEmail: The email address you've chosen to create the dev account using the script.
- DevPassword: The password you've chosen to create the dev account using the script.
-
Authors:
- DRIHMIA Redouane: [email protected]
- Omnia ABOUHAIKAL: [email protected]
-
GitHub Accounts:
This project is licensed under the Apache License - see the LICENSE file for details.