CSE312 Software Architecture Principles and Practices
A lifelong health record that the patient owns.
Shivansh Neekhra, Akshay VS, Bharadwaj B Chand, Srimoneyshankar Ajith
Indian Institute of Information Technology, Kottayam, Team 1
Guide: Dr. Dhakshayani J
A story
Nobody can answer. The record is in three hospitals, and none of them are here.
At the hospital
Ravi made an emergency card and put its QR on the back of his phone.
The paramedic scans it, signed in to the hospital system.
Only the card opens. His record stays closed.
Four seconds later
A smaller moment
No AI model. Fixed rules over her own record. Nothing she asks is stored.
Introduction
Own the record, grant and revoke consent, see every access.
File entries and documents, including for people who never registered.
Read only inside an active consent. The role alone grants nothing.
Keep identities clean. Can never read clinical data.
Built for India: four languages, synthetic data only, never a real patient.
Problem statement
Objectives
Requirements
Register, verify email, step-up password check for sensitive actions.
Five entry kinds. Corrections add a new entry, never overwrite.
Provider staff file entries and documents, even for unregistered patients.
Scoped by entry type and date window, optional expiry, revoked at once.
Every read listed for the patient, with notifications.
Patient-written card, QR, 60-minute break-glass with a reason.
Lab trends, medications, visits, computed at request time.
Plain questions answered by fixed rules, in four languages.
Requirements
Consent filter on every clinical read. Denied reads are 404, not 403.
Audit table is append-only by database GRANT.
Argon2id, opaque Redis sessions, CSRF origin guard, default-deny routes.
No in-place edits. No clinical values in JSONB.
Four locales, mobile-first, colour never carries meaning alone.
Modular monolith with import and SQL boundaries enforced in CI.
Integration tests on real PostgreSQL, negative tests first.
docker compose up, 6 services, seeded.
System architecture
Inside a module
Modules talk through service interfaces, never each other's tables. A CI lint fails the build if they do.
routes.pyHTTP onlyParse, validate, delegate. No business logic.service.pyBusiness rulesConsent, permissions, transactions. No SQL, no framework.repository.pyAll SQLOne query builder for clinical reads.models + schemasShapeSQLAlchemy tables and the Pydantic API contract.The rule everything rests on
async def accessible_entries(session, actor, patient_id):
if await actor_owns_patient(session, actor, patient_id):
conditions.append(MedicalEntry.patient_id == patient_id)
if provider_id is not None:
conditions.append(and_(MedicalEntry.patient_id == patient_id,
MedicalEntry.source_provider_id == provider_id))
if actor.role is Role.CLINICIAN:
conditions.append(and_(..., clinical_access_predicate(
patient_id, actor.user_id, entry_type, occurred_at)))
if not conditions:
conditions.append(false())
return select(MedicalEntry).where(or_(*conditions)) Consent engine
Password re-check. Scoped to entry types and a date window.
Consent activeThe filter passes. The access is logged once.
200, entriesNo password prompt. The permission row is deleted in the same transaction.
Consent revokedNothing cached, so the very next query denies it.
404, not 403A 403 would confirm the person is a patient here. A 404 says nothing.
Decisions, 18 recorded
Patterns and practices
11 modules, one deployable, one database.
routes, service, repository. SQL lives in one place.
Storage, notification, identity behind interfaces.
OpenAPI generates the TypeScript types. Stubs before code.
Route coverage plus 4 lints fail the build on a violated rule.
Revoked, expired, wrong scope, admin: each must return nothing.
A rule that only lives in a document gets broken by accident. These live in CI.
Verification
backend tests on real PostgreSQL
browser tests, plus 1 live run on the real stack
endpoints, every one declares a permission
modules with enforced boundaries
decision records with alternatives
interface strings in each of 4 languages
FAQ
Opaque Redis sessions are checked on the server, so logout and role changes take effect at once.
One laptop-scale deployment with no scaling need. Module boundaries are linted as if extraction were coming.
A 403 confirms the record exists, which reveals that a person is a patient here at all.
No model. Fixed rules map a question to a query that goes through the same consent filter.
The interface is localised, clinical text is not. Translating it would invent a medical claim.
None. Synthea plus an Indian overlay gives 125 synthetic patients, committed to the repo.
Pulse
Shivansh Neekhra, Akshay VS, Bharadwaj B Chand, Srimoneyshankar Ajith
Indian Institute of Information Technology, Kottayam, Team 1. Guide: Dr. Dhakshayani J