The project revolves around establishing a comprehensive virtual clinic integrated with an associated pharmacy, serving both the clinic and its patients. El7a2ny presents a software solution designed for clinics, doctors, pharmacists, and patients, aiming to simplify and automate the interactions among patients, medical professionals, and pharmacists. This encompasses a wide range of functionalities, including searching for a doctor, scheduling appointments, conducting on-site or virtual meetings, receiving prescriptions, setting up follow-up reminders, accessing medical histories, and ordering prescribed medications.
- Motivation
- Build Status
- Code Style
- Screenshots
- Tech/Framework used
- Features
- Code Examples
- Installation
- API Refrences
- Tests
- How To Use
- Contribute
- Credits
- License
The motivation behind the YKHO-Pharmacy project includes:
- Gain proficiency in utilizing the Agile Methodology for effective project planning and software development.
- Understand the process of implementing software development based on a predefined set of system requirements.
- Acquire research skills and expertise in utilizing the MERN Stack (MongoDB, Express.js, React, Node.js).
- Learn collaborative teamwork using GitHub as a platform.
- Develop the ability to integrate and merge two functioning systems into a unified solution.
This section provides information about the current build status of the project. The badge above indicates that the build is passing, ensuring that the project is in a stable state.
If you encounter any bugs, errors, or issues, please open an issue on our GitHub repository. By reporting issues, you contribute to the improvement of the project. Developers familiar with the issue can provide solutions or insights directly, saving time and ensuring a more efficient resolution.
We follow a set of coding conventions to maintain consistency throughout the project. Contributors are encouraged to adhere to the following guidelines:
- Indentation: Use 2 spaces for indentation.
- Naming Conventions: Follow camelCase for variable and function names.
- Comments: Include comments for complex code sections or where additional explanation is needed.
- File Organization: Organize files logically, placing related files in the same directory.
- Error Handling: Implement proper error handling to enhance code robustness.
- Documentation: Include inline documentation for functions and major code sections using JSDoc comments.
Here is an example illustrating the preferred coding style for this project:
// Good
function calculateTotalPrice(itemPrice, quantity) {
// Calculate the total price
const totalPrice = itemPrice * quantity;
return totalPrice;
}
// Bad
function calculateTotal(item_price, Quantity) {
const total = item_price * Quantity; // Calculating total
return total; // Return total
}
Here are some screenshots showcasing the key features of the YKHO-Pharmacy project:
Screenshots
The YKHO-Pharmacy project utilizes the MERN Stack (MongoDB, Express.js, React, Node.js) for its development:
- MongoDB: A NoSQL database used for storing and managing data.
- Express.js: A web application framework for Node.js, simplifying the development of server-side applications.
- React: A JavaScript library for building user interfaces, used for creating dynamic and interactive client-side components.
- Node.js: A JavaScript runtime environment that allows the execution of server-side code.
These technologies collectively provide a robust and efficient foundation for the development of the virtual clinic and pharmacy solution.
The YKHO-Pharmacy project incorporates the following key features:
-
User Authentication:
- Secure user authentication system for patients, administrators, and pharmacists.
-
Admin Panel:
- An interface to manage and administrate the system as a whole.
-
Telemedicine Integration:
- Seamless integration for conducting real-time meetings and consultations between pharmacists, patients, and doctors.
-
Prescription Ordering:
- Electronic prescription system for patient to issue and purchase medication.
-
Follow-up Reminders:
- Automated reminders for pharmacists to follow up on medicines that are out of stock.
-
Order History Access:
- Centralized access to order histories for patients to provide better-informed care.
-
Medication Ordering:
- User-friendly system for patients to order medications from the integrated pharmacy.
-
Search Functionality:
- Efficient search capabilities to help users find specific medicines.
-
Filter Functionality:
- Efficient filter capabilities to help users find specific medicines.
-
Sales Report Dashboard:
- A dashboard for pharmacists to view sales performance of each medicine.
-
Data Security:
- Implementation of robust security measures to safeguard patient and medical data.
-
User Registration:
- An interface to allow users to register to the system.
-
User Login:
- An interface to allow users to login to the system using their credentials.
-
OTP Password-Reset:
- A secure method to allow users to reset their forgotten passwords using a OTP sent through email.
-
Pharmacist Panel:
- An interface to manage and administrate the system with stuff related to medicines and patients.
These features collectively contribute to creating a comprehensive virtual clinic and pharmacy solution, enhancing the overall healthcare experience for users.
// Placeholder code for user authentication logic
function isAuthenticated(req, res, next) {
if (req.session.user) {
next();
} else {
res.redirect('/login');
}
}
// Placeholder code for search logic
exports.searchMedicines = async (req, res) => {
try {
const { search } = req.query;
const searchRegex = new RegExp(search, 'i');
const medicines = await Medicine.find({ name: searchRegex });
res.render('patient/medicines', { medicines });
} catch (err) {
res.status(500).json({ error: err.message });
}
};
// Placeholder code for filter logic
exports.filterMedicinesByMedUse = async (req, res) => {
try {
const { medUse } = req.query;
if (!medUse) {
return res.status(400).json({ error: 'Please provide a "medUse" filter' });
}
const medicines = await Medicine.find({ medUse: medUse });
res.render('patient/medicines', { medicines });
} catch (err) {
res.status(500).json({ error: err.message });
}
};
// Placeholder code for create medicine logic
exports.createMedicine = async (req, res) => {
try {
const {
image,
name,
dosage,
description,
medUse,
detail,
quantity,
sales,
price,
needPres,
} = req.body;
const prescriptionRequired = needPres === 'on';
let existingMedicine = await Medicine.findOne({ name });
if (existingMedicine) {
return res.status(404).json({
message: 'Medicine with the same name already exists',
medicine: existingMedicine,
});
}
const newMedicine = new Medicine({
image,
name,
dosage,
description,
medUse,
detail,
quantity,
sales,
price,
needPres: prescriptionRequired,
});
await newMedicine.save();
res.status(201).json({
message: 'Medicine added successfully',
medicine: newMedicine,
});
} catch (err) {
res.status(500).json({ error: err.message });
}
};
// Placeholder code for change password logic
exports.changePassword = async (req, res) => {
try {
const { oldPassword, newPassword } = req.body;
const username = req.session.user.username;
const admin = await Administrator.findOne({ username });
if (!admin) {
return res.status(404).json({ message: 'Administrator not found' });
}
if (oldPassword !== admin.password) {
return res.status(401).json({ message: 'Incorrect old password' });
}
admin.password = newPassword;
await admin.save();
res.json({ message: 'Password changed successfully' });
} catch (err) {
res.status(500).json({ error: err.message });
}
};
// Placeholder code for reset password logic
exports.resetPassword = async (req, res) => {
try {
const { newPassword } = req.body;
const username = req.session.user.username;
const admin = await Administrator.findOne({ username });
if (!admin) {
return res.status(404).json({ message: 'admin not found' });
}
admin.password = newPassword;
await admin.save();
res.json({ message: 'Password changed successfully' });
} catch (err) {
res.status(500).json({ error: err.message });
}
};
Follow these steps to set up and run the YKHO-Pharmacy project locally:
Make sure you have the following software installed on your machine:
- Node.js: JavaScript runtime for executing server-side code.
- npm (Node Package Manager): Package manager for JavaScript.
npm install
npm install express mongoose multer socket.io
git clone https://github.com/advanced-computer-lab-2023/YKHO-Pharmacy.git
cd YKHO-Pharmacy
- Home:
GET /admin/adminHome
- Add Administrator:
- View:
GET /admin/addadministrator
- Action:
POST /admin/addadministrator
- View:
- Remove Pharmacist:
- View:
GET /admin/removePharmacist
- Action:
POST /admin/removePharmacist
- View:
- Remove Patient:
- View:
GET /admin/removePatient
- Action:
POST /admin/removePatient
- View:
- Get Patient:
- View:
GET /admin/getPatient
- Action:
POST /admin/getPatient
- View:
- Get Pharmacist:
- View:
GET /admin/getPharmacist
- Action:
POST /admin/getPharmacist
- View:
- Get Requests:
GET /admin/getRequests
- Accept Request:
POST /admin/acceptRequest
- Reject Request:
POST /admin/rejectRequest
- Medicines:
GET /admin/medicines
- Search Medicines:
GET /admin/searchMedicines
- Filter Medicines by Medical Use:
GET /admin/medicines/filter
- Change Password:
- View:
GET /admin/change-password
- Action:
POST /admin/change-password
- View:
- Reset Password:
- View:
GET /admin/resetPassword
- Action:
POST /admin/resetPassword
- View:
- Sales Report:
- View:
GET /admin/salesReport
- Action:
POST /admin/salesReport
- View:
- Home:
GET /patient/patientHome
- Medicines:
GET /patient/medicines
- Search Medicines:
GET /patient/searchMedicines
- Filter Medicines by Medical Use:
GET /patient/medicines/filter
- Change Password:
- View:
GET /patient/change-password
- Action:
POST /patient/change-password
- View:
- Reset Password:
- View:
GET /patient/resetPassword
- Action:
POST /patient/resetPassword
- View:
- Add to Cart:
POST /patient/addToCart
- Shopping Cart:
GET /patient/ShoppingCart
- Remove From Cart:
POST /patient/removeFromCart
- Edit Cart Item Quantity:
POST /patient/editCartItemQuantity
- Get Checkout:
GET /patient/getcheckout
- Add Address:
POST /patient/addAddress
- Checkout:
POST /patient/checkout
- Empty Cart:
POST /patient/emptyCart
- Success Page:
GET /patient/success
- Failed Order:
POST /patient/failedOrder
- Failure Page:
GET /patient/failure
- Orders:
GET /patient/orders
- Cancel Order:
POST /patient/cancelOrder
- Wallet:
GET /patient/wallet
- Chat:
GET /patient/chat
- Alternative Medicines:
GET /patient/medicines/alternative
- Prescribed Medicines:
GET /patient/presMed
- Upload Prescription:
- View:
POST /patient/presMed
- Action:
upload.single('file')
- View:
- Home:
GET /pharmacist/pharmacistHome
- Medicines:
GET /pharmacist/medicines
- Create Medicines:
- View:
GET /pharmacist/createMedicines
- Action:
POST /pharmacist/createMedicines
- View:
- Search Medicines:
GET /pharmacist/searchMedicines
- Filter Medicines by Medical Use:
GET /pharmacist/medicines/filter
- Edit Medicines:
- View:
POST /pharmacist/edit
- Action:
POST /pharmacist/editMedicine
- View:
- Change Password:
- View:
GET /pharmacist/change-password
- Action:
POST /pharmacist/change-password
- View:
- Reset Password:
- View:
GET /pharmacist/resetPassword
- Action:
POST /pharmacist/resetPassword
- View:
- Archive/Restore Medicine:
POST /pharmacist/archive/:medicineId
- Wallet:
GET /pharmacist/wallet
- Chat:
GET /pharmacist/chat
- Notifications:
GET /pharmacist/notifications
- Sales Report:
- View:
GET /pharmacist/salesReport
- Action:
POST /pharmacist/salesReport
- View:
- All Sold Medicines Report:
GET /pharmacist/allSoldMedicinesReport
- Filter Medicines by Name:
GET /pharmacist/filterMedicinesByName
- Filter Medicines by Date:
GET /pharmacist/filterMedicinesByDate
- Home:
GET /guest/guestHome
- Create Patient:
- View:
GET /guest/createPatient
- Action:
POST /guest/createPatient
- View:
- Create Request:
- View:
GET /guest/createRequest
- Action:
POST /guest/createRequest
- View:
- Fetch File:
GET /fetchFile
- Login:
- View:
GET /login
- Action:
POST /login
- View:
- Logout:
GET /logout
- Authentication Middleware:
isAuthenticated
- Enter OTP Page:
GET /enter-otp
- Request Reset Page:
GET /request-reset
- Request Reset:
POST /request-reset
- Verify OTP:
POST /verify-otp
- Get Chats:
GET /chats
- Send Text Message:
POST /text
- Mark Message as Read:
POST /read
- Start Chat:
POST /start
- Get Contacts:
GET /contacts
Testing for the YKHO-Pharmacy project is primarily conducted using Postman, a comprehensive API testing tool. The tests cover various scenarios to ensure the functionality and reliability of API endpoints.
We leverage Postman collections and environments to structure and run tests. Below are examples of common scenarios tested using Postman:
- Verify that a patient can successfully log in.
- Check the authentication flow for administrators and pharmacists.
- Test adding, updating, and retrieving medicine information.
- Validate the search and filter functionality for medicines.
- Test the ordering process for patients.
- Verify that pharmacists can receive and process orders.
- Test administrator functionalities such as managing patients, pharmacists, and medicines.
- Validate the approval and rejection of registration requests.
- Validate medicine creation by pharmacists.
- Check pharmacist-related functionalities like sales reports and notifications.
- Test patient-specific actions, including cart management and order placement.
The Postman collections are integrated into our continuous integration pipeline, ensuring that API endpoints are tested automatically with each deployment.
To execute Postman tests, follow these steps:
- Open Postman.
- Import the provided Postman collection and environment.
- Configure the environment variables such as base URL and authentication tokens.
- Run the entire collection or specific test suites.
Adjust the test scenarios based on your specific API endpoints and functionalities.
Detailed documentation of test cases, including expected responses and edge cases, is available within the Postman collection for reference.
Postman generates test reports that can be reviewed for each test run, providing insights into test success, failures, and execution times.
Follow these step-by-step instructions to set up and run the YKHO-Pharmacy project locally:
-
Node.js and npm:
- Ensure that Node.js is installed on your machine. You can download it from nodejs.org.
-
MongoDB:
- Install MongoDB and make sure it's running. You can download it from mongodb.com.
git clone <https://github.com/advanced-computer-lab-2023/YKHO-Pharmacy.git>
cd YKHO-Pharmacy
npm install
- Create a .env file in the root directory.
- Define the following environment variables in the .env file: MONGODB_URI="mongodb+srv://fuji:[email protected]/clinic?retryWrites=true&w=majority"
cd client
npm start
cd src
node app
The application should now be running on http://localhost:3000.
We appreciate contributions from the community to enhance the YKHO-Pharmacy project. If you're interested in contributing, please follow these guidelines:
-
Fork the Repository:
- Fork the YKHO-Pharmacy repository to your GitHub account.
-
Clone the Repository:
- Clone the forked repository to your local machine.
git clone <your-forked-repository-url> cd YKHO-Pharmacy
-
Create a Branch:
- Create a new branch for your contribution.
git checkout -b feature/new-feature
-
Make Changes:
- Implement your changes or additions. Ensure that your code follows the coding conventions and style guide.
-
Test Your Changes:
- Test your changes locally to ensure they work as expected.
-
Commit Changes:
- Commit your changes with a descriptive commit message.
git add . git commit -m "Add feature: new feature"
-
Push Changes:
-
Push your changes to your forked repository.
git push origin feature/new-feature
Follow the coding conventions and guidelines mentioned in the Code Style section of the project's documentation. This ensures consistency across the codebase.
If you encounter any issues or have suggestions for improvements, please open an issue on the GitHub repository. Provide a detailed description of the problem or your suggestion.
If you have questions or need further assistance, feel free to reach out to us through the GitHub issues or contact the maintainers directly.
Thank you for contributing to the YKHO-Pharmacy project! Your efforts help make the project better for everyone.
We would like to give credit to the following resources and individuals that have inspired or assisted in the development of the YKHO-Pharmacy project:
-
TechStack Overflow: A valuable resource for technical questions and problem-solving.
-
MERN Stack Tutorial: An insightful tutorial that provided guidance on implementing the MERN stack.
-
Node.js Documentation: The official documentation for Node.js, which proved essential for understanding server-side JavaScript.
-
React Documentation: The official documentation for React, offering comprehensive guidance on building user interfaces.
-
MongoDB University: Courses and resources from MongoDB University that helped in mastering MongoDB.
-
Express.js Guide: The official guide for Express.js, aiding in building robust web applications.
-
Socket.io Documentation: The official documentation for Socket.io, which facilitated real-time communication implementation.
-
Multer Documentation: Documentation for the Multer middleware used for handling file uploads.
-
GitHub: A collaborative platform that enabled version control and team collaboration.
-
Open Source Community: The broader open-source community for fostering collaborative development.
-
PedroTech: A youtuber that helped us implementing complex tasks.
-
Net Ninja: A youtuber that helped us implementing complex tasks.
The YKHO-Pharmacy project utilizes the following third-party libraries and frameworks, each governed by its respective license:
-
- License: Stripe Terms of Service
-
- License: MIT License
-
- License: MIT License
-
- License: MIT License
-
- License: MIT License
-
- License: Server Side Public License (SSPL)
-
- License: MIT License
Please review the individual licenses for each component to ensure compliance with their terms.