easybulb / healmate

HealMate is an online healthcare platform designed to connect patients with medical consultants across a variety of specialties for remote consultations, advice, and healthcare management.
https://healmate-378e458234ec.herokuapp.com/
0 stars 1 forks source link

HealMate

HealMate is an online platform designed to bridge the gap between patients and medical specialists. It allows users to easily find, book, and consult with professionals from various medical fields such as dermatology, psychology, and optometry. The project is part of the Code Institute's Full-Stack Developer course and focuses on Django framework, database manipulation, and CRUD functionality.

HealMate Homepage

Live site: HealMate

For Admin access with relevant sign-in information, click here.

Github repository, click here.

Table of Contents

  1. Introduction
  2. Overview
  3. UX - User Experience
  4. Project Planning
  5. Scope Plane
  6. Structural Plane
  7. Skeleton & Surface Planes
  8. Database Schema - Entity Relationship Diagram
  9. Security
  10. Features
  11. Future Features
  12. Technologies & Languages Used
  13. Libraries & Frameworks
  14. Tools & Programs
  15. Testing
  16. Deployment
  17. Privacy Policy
  18. Credits
  19. Acknowledgements

Overview

HealMate is an online platform that allows users to:

The platform ensures accessibility across all devices and browsers, and its goal is to streamline the process of finding and scheduling medical consultations. In future iterations, HealMate will add functionality for healthcare providers to manage their schedules, send reminders to patients, and offer tools for patient-doctor communication.

UX - User Experience

Design Inspiration

My inspiration for HealMate came from a personal experience during a routine visit to my GP. I thought about how many medical consultations, especially those that don’t require physical examinations, could easily be handled online. This thought extended to pregnant women, who often need guidance and reassurance from their midwives or doctors but don’t necessarily need an in-person visit. The convenience of a digital platform for such consultations became clear. The name HealMate reflects the idea of a supportive, reliable partner in managing one's health—much like popular health apps such as ClueMate, where ‘Mate’ signifies companionship and guidance in managing health.

Colour Scheme

In line with the healthcare theme, I chose a neutral, clean palette:

Font

Project Planning

Strategy Plane

The primary objective of HealMate is to bridge the gap between patients and healthcare providers. By offering an intuitive interface, users can easily search for medical professionals, book appointments, and receive necessary care without hassle.

Site Goals

Agile Methodologies - Project Management

I used an agile approach to project management. The HealMate development process was broken into sprints, and tasks were added to the GitHub project board to be tracked and managed through issues.

MoSCoW Prioritization

Sprints

User Stories

Scope Plane

The HealMate platform will include the following MVP functionalities:

Structural Plane

The site is structured around an easy-to-use interface. The primary menu includes links to specialist searches, appointment bookings, and user profile management.

Skeleton & Surface Planes

Wireframes

Wireframes were created for the following key pages to ensure an intuitive user journey:

Homepage Wireframe

Homepage Wireframe

Homepage Wireframe

Homepage Wireframe

Homepage Wireframe

Homepage Wireframe

Wireframes were designed using Balsamiq, ensuring responsiveness across devices.

Database Schema - Entity Relationship Diagram

The ERD for HealMate illustrates the relationships between the users, specialists, appointments, and more. This is essential to demonstrate the relationships between the different models in the PostgreSQL database.

The ERD also demonstrates the platform's role-based structure. Each user is assigned to a specific group (patient, specialist, or admin) that determines their access level. PatientProfile and SpecialistProfile models are linked to the User model, and each profile type has specific fields relevant to their role. Admins have broader access to manage both specialist vetting and platform data.

ERD Illustration

The above ERD was generated using Python Extension - pygraphviz and pydotplus. Documentation at https://django-extensions.readthedocs.io/en/latest/graph_models.html.

Security

All data is securely handled with Django’s security features, including:

Role-based access control (RBAC) is implemented using Django's Group and Permission systems. Patients, specialists, and admins are grouped based on their role, and their access to features and sensitive information is restricted accordingly. Patients can only access their own medical data and booking history, while specialists can only view data related to their consultations. Admins have the broadest access for system management.

Features

User View - Registered/Unregistered

HealMate offers distinct user views. Unregistered users can search for specialists, but registered users have full access to the appointment system and dashboard functionalities.

User Registration Process

This registration flow was chosen to ensure role-based control and security. Patients are the primary users of the platform, and allowing them to register freely makes the service accessible. However, specialists and admins require a higher level of trust and validation, so they undergo a manual vetting process. This ensures that only qualified professionals and authorized admins can manage sensitive tasks such as consultations and platform settings, which helps maintain the integrity and security of the system.

Role-Based Dashboard Features

HealMate includes role-based dashboards for different types of users:

Role-Based Navigation

(Not the same as Role-Based Dashboard Features)

The navigation bar in HealMate adapts dynamically based on the user's role. This feature ensures that users see only the relevant options for their role, improving usability and reducing clutter in the interface.

This role-based navigation provides a tailored experience for every user type, streamlining access to the most relevant pages.

Soft Delete/Archiving for Patient Accounts

HealMate includes a soft delete mechanism to ensure data integrity and prevent accidental loss of important user information. Instead of permanently deleting accounts, users can request a soft deletion, which deactivates their account while retaining their data in the system.

How It Works:

Benefits:

Appointment Booking System

HealMate allows patients to book appointments with specialists directly through the platform. The system includes:

Messaging System

HealMate provides a secure messaging system for communication between patients and specialists:

Profile Management

Each user can manage their profile through the dashboard:

Confirmation Messages

CRUD Functionality

The following CRUD functionalities are implemented within HealMate:

This CRUD cycle is central to the PatientProfile model, ensuring that users can fully manage their personal information while providing system integrity with the soft delete functionality.

Future Features

I plan to implement the following in future iterations:

Technologies & Languages Used

Libraries & Frameworks

Tools & Programs

Testing

Validation Testing

All code has been validated through:

HTML validator test

CSS validator test

User Testing

Bugs

Issue:
During the deployment to Heroku, the following error occurred:

The error was caused by the absence of proper static file handling and a misconfiguration in the INSTALLED_APPS list in settings.py.

Cause:

Steps Taken to Fix:

  1. Fixed the duplicate django.contrib.staticfiles entry in INSTALLED_APPS.
  2. Ensured the static and media handling was properly set up with Cloudinary and Whitenoise.
  3. Deleted the DISABLE_COLLECTSTATIC=1 from Heroku's Config Vars.
  4. Deployed again, which successfully collected static files and completed the deployment.

Bug Fix #2: Permission Issues with Dashboard Access

Issue

Users are unable to access the Admin, Patient, and Specialist dashboards even though they are assigned to the correct user groups in the Django admin panel. The application either throws a 403 Forbidden error or does not recognize the users' group memberships.

Cause

The issue seems to be related to incorrect handling of group membership checks in the views or misconfiguration of user group assignments within the Django admin panel.

Steps Taken to Fix

  1. Investigate Group Check Functions:

    • Reviewed the group-check functions (is_admin, is_patient, is_specialist) in views.py to ensure they correctly identify user groups.
    • Confirmed that the group names match those set in the Django admin.
  2. Validate Group Assignments:

    • Ensured that users are properly assigned to the correct groups (Admin, Patient, Specialist) in the Django Admin panel.
    • Verified that the group names in the code match the group names set up in Django admin.
  3. Testing:

    • Tested access with both existing and newly created users to ensure they can access their respective dashboards without issues.
    • Verified that group membership was properly recognized for all users.
  4. Revert Changes:

    • Once the issue was resolved, reverted any temporary modifications to the views back to their original implementation.
  5. Verify Access Control:

    • Tested edge cases, such as users without group assignments attempting to access dashboards, to ensure proper behavior.
    • Confirmed that custom PermissionDenied logic displayed the correct 403 error page for unauthorized access attempts.

Outcome

The problem was successfully resolved, allowing users to access their respective dashboards based on group membership without encountering 403 errors or redirection issues.

Bug Fix #3: Form Not Visible on Homepage Due to Conflicting View Usage

Issue

The form on the homepage not visible due to conflicting view usage. The homepage should display a form that allows users to search for specialists, but the form did not appear as expected.

Cause

The conflict arises from the use of both a class-based HomePage view and a function-based home view. The class-based view does not properly pass the specialties context required to render the form on the homepage.

Steps Taken to Fix

  1. Update URLs:

    • Updated core/urls.py to replace the class-based HomePage view with the function-based home view to ensure the correct context is passed.
  2. Verify Context Passing:

    • Verified that the specialties context was properly passed to index.html so that the form could display the list of specialties dynamically.
  3. Test Form Visibility and Functionality:

    • Tested the homepage to ensure that the form was visible and correctly populated with the list of specialties from the database.
  4. Commit Changes:

    • Added and committed the changes after confirming that the issue was resolved.

Outcome

The form is now visible on the homepage and correctly displays the list of specialties, allowing users to search for specialists as intended. The conflict between the views was resolved by using the appropriate function-based view that properly passes the necessary context.

Bug Fix #4: Signal Not Triggering on User Registration

Issue

A Django signal intended to automatically assign new users to the "Patients" group and create a PatientProfile upon registration was not firing. This led to no profile being created and no group being assigned after user registration.

Cause

The issue was caused by an incorrect configuration of the AccountsConfig class in INSTALLED_APPS in settings.py and missing signal imports in the ready() method of accounts/apps.py.

Steps Taken to Fix

  1. Correct Configuration in INSTALLED_APPS:

    • Updated INSTALLED_APPS in settings.py to reference 'accounts.apps.AccountsConfig' instead of just 'accounts'. This ensured that the custom AppConfig class was properly loaded.
  2. Add Signal Imports in ready() Method:

    • Added a ready() method in accounts/apps.py to correctly import the signal handlers, ensuring they were registered when the app was loaded.
  3. Remove Debug Statements:

    • Removed unnecessary print statements that were used for debugging to keep the code clean and efficient.

Outcome

The signal is now correctly triggered upon user registration, resulting in the automatic assignment of new users to the "Patients" group and the creation of a PatientProfile as intended. The configuration in INSTALLED_APPS and signal registration were successfully fixed.

Bug Fix #5: Specialist Availability Submission and Display Issues

Issue

Specialists encountered multiple issues when trying to set their availability. Initially, a 405 Method Not Allowed error occurred upon form submission. After fixing that, the start time was not displayed on the specialist dashboard, while the end time appeared correctly.

Cause

  1. 405 Method Not Allowed:

    • The post method was missing from the SpecialistDashboardView class in dashboard/views.py, resulting in the 405 error when attempting to submit availability.
  2. Missing Start Time:

    • The start_time was not displayed on the specialist dashboard due to a missing template tag ({{ availability.start_time }}) in the "Your Availability" section.

Steps Taken to Fix

  1. Handle POST Method in View:

    • Added a post method to SpecialistDashboardView in dashboard/views.py to properly handle form submissions, resolving the 405 Method Not Allowed error.
  2. Fix Start Time Rendering in Template:

    • Updated the specialist dashboard template to include the {{ availability.start_time }} tag, ensuring that both the start_time and end_time are displayed in the "Your Availability" section.

Outcome

Specialists can now successfully submit their availability without encountering the 405 error. Both start_time and end_time are displayed correctly on the specialist dashboard, providing a complete view of their available times for appointments.

Bug Fix #6: Incorrect Template Rendered for Specialist Search Results

Issue

The incorrect template was being rendered for specialist search results on the HealMate platform. A secondary search_results.html template in a different directory was causing confusion, leading to a simplified search results page being displayed. Key features like specialist bio, profile image, and pagination were missing.

Cause

An additional search_results.html template was located inside the global /templates/specialists/ directory. This template had minimal content and was unintentionally overriding the correct search_results.html template in the /specialists/templates/specialists/ directory.

Steps Taken to Fix

  1. Isolate Problematic Template:

    • Renamed the global /templates/specialists/ directory to determine if it was the source of the issue.
  2. Confirm and Resolve Issue:

    • After confirming the issue was caused by the additional template, deleted the /templates/specialists/ directory and its contents.
  3. Verify Correct Template Rendering:

    • Verified that the correct search_results.html template inside /specialists/templates/specialists/ is now rendering, displaying all necessary features, including the specialist bio, profile image, and pagination.

Outcome

The correct template for specialist search results is now rendering as intended. The page displays all relevant information, including specialist bio, profile images, and pagination, providing users with a complete view of search results.

Deployment

All code for this project was written in Visual Studio/Gitpod as the integrated development environment. GitHub was used for version control, and the application was deployed to Heroku from GitHub.

Pre-Deployment

To ensure a successful deployment to Heroku, the following practices are to be followed (Experience from previous Django projects):

Deploying with Heroku

The steps for deploying to Heroku are as follows (Experience from previous Django projects):

  1. Create New App: Log in to your Heroku account and click on the "Create New App" button.
  2. App Name: Choose a unique name for your app.
  3. Select Region: Choose the appropriate region (Europe was selected for this project).
  4. Create App: Click the "Create App" button to proceed.
  5. Deployment Method: In the "Deploy" tab, select GitHub as the deployment method.
  6. Connect to GitHub: Search for the repository name and click "Connect".
  7. Manual or Automatic Deployment: Select either manual or automatic deployment. Ensure the main branch is selected for deployment.
  8. Config Vars: In the "Settings" tab, click "Reveal Config Vars" and input the required environment variables.
  9. Buildpack: Select Node.js and Python as the buildpacks for your project.
  10. Deploy: Once the configuration is complete, click the "Deploy Branch" button. After successful deployment, a "View" button will appear to take you to the live site.

The live link for this project can be found here: HealMate

Fork this Repository

  1. Go to the GitHub repository.
  2. Click the "Fork" button in the upper right-hand corner.

Clone this Repository

  1. Go to the GitHub repository.
  2. Click the "Code" button at the top of the page.
  3. Choose between 'HTTPS', 'SSH', or 'GitHub CLI' depending on your preference.
  4. Click the copy button to copy the URL.
  5. Open Git Bash.
  6. Change the working directory to where you want to clone the directory.
  7. Type:
    git clone https://github.com/easybulb/healmate
  8. Press Enter to create the local clone.

Note: The difference between a clone and a fork is that with a clone, you need permission to push changes to the original repository, whereas a fork creates an entirely new project under your GitHub account.

Privacy Policy

As part of my HealMate project, I am dedicated to ensuring that users’ personal data is handled responsibly. The following privacy practices outline how information is collected, used, and stored within this academic project.

Since this is an educational project, the privacy and data handling policies may evolve over time as more features are added and refined.

Credits

Code

Media

Additional reading/tutorials/books/blogs

Acknowledgements

I would like to extend my heartfelt gratitude to the following individuals and organizations whose support, guidance, and inspiration have been invaluable in the development of this project.

Mentors and Advisors

Supportive Friends and Family

Academic Institutions

Final Note

This project would not have been possible without the support, advice, and inspiration of each individual and organization mentioned. Thank you for being a part of this journey.