A comprehensive web-based Hospital Management System built with Flask that allows doctors and patients to manage appointments, share medical information, and communicate effectively.
-
User Authentication
- Separate registration and login for doctors and patients
- Secure password handling
- Profile management with image upload
-
Doctor Features
- Create and manage medical blogs
- View and manage patient appointments
- Update patient diagnoses
- Profile management with specialization details
-
Patient Features
- Book appointments with doctors
- View medical blogs
- Track appointment status
- Update personal information
-
Blog System
- Create, edit, and delete medical blogs
- Share medical information and updates
- View all published blogs
-
Appointment Management
- Book appointments
- Track appointment status
- View appointment history
- Update appointment details
- pyenv (Python version manager)
- pip (Python package installer)
-
Install pyenv
-
Windows:
# Open PowerShell as Administrator and set execution policy Set-ExecutionPolicy RemoteSigned # Type 'Y' when prompted # Install pyenv-win Invoke-WebRequest -UseBasicParsing -Uri "https://raw.githubusercontent.com/pyenv-win/pyenv-win/master/pyenv-win/install-pyenv-win.ps1" -OutFile "./install-pyenv-win.ps1"; &"./install-pyenv-win.ps1"
After installation, restart your terminal and verify:
pyenv --version
-
Linux/MacOS:
# Using curl curl https://pyenv.run | bash
Add to your shell configuration file (~/.bashrc, ~/.zshrc, etc.):
export PATH="$HOME/.pyenv/bin:$PATH" eval "$(pyenv init -)" eval "$(pyenv virtualenv-init -)"
-
-
Clone the repository
git clone <repository-url> cd Hospital_Management
-
Install Python 3.11 using pyenv
# Install Python 3.11 pyenv install 3.11.0 # Set local Python version pyenv local 3.11.0
-
Create and activate virtual environment
# Create virtual environment python -m venv hospital-env #Windows pyenv virtualenv 3.11.0 hospital-env #Linux/MacOS # Activate virtual environment hospital-env\Scripts\activate #Windows pyenv activate hospital-env #Linux/MacOS
-
Install the project and dependencies
# Install in editable mode with development dependencies pip install -e ".[dev]"
-
Set up environment variables Create a
.envfile in the root directory with the following content:FLASK_APP=hospital_flask FLASK_ENV=development SECRET_KEY=<your-secret-key> SQLALCHEMY_DATABASE_URI=sqlite:///hospital.db SQLALCHEMY_TRACK_MODIFICATIONS=False -
Initialize the database
flask shell
In the Flask shell:
from hospital_flask import db db.create_all() exit()
The project uses several development tools to maintain code quality:
- Code Formatting: Black and isort for consistent code style
- Type Checking: mypy for static type checking
- Linting: flake8 for code linting
- Testing: pytest for unit and integration tests
To run the development tools:
# Format code
black .
isort .
# Type checking
mypy .
# Linting
flake8
# Run tests
pytest-
Run the Flask application
flask run
-
Access the application Open your web browser and navigate to
http://localhost:5000
Hospital_Management/
├── hospital_flask/
│ ├── __init__.py
│ ├── models.py
│ ├── routes.py
│ ├── forms.py
│ ├── static/
│ │ ├── css/
│ │ ├── js/
│ │ └── profile_pics/
│ └── templates/
│ ├── base.html
│ ├── login.html
│ ├── register.html
│ └── ...
├── pyproject.toml
├── .python-version
├── run.py
└── README.md
-
User (Doctor)
- Basic information (name, email, password)
- Professional details (occupation, specialization)
- Profile image
- Blog and appointment relationships
-
UserPatient
- Basic information (name, email, password)
- Personal details (age, gender)
- Profile image
- Appointment relationships
-
Blog
- Title and content
- Author relationship
- Timestamp
-
Appointment
- Doctor and patient relationships
- Appointment date and time
- Status and diagnosis
- Symptoms
- Fork the repository
- Create a new branch for your feature
- Commit your changes
- Push to the branch
- Create a Pull Request
Please ensure your code follows our style guidelines:
- Use Black for code formatting
- Follow type hints with mypy
- Pass all tests
- Update documentation as needed
For support, please open an issue in the GitHub repository or contact the maintainers.
- Flask and its extensions for the web framework
- SQLAlchemy for database management