Hospital Inventory Management System — Built for Techvyom 2025 at SRMS-CET, Bareilly.
MediTrack is a full-stack web application for managing hospital inventory. It tracks medical equipment, medicines, and general surgery instruments with real-time alerts, summary reports, and inline editing — all backed by a MySQL database.
- 📊 Dashboard — Overview of total inventory counts and active alerts
- 💊 Medicine Management — Add, edit, delete, and search medicine stock with expiry tracking
- 🔧 Equipment Management — Track medical equipment with maintenance schedules and status
- 🩺 General Surgery Inventory — Manage surgical instruments with quantity and type classification
- 🔔 Smart Alerts — Automatic alerts for:
- Medicines expiring within 30 days
- Equipment maintenance due within 7 days
- Low stock items (quantity ≤ 5)
- 📈 Reports — Date-range and category-filtered inventory reports with total value calculation
- 🔍 Global Search — Live autocomplete search across all inventory categories
- ✏️ Inline Editing — Edit individual fields directly in the table via AJAX (no page reload)
- 🗄️ Auto Database Init — Automatically creates the database and seeds sample data on first run
| Technology | Version | Purpose |
|---|---|---|
| Python | 3.8+ | Core language |
| Flask | 2.x | Web framework & routing |
| mysql-connector-python | Latest | MySQL database driver |
| Technology | Purpose |
|---|---|
| MySQL | Relational database for all inventory data |
| Technology | Purpose |
|---|---|
| Jinja2 | HTML templating (ships with Flask) |
| Vanilla CSS | Custom styling (static/styles.css) |
| Vanilla JavaScript | Inline editing, search autocomplete, AJAX requests (static/completed-script-js.js) |
MediTrack/
├── vyom.py # Main Flask application (routes, DB logic)
├── .env # Local environment variables (not committed)
├── .gitignore # Git ignore rules
├── initialized.flag # Created after first DB init
│
├── templates/ # Jinja2 HTML templates
│ ├── base-layout.html # Shared layout (navbar, sidebar, flash messages)
│ ├── dashboard.html # Home dashboard with inventory summary
│ ├── equipment.html # Medical equipment list & add form
│ ├── medicines.html # Medicine stock list & add form
│ ├── general_surgery.html # Surgery instrument list & add form
│ ├── alerts.html # Active alerts (expiry, maintenance, low stock)
│ ├── reports.html # Inventory reports with date & type filters
│ └── search_results.html # Global search results page
│
└── static/ # Static assets
├── styles.css # Global stylesheet
├── completed-script-js.js # Inline editing & search autocomplete JS
├── k0J5JlZ1_400x400.svg # Logo/icon asset
└── srmsims.meditech.jpg # Branding image
Three tables are created automatically on first run:
equipment
| Column | Type | Description |
|---|---|---|
equipment_id |
INT (PK, Auto) | Unique identifier |
name |
VARCHAR(255) | Equipment name |
manufacturer |
VARCHAR(255) | Manufacturer name |
cost |
DECIMAL(10,2) | Unit cost |
location |
VARCHAR(255) | Hospital location/ward |
last_maintenance |
DATE | Date of last maintenance |
next_maintenance |
DATE | Scheduled next maintenance |
status |
VARCHAR(100) | Operational / Needs Inspection |
date_added |
DATE | Record creation date |
medicines
| Column | Type | Description |
|---|---|---|
medicine_id |
INT (PK, Auto) | Unique identifier |
name |
VARCHAR(255) | Medicine name |
manufacturer |
VARCHAR(255) | Manufacturer name |
quantity |
INT | Stock quantity |
cost |
DECIMAL(10,2) | Cost per unit |
expiry_date |
DATE | Expiry date |
date_added |
DATE | Record creation date |
general_surgery_equipments
| Column | Type | Description |
|---|---|---|
equipment_id |
INT (PK, Auto) | Unique identifier |
name |
VARCHAR(255) | Instrument name |
manufacturer |
VARCHAR(255) | Manufacturer name |
cost |
DECIMAL(10,2) | Unit cost |
last_maintenance |
DATE | Last maintenance date |
next_maintenance |
DATE | Next maintenance date |
quantity |
INT | Stock quantity |
type |
VARCHAR(255) | Instrument type (e.g. Cutting, Suturing) |
date_added |
DATE | Record creation date |
| Method | Route | Description |
|---|---|---|
GET |
/ |
Redirects to /dashboard |
GET |
/dashboard |
Inventory summary & alert preview |
GET/POST |
/equipment |
List all equipment / Add new equipment |
GET/POST |
/medicines |
List all medicines / Add new medicine |
GET/POST |
/general_surgery |
List surgery equipment / Add new item |
POST |
/update_equipments/<id> |
AJAX inline field update for equipment |
POST |
/update_medicine/<id> |
AJAX inline field update for medicine |
POST |
/update_general_surgerys/<id> |
AJAX inline field update for surgery item |
POST |
/delete_equipment/<id> |
Delete an equipment record |
POST |
/delete_medicine/<id> |
Delete a medicine record |
POST |
/delete_general_surgery/<id> |
Delete a surgery equipment record |
GET |
/alerts |
All active alerts (expiry, maintenance, low stock) |
GET |
/reports |
Inventory reports with date & type filters |
GET |
/search |
Full-text search across all categories |
GET |
/search_suggestions |
Live autocomplete suggestions (JSON) |
GET |
/debug |
Health check endpoint (returns JSON status) |
- Python 3.8 or higher
- MySQL Server (running locally or remotely)
pippackage manager
git clone https://github.com/your-username/MediTrack.git
cd MediTrack# Windows
python -m venv venv
venv\Scripts\activate
# macOS / Linux
python -m venv venv
source venv/bin/activatepip install flask mysql-connector-pythonCreate a .env file in the project root:
MYSQL_HOST=localhost
MYSQL_USER=your_mysql_username
MYSQL_PASSWORD=your_mysql_password
MYSQL_DATABASE=hospital
FLASK_SECRET_KEY=your_secret_key_herepython vyom.pyThe app will:
- Connect to MySQL and create the
hospitaldatabase if it doesn't exist - Create all required tables automatically
- Seed sample data if the tables are empty
http://127.0.0.1:5000
- Auto-initialization: The database, tables, and sample data are created automatically on startup if missing — no manual SQL setup required.
- Security: Never commit
.envto version control. It is already listed in.gitignore. - Inline Editing: Fields in all inventory tables can be edited directly in the browser via AJAX — changes are saved instantly without a page reload.
- Search: The global search bar supports live autocomplete and searches across all three inventory categories simultaneously.
- Alert Thresholds:
- Low stock: quantity ≤ 5
- Expiring medicines: expiry within 30 days
- Maintenance due: next maintenance within 7 days
Techvyom 2025 — Annual Technical Festival
SRMS College of Engineering & Technology (SRMS-CET), Bareilly, India
This project is for academic/competition purposes. All rights reserved.