A Flask-based web application designed to solve a real-world problem: helping my sister digitally manage medical prescriptions and patient information.
-
Patient Management
- Add and edit patient information
- Store comprehensive patient details including contact info and medical history
- Brazilian address integration with automatic CEP (postal code) lookup
-
Prescription Management
- Create and edit medical prescriptions
- Real-time prescription preview
- Support for both hormonal and non-hormonal prescriptions
- Print prescriptions in A4 format
-
Medical Records
- Track prescription history
- Filter prescriptions by patient and date range
- Manage CID (International Classification of Diseases) codes
- Maintain medication database
- Backend: Python Flask
- Database: MySQL (Production) / SQLite (Development)
- Frontend: HTML, CSS, JavaScript
- Dependencies: See
requirements.txt
Before running the application (either directly or with Docker), you must create these configuration files:
- Configure environment variables:
cp config-template.env config.envEdit config.env with your database credentials and settings.
- Configure professional information:
cp professional_info-template.json professional_info.jsonEdit professional_info.json with your professional details.
- Clone the repository:
git clone <repository-url>
cd flaskApp_pythonanywhere- Create and activate a virtual environment:
python -m venv venv
source venv/bin/activate # Linux/Mac
# or
venv\Scripts\activate # Windows- Install dependencies:
pip install -r requirements.txt- Initialize the database:
python populate_db.py all- Run the application:
python flask_app.py- Clone the repository:
git clone <repository-url>
cd flask_medPrescription-
Method A: Using Docker directly
Build the Docker image:
docker build -t med-prescription .Run the container (ensure you've created config.env and professional_info.json first):
docker run -p 5000:5000 -v $(pwd)/config.env:/app/config.env -v $(pwd)/professional_info.json:/app/professional_info.json med-prescription
On Windows, use this volume mount syntax:
CMD:
docker run -p 5000:5000 -v "%cd%\config.env:/app/config.env" -v "%cd%\professional_info.json:/app/professional_info.json" med-prescription
Powershell:
docker run -p 5000:5000 -v "${PWD}/config.env:/app/config.env" -v "${PWD}/professional_info.json:/app/professional_info.json" med-prescription
-
Method B: Using Docker Compose
Run with docker-compose (ensure you've created config.env and professional_info.json first):
docker-compose up
This will mount your entire local directory to the container, which is useful for development.
Note: When using docker-compose, you may need to initialize the database by running:
docker-compose exec web python populate_db.py all
- The application uses Flask's development server when
FLASK_ENV=development - SQLite is used for local development
- MySQL is used in production (e.g., on PythonAnywhere)
The application is designed to be deployed on PythonAnywhere, but can be adapted for other hosting services.
Alan De Maman
This project was created to assist healthcare professionals in managing medical prescriptions and patient information digitally.