Skip to content

Repository files navigation

MAA Payment Record Manager

A web application for tracking hospital admission claims under the MAA (Mother's Absolute Affection) health insurance scheme. Supports CSV ingestion, claim browsing with filters, Excel report generation, and per-doctor expense tracking.

Features

  • Dashboard — Overview statistics, monthly approved vs paid bar chart, status breakdown
  • Ingest — Upload GenericSearchReport*.csv files with dry-run validation and change detection; or fetch directly from the MAA portal via browser session reuse
  • Admissions — Filterable, paginated table (name search + date/policy/status/speciality) with per-claim package details and Excel export
  • Reports — Multiple report types (Admission Summary, Monthly, Financial Year, Raw Export) as downloadable .xlsx files
  • Doctor Share — Per-doctor expense tracking with MAA claim linking, auto-status detection, monthly/range filters, bulk mark-paid, and internal/doctor-copy Excel exports
  • Automatic backups — Daily rotating snapshot of maa.db to backups/ on app launch (newest 14 kept)
  • Logging — App and CLI activity logged to logs/maa.log (daily rotation, 14 days kept)

Architecture

app.py                Entry point: page config, DB connection, sidebar nav, routing
log.py                Logging setup — logs/maa.log, daily rotation, optional console
utils.py              Shared helpers (fmt_inr currency formatter)
db.py                 All database access (SQLite). Schema: claims + doctor_expenses
ingest.py             CSV parsing and ingestion (CLI and library)
fetch.py              MAA portal scraper — browser session reuse + Playwright fallback
reports.py            In-memory .xlsx generation via openpyxl
doctors.toml          Local config: doctor names and default fee percentages (gitignored)
doctors.toml.example  Template for doctors.toml
backups/              Daily rotating DB snapshots (maa-YYYY-MM-DD.db, gitignored)
ui/
  dashboard.py        Dashboard page
  ingest.py           Ingest page
  admissions.py       Admissions page
  reports.py          Reports page
  doctor_share.py     Doctor Share page + entry/delete dialogs

Setup

python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txt

Copy and configure the doctor list:

cp doctors.toml.example doctors.toml
# Edit doctors.toml with your doctor names and default fee percentages

Running

streamlit run app.py

Backups

On the first launch of each day, the app snapshots maa.db to backups/maa-YYYY-MM-DD.db using SQLite's online backup API and keeps the newest 14 copies. The sidebar footer shows the last backup date.

To restore: quit the app, then

cp backups/maa-YYYY-MM-DD.db maa.db

and relaunch. Claims can always be re-fetched from the portal, but doctor share entries exist only in this database — restore from the most recent good backup.

Logs

App and CLI activity is logged to logs/maa.log (daily rotation, 14 days kept). Set MAA_DEBUG=1 or pass --verbose to the CLI tools for debug-level detail.

Data Ingestion

CSV files should be in the GenericSearchReport*.csv format exported from the claims portal.

# Ingest specific files
python ingest.py file1.csv file2.csv

# Dry-run (validate without writing)
python ingest.py --dry-run

# Auto-detect CSV files from parent directory
python ingest.py

Configuration

doctors.toml

Doctor names and their default fee percentages are stored in doctors.toml (gitignored, not committed). Copy doctors.toml.example and edit:

[doctors]
"Dr. Smith" = 0.40
"Dr. Jones" = 0.35

The percentage is applied to (MAA payment − expenses) when no flat override is set on an entry. Restart the app after editing.

Tech Stack

About

A web application for tracking hospital admission claims under the MAA health insurance scheme. Supports CSV ingestion, claim browsing with filters, and Excel report generation.

Resources

Stars

Watchers

Forks

Releases

Packages

Used by

Contributors

Languages