SmartRx REST API backend is a Java and Spring Boot application that provides a robust and scalable solution for managing prescription and medication data. It serves as a reliable and efficient backend system to support various client applications such as web, mobile, or desktop applications.
SmartRx allows users to perform Create, Read, Update, and Delete (CRUD) operations on prescription and medication data. Users can create new prescriptions, retrieve prescription details, update existing prescriptions, and delete prescriptions as needed.
SmartRx implements secure authentication and authorization mechanisms to ensure that only authorized users can access the protected endpoints. It enables user registration, login, and generates JSON Web Tokens (JWT) to authenticate and authorize API requests.
SmartRx performs thorough validation of incoming data to ensure its integrity and consistency. It provides appropriate error responses with detailed error messages and status codes when invalid requests or exceptions occur, improving the user experience.
SmartRx also includes a suite of unit tests and integration tests to validate the functionality and behavior of the API. It follows coding best practices, adheres to code style guidelines, and undergoes rigorous testing to ensure high-quality and reliable software.
In our development process, we have adopted an agile approach with a focus on collaboration and iterative development. We have been utilizing pair programming extensively, both in duos and as a quad, to leverage the collective skills and expertise of our team members. We utilize Kanban as our project management framework to enhance our workflow and improve overall efficiency.
Here are some key aspects of our general approach:
Kanban Board: We maintain a Kanban board to visualize our workflow and track the progress of tasks. The board consists of columns representing different stages of the development cycle, such as "To Do," "In Progress," "Review," and "Done." This board helps us visualize the work in progress and maintain a smooth flow of tasks.
Collaborative Environment: We foster a collaborative environment where every team member actively participates and contributes to the project. Pair programming allows us to work closely together, share knowledge, and make collective decisions.
Rotation and Diversity: We rotate pairs regularly to ensure that everyone gets a chance to work with different team members. This helps us leverage diverse perspectives, cross-pollinate ideas, and build a strong sense of camaraderie within the team.
Clear Goals and Objectives: Each pairing session has clear goals and objectives. We define specific tasks or features to work on during the session, ensuring that we stay focused and aligned with the project requirements.
Roles and Responsibilities: Within each pair or quad, we assign roles and responsibilities. We have a designated driver who actively writes the code, while the navigator provides guidance, reviews the code, and ensures adherence to best practices. We periodically rotate these roles to promote equal participation and knowledge sharing.
Effective Communication: Communication is vital in our pairing sessions. We engage in open and frequent communication, discussing ideas, brainstorming solutions, and seeking clarifications. We value active listening and constructive feedback, which enables us to make informed decisions and deliver high-quality code.
Continuous Learning: Pair programming serves as a platform for continuous learning and skill development. We actively share insights, coding techniques, and best practices with each other. This collaborative learning environment helps us grow individually and as a team.
Code Reviews and Quality Assurance: We prioritize code reviews within the team. Each pair or quad conducts code reviews, providing feedback and suggestions for improvement. This practice ensures code quality, adherence to coding standards, and helps identify and resolve any issues early in the development process.
Adaptability and Agility: We value adaptability and embrace changes throughout the development process. We regularly reflect on our progress, discuss lessons learned, and make adjustments to our approach as needed. This iterative mindset allows us to respond to evolving project requirements effectively.
One of our major wins was successfully implementing the Prescription feature, which involved incorporating a many-to-many relationship. This achievement allowed us to efficiently manage and track prescriptions, ensuring accuracy and accessibility for both users and healthcare professionals. We are proud of this accomplishment as it significantly enhances the functionality and value of our product.
This project follows the Test Driven Development (TDD) approach to ensure the reliability and correctness of the codebase. TDD involves writing tests before implementing the actual code logic.
Here's an overview of the TDD process followed in this project:
Write Tests: Tests are written in the form of Cucumber feature files using Gherkin syntax. Each feature file describes a specific functionality or scenario to be tested. Test scenarios are written in a user-friendly language that captures the expected behavior of the system.
Run Tests: The Cucumber tests are executed using the TestRunner and Test Definitions. These files contain the necessary configurations and definitions for running the tests. Tests can be run locally or integrated with a CI/CD system for automated testing on each code commit.
Implement Code: After writing the tests, the corresponding code implementation is done to make the tests pass. The implementation follows the principles of SOLID design and clean code practices. The tests act as a guide to ensure that the code meets the desired functionality.
Refactor Code: Once the tests pass, the code is refactored to improve its design, readability, and maintainability. Refactoring involves making changes to the code without altering its behavior. The goal is to enhance the code's structure, eliminate duplication, and improve overall code quality.
Re-run Tests: After refactoring the code, the tests are re-run to ensure that the changes have not introduced any regressions or unexpected behavior. This step verifies that the code still adheres to the desired functionality defined by the tests.
Name | API Endpoint | HTTP Verb | Purpose |
---|---|---|---|
Create User | /api/auth/users/register | POST | Create a new User |
Login User | /api/auth/users/login | POST | Logs in a User |
Show User | /api/users | GET | Displays a User |
Update User | /api/users | PUT | Updates a User |
Delete User | /api/users | DELETE | Deletes a User from database |
Name | API Endpoint | HTTP Verb | Purpose |
---|---|---|---|
List User's Prescriptions | /api/prescriptions | GET | Gets a list of a Users Prescriptions |
Get all prescriptions | /api/pharmacist/prescriptions | GET | Gets all prescriptions |
Get one medication | /api/prescriptions/medications/{medicationId} | GET | Gets a specific medication by Id |
Get Specific Prescription | /api/pharmacist/prescriptions/{prescriptionId} | GET | Gets a Specific Prescription by Id |
Create a prescription | /api/pharmacist/prescriptions/{prescriptionId}/{userId}/ | POST | Creates a Prescription |
Update a prescription | /api/pharmacist/prescriptions/{prescriptionId} | PUT | Updates a Specific Prescription by Id |
Delete a prescription | /api/pharmacist/prescriptions/prescription | DELETE | Delete a Prescription by Id |
If you are using the command line, navigate to the project directory and run the command mvn clean install. This will trigger the Maven build process and download the dependencies specified in the pom.xml file.
To run this application on your local machine, please follow the steps below:
Before proceeding with the installation, ensure that the following prerequisites are met:
Clone the project repository from the GitHub repository using the following command:
git clone <repository-url>
Open the application.properties file located in the src/main/resources directory. Update the database configuration properties according to your PostgreSQL database setup. Make sure to provide the correct database URL, username, and password.
Navigate to the project's root directory and build the application using Maven. Run the following command:
mvn clean install
After a successful build, run the application using the following command:
mvn spring-boot:run
The application will start, and you will see the logs indicating the server is up and running.
Open your web browser and access the application using the following URL:
http://localhost:8080
You can now explore and interact with the application.
We welcome and appreciate contributions from the community! If you're interested in making this project better, you can contribute in several ways. Whether you want to report a bug, suggest a new feature, or submit code improvements, your contributions are valuable to us.
To contribute to this project, please follow the guidelines below:
If you encounter any issues or bugs while using this project, please open an issue on the GitHub repository. When reporting an issue, provide as much detail as possible, including:
If you have an idea to enhance this project or want to propose a new feature, feel free to submit a feature request on the GitHub repository. Clearly describe your suggestion and provide any additional context that might be helpful.
If you're interested in contributing code to this project, we're thrilled to have your help! Here's how you can get started:
To maintain consistency within the project, please adhere to the following code style guidelines:
We expect all contributors to adhere to the project's Code of Conduct. Please be respectful and considerate of others throughout the process.
Thank you for your interest in contributing to this project! Your contributions are highly appreciated, and together we can make this project even better.
We would like to extend our gratitude to the following individuals for their contributions to this project:
Our Instructors:
Their dedication and expertise have greatly contributed to the success of this project. We are grateful for their valuable insights and efforts.
Add JWT to Header for use with RestTemplate
Git Merging - Source: Atlassian
Git Branching - Source: git-scm.com
Rest Assured - Source: github.com
HTTP Status Codes - Source: Mozilla.org