Skip to content

This application is a comprehensive web-based system designed for medical physicists at Prophy, providing a centralized platform to efficiently manage client data, schedule appointments, and organize institutional materials.

License

Notifications You must be signed in to change notification settings

ledsouza/prophy

Repository files navigation

Prophy Logo

MedPhys Hub

Status Badge

Django Django REST Framework React Next.js TypeScript Postman Cypress PostgreSQL Redux RTK Query Zod JWT Tailwind CSS Figma DigitalOcean

Description

This application is a comprehensive web-based system designed for medical physicists at Prophy, providing a centralized platform to efficiently manage client data, schedule appointments, and organize institutional materials.

Motivation

Companies providing medical physics services often lack a standardized tool to manage and organize data and business processes. Each company relies on its own methods, making it challenging for regulatory entities like ANVISA and CNEN to conduct audits effectively. Additionally, medical physicists frequently resort to manual processes for managing data and workflows, which are error-prone and time-consuming.

The goal of this project is to develop software that standardizes auditing processes and automates business workflows related to medical physics services. By doing so, it aims to enhance the security of healthcare services and improve the efficiency of medical physicists, ensuring better compliance and streamlined operations.

Quick Start

Set up a Python environment based on the pyproject.toml file:

  1. Install Poetry: Poetry is a robust tool for dependency management and packaging in Python. To install it, follow the docs: Poetry Installation

  2. Initialize the Project: Navigate to your project directory containing the pyproject.toml file and run:

    poetry install

    This command will create a virtual environment and install the dependencies specified in the pyproject.toml.

Set up the environment for the frontend:

  1. Install Node.js and npm:

    • Download and install the latest Long-Term Support (LTS) version of Node.js from the official website: https://nodejs.org/.
    • The Node.js installer includes npm (Node Package Manager), which you'll use to manage project dependencies.
  2. Install Project Dependencies:

    • Inside of the frontend folder, run:

      npm install

      This command reads the package.json file and installs all specified dependencies into a node_modules folder.

Set up the enviroment variables

Environment Variables for Backend

To run this Django project, specific environment variables must be configured in a .env file located at the backend folder. Below is a detailed explanation of all the environment variables required:

  1. DJANGO_SECRET_KEY
  • Description: The secret key used by Django for cryptographic signing.
  • Purpose: This key ensures the security of cookies, tokens, and other cryptographic processes.
  • Example: DJANGO_SECRET_KEY='<random_generated_secret_key>
  • Note: This should be a long, unique, and randomly generated string. Never share it publicly.
  1. DEBUG
  • Description: Controls whether the application is in debug mode.
  • Purpose: Debug mode is helpful during development but should always be set to False in production.
  • Values:
    • True: Enables debug mode.
    • False: Disables debug mode.
  • Example: DEBUG=True
  1. AUTH_COOKIE_SECURE
  • Description: Determines whether the authentication cookie should only be sent over secure (HTTPS) connections.
  • Purpose: Enhances the security of cookies by restricting them to HTTPS.
  • Values:
    • True: Only allow cookies over HTTPS.
    • False: Allow cookies over both HTTP and HTTPS (useful for local development).
  • Example: AUTH_COOKIE_SECURE=False
  1. FRONTEND_URL
  • Description: The URL of the frontend application that interacts with this Django backend.
  • Purpose: Used for configuring CORS and other integrations with the frontend.
  • Example: FRONTEND_URL='http://localhost:3000'
  1. DJANGO_ALLOWED_HOSTS
  • Description: Specifies the host/domain names that this Django site can serve.
  • Purpose: Protects against HTTP Host header attacks.
  • Values: A comma-separated list of allowed hostnames.
  • Example: DJANGO_ALLOWED_HOSTS='127.0.0.1,localhost'

Environment Variables for Frontend

To run the frontend application, only one variable must be set in a .env file located at frontend folder.

  1. NEXT_PUBLIC_HOST
  • Description: The host URL for the backend application, used by the frontend to communicate with the backend API.
  • Purpose: Ensures the frontend correctly points to the backend application.
  • Example: NEXT_PUBLIC_HOST=http://localhost:8000

Notes

  1. Security: Do not expose your .env file publicly or commit it to version control systems like Git.
  2. Production Configuration: Ensure that DEBUG is False and AUTH_COOKIE_SECURE is True in production.
  3. Dynamic Configuration: You can create separate .env files for different environments (e.g., .env.production and .env.development) and load them accordingly.

Ensure all required variables are properly set before running the application to avoid errors or insecure configurations.

Set up database

  1. Inside of the backend folder, run the migratios:
python manage.py makemigrations
python manage.py migrate
  1. Run the script to populate the database with some example data:
./flush_and_populate_db.sh

Run the application

  1. In the backend folder, run:
python manage.py runserver
  1. In a different terminal and inside the frontend folder, run:
npm build && npm start

If the environment variables were correctly set up, the application should be running in your local machine!

Detailed Features

User Authentication and Authorization

  • Secure user registration and login system.
  • Role-based access control (RBAC) with the following user profiles:
    • Prophy Manager: Full access to all features.
    • Comercial: Access to clients data (read-only), reports (read-only) and proposal of contracts (add/edit/read)
    • Internal Medical Physicist: Access to most features, including client-specific data, institutional materials, and scheduling.
    • Client Manager: Access to their own institution's data, equipment information, schedules (read-only), and invoices (read-only).
    • Unit Manager: Assigned by a Client Manager to manage specific units, with access limited to their assigned units' data.
    • External Medical Physicist: Limited access to schedules (read-only) and client data (read-only) associated with their assigned clients.

Client Management

  • Client Registration Form:
    • Allows approved clients to submit their information and request services.
  • Client Dashboard:
    • Clients can register and manage their institution's information:
      • CNPJ (Brazilian company ID)
      • Institution details
      • Contact details
      • Units and responsible managers
      • Equipment inventory
    • Updating data needs approval from someone in the Prophy Staff
  • Client Data Management (Internal Staff):
    • Internal staff can view, edit, review, and manage client data:
      • Client details
      • Units
      • Equipments
      • Invoices (including download options and payment status updates)
    • Advanced filtering options for efficient data retrieval.

Scheduling and Appointments

  • Appointment Scheduling:
    • Internal staff can schedule appointments, specifying:
      • Date and time
      • Client
      • Equipment involved
      • Description of the service that will be provided
      • Appointment status (scheduled, completed)
      • Reports
    • Google Calendar integration for seamless scheduling and reminders.
  • Appointment Views:
    • Clients and assigned external physicists can view their scheduled appointments.
    • Notifications and reminders via email and Google Calendar integration.

Institutional Materials

  • Material Management:
    • Internal staff can upload and manage institutional materials:
      • PDFs
      • Video links
      • Categorization by client profile and diagnostic modality
    • Access control to ensure only authorized users can view and download materials.

Billing and Invoices

  • Invoice Generation:
    • System generates invoices based on services provided.
    • Internal staff can manage invoice details and payment status.
  • Payment Tracking:
    • Clients can view their invoices, download copies, and upload payment confirmations.

Project Status and Future Development

The project is actively in development. There's 4 stages of development:

  • User authentication and client registration.
  • Client data management for both internal staff and clients (actively under development).
  • Appointment scheduling and Reports.
  • Institutional materials management and access control.

Future development will include:

  • Enhanced reporting and analytics.
  • Mobile app for clients and staff.
  • Continuous improvement based on user feedback.

🤝 Contributing

If you'd like to contribute, please fork the repository and open a pull request to the main branch.

About

This application is a comprehensive web-based system designed for medical physicists at Prophy, providing a centralized platform to efficiently manage client data, schedule appointments, and organize institutional materials.

Topics

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published