This document presents the project structure for a web-based application that can significantly benefit various organizations such as ambulatory care services, drug stores, and similar entities. The primary aim is to develop an MVP (Minimum Viable Product) that centers on key functionalities crucial for enhancing operational efficiency in patient or client management and route optimization. In line with the MVP strategy, certain aspects like patient or client data are deliberately simplified to meet the minimum necessary requirements for the application's effective functioning. This approach ensures a concentrated development effort on the essential features, providing immediate practical benefits.
The application is designed to streamline management processes and route planning, offering a straightforward digital interface for easy interaction. It employs modern web technologies to facilitate effective communication between the front-end and back-end via API and JSON. This is vital for ensuring real-time data exchange, a necessity in the fast-paced environments of healthcare and retail. Deployed on Heroku, the application guarantees reliable access and scalability to cater to the dynamic needs of various service providers. Beyond being a technological tool, this application is envisioned as a means to advance more personalized, efficient, and customer-centric service delivery.
https://dashdothub.github.io/PlanRoute/#/
https://planroute-6bd1a349d590.herokuapp.com
As a visitor, I want to access a landing page with overall information about the application, so I can understand its purpose and features.
As a visitor, I want the ability to register for an account or log in, so I can access personalized features of the application.
As a logged-in user, I want to be redirected to a dashboard where I can manage patients, so I can easily add or edit patient information.
As a user, I want to view a grid or table of patients, so I can select them for route planning.
As a user, I want to click a button to calculate routes between selected patients, so I can efficiently plan visits or appointments.
As a system, I need to securely handle user registration and login, so that user data is protected.
As a system, I need to store and manage patient information, so that users can add, view, and edit patient details.
As a system, I need an API to communicate with the frontend using JSON, to manage and provide patient data and calculated routes.
As a developer, I want to deploy the application on Heroku, so that it is accessible online for users.
As a system administrator, I want to ensure that the application runs smoothly on Heroku, with necessary resources and configurations in place.
As a developer, I want to develop a RESTful API for efficient communication between the frontend and backend.
As a developer, I want to document the API, so that it is easy for other developers to understand and use.
As a frontend developer, I want to integrate the frontend application with the backend API.
As a system, I need to implement robust security measures, so that user data and patient information are protected against unauthorized access and breaches.
As a user, I want a user-friendly interface, so that I can navigate and use the application with ease.
As a user, I want clear and informative feedback from the system, so that I can understand the outcomes of my actions (like successful patient additions, errors, etc.).
As a developer, I want to thoroughly test the application, so that users encounter minimal bugs and issues.
As a user, I expect a reliable and consistent performance, so that I can trust and effectively use the application.
Python is a critical component for running Django applications. Here's how you can install the latest Long Term Support (LTS) version of Python:
Download the Installer:
Run the Installer:
Verify Installation:
python --version
.Install Homebrew (if not already installed):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
and press Enter.Install Python via Homebrew:
brew install python@3.9
(replace 3.9
with the latest LTS version).Verify Installation:
python3 --version
.Update Package Lists:
sudo apt-get update
to update package lists.Install Python:
sudo apt-get install python3.9
(replace 3.9
with the latest LTS version).Verify Installation:
python3 --version
in the Terminal.npm is a package manager for JavaScript, and is necessary for managing and installing packages for Vue.js projects. Here's how to install npm, which is distributed with Node.js:
Download Node.js Installer:
Run the Installer:
Verify Installation:
node -v
and npm -v
.Install Homebrew (if not already installed):
/bin/bash -c "$(curl -fsSL https://raw.githubusercontent.com/Homebrew/install/HEAD/install.sh)"
and press Enter.Install Node.js and npm via Homebrew:
brew install node
.Verify Installation:
node -v
and npm -v
.Update Package Lists:
sudo apt-get update
to update package lists.Install Node.js and npm:
sudo apt-get install nodejs npm
.Verify Installation:
node -v
and npm -v
in the Terminal.git clone <repository-url>
cd <project-name>
python3 -m venv venv
source venv/bin/activate
python -m venv venv
.\venv\Scripts\activate
pip install -r requirements.txt
requirements.txt
file.env.py
env.py
in the project root.Insert the following content:
import os
# Set environment variables
os.environ['API_KEY'] = '<your_tomtom_api_key>'
os.environ['DEVELOPMENT'] = 'True'
os.environ['DATABASE_URL'] = 'postgres://<user>:<password>@<host>:<port>/<dbname>'
os.environ.setdefault('SECRET_KEY', '<your_django_secret_key>')
DATABASE_URL
in env.py
with your database credentials.python manage.py migrate
python manage.py createsuperuser
cd <frontend-directory>
npm install
python manage.py runserver
npm run serve
http://127.0.0.1:8000
http://localhost:8080
Environment variables are used to configure various aspects of the application. Here's a breakdown of the variables and their descriptions:
API_KEY
: The API key used for accessing external services. Here it is TomTom, available at TomTom, free tier possible.DEVELOPMENT
: Specifies whether the application is in development mode. Set to True
for development and False
for production.DATABASE_URL
: The URL for connecting to the PostgreSQL database.SECRET_KEY
: A secret key used for cryptographic signing in Django applications.EMAIL_ADDRESS
: The email address used for sending emails from the application.EMAIL_PASSWORD
: The password associated with the email address for email authentication. For 2FA eMails, an application password needs to be created.PRODUCTION_URL
: The URL of the production server. (Frontend). Needed for the correct email token redirect link, without slash at the end.PROD_ALLOWED_HOSTS
: Comma-separated list of allowed hosts in production.PROD_CSRF_TRUSTED_ORIGINS
: Comma-separated list of origins that are trusted for Cross-Origin Resource Sharing (CORS) and Cross-Site Request Forgery (CSRF) protection in production.PROD_CORS_ALLOWED_ORIGINS
: Comma-separated list of origins allowed for CORS requests in production.PROD_CORS_ALLOW_CREDENTIALS
: Boolean value indicating whether to allow credentials in CORS requests in production.RUNNING_TESTS
: Specifies whether tests are currently running. Set to True
during test execution.DEVELOPMENT_URL
: The URL of the development server, this way you can debug your application on e.g. heroku, paste here the url and set DEVELOPMENT to true.ACCESS_TOKEN_LIFETIME
: Lifetime of access tokens in minutes.REFRESH_TOKEN_LIFETIME
: Lifetime of refresh tokens in days.These environment variables are essential for configuring your Django application and ensuring it operates correctly in various environments. For Swagger documentation of the API, DEVELOPMENT needs to be set to true. For all tests inside the backend to run correct, DEVELOPMENT and RUNNING_TESTS needs to be set to true.
This project was made possible thanks to the invaluable resources and documentation provided by the following: