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.
- Dashboard — Overview statistics, monthly approved vs paid bar chart, status breakdown
- Ingest — Upload
GenericSearchReport*.csvfiles 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
.xlsxfiles - 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.dbtobackups/on app launch (newest 14 kept) - Logging — App and CLI activity logged to
logs/maa.log(daily rotation, 14 days kept)
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
python -m venv .venv
source .venv/bin/activate
pip install -r requirements.txtCopy and configure the doctor list:
cp doctors.toml.example doctors.toml
# Edit doctors.toml with your doctor names and default fee percentagesstreamlit run app.pyOn 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.dband 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.
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.
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.pyDoctor 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.35The percentage is applied to (MAA payment − expenses) when no flat override is set on an entry. Restart the app after editing.