Initial commit: Role-based data visualisation platform for DMH hospital admissions (Phases 1-3)

This commit is contained in:
Atharv1705
2026-11-25 09:54:08 +05:30
commit a79e21aad6
87 changed files with 95719 additions and 0 deletions
@@ -0,0 +1,124 @@
%PDF-1.4
%“Œ‹ž ReportLab Generated PDF document (opensource)
1 0 obj
<<
/F1 2 0 R /F2 3 0 R /F3 4 0 R /F4 5 0 R
>>
endobj
2 0 obj
<<
/BaseFont /Helvetica /Encoding /WinAnsiEncoding /Name /F1 /Subtype /Type1 /Type /Font
>>
endobj
3 0 obj
<<
/BaseFont /Helvetica-Bold /Encoding /WinAnsiEncoding /Name /F2 /Subtype /Type1 /Type /Font
>>
endobj
4 0 obj
<<
/BaseFont /Helvetica-BoldOblique /Encoding /WinAnsiEncoding /Name /F3 /Subtype /Type1 /Type /Font
>>
endobj
5 0 obj
<<
/BaseFont /Helvetica-Oblique /Encoding /WinAnsiEncoding /Name /F4 /Subtype /Type1 /Type /Font
>>
endobj
6 0 obj
<<
/Contents 12 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 11 0 R /Resources <<
/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ]
>> /Rotate 0 /Trans <<
>>
/Type /Page
>>
endobj
7 0 obj
<<
/Contents 13 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 11 0 R /Resources <<
/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ]
>> /Rotate 0 /Trans <<
>>
/Type /Page
>>
endobj
8 0 obj
<<
/Contents 14 0 R /MediaBox [ 0 0 595.2756 841.8898 ] /Parent 11 0 R /Resources <<
/Font 1 0 R /ProcSet [ /PDF /Text /ImageB /ImageC /ImageI ]
>> /Rotate 0 /Trans <<
>>
/Type /Page
>>
endobj
9 0 obj
<<
/PageMode /UseNone /Pages 11 0 R /Type /Catalog
>>
endobj
10 0 obj
<<
/Author (\(anonymous\)) /CreationDate (D:20261124183401+05'00') /Creator (\(unspecified\)) /Keywords () /ModDate (D:20261124183401+05'00') /Producer (ReportLab PDF Library - \(opensource\))
/Subject (\(unspecified\)) /Title (\(anonymous\)) /Trapped /False
>>
endobj
11 0 obj
<<
/Count 3 /Kids [ 6 0 R 7 0 R 8 0 R ] /Type /Pages
>>
endobj
12 0 obj
<<
/Filter [ /ASCII85Decode /FlateDecode ] /Length 3796
>>
stream
Gatm>>BAN>&q9SYkbjZO$Smm,&D8GgZ?@]m]Je'74lr]n+:U"D+gDplS,N$Woo-[oK9E<-.RB$3FAH8X^<*2]rjq7lGY3'5TVM66\K22LjE@(H%6i59i8F&+[skXK;(qR4.-a=t"`?<&gC(VVE]gPW%:!q*0!A)+5/;((M?()R@WRSmZagnCeq[m>(Nbk=Z@*q(9^#07K"`X=M,\1dW]['B<0X/jR(fE5?SqP3\bQ>W2`^.-CE.2QopMmscG@G)Q\dep:+to/i3h^\(NoYi#G12LG+hPhV;ibkW)CWH<QGrHa]-Mr!=l=(Ue7J\2ftKaB8)ks9]Hmo(\qE_)M\pH<6Q8kof^?&EU,Xd4lH$hK3_a<r-j`q?V`+i?,u77+hjaoqeU%4FBlQs;&Dc<q`FbJ(NfQ8o^-PkN''=4rU?sUQNGL22EhL?UL+KlAiHbR@ga;e$f27a#cZS3,&kluN6"(ROnYBeauf[_/jB.Q[i^dnif'GTaF#+fYq5-\0c!oopNK)YbWu.(6RY64+qs'kY!b16HLacEFHPmW.Rcu(CeOM@>BF.^Ei8]GhB(@)[E:(Kios87>Y^'[+KsgZ4.-E.(\YbhAYr''.Bing=`31*AuW.lAGM?Gp^4a\>pn3E81k6RSUR2gr'@g5mF+VJ1su&9)o]<GhJZ%a<dG.sf+XZCPC)bDTl9i\Q)+Vu??"s/1m#;uF=hI3CtufW1qkV)Q19OCDZ">Z\*o#'O0:3@FSj,!j#!@KklO76i0t>>7LGf@)n"mS-?,0o:FDkbFgIq4M=6L',[35l^81@:X>2448.b>+gJISGrr$uto_K`hM4DWt]KXCR'_*'2%"Ql11,W`s$\kPoC14*JZ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qHEc7Wh)%4us_'F?O0dpE9_5n!FoGXCD%"6qfN-j_Ro*2dar>NTO#kd194:=[lnYj`o0fg1%0VR!d8_t>@#cocCL%`^Sl2!j^LZu_/28lp99fc<=!YpTOkS4#.#!&*]GX:g`6=P"JZP&e"V[I:VXNV'RF&6"--,6U=JAQWrhn46Kg)[fe;K0?H!kN$ME1DQFX7:u;fO89AL[Y:Ui,'aq/K5-Qqc$0d,\JNZB3#LXf>8^LD=]-KDO/8=W[Ed)6riX[@@[r)JP?=DSV4]:Smf*%=YU!Vc&&`FhVc3ARR>%UM;>at?m4/#r%-9Jj%'*+g(m5,V]JA&;3X;;>.r`M>XNl858B[e]/'p2.le@IsB_U>Y#7+pV+G.XG<l;>RqVa-E:BoUW5`1)!Mn]7<RKl4HZ9*g(i@mup-(.22btM2]@;HDPp2UWXLkF.<^Tj?[Bb\r>\p5F$0/KYG@c6&,r3r^;p@COlR'r)`kO*7_4V2"fj&&N6&EMp7*&?jB<E%Zuf3,@f38g]6aScgfa3V4,M3Og70hE>jXtZ)0YQ\um2'N);91`8C_@6`1gblO:C"#E#0(%`>3o!s18>%H.W"0J5[E95h3c3T^j']DHlHe%9K;B$B>AM-mdY<Xb[GdddWAYsN$].<Sc+d=L/k':Bn':^-X&16:Rt<.74&JUHfJ8$S4%,o<\_#^?o@Y<>O:Zc%$G>Q)hncqm8%"UU?SXRlH005?Vr/oR2%$>bmSVBL*O^_P?sG%"hn"e?O1bWQm.g.mZmhhJc,cg4MbL@Bcks9+K"Jkr$'/RVKqO4,R7QN;[^8tt"LcT0O!`G_0mMc%rTLHT#NHl?lY<!U^!D)dkT(C#rnt2hj.Krc7XkDj#T:P~>endstream
endobj
xref
0 15
0000000000 65535 f
0000000061 00000 n
0000000122 00000 n
0000000229 00000 n
0000000341 00000 n
0000000460 00000 n
0000000575 00000 n
0000000780 00000 n
0000000985 00000 n
0000001190 00000 n
0000001259 00000 n
0000001540 00000 n
0000001612 00000 n
0000005500 00000 n
0000009429 00000 n
trailer
<<
/ID
[<91390a0e3b5f1680325052612915749c><91390a0e3b5f1680325052612915749c>]
% ReportLab generated PDF document -- digest (opensource)
/Info 10 0 R
/Root 9 0 R
/Size 15
>>
startxref
10687
%%EOF
+125
View File
@@ -0,0 +1,125 @@
# DMH Role-Based Data Visualisation Platform — Implementation Plan
> **Platform Purpose:** A governed healthcare analytics platform for hospital admission records (initial dataset: `admissionData-2025_v1.csv`, 86,099 rows, 19 fields). A super admin controls exactly which data each user or role may see; all other users log in and view interactive charts strictly scoped to their permitted slice. The system is designed to transition seamlessly from flat file uploads to live enterprise databases without code refactoring.
---
## 1. Guiding Principles & Architecture
### The One Rule That Matters Most
> **The browser must never receive data the user is not allowed to see.**
> All permission checks, column masking, row filtering, and aggregations happen strictly on the backend. The frontend client sends a declarative JSON chart specification (`ChartSpec`), never raw SQL. The backend validates every field against a whitelist, injects user/role row rules, runs a parameterized SQLAlchemy Core query, and returns only the aggregated result.
```mermaid
flowchart TD
Client["Browser / React Client"] -->|"Declarative JSON ChartSpec (No SQL)"| API["FastAPI Gateway"]
API --> Auth["JWT & RBAC Middleware"]
Auth --> Perm["Permission & Rule Evaluator"]
Perm -->|"Inject Row Rules & Check Column Whitelist"| QueryEngine["SQLAlchemy Core Aggregation Engine"]
QueryEngine -->|"Parameterized Core SQL"| DB[("PostgreSQL / SQLite Database\n(ds_hospital_admissions_2025)")]
DB -->|"Aggregated Summary Only"| QueryEngine
QueryEngine -->|"Safe Summary JSON"| Client
subgraph Privacy_Enforcement["Security Boundary"]
Perm
QueryEngine
end
```
---
## 2. Technology Stack
| Layer | Component | Purpose & Implementation |
|---|---|---|
| **Backend API** | FastAPI (Python 3.11+) | Async REST endpoints, Pydantic v2 request/response validation, dependency injection |
| **Data Engine** | SQLAlchemy 2.0 Core | Whitelisted column expressions, dynamic table binding, parameterized SQL, zero f-string SQL |
| **Migrations** | Alembic | Schema versioning; dynamic data tables (`ds_*`) excluded via `include_object` filter |
| **Authentication** | Argon2-cffi & PyJWT | Password hashing resistant to GPU cracking; signed JWT access tokens with 8-hour TTL |
| **Database** | PostgreSQL 16 (SQLite for Dev/Test) | Ingested 86,099 hospital inpatient records across 19 fields |
| **Frontend UI** | React 18, Vite, TypeScript | Type-safe single-page web app with strict compiler checks (`noUnusedLocals`) |
| **State & Cache** | TanStack Query v5 | Automatic background query caching, query invalidation on filter/role change |
| **Visualisation** | Apache ECharts (`echarts-for-react`) | Responsive canvas/SVG charts with custom DMH palette, tooltips, and animations |
| **Styling** | Tailwind CSS & Lucide Icons | Clean healthcare SaaS interface, responsive layouts, role badges, simulation toolbar |
| **Deployment** | Docker Compose & Nginx | Reverse proxy, static asset serving, multi-container orchestration |
---
## 3. Implementation Status Overview
| Phase | Description | Status | Test Coverage |
|---|---|---|---|
| **Phase 1: Foundation** | JWT Auth, Argon2 hashing, User CRUD, CSV ingestion engine (86,099 rows), Alembic | **COMPLETED** | 15 unit tests passing |
| **Phase 2: Access Control** | Dataset/Column/Row rules, AND intersection, Super Admin simulation ("Preview As") | **COMPLETED** | 4 unit tests passing |
| **Phase 3: Visualisation** | SQLAlchemy Core aggregation engine, 4 KPI cards, 5 ECharts widgets, dynamic filters | **COMPLETED** | 6 unit tests passing |
| **Phase 3.5: Advanced Analytics** | Average Length of Stay (ALOS), Day-vs-Hour Heatmap, Districts spread, Cross-filtering | **READY TO BUILD** | Specs defined |
| **Phase 4: Governance** | Tamper-evident audit logging, Excel/CSV exports, DPDP Act small-group suppression | **SCHEDULED** | Specs defined |
| **Phase 5: Live Database** | Live DB connectors (Postgres/MySQL), encrypted credentials, caching, Docker Compose | **SCHEDULED** | Architecture planned |
---
## 4. Phase-by-Phase Detailed Plan
### Phase 3.5 — Advanced Healthcare Analytics & Cross-Filtering
*Goal: Provide clinical and operational metrics requested by hospital leadership.*
1. **Average Length of Stay (ALOS) Analysis**:
- Compute `(julianday(DischargeDate) - julianday(AdmissionDate))` in SQLite, and `EXTRACT(EPOCH FROM DischargeDate - AdmissionDate)/86400` in Postgres.
- Display overall hospital ALOS (days) in a KPI card.
- Add "ALOS by Speciality" bar chart to pinpoint long-stay clinical departments.
2. **Day-of-Week vs. Hour-of-Day Admission Heatmap**:
- Aggregated 2D matrix: Day (Monday–Sunday) $\times$ Hour (00:00–23:00).
- Apache ECharts visual heatmap to visualize peak emergency intake surge times.
3. **Geographic Distribution (District & State)**:
- Analysis of regional intake: Pune vs. rural Maharashtra vs. neighboring states.
- Top 10 districts horizontal bar chart with percentage share.
4. **Interactive Cross-Filtering**:
- Clicking a department in the Speciality chart automatically sets the dashboard filter to that department and triggers re-query for all other widgets.
5. **Chart Image Export**:
- Enable Apache ECharts toolbox (`saveAsImage`) with high-resolution PNG export.
---
### Phase 4 — Governance, Compliance & Export Engine
*Goal: Meet enterprise audit standards and India's Digital Personal Data Protection (DPDP) Act.*
1. **Audit Logging System (`audit_logs` table)**:
- Tracks: `user_id`, `action` (`LOGIN`, `CHART_QUERY`, `PERMISSION_CHANGE`, `EXPORT`), `resource`, `query_params` (JSON), `ip_address`, `timestamp`.
- Every chart query and simulation execution records an audit entry.
2. **Admin Audit Viewer Screen (`/admin/audit-logs`)**:
- Paginated, filterable table allowing Super Admins to search access history by user, date range, or action type.
3. **Privacy Compliance ($k$-Anonymity / Small-Group Suppression)**:
- If an aggregated query group has fewer than **5** patients, automatically mask the count or group into `"Other (< 5)"` to prevent patient re-identification.
4. **Role-Gated Aggregated Data Exports**:
- Export permitted chart data to CSV and styled `.xlsx` using `openpyxl`.
- Backend enforces `can_export == True`; unauthorized users receive HTTP 403.
- Exports include hospital watermark metadata and generation timestamp.
---
### Phase 5 — Live Enterprise Database Connector & Packaging
*Goal: Enable real-time database connectivity and production container deployment.*
1. **Database Connector Service**:
- Support connecting to external PostgreSQL, MySQL, and SQL Server databases.
- Store database credentials securely using symmetric encryption (`cryptography.fernet`).
- Connection test endpoint (`POST /api/v1/connectors/test`).
2. **Performance Caching Layer**:
- In-memory / Redis cache for common aggregated chart queries with configurable TTL (e.g., 5 minutes).
- Invalidation hooks on new dataset upload or permission updates.
3. **Docker Compose & Deployment Hardening**:
- Nginx reverse proxy with gzip compression and cache-control headers.
- Production Docker containers for Postgres 16, FastAPI backend, and Nginx frontend.
---
## 5. Acceptance Verification Matrix
| Milestone | Key Verification Criteria | Target |
|---|---|---|
| **Phase 1 (Delivered)** | 86,099 rows ingested, Argon2 JWT login, Super Admin User CRUD | **PASSED** (15 tests) |
| **Phase 2 (Delivered)** | Dept Manager limited to Medicine (9,770 rows), Finance to TPA (32,056 rows), 403 on `mrdNumber` | **PASSED** (4 tests) |
| **Phase 3 (Delivered)** | Live ECharts dashboard, 4 KPIs, 5 visualisations, dynamic building/speciality filters | **PASSED** (6 tests) |
| **Phase 3.5 (Next)** | ALOS calculated in days, 7x24 heatmap renders, cross-filtering updates widgets | **Target: Next Turn** |
| **Phase 4** | Audit entries created on every query, $k < 5$ suppressed, CSV export gated | **Target: Phase 4** |
| **Phase 5** | External PostgreSQL connector connects, Docker Compose boots all 3 containers | **Target: Phase 5** |
+18
View File
@@ -0,0 +1,18 @@
# Phase 1 Acceptance Verification Report
## Acceptance Criteria Checklist
| # | Acceptance Criterion | Verification Method | Status | Notes |
|---|---|---|---|---|
| 1 | Super admin can log in with secure credentials | `POST /api/v1/auth/login` with `argon2` password verification | **PASSED** | Verified in `test_login_success` & seed script. Returns signed JWT token. |
| 2 | Invalid passwords or non-existent users rejected | `POST /api/v1/auth/login` returns HTTP 401 | **PASSED** | Verified in `test_login_invalid_password` & `test_login_nonexistent_user`. |
| 3 | Restricted users (viewers) cannot access user management | `GET /api/v1/users` returns HTTP 403 Forbidden | **PASSED** | Verified in `test_viewer_cannot_list_users`. Enforced on backend dependency `require_super_admin`. |
| 4 | Super admin can create, update, and list users | `POST /api/v1/users`, `PUT /api/v1/users/{id}`, `GET /api/v1/users` | **PASSED** | Verified in `test_admin_can_list_users`, `test_admin_creates_user`, `test_admin_updates_user`. |
| 5 | Restricted users cannot upload datasets or change metadata | `POST /api/v1/datasets/upload` returns HTTP 403 | **PASSED** | Verified in `test_viewer_cannot_upload_dataset`. |
| 6 | Super admin can upload CSV dataset and register schema | `POST /api/v1/datasets/upload` creates typed dynamic table and extracts columns | **PASSED** | Verified in `test_admin_uploads_dataset_successfully`. |
| 7 | Full hospital dataset (86,099 rows, 19 fields) ingests accurately | `seed.py` ingests `admissionData-2025_v1.csv` | **PASSED** | Successfully ingested: 86,099 records, 19 fields into `ds_hospital_admissions_2025`. |
| 8 | Sensitive fields auto-flagged | Columns `mrdNumber` and `AdmittingDoctorName` marked `is_sensitive=True` | **PASSED** | Verified in `test_admin_uploads_dataset_successfully`. |
| 9 | Dates parsed from `DD-MM-YYYY HH:MM` | Ingestion parser converts dates to `DATETIME` | **PASSED** | Verified in `test_admin_uploads_dataset_successfully` and SQLite table inspector. |
| 10 | Super admin can update column display names and sensitivity | `PATCH /api/v1/datasets/{id}/columns/{col_id}` | **PASSED** | Verified in `test_admin_updates_column_metadata`. |
| 11 | Alembic migrations support | Alembic initialized with exclude filter for dynamic `ds_*` tables | **PASSED** | Migration revision `1f35b45a7c20` created and stamped to head. |
| 12 | Frontend compilation | React 18 + Vite + TypeScript build (`npm run build`) | **PASSED** | Compiled cleanly into production bundle in `dist/` with 0 errors. |
+23
View File
@@ -0,0 +1,23 @@
# Phase 2 & 3 Acceptance Verification Report
## Scope: Access Control & Visualisation Engine
### The One Rule That Matters Most
> The browser never receives data the user is not allowed to see. All permission checks and all aggregations execute securely on the backend. The frontend sends a declarative JSON chart specification, which is validated and rewritten using whitelisted column objects and bound parameters.
---
## Acceptance Criteria Checklist
| # | Acceptance Criterion | Verification Method | Status | Verified Result |
|---|---|---|---|---|
| 1 | Super Admin queries overall aggregated dataset | `POST /api/v1/charts/query` with `kpi` & `bar` | **PASSED** | Correctly aggregated **86,099** admissions. Top specialities: Oncology (18,536), Medicine (9,770), Ophthalmology (5,366). |
| 2 | Role-based row rule enforcement on server | Query as `dept_manager` (`AdmittingDoctorSpecialityName = 'MEDICINE'`) | **PASSED** | Only returns Medicine department admissions (**9,770**). All other departments filtered out on database query. |
| 3 | Role-based row rule enforcement for Finance | Query as `finance_user` (`PatientCategoryName = 'TPA'`) | **PASSED** | Only returns TPA insured admissions (**32,056**). Cash/GNL records excluded. |
| 4 | Sensitive column masking | Attempt to query `mrdNumber` or `AdmittingDoctorName` as standard viewer | **PASSED** | Server immediately rejects query with **HTTP 403 Forbidden** ("Access to column is restricted"). |
| 5 | Parameterized Core queries (No SQL injection) | Client filters compiled via SQLAlchemy Core bound parameters | **PASSED** | No string interpolation or f-strings. All columns verified against whitelisted schema. |
| 6 | Super Admin "Preview As" capability | Query with `?preview_role=department_manager` or `?preview_role=finance` | **PASSED** | Super Admin dynamically simulates restricted user and role views with live UI badge. |
| 7 | Core hospital charts rendered via Apache ECharts | Full dashboard with 5 visualisations & 4 KPI cards | **PASSED** | Bar chart (Specialities), Donut (Buildings), Monthly Trend Area (2025), Pie (Admission Categories), Stacked Bar (Payer mix x Gender). |
| 8 | Dynamic and permission-scoped filter options | `GET /api/v1/charts/filter-options/{id}` | **PASSED** | Filter dropdown options only include values permitted under active user rules. |
| 9 | Backend automated test suite | `pytest` in `backend` | **PASSED** | **25 out of 25 unit tests passed** in 7.27s. |
| 10 | Frontend production compilation | `npm run build` in `frontend` | **PASSED** | TypeScript strictly compiled into production bundle in `dist/` with zero errors. |
+266
View File
@@ -0,0 +1,266 @@
# DMH Role-Based Data Visualisation Platform — System Documentation
**Author / Engineering Lead:** AI Engineering Team
**Client / Organisation:** Deenanath Mangeshkar Hospital (DMH), Pune
**Current Date:** 24 November 2026
**Initial Dataset:** `admissionData-2025_v1.csv` (86,099 inpatient records, 19 fields)
**System Status:** Phases 1–3 Complete & Verified (25/25 Tests Passing); Phases 3.5–5 Planned
---
## 1. Executive Summary & Problem Context
Healthcare organisations manage large, highly sensitive operational datasets. Historically, these datasets are consumed in one of two suboptimal ways:
1. **Uncontrolled Spreadsheets**: Raw CSV or Excel exports containing sensitive patient-level data are circulated via email or shared drives, resulting in data staleness and compliance violations.
2. **Rigid, Expensive Ad-Hoc Reports**: Each department requests custom reports from developers, creating engineering bottlenecks and lack of self-service agility.
In hospital environments, access must be strictly role-governed:
* **Department Managers** (e.g., Medicine, Oncology, Cardiology) should only see operational data for their respective departments.
* **Finance & Billing Analysts** need access to payer mix, corporate insurance claims (TPA), and policy categories, but should not access clinical medical notes.
* **Hospital Executive Leadership** requires an aggregate, hospital-wide view across all buildings and specialties.
* **Patient Privacy**: Direct identifiers (Medical Record Numbers `mrdNumber`, Doctor Identifiers) must be strictly masked by default.
### The Problem Statement
Build a web-based, role-governed healthcare visualization platform that enables a **Super Admin** to connect data sources, configure exact column masking and row-level access rules per user or role, and deliver interactive charts (pie, bar, line, area, KPI cards, heatmaps) that are **strictly confined to permitted data slices**. The platform must ingest flat files initially and transition to live client databases without architectural rework.
---
## 2. "The One Rule That Matters Most"
> **The browser must never receive data the user is not allowed to see.**
* **No Client-Side Filtering**: Hiding chart elements, blurring table cells, or filtering arrays in the browser is prohibited. A user inspecting network traffic (DevTools) must never see unpermitted rows or columns.
* **No Client-Supplied SQL**: The frontend sends a declarative JSON chart specification (`ChartSpec`), never SQL.
* **Server-Side Enforcement**: All column whitelisting, row-rule injection, and mathematical aggregations occur exclusively on the backend.
* **Zero SQL Injection**: Queries are built via SQLAlchemy 2.0 Core using bound parameters and schema-whitelisted column objects. String concatenation or f-strings for SQL are strictly prohibited.
* **Zero Raw Records to Browser**: Only aggregated data points (e.g., `{"name": "MEDICINE", "value": 9770}`) are returned to the client.
```mermaid
flowchart TD
subgraph Frontend["Frontend Layer (React 18 + Vite)"]
UI["Dashboard / ECharts"]
FilterBar["Interactive Filter Bar"]
UI -->|"1. User triggers filter / chart view"| Client
Client["JSON ChartSpec\n(dimension, aggregation, filters)"]
end
subgraph BackendGateway["FastAPI Gateway"]
AuthMid["2. JWT Bearer Auth & Role Check"]
PermEngine["3. Permission Evaluator\n- Whitelist Columns\n- Intersect Row Rules"]
end
subgraph CoreEngine["Data Layer (SQLAlchemy 2.0 Core)"]
Builder["4. Dynamic Query Builder\n(Bound Parameters Only)"]
DB[("Database\nds_hospital_admissions_2025\n(86,099 rows)")]
end
Client -->|"POST /api/v1/charts/query"| AuthMid
AuthMid --> PermEngine
PermEngine -->|"Allowed Column Objects & Injected WHERE clauses"| Builder
Builder -->|"SELECT dim, count() WHERE role_rule = val GROUP BY dim"| DB
DB -->|"Aggregated counts only (No raw rows)"| Builder
Builder -->|"JSON ChartResult"| UI
```
---
## 3. Technology Stack
| Layer | Technology | Architectural Purpose |
|---|---|---|
| **Backend API** | Python 3.11 / 3.13 + FastAPI | Asynchronous REST endpoints, OpenAPI documentation, Pydantic v2 validation |
| **Data Engine** | SQLAlchemy 2.0 Core | Dynamic schema generation, parameterized SQL compilation, column whitelisting |
| **Migrations** | Alembic | System table migrations; dynamic data tables (`ds_*`) excluded via custom filter |
| **Security & Auth** | `argon2-cffi` + `PyJWT` | Password hashing resistant to GPU cracking; signed JWT access tokens (8h TTL) |
| **Primary Database** | PostgreSQL 16 (SQLite for Dev/Test) | Relational storage for metadata and dynamic data tables |
| **Frontend Framework**| React 18 + TypeScript + Vite | Type-safe single-page web app with strict compilation rules (`noUnusedLocals`) |
| **State & Networking**| TanStack Query v5 | Automatic query caching, background re-fetching, cache invalidation |
| **Visualisation** | Apache ECharts (`echarts-for-react`)| Production-grade, high-performance canvas/SVG charts with DMH healthcare palette |
| **Styling & UI** | Tailwind CSS + Lucide Icons | Responsive layout, modern healthcare SaaS aesthetics, simulation toolbar |
| **Packaging** | Docker Compose + Nginx | Reverse proxy, static asset serving, multi-container deployment |
---
## 4. What Has Been Developed (Phases 1–3 Complete)
### Module 1: Authentication & User Management (Phase 1)
* **Argon2 Password Hashing**: Passwords stored as irreversible Argon2id hashes.
* **JWT Token Security**: Stateless bearer tokens signed with `HS256`, containing user ID, username, and active role.
* **Role Hierarchy**: 4 system roles defined (`super_admin`, `viewer`, `department_manager`, `finance`).
* **Super Admin User Console**:
* `GET /api/v1/users`: List registered users with roles and status.
* `POST /api/v1/users`: Create new users with role assignments and password policies.
* `PUT /api/v1/users/{id}`: Modify user profile, change roles, activate/deactivate accounts.
* `DELETE /api/v1/users/{id}`: Safely remove user accounts.
* Non-super admins attempting to access these endpoints receive **HTTP 403 Forbidden**.
### Module 2: High-Performance Data Ingestion Engine (Phase 1)
* **Generic Ingestion Pipeline**: Ingests flat CSV files via `POST /api/v1/datasets/upload`.
* **Hospital Admission Parser**:
* Accurately parses `DD-MM-YYYY HH:MM` timestamps (e.g. `01-01-2025 00:06`) into ISO `DATETIME` columns.
* Handles empty strings / cash patient blanks cleanly.
* Treats `bedNumber` as text.
* **Dynamic Table Creation**: Builds dynamic tables (`ds_hospital_admissions_2025`) using SQLAlchemy Core `Table` constructs.
* **Batch Ingestion**: Uses chunked bulk inserts (5,000 rows/batch) to ingest all **86,099 rows and 19 columns** in under 5 seconds.
* **Automatic Column Classification**: Automatically identifies and marks sensitive fields (`mrdNumber`, `AdmittingDoctorName`) as `is_sensitive=True`.
### Module 3: Access Control Matrix & Rule Intersection (Phase 2)
* **Three Levels of Access Control**:
1. **Dataset Grants**: Defines whether a user or role can view or export a specific dataset (`can_view`, `can_export`).
2. **Column Masking**: Explicit list of hidden columns. Sensitive columns are masked for non-super admins by default.
3. **Row-Level Rules**: Parameterized rules (e.g. `BuildingName = 'DMHRC'`, `AdmittingDoctorSpecialityName = 'MEDICINE'`, `PatientCategoryName = 'TPA'`).
* **AND-Rule Intersection**: If multiple permissions apply to a user (user-specific + role-based), the system applies the strict mathematical intersection (all row filters combined with `AND`; columns hidden if hidden in either).
* **Super Admin "Preview As" Simulation Tool**: Super Admins can simulate restricted user views (`viewer`, `department_manager`, `finance`) directly in the header to audit exactly what each role sees.
### Module 4: SQLAlchemy Core Aggregation Engine (Phase 3)
* **Declarative Specification**: Frontend sends a typed `ChartSpec`:
```json
{
"dataset_id": 1,
"chart_type": "bar",
"dimension": "AdmittingDoctorSpecialityName",
"measure": "*",
"aggregation": "count",
"filters": [{"column": "BuildingName", "operator": "eq", "value": "DMHRC"}],
"limit": 10
}
```
* **Security Validation**:
* Verifies dataset access rights.
* Rejects queries requesting restricted dimensions, measures, or filter columns with **HTTP 403**.
* Dynamically binds row rules to the SQLAlchemy query.
* Compiles parameterized SQL with bound parameters.
* **Performance Aggregation**: Returns only grouped aggregations. Raw rows are never transmitted across the network.
### Module 5: Interactive Apache ECharts Dashboard (Phase 3)
* **4 Executive KPI Cards**: Total Admissions, Average Patient Age, Active Clinical Specialities, Hospital Wings.
* **Admissions by Medical Speciality**: Ranked horizontal/vertical bar chart showing department volumes.
* **Admissions by Hospital Building**: Donut chart displaying facility distribution (`DMHRC`, `DMHSS`).
* **Monthly Admission Trend**: Smooth area chart tracking inpatient intake throughout 2025.
* **Admission Categories**: Pie chart of Emergency vs. Walk-in admissions.
* **Demographics & Payer Mix**: Multi-series stacked bar chart combining insurance categories (`GNL` vs `TPA`) across genders.
* **Permission-Scoped Filter Bar**: Dropdown filters for Building, Speciality, and Admission Type that only display values permitted under the active user's permissions.
---
## 5. Live Verification Metrics on the Ingested Dataset
The platform was seeded and tested directly against the full `admissionData-2025_v1.csv` dataset. The verified query outputs:
| Scenario / Role | Enforced Rules | Verified Aggregated Result | Security Verification |
|---|---|---|---|
| **Super Admin (Unrestricted)** | None (full access) | **86,099 Total Admissions** | All 19 columns accessible |
| **Top Specialities (Admin)** | None | Oncology: 18,536<br>Medicine: 9,770<br>Ophthalmology: 5,366<br>OB/GYN: 5,264<br>Nephrology: 5,044 | Verified exact row counts |
| **Department Manager** | `Speciality = 'MEDICINE'` | **9,770 Admissions** | Non-Medicine rows excluded by server |
| **Finance User** | `PatientCategory = 'TPA'` | **32,056 Admissions** | Cash / GNL rows excluded by server |
| **Restricted Viewer** | Sensitive masking | `mrdNumber` query rejected | **HTTP 403 Forbidden** |
### Automated Test Suite Status
* **Backend Pytest**: **25 out of 25 unit tests passing** (7.27 seconds execution time).
* `test_auth.py`: 6/6 tests passing (login, invalid creds, token expiration, profile endpoint).
* `test_users.py`: 6/6 tests passing (RBAC boundaries, user CRUD, duplicate checks).
* `test_datasets.py`: 3/3 tests passing (upload, column typing, sensitive flagging).
* `test_permissions.py`: 4/4 tests passing (permission CRUD, effective permissions, preview-as).
* `test_charts.py`: 6/6 tests passing (KPI queries, stacked bars, row rules, 403 column rejection, filter options).
* **Frontend Production Build**: Vite compiled **2,134 modules** into `dist/` with **zero TypeScript errors**.
---
## 6. What Is Remaining to Develop (Roadmap)
### Phase 3.5 — Advanced Healthcare Analytics & Cross-Filtering (Next Step)
1. **Average Length of Stay (ALOS) Analysis**:
- Compute `DischargeDate - AdmissionDate` in days across SQLite and PostgreSQL.
- Display overall hospital ALOS KPI card plus a department-level ALOS ranking chart.
2. **Day-of-Week vs. Hour-of-Day Admission Surge Heatmap**:
- 2D matrix ($7 \text{ days} \times 24 \text{ hours}$) showing peak emergency admission hours to assist hospital bed allocation.
3. **Geographic Distribution (District & State)**:
- In-state (Pune, Satara, Solapur, Ahmednagar) vs. out-of-state patient volume breakdown.
4. **Interactive Cross-Filtering**:
- Clicking a department in the Speciality chart automatically filters all other charts to that department.
5. **Chart Image Export**:
- High-resolution PNG/SVG export via the ECharts toolbox.
### Phase 4 — Governance, Compliance & Export Engine
1. **Tamper-Evident Audit Logging**:
- `audit_logs` table tracking: `user_id`, `action` (`LOGIN`, `CHART_QUERY`, `PERMISSION_CHANGE`, `EXPORT`), `resource`, `query_params`, `ip_address`, and `timestamp`.
2. **Admin Audit Trail Viewer Screen (`/admin/audit-logs`)**:
- Searchable, filterable audit log interface for compliance officers.
3. **India DPDP Act Compliance ($k$-Anonymity / Small-Group Suppression)**:
- Automatically suppress or lump groups with $< 5$ patients into `"Other (< 5)"` to eliminate patient re-identification risks.
4. **Role-Gated Data Exports**:
- Export permitted chart data to CSV and formatted `.xlsx` (via `openpyxl`), strictly gated by the `can_export` flag.
### Phase 5 — Live Enterprise Database Connector & Production Deployment
1. **External Database Connector Wizard**:
- Connect directly to external PostgreSQL, MySQL, and Microsoft SQL Server databases.
- Encrypt database connection strings at rest using symmetric encryption (`cryptography.fernet`).
2. **Scheduled Refresh & Caching**:
- In-memory / Redis query caching for high-concurrency performance ($< 50\text{ms}$ response times).
3. **Production Packaging**:
- Multi-container Docker Compose configuration (`postgres`, `backend`, `frontend` behind Nginx).
---
## 7. Project File Structure Reference
```
DMH-Data-visualisation/
├── backend/
│ ├── alembic/ # Alembic database migrations
│ ├── app/
│ │ ├── api/v1/ # auth, users, datasets, permissions, charts
│ │ ├── core/ # security (argon2, pyjwt), custom exceptions
│ │ ├── models/ # User, Dataset, DatasetColumn, DatasetPermission, RowRule
│ │ ├── schemas/ # Pydantic v2 schemas
│ │ ├── services/ # Ingestion, Permissions, Chart aggregation engine
│ │ ├── config.py # Pydantic settings
│ │ ├── database.py # SQLAlchemy 2.0 Core engine & Session
│ │ └── main.py # FastAPI application
│ ├── scripts/seed.py # Database seeder (86,099 rows + roles)
│ ├── tests/ # 25 automated pytest tests
│ ├── Dockerfile
│ └── requirements.txt
├── frontend/
│ ├── src/
│ │ ├── api/ # client, auth, users, datasets, permissions, charts
│ │ ├── components/charts/ # EChartRenderer, DashboardFilters, PreviewAsBanner
│ │ ├── pages/ # LoginPage, DashboardPage, AdminUsers, AdminDatasets, AdminPermissions
│ │ ├── context/ # AuthContext
│ │ └── types/ # TypeScript types
│ ├── Dockerfile
│ ├── nginx.conf
│ └── package.json
├── data/admissionData-2025_v1.csv # 86,099 records
├── docs/ # Implementation plan, acceptance reports
├── docker-compose.yml
└── README.md
```
---
## 8. Developer Quick-Start Guide
### Backend Execution
```powershell
cd backend
.venv\Scripts\activate
python scripts/seed.py
uvicorn app.main:app --reload --port 8000
```
Swagger UI: `http://localhost:8000/docs`
### Frontend Execution
```powershell
cd frontend
npm run dev
```
Web App: `http://localhost:5173`
### Pre-Configured Demo Accounts
| Role | Username | Password | Access Scope |
|---|---|---|---|
| **Super Admin** | `admin` | `Admin@123456` | Unrestricted full hospital access. |
| **Clinical Staff Viewer** | `viewer` | `Viewer@123456` | General view; sensitive columns masked. |
| **Department Manager** | `dept_manager` | `Manager@123456` | Row rule: **Medicine** department only (9,770 rows). |
| **Finance / Billing** | `finance_user` | `Finance@123456` | Row rule: **TPA** insurance only (32,056 rows). |