Problem
Busy OPD hours meant crowded waiting areas, handwritten tokens, lost lab slips and patients walking between departments to ask whether a report was ready. Doctors could not see a patient’s tests and earlier prescriptions in one place.
Users
Receptionists, doctors, nurses, laboratory staff, billing staff and managers — each with a separate role — plus patients through their own portal.
My role
I designed, built and maintain the system end to end: the clinical and financial data model, department workflows, printed documents, permissions and tests, working directly with hospital staff on how each department actually operates.
Implemented features
- Reception: patient registration, appointments and doctor schedules, daily tokens per department with printed token slips.
- OPD: visits, medical records, consultation templates, and prescriptions printed on the hospital letterhead.
- Laboratory and imaging: test orders, results with parameters, and tracking of X-ray, MRI and ultrasound procedures.
- Indoor care: admissions and rooms, nursing medication, surgeries and implants, physiotherapy, dressing and injection services.
- Pharmacy and stock: a pharmacy point of sale with medicine stock, and internal inventory for consumables.
- Money: invoices, payments, refunds, cash reconciliation and an immutable day-end audit snapshot.
- Staff: attendance, exceptions and payroll.
- Clinical safety: drug-interaction, allergy and contraindication warnings while prescribing, with every override recorded in an audit log.
Architecture decisions
- One shared visit record. Reception, doctor, lab, imaging, pharmacy and billing all work on the same visit, so nothing is retyped and nothing travels on paper.
- Separate Django apps by responsibility: the core hospital workflow, clinical safety, pharmacy point of sale and internal inventory.
- Clinical-safety checks as small APIs (Django REST Framework): drug interactions, allergy checks and contraindications are checked while the doctor prescribes, and overrides are posted back with a reason.
- SQLite today, PostgreSQL ready. Setting one environment variable moves the system to PostgreSQL with no code change.
Security and data handling
- Role-based access with checks on the server, covered by automated tests — for example: a patient cannot list other patients, only a manager can see payroll, and only billing staff can turn an order into an invoice — a nurse or a patient trying is refused.
- Audit trails that are never edited: the activity log, day-end audit snapshots, and the clinical override log.
- The secret key comes from an environment variable or a private file on the server; debug mode is off.
- Public material uses sample patients only; no live address or login is published.
Challenges and lessons
- Departments see the same patient differently. Making the visit the shared record, with lab, imaging, pharmacy and billing orders attached to it, means no department retypes another’s data.
- Money needs an audit trail, not just totals. Day-end snapshots cannot be edited after they are taken, so the day’s figures can be checked later against what was recorded at the time.
- Clinical warnings must not block care silently. A doctor can override a warning, but must give a reason, and the override is logged.
- Reproducible setup matters. Pinning the project’s dependencies let the full test suite run cleanly from a fresh environment.
Evidence
68 automated tests pass, including an access-control suite. The demo video uses sample patients. Source code is private because the system holds patient records; a walkthrough on a demo database is available on request.
← Back to all projects