Skip to content
OnlyProjects
BCA · AI & Machine LearningFor educational purposes only
Code included

Daily Outpatient Footfall Forecasting for a District Hospital OPD (Python, Keras, MySQL)

Forecast daily OPD crowds department by department, and plan the doctor roster before the Monday rush arrives

Mapped to your syllabusUniversity of Madras CBCS 2023-24 · 320S61 Mini Project (Professional Competency Skill) · Semester 6

Overview

1 min read

Daily Outpatient Footfall Forecaster is an advanced mini project that predicts tomorrow's outpatient (OPD) attendance for a large government hospital — department by department — and converts each forecast into a simple staff-and-counter rota suggestion.

The motivation is real and public: Rajiv Gandhi Government General Hospital in Chennai, one of India's busiest government hospitals, handles on the order of 12,000–15,000 outpatient visits every day, and hospitals across Tamil Nadu face the same pattern — Monday and post-holiday surges, a drop on Sundays, and visible crowding when the north-east monsoon drives seasonal illness. Hospital National Health Mission (HMIS) reporting already collects OPD attendance as routine indicators, yet the rota is still planned from monthly averages and staff experience. This project treats the OPD count as a multi-horizon time-series forecasting problem: it ingests three years of daily department-wise attendance (a bundled, realistic sample modelled on public reporting patterns, replaceable with a hospital's own HMIS extract), engineers calendar, holiday and rainfall features, and rigorously compares four approaches — a seasonal-naive baseline, SARIMA, Prophet and an LSTM sequence model built in Keras — using MAE, RMSE, MAPE and MASE under walk-forward backtesting.

A Flask dashboard presents per-department forecasts with prediction intervals and a rota table (counters and doctors to open per session). TensorFlow/Keras and Prophet are industry-standard extras beyond the CBCS syllabus; Python (120C1A), RDBMS (320C5B) and Web Technology (320C5C) carry the rest. Only aggregate daily counts are ever stored — no patient-level data.

Relevant for
Tamil Nadu
Level
Advanced · 6 weeks · team of 2
Common at
University of Madras, Bharathiar University, Coimbatore, IGNOU
Updated
Nov 2026

Syllabus alignment

University of Madras · CBCS 2023-24

320S61 · Mini Project (Professional Competency Skill) · Semester 6 · 2 credits · 40 + 60

Subjects this project applies
  • Python (120C1A)
  • RDBMS (320C5B)
  • Web Technology (320C5C)
  • Data Structures (220C3A)
How it is evaluated

See your department's project guidelines.

Also fits: Bharathiar University 2023-24, IGNOU BCA (revised) — BCSP-064 guidelines, BCU SEP 2024.

What's in the box

11 parts · 5 free · 2 previewed · 4 unlock for ₹2,000

Problem & synopsis

5 min read

Problem statement

Large government hospital OPDs plan tomorrow's staffing from yesterday's habits: monthly averages, intuition and firefighting. Attendance, however, follows strong weekly, festival and monsoon cycles that averages ignore, so a predicted Monday surge is staffed the same way as a slack mid-week day. The result is familiar — long queues and token scrambles on peak days, idle counters on others — in facilities where a single hospital can see five-figure daily footfall and every wasted counter is a lost consultation slot.

HMIS makes every facility report OPD attendance, yet that data is never turned into an operational forecast for the facility itself. What is needed is a measured, department-level forecasting system that (a) works from the aggregate daily counts hospitals already produce, (b) tests statistical and sequence models against an honest seasonal-naive baseline with walk-forward validation, (c) translates the forecast into a concrete rota suggestion within administrator-set capacity limits, and (d) stores no patient-identifying information whatsoever.

Synopsis

Abstract

This project builds and rigorously evaluates a forecasting service for daily outpatient attendance in a district hospital. Four models — seasonal naive, SARIMA, Prophet and a Keras LSTM — are compared on three years of daily, department-wise OPD counts with walk-forward backtesting, using MAE, RMSE, MAPE and MASE against the seasonal-naive baseline. The winning model per department drives a Flask dashboard showing a 7-day-ahead forecast with intervals and a session-wise rota suggestion. The full pipeline — MySQL storage, feature builder, model registry, dashboard — is reproducible on a student laptop.

Introduction

Government hospital OPDs in Tamil Nadu run at enormous scale — Rajiv Gandhi Government General Hospital alone reports on the order of twelve to fifteen thousand outpatient visits daily — and attendance is predictable in shape: weekday peaks, Sunday troughs, festival dips and monsoon-season surges of fever cases. Because the shape is regular, forecasting is useful: an extra counter on a predicted Monday surge shortens queues, while over-staffing a Sunday wastes scarce doctors' time. The National Health Mission's HMIS already mandates OPD attendance reporting, so the raw signal exists in every facility; what is missing is a forecast layer on top of it.

Existing System

  • Rotas are planned from last month's averages and senior staff intuition; surges are handled reactively by pulling in duty staff.
  • Token and queue-management pilots (RGGGH trialled one in 2024) manage the crowd after patients arrive, but do not inform tomorrow's staffing.
  • HMIS reports OPD attendance monthly for programme monitoring — retrospective, aggregated for administration, never fed back to the facility as an operational forecast.
  • Limitations: no department-level forward view, no holiday or monsoon awareness, no measurable accuracy, and knowledge leaves with the staff who hold it.

Proposed System

  • A data layer in MySQL holding daily department-wise attendance, a Tamil Nadu holiday calendar, and rainfall series; the bundled dataset is a documented three-year sample generated to match published reporting patterns, with a loader for a real HMIS extract.
  • A feature builder producing lags, rolling means, day-of-week and month encodings, holiday flags (including festivals that shift demand) and monsoon indicators.
  • Four-model comparison per department with walk-forward backtesting and MASE scores relative to seasonal naive — no model is adopted without beating the baseline.
  • A Keras LSTM trained on sliding windows with early stopping and dropout, alongside SARIMA and Prophet as statistical references.
  • A Flask dashboard with forecast charts, intervals, and a rota table translating a predicted surge into counters and doctors per session, within administrator-editable capacity limits.

Feasibility Study

  • Technical: all libraries are free; the LSTM trains in minutes on CPU at this data size; MySQL and Flask are already in the CBCS syllabus.
  • Economic: zero licence cost; runs on a college laptop with 8 GB RAM, no GPU required.
  • Operational: the dashboard needs no training; aggregate counts avoid any patient-privacy surface, so a hospital can pilot it without ethics clearance for records access.

Objectives

  1. 01Design and implement a MySQL schema for daily department-wise OPD attendance, holiday calendars, rainfall series, model registry and forecasts.
  2. 02Build an ETL and feature-engineering layer producing lags, rolling means, calendar encodings, Tamil Nadu holiday flags and monsoon indicators.
  3. 03Implement and walk-forward-backtest a seasonal-naive baseline, SARIMA and Prophet models per department using statsmodels and Prophet.
  4. 04Design, train and tune a Keras LSTM sequence model on sliding windows, with dropout and early stopping to control overfitting on small data.
  5. 05Evaluate all models with MAE, RMSE, MAPE and MASE, and adopt the best per department only where it beats the seasonal-naive baseline.
  6. 06Translate forecasts into a session-wise rota suggestion (counters and doctors) bounded by administrator-editable capacity parameters.
  7. 07Deliver a Flask dashboard showing forecast charts with prediction intervals, and unit-test the calendar and rota logic end to end.

Scope

In scope

  • One facility, OPD departments (General Medicine, Paediatrics, Surgery, ENT, Ophthalmology and so on), daily granularity.
  • Horizons of 1–7 days ahead with prediction intervals.
  • Three years of bundled sample data matching public reporting patterns, plus a documented loader for a real HMIS-format extract.
  • Four-model comparison with walk-forward backtesting and a model registry in MySQL.
  • Rota suggestion logic with editable capacity parameters; Flask dashboard with charts.

Out of scope (v1)

  • Inpatient, emergency and admission forecasting; bed-occupancy management.
  • Patient-level records, triage or queue-token systems — only aggregate daily counts exist in this system.
  • Hourly intra-day forecasting and biometric-gate integration.
  • Multi-facility cloud deployment and automated roster approval workflows.
  • Causal modelling of disease outbreaks — rainfall and holidays are exogenous features, not epidemiological models.

Methodology

The project uses an Incremental (evolutionary prototyping) SDLC model: a baseline-forecast pipeline exists by the end of week 2, and each later increment adds a model class or a layer of the application, always leaving the system runnable. With six weeks and two members, this is the only discipline that survives contact with a real deadline.

PhaseWeeksActivitiesDeliverable
Requirements & data1Study HMIS reporting fields; define schema; generate and document the three-year sample dataset; build the holiday calendarSchema + dataset documentation
Increment 12ETL into MySQL, feature builder, seasonal-naive baseline, first walk-forward backtestBaseline metrics
Increment 23SARIMA and Prophet per department; residual checks; MASE comparison tableStatistical models report
Increment 34Keras LSTM: windowing, training, early stopping, hyper-parameter tuningTrained LSTM + comparison
Increment 45Rota advisor logic, Flask dashboard with charts and intervals, admin capacity settingsWorking application
Testing & documentation6Unit and integration tests, final backtest run, report, diagrams, demo rehearsal, viva prepFinal submission

Team division: Member A owns the data layer, statistical models and evaluation; Member B owns the LSTM, dashboard and rota advisor; both share the report and demo.

Testing approach: unit tests for calendar features (holiday boundaries, festival shifts) and rota capacity arithmetic; integration tests for ETL idempotency; and walk-forward backtesting as the final acceptance test, with a documented failure analysis of the worst-predicted weeks (typically deepavali-week dips and monsoon fever spikes).

Architecture & tech stack

2 diagrams · 7 technologies · 2 min read

  • Python
  • pandas
  • statsmodels
  • scikit-learn
  • TensorFlow/Keras
  • MySQL
  • Flask

The system is a layered analytics architecture: a data layer, a modelling layer and a presentation layer, each independently testable.

  1. Data layer (MySQL) — daily attendance per department, the Tamil Nadu holiday calendar, daily rainfall, a model registry, generated forecasts and evaluation metrics. Views expose the aggregates the dashboard needs.
  2. Modelling layer (Python) — a feature builder feeds two parallel tracks: statistical models (SARIMA via statsmodels, Prophet) and a Keras LSTM over sliding windows. Every experiment writes its hyper-parameters and metrics to the model registry, and the rota advisor reads only registry-flagged best models.
  3. Presentation layer (Flask) — server-rendered pages with Chart.js graphs: forecast per department with intervals, backtest overlays, and the editable rota table.
flowchart TD
  SRC["HMIS-format CSV / bundled sample"] -->|"idempotent load"| ETL["ETL job — pandas"]
  ETL --> DB[("MySQL: visits, holidays, rainfall")]
  DB --> FB["Feature builder — lags, rolling means, calendar"]
  FB --> SM["SARIMA + Prophet"]
  FB --> LSTM["Keras LSTM sequence model"]
  SM -->|"metrics"| REG["Model registry + evaluation tables"]
  LSTM -->|"metrics"| REG
  REG -->|"best per department"| RA["Rota advisor"]
  SM -->|"7-day forecast + intervals"| DB
  LSTM -->|"7-day forecast + intervals"| DB
  DB --> UI["Flask dashboard + Chart.js"]
  RA --> UI
  UI --> A(["Hospital administrator"])
  UI --> M(["Guide / review panel"])

ER diagram

erDiagram
  DEPARTMENT ||--o{ OPD_VISIT : records
  OPD_VISIT }o--|| CALENDAR_DATE : "falls on"
  MODEL ||--o{ FORECAST : generates
  DEPARTMENT ||--o{ FORECAST : receives
  MODEL ||--o{ EVALUATION : "is scored by"
  FORECAST ||--o{ ROTA_SLOT : "drives"

  DEPARTMENT {
    int dept_id PK
    string dept_name UK
    string category
  }
  OPD_VISIT {
    int visit_id PK
    int dept_id FK
    date visit_date
    int patient_count
    string data_source
  }
  CALENDAR_DATE {
    date cal_date PK
    int day_of_week
    boolean is_holiday
    string holiday_name
    boolean is_monsoon
    float rainfall_mm
  }
  MODEL {
    int model_id PK
    string model_name
    string algorithm
    string hyperparameters
    boolean is_best_for_dept
  }
  FORECAST {
    int forecast_id PK
    int dept_id FK
    int model_id FK
    date target_date
    int predicted_count
    int interval_low
    int interval_high
  }
  EVALUATION {
    int eval_id PK
    int model_id FK
    decimal mae
    decimal rmse
    decimal mape
    decimal mase
  }
  ROTA_SLOT {
    int slot_id PK
    int forecast_id FK
    string session
    int counters_open
    int doctors_assigned
  }

Key design decisions: the calendar table carries holidays, festivals and rainfall so that every model consumes identical exogenous features; the model registry stores hyper-parameters with metrics, making the four-model comparison reproducible in the viva; and forecasts are kept per model rather than overwritten, so the dashboard can show why a model was chosen and how alternatives performed on the same weeks.

Modules

6 modules

  1. Module 01

    Data Collection & ETL (Member A)

    Loads daily department-wise attendance from the bundled three-year sample or an HMIS-format CSV into MySQL with idempotent upserts, validates ranges, repairs small gaps by interpolation flagged as imputed, and maintains the Tamil Nadu holiday and festival calendar plus the daily rainfall series.

  2. Module 02

    Feature Engineering & Exploratory Analysis (Member A)

    Builds lag features, 7-day rolling means, day-of-week and month encodings, holiday and monsoon flags; produces the EDA evidence — weekly seasonality plots, ACF/PACF, monsoon overlays — that justifies the model choices in the report and the viva.

  3. Module 03

    Statistical Models & Baseline (Member A)

    Implements the seasonal-naive baseline and SARIMA with statsmodels and Prophet with holiday regressors, fits per department, checks residuals, and runs the walk-forward backtest harness that produces the MASE table every later model must beat.

  4. Module 04

    LSTM Sequence Model (Member B)

    Designs a Keras LSTM on scaled sliding windows (past 28 days plus exogenous features) predicting the next 7 days, with dropout and early stopping; documents window sizing, hyper-parameters and the CPU training time, and registers artefacts and metrics in the model registry.

  5. Module 05

    Rota Advisor (Member B)

    Translates each department's 7-day forecast into session-wise counter and doctor suggestions using administrator-editable parameters (patients per counter per session, consultation slots per doctor), capped by available staff, and exposes the rules so the suggestion is always auditable.

  6. Module 06

    Dashboard & Model Registry Views (Member B)

    A Flask application with Chart.js dashboards showing forecast-versus-actual overlays, prediction intervals, backtest metrics per department and the editable rota table, backed by MySQL views that keep SQL out of the presentation code.

Slides

12 slides · titles free · bullets, notes and the .pptx unlock

  1. Slide 1

    Daily OPD Footfall Forecaster

  2. Slide 2

    Introduction & Motivation

  3. Slide 3

    Problem Statement

  4. Slide 4

    Existing vs Proposed System

  5. Slide 5

    Objectives

  6. Slide 6

    Dataset & Data Design

  7. Slide 7

    Technology Stack

  8. Slide 8

    Architecture & ER

  9. Slide 9

    Models & Evaluation Design

  10. Slide 10

    Results / Demo

  11. Slide 11

    Testing

  12. Slide 12

    Conclusion & Future Scope

Bullets, speaker notes and the .pptx · ₹2,000

The titles above are the real outline. The rest is what you present from.

Unlock for ₹2,000

Viva questions & answers

3 of 15 answered free · 12 unlock

Read each answer, close it, and say it in your own words. Your viva will ask. Now you'll know.

  1. 01Concept

    Why is OPD attendance a good forecasting problem at all?

    Because it combines high volume with strong, stable seasonality: weekday peaks, Sunday troughs, festival dips and monsoon-season illness waves recur every year, and the aggregate counts are already collected for HMIS reporting. A signal that is both predictable and operationally actionable — staffing decisions change queue lengths — is exactly the case where forecasting pays for itself.

  2. 02Concept

    What is MASE and why did you add it to MAE and MAPE?

    MASE scales a model's error by the in-sample error of the naive one-step forecast, so a value below one means the model genuinely beats that naive rule. MAPE becomes unreliable on low-volume days where a small absolute error is a huge percentage, and MAE alone has no reference point. MASE gives one comparable number across departments with very different volumes, which is why the selection table uses it.

  3. 03Concept

    Explain stationarity and how you handled it for SARIMA.

    A stationary series has constant mean and variance over time; SARIMA's autoregressive machinery assumes it after differencing. I checked the attendance series with rolling means and an ADF test, applied first differencing for the trend and seasonal differencing at lag seven for the weekly cycle, and confirmed the residuals had no remaining structure with ACF/PACF plots before trusting the fitted model.

+12 more questions, with answers

Try the free ones out loud first. Your examiner will not accept “it's in the PPT”.

Source code & how to run

8 steps · complete source code · unlocks with the project

Unlocks with the project · ₹2,000

8 steps · source code zip

Prerequisites, install, seed data and tests, written for demo day. Plus the complete source.

Unlock for ₹2,000

READMEFIRST

270 words · unlocks with the project

What to change before it goes anywhere near a submission. Skipping it is how the demo fails live.

Unlocks with the project · ₹2,000

270 words · ~1 min read

The checklist of things to rename, re-seed and re-think so the project reads as yours.

Unlock for ₹2,000

Instructions

329 words · unlocks with the project

How to study it, adapt it and walk your examiner through it, step by step.

Unlocks with the project · ₹2,000

329 words · ~2 min read

Report structure, formatting rules and the submission checklist your department will grade.

Unlock for ₹2,000

References

8 sources

  1. HMIS — Health Management Information System portal, Ministry of Health & Family Welfare
  2. National Health Mission — HMIS portal overview
  3. Rob J. Hyndman & George Athanasopoulos, Forecasting: Principles and Practice, 3rd ed., OTexts
  4. Prophet — forecasting procedure documentation
  5. statsmodels Documentation — SARIMAX and time-series analysis
  6. TensorFlow / Keras Documentation
  7. scikit-learn Documentation — preprocessing and model evaluation
  8. MySQL 8.0 Reference Manual

Cite this bundle

OnlyProjects. (2026). Daily Outpatient Footfall Forecasting for a District Hospital OPD (Python, Keras, MySQL): BCA AI & Machine Learning project bundle [Educational resource]. https://onlyprojects.online/projects/bca-aiml-opd-footfall-forecaster

Future scope

1 min read

  • Intra-day forecasting on hourly registration data to drive afternoon-session staffing, not just daily planning.
  • Admission and bed-demand extension linking OPD volume to next-day inpatient occupancy for the same departments.
  • Multivariate deep models — a temporal fusion or transformer-style architecture consuming weather forecasts and epidemic alerts as future covariates.
  • Multi-facility deployment with per-facility model registries and a state-level rollup for NHM-style programme monitoring.
  • Anomaly overlay — flagging days when actual attendance departs sharply from the forecast band, as an early outbreak signal for the facility.

Keep browsing

Same degree, same syllabus slot, different idea. Pick the one your guide will actually approve.

BCACode included

Web Development

Smart Hostel Management System

Room allocation, complaints and mess billing without the register

  • Next.js
  • TypeScript
  • Node.js
  • +3

intermediate8 wk2 students