Forensic Medical Records Management System
CO2050 / CO226 β Database Systems Project
Department of Computer Engineering | Faculty of Engineering | University of Peradeniya
Designed and engineered by Team Mythix (Group 03)

π₯ Team
![]() S.H.S. Hansara E/22/130e22130@eng.pdn.ac.lk |
![]() T.H. Abeywickrama E/22/008e22008@eng.pdn.ac.lk |
![]() H.P.J. Gunawardhana E/22/126e22126@eng.pdn.ac.lk |
![]() H.T.D. Hatharasinghe E/22/135e22135@eng.pdn.ac.lk |
π Table of Contents
- Introduction
- Problem Domain & Background
- Solution & Core Objectives
- System Architecture
- Database Architecture & Relational Design
- Role-Based Access Control (RBAC)
- Medico-Legal Form Pipelines
- Technology Stack
- DevOps & Automated CI/CD Pipeline
- Testing & Quality Assurance
- Links & Resources
Introduction
In Sri Lankaβs healthcare and judicial ecosystem, forensic medical recordsβincluding Medico-Legal Examination Forms (MLEF), Medico-Legal Reports (MLR), Post-Mortem Reports (PMR), and anatomical Autopsy reportsβhave traditionally depended on physical registries, manual paper documentation, and decentralized departmental archives.
The Forensic Medical Records Management System is an enterprise-grade, paperless, tamper-evident digital solution built specifically to transform this mission-critical workflow. Developed for the Database Systems module at the Department of Computer Engineering, University of Peradeniya, the platform bridges hospitals, Judicial Medical Officers (JMOs), police stations, and diagnostic laboratories into a unified, secure relational environment.
Problem Domain & Background
The conventional paper-based management of forensic and medico-legal records introduces significant systemic vulnerabilities:
- Degradation & Loss of Evidence: Physical paper files are susceptible to physical wear, misplacement, fire, and flood hazards over years of court proceedings.
- Trial Delays: Police officers and magistrates face prolonged delays waiting for physical reports to be hand-carried between mortuaries, hospitals, and judicial benches.
- Integrity & Tampering Risks: Paper records lack cryptographic verification, revision trails, and role enforcement, opening avenues for unauthorized manipulation.
- Fragmented Laboratory Tracking: Specimen collection (Toxicology, Blood Alcohol, Histopathology) often suffers from delayed status updates and lost chain-of-custody handovers.
Solution & Core Objectives
Our system addresses these challenges through five core pillars:
- Relational Integrity & Legal Compliance: Strict relational schema normalization (3NF/BCNF) with foreign-key cascades and checks enforcing Sri Lankan legal and medical standards.
- Chain of Custody & Tamper Evidence: End-to-end auditability from initial police intake, through post-mortem dissection, specimen collection, to final legal deposition.
- Role-Based Access Security: Granular, cryptographically secure separation of duties for Doctors, JMOs, Police/Clerks, and Lab Technicians with JWT authentication and 2FA protection.
- Court-Ready Legal Document Generation: Instantaneous automated generation of standardized, formatted legal PDF reports containing SLMC registration details, hospital seals, and chronological injury maps.
- Cloud-Native Automated Operations: Multi-container Dockerized deployment on AWS EC2 orchestrated by automated Jenkins CI/CD quality gates.
System Architecture
The application adopts a high-availability multi-tier architecture with clear separation of presentation, business logic, persistence, and continuous deployment.
Architecture Highlights:
- Client Layer: Single Page Application (SPA) built with React 18 and TypeScript, styled with Tailwind CSS, served over Nginx reverse proxy.
- Application Layer: Node.js and Express 5 REST API with centralized error boundaries, input sanitization, JWT authorization guards, and connection pooling.
- Database Layer: PostgreSQL 15+ relational database with customized indexing (B-Tree indexes on foreign keys) and relational integrity constraints.
- DevOps & Cloud Infrastructure: Automated Jenkins pipeline running on an AWS EC2 instance, building Docker containers and conducting continuous automated testing on every commit.
Database Architecture & Relational Design
The relational database schema is normalized to 3NF/BCNF to eliminate data redundancy and insertion/deletion anomalies while handling interconnected medico-legal documents:
- Referential Integrity: Child entities (injuries, grievous injury entries, inquest identifiers, evidentiary articles) enforce strict
ON DELETE CASCADEintegrity. - PostgreSQL Native Array Columns: Utilized for multi-select legal fields such as
body_harm_types,causative_weapon,sexual_assault_signs, andtest_typesto preserve schema cleanliness without unnecessary join overhead. - High-Performance Secondary Indexes: Automatically created B-Tree indexes on foreign keys (
patient_id) across all form tables to eliminate sequential scans on frequent joins.
Role-Based Access Control (RBAC)
The system implements strict separation of duties across 4 specialized roles:
| Role | System Scope & Responsibilities |
|---|---|
| Medical Officer (Doctor / MO) | Examines living clinical examinees, completes Part B of MLEF, drafts and submits MLR reports, catalogs injury details, and orders laboratory investigations. |
| Judicial Medical Officer (JMO) | Conducts inquest examinations, oversees post-mortem inquests (PMR), performs systemic anatomical Autopsy examinations, records causes of death, and logs evidentiary articles. |
| Police Officer / Hospital Clerk (Admin) | Registers new examinees and demographic records (NIC, address, contact), files Part A of MLEF police requisitions, and manages staff administrative accounts. |
| Forensic Lab Technician (Lab) | Processes lab diagnostic queues, logs specimen intake (Toxicology, Blood Alcohol Content, Drug Screening), updates processing states, and certifies forensic test reports. |
Medico-Legal Form Pipelines
The platform digitizes Sri Lankaβs standard legal and forensic documentation workflows:
βββββββββββββββββββ ββββββββββββββββββββββββββ ββββββββββββββββββββββββ
β Police Intake β ββββΊ β Clinical Examination β ββββΊ β Legal Certification β
β (MLEF Part A) β β (MLEF Part B / MLR) β β (Court-Ready PDF) β
βββββββββββββββββββ ββββββββββββββββββββββββββ ββββββββββββββββββββββββ
β
βΌ
ββββββββββββββββββββββββββ
β Lab Investigation β
β (Routine/Urgent/STAT) β
ββββββββββββββββββββββββββ
- MLEF (Medico-Legal Examination Form): Two-stage clinical intake. Part A captures police station details and alleged assault circumstances; Part B captures clinical harm, weapon correlation, alcohol/substance influence, and danger-to-life assessment.
- MLR (Medico-Legal Report): Comprehensive legal injury report classifying non-grievous and grievous injuries under the Sri Lankan Penal Code.
- PMR (Post-Mortem Report): Magistrate court inquest documentation including identifier witnesses and external post-mortem observations.
- Detailed Autopsy Form: Full systemic anatomical dissection recording findings across cranial, thoracic, abdominal, cardiovascular, and skeletal systems, as well as articles preserved for trial evidence.
- Forensic Lab Requests: Diagnostic ordering pipeline categorized by urgency (
routine,urgent,stat) with real-time feedback into clinical records.
Technology Stack
| Layer | Technologies |
|---|---|
| Database | PostgreSQL 15+ (Relational Database, B-Tree Indexing, Cascades) |
| Backend REST API | Node.js (v18+), Express.js 5, pg (Connection Pool), JWT, Bcrypt |
| Frontend UI | React 18, TypeScript 5, Vite, Tailwind CSS v4, Lucide Icons |
| DevOps & Containers | Docker, Docker Compose, Nginx Reverse Proxy |
| CI/CD Automation | Jenkins Pipeline (Automated Build, Test, and Zero-Downtime Rolling Deploy) |
| Cloud Hosting | AWS EC2 (Ubuntu Linux) |
| Automated Testing | Jest & Supertest (Backend), Vitest & React Testing Library (Frontend) |
DevOps & Automated CI/CD Pipeline
- Automated Webhook Triggers: Pushes to the
mainbranch immediately trigger the automated Jenkins pipeline on AWS EC2. - Multi-Stage Quality Gates:
- Automated checkout of source code.
- Execution of backend integration tests (Jest + Supertest across all 7 route modules).
- Execution of frontend component tests (Vitest + React Testing Library).
- Secure environment secret injection (
/var/lib/jenkins/project_secrets/). - Multi-container rebuild (
docker compose build --no-cache) and zero-downtime container replacement. - Automated post-deployment image cleanup (
docker image prune -af).
Testing & Quality Assurance
The system maintains high code quality through rigorous automated testing:
- Backend Integration Tests: Comprehensive tests covering authentication, JWT guards, 2FA hashing, input validation, and CRUD operations across all route modules (
auth,patients,mlef,mlr,pmr,autopsy,lab). - Frontend Component Tests: Component validation tests checking UI badge statuses, role-based rendering, form input validations, read-only view state protections, and PDF generator output structures.
Links
- Project Repository
- Project Documentation Page
- UI/UX Prototype (Figma)
- Department of Computer Engineering
- Faculty of Engineering, University of Peradeniya
Β© 2026 Team Mythix β Built for academic evaluation under Database Systems module.



