Skip to content

AyalaVirtual/MedicationTrackerAPI

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

8 Commits
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

Medication Tracker & Reminder API

The Medication Tracking and Reminder REST API is a sophisticated healthcare management system designed to empower patients and pharmacy customers to efficiently track their current and past medications while setting up convenient reminders. The REST API includes robust user authentication and authorization mechanisms, safeguarding user data and ensuring that each user can access only their own data. Users can effortlessly manage their medications, including adding new prescriptions, editing existing entries, and deleting outdated records, offering them a centralized hub for their medical needs. The reminder system empowers users to create and manage medication reminders. 

Technologies Used

  • Java 17
  • Maven
  • Spring Boot
  • Spring Data (JPA)
  • Spring Security
  • JSON Web Tokens
  • H2 Database
  • Postman
  • Apache Tomcat
  • MockMVC
  • Cucumber with Rest Assured
  • IntelliJ

General Approach

I started off by creating my user stories and acceptance criteria. This helped me visualize my end goals and outline what I wanted to achieve with this project. I also created a spreadsheet of all my HTTP methods and endpoints to keep track of which methods were supposed to hit which endpoint.

Finally, I created an ERD (entity relationship diagram) to plan my different models and their relevant attributes. This helped me to visualize their relationships to one another and plan out how I was going to link the corresponding tables in the database.

Entity Relationship Diagram

ERD

HTTP Endpoints

Request Type URL Functionality Access
POST /auth/users/register/ Register a new user Public
POST /auth/users/login/ Login a user Public
POST /api/medications/ Create a medication Private
GET /api/medications/ Get all medications Private
GET /api/medications/1/ Get a medication Private
PUT /api/medications/1/ Update a medication Private
DELETE /api/medications/1/ Delete a medication Private
POST /api/medications/1/reminders/ Creating a medication reminder Private
GET /api/medications/reminders/ Get all medication reminders Private
GET /api/medications/1/reminders/1/ Get a medication reminder Private
PUT /api/medications/1/reminders/1/ Update a medication reminder Private
DELETE /api/medications/1/reminders/1/ Delete a medication reminder Private

User Stories

User Story 1:
As a user I want to register/sign up for an account using my email address and password so that I can track my medications.

Acceptance Criteria:

  • User should be able to create a new account using their email address and create a unique password.

User Story 2:
As a user I want to log in to my account with my email and password to access my medication tracking features.

Acceptance Criteria:

  • User should be able to login to their account using their email and password.
  • The application should validate the user's credentials against the stored user data in the database.

User Story 3:
As a user I want to create a user profile with my personal information (name, contact information) for a more personalized experience.

Acceptance Criteria:

  • User should be able to access their profile and saved medications.

User Story 4:
As a user I want to view a list of all my current and past medications to track when and how often I've taken each medication for easy reference. (GET all meds)

Acceptance Criteria:

  • User can search for all medications, past and present.
  • Search results should display a list of all medications.

User Story 5:
As a user I want to view a specific current or past medication to track when and how often I've taken it. (GET med by id)

Acceptance Criteria:

  • User can filter search results by medications.
  • Search results should return an exact match to the user's search criteria.

User Story 6:
As a user I want to add a new medication to my profile, specifying the medication name, description, dosage, and whether I am currently taking it. (POST med)

Acceptance Criteria:

  • User can add new medications to their list of prescribed meds.
  • User can save the details of a medication to their profile.

User Story 7:
As a user I want to update/edit the details of a medication in my profile, including the name, description, dosage, and current status. (PUT med)

Acceptance Criteria:

  • User can edit/update medications.
  • User can save the updated information for specific medications to their profile.

User Story 8:
As a user I want to delete a medication from my profile when I no longer need to track it. (DELETE med)

Acceptance Criteria:

  • User can delete medications.

User Story 9:
As a user I want to view a list of all my medication reminders to track upcoming reminders for easy reference. (GET all reminders)

Acceptance Criteria:

  • User can search for all reminders.
  • Search results should display a list of all reminders.

User Story 10:
As a user I want to view a specific reminder to easily refer back to it. (GET reminder by id)

Acceptance Criteria:

  • User can filter search results for reminders by medication.
  • Search results should return an exact match to the user's search criteria.

User Story 11:
As a user I want to add a new medication reminder to my profile. (POST reminder)

Acceptance Criteria:

  • User can add new reminders to their list of reminders, specifying the medication name and instructions.
  • User can save the details of a reminder to their profile.

User Story 12:
As a user I want to update/edit the details of a reminder in my profile, including the name and instructions. (PUT reminder)

Acceptance Criteria:

  • User can edit/update reminders.
  • User can save the updated information for specific reminders to their profile.

User Story 13:
As a user I want to delete a reminder from my profile when I no longer need it. (DELETE reminder)

Acceptance Criteria:

  • User can delete reminders.

Major Hurdles

When writing the tests for my Controller and Service classes, I was able to get all tests for the medication model to pass in both MockMVC and using Cucumber-Rest Assured before adding the security and authorization. However, after adding the security and authorization, the tests would no longer pass. All the endpoints work, so I know it's just a matter of me doing more research into how to refactor the test code for models that implement security and authorization, which I plan on doing in the near future.

Links

Special Thanks

  • Suresh Sigera - my instructor who taught me all the concepts used in this project.
  • GitHub

Author

👩‍💻 Erica Ayala

About

An API built using Java, Spring Boot, Spring Data JPA, and Spring Security, H2 database, and MockMVC and Cucumber with Rest Assured for testing.

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published