Skip to content

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

2 Commits
 
 
 
 
 
 
 
 
 
 
 
 

Repository files navigation

🏥 MediTrack

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.


✨ Features

  • 📊 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

🛠️ Tech Stack

Backend

Technology Version Purpose
Python 3.8+ Core language
Flask 2.x Web framework & routing
mysql-connector-python Latest MySQL database driver

Database

Technology Purpose
MySQL Relational database for all inventory data

Frontend

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)

📁 Project Structure

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

🗃️ Database Schema

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

🌐 API Routes

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)

⚙️ Setup & Installation

Prerequisites

  • Python 3.8 or higher
  • MySQL Server (running locally or remotely)
  • pip package manager

1. Clone the repository

git clone https://github.com/your-username/MediTrack.git
cd MediTrack

2. Create and activate a virtual environment

# Windows
python -m venv venv
venv\Scripts\activate

# macOS / Linux
python -m venv venv
source venv/bin/activate

3. Install dependencies

pip install flask mysql-connector-python

4. Configure environment variables

Create 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_here

5. Run the application

python vyom.py

The app will:

  1. Connect to MySQL and create the hospital database if it doesn't exist
  2. Create all required tables automatically
  3. Seed sample data if the tables are empty

6. Open in browser

http://127.0.0.1:5000

📝 Notes

  • Auto-initialization: The database, tables, and sample data are created automatically on startup if missing — no manual SQL setup required.
  • Security: Never commit .env to 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

🏆 Built For

Techvyom 2025 — Annual Technical Festival
SRMS College of Engineering & Technology (SRMS-CET), Bareilly, India


📄 License

This project is for academic/competition purposes. All rights reserved.

About

MediTrack is a Flask-based hospital inventory management project for tracking medical equipment, medicines, and general surgery items. It includes dashboards, alerts, reports, search, and basic inventory operations using a MySQL database.

Resources

Stars

1 star

Watchers

0 watching

Forks

Releases

Packages

Contributors

Languages