hospital-management/prd_hospital_management_system_v4.md
Marwan Alwali 4ca3f7159a update
2025-09-22 01:37:55 +03:00

8.8 KiB

Product Requirements Document (PRD): Hospital Management System v4

1. Introduction

1.1 Purpose

This PRD documents the current state of the Hospital Management System (HMS) v4, a comprehensive Django-based web application designed to manage hospital operations. The system supports multi-tenant environments, integrates healthcare standards (e.g., ICD-10 codes, SBS billing), and covers key domains such as patient care, administrative functions, financial billing, and facility operations. It facilitates efficient workflows for healthcare providers, administrators, and support staff.

1.2 Scope

The system is modular, with Django apps handling specific functionalities. Core features include patient registration, appointment scheduling, electronic medical records (EMR), inpatient management, laboratory and radiology services, pharmacy, billing, HR, inventory, blood bank, operating theatre, quality assurance, communications, analytics, and facility management. Data generation scripts (e.g., hr_data.py, inpatients_data.py) and compliance documents (e.g., ICD-10 XML files, SBS code lists) indicate support for testing and regulatory adherence.

1.3 Target Users

  • Clinical Staff: Doctors, nurses (EMR, appointments, inpatients, lab/radiology/pharmacy).
  • Administrative Staff: Receptionists, admins (patient profiles, billing, HR, inventory).
  • Management: Executives (analytics, quality, facility management).
  • Support: IT (integrations, core system config).

1.4 Assumptions and Dependencies

  • Built on Django with PostgreSQL/SQLite (evident from db.sqlite3 and migrations).
  • Uses external libraries (e.g., via requirements.txt, uv.lock).
  • Multi-tenant via core.models.Tenant.
  • Compliance with Saudi health standards (SBS V2, ICD-10).

2. System Architecture

2.1 High-Level Overview

  • Framework: Django (MVC pattern) with apps for modularity.
  • Database: Relational (models use Django ORM); supports audit logging (core.models.AuditLogEntry).
  • Frontend: Django templates (e.g., dashboards for HR/inpatients, lists for assets/maintenance).
  • Backend: Views and forms for CRUD operations; API endpoints in most apps (e.g., accounts/api/).
  • Integrations: External systems via integration app (endpoints, webhooks, logs).
  • Security: Two-factor auth, password history (accounts); consents (patients).
  • File Structure: Root-level data scripts, Django project (hospital_management), apps with models/views/templates/migrations.

2.2 Key Technologies

  • Python/Django.
  • Templates: HTML with partials (e.g., bed details, transfer forms).
  • Standards: ICD-10 (emr.models.Icd10), SBS billing (billing).

3. Features

The system implements a wide range of hospital workflows. Below is a breakdown by module.

3.1 Core System (core)

  • Tenant management for multi-hospital support.
  • System configurations, notifications, audit logs.
  • Middleware and context processors for global functionality.

3.2 User Accounts and Authentication (accounts)

  • User sessions, social accounts, two-factor devices.
  • Password history for security compliance.

3.3 Patient Management (patients)

  • Patient profiles with emergency contacts.
  • Insurance info, claims (with documents, status history).
  • Consent templates and forms.
  • Patient notes for documentation.

3.4 Appointments (appointments)

  • Appointment requests and slot availability.
  • Waiting queues and lists with contact logs.
  • Telemedicine sessions.
  • Templates for recurring schedules.

3.5 Electronic Medical Records (EMR) (emr)

  • Encounters linking to patient visits.
  • Vital signs tracking.
  • Problem lists, care plans, clinical notes (with templates).
  • ICD-10 code integration for diagnoses.

3.6 Inpatient Management (inpatients)

  • Wards and bed management (status updates).
  • Admissions, discharge summaries.
  • Patient transfers.
  • Surgery schedules.

UI: Dashboards, ward/bed lists/details, transfer forms/management (from open tabs).

3.7 Laboratory (laboratory)

  • Lab tests, orders, specimens.
  • Results with quality control and reference ranges.

3.8 Radiology (radiology)

  • Imaging studies, series, DICOM images.
  • Reports with templates.
  • Orders for procedures.

3.9 Pharmacy (pharmacy)

  • Medication catalog with interactions.
  • Prescriptions, inventory items, dispense records.
  • Administration tracking.

3.10 Operating Theatre (operating_theatre)

  • Operating rooms and block scheduling.
  • Surgical cases, notes (with templates), equipment usage.

3.11 Blood Bank (blood_bank)

  • Blood groups, donors, components, units.
  • Testing (cross-match, infectious diseases).
  • Requests, issues, transfusions, adverse reactions.
  • Inventory locations and quality control.

3.12 Billing (billing)

  • Medical bills with line items.
  • Insurance claims, payments, status updates.
  • Billing configurations for SBS compliance.

3.13 Human Resources (HR) (hr)

  • Employee profiles, departments.
  • Schedules, assignments, time entries.
  • Performance reviews.
  • Training programs (modules, prerequisites, sessions, records, attendance, assessments, certificates).

UI: HR dashboard (from open tabs).

3.14 Inventory (inventory)

  • Items, stock levels, locations.
  • Purchase orders, suppliers.

3.15 Facility Management (facility_management)

  • Buildings, floors, rooms.
  • Assets (categories), maintenance (requests, schedules, types).
  • Vendors, service contracts, inspections.
  • Energy meters/readings, space reservations.

UI: Asset/maintenance lists (from open tabs).

3.16 Quality Assurance (quality)

  • Quality indicators and measurements.
  • Incident reports, risk assessments.
  • Audit plans/findings.
  • Improvement projects.

3.17 Communications (communications)

  • Messages and recipients.
  • Notification templates, alert rules/instances.
  • Channels and delivery logs.

3.18 Analytics (analytics)

  • Dashboards with widgets.
  • Data sources, reports, executions.
  • Metric definitions and values.

3.19 Integrations (integration)

  • External systems, endpoints, data mappings.
  • Execution logs, webhooks.

4. Data Model

The system uses Django models for relational data. Key entities (from 144+ models):

  • Patients/Encounters: PatientProfile, Encounter, VitalSigns, ProblemList, CarePlan.
  • Clinical Data: ClinicalNote, Icd10, LabResult, ImagingStudy, Prescription, MedicationAdministration.
  • Administrative: Employee, Department, AppointmentRequest, MedicalBill, InsuranceClaim.
  • Operational: Ward, Bed, Admission, Transfer, SurgicalCase, BloodUnit, InventoryItem, Asset, MaintenanceRequest.
  • Support: AuditLogEntry, SystemConfiguration, QualityIndicator, IncidentReport.
  • Relationships: Foreign keys link entities (e.g., Admission to PatientProfile, LabOrder to Encounter). Choices (e.g., TrainingType) and many-to-many (e.g., schedules).

Data integrity via signals (e.g., accounts/signals.py, facility_management/signals.py). Migrations ensure schema evolution.

5. User Interface and Experience

  • Dashboards: Centralized views (e.g., inpatients dashboard, HR dashboard).
  • Lists and Details: Paginated lists (wards, beds, assets, maintenance); detail views with partials (bed details, update forms).
  • Forms: Interactive (e.g., transfer forms, bed status updates).
  • Templates: Modular (e.g., inpatients/templates/inpatients/partials/ for reusable components).
  • Responsive design inferred from Django templates; no explicit JS frameworks noted.

Open tabs indicate focus on inpatient workflows (wards, beds, transfers) and HR/facility management.

6. Non-Functional Requirements

6.1 Security

  • Authentication: Sessions, 2FA, social login.
  • Auditing: Logs for all actions.
  • Consents: Managed forms.

6.2 Performance

  • Analytics for metrics; scalable via Django ORM.
  • Inventory/quality control for real-time tracking.

6.3 Compliance

  • ICD-10 for diagnoses (emr).
  • SBS V2 for billing (billing).
  • Quality indicators for accreditation.

6.4 Testing and Data

  • Test files in apps (e.g., tests.py).
  • Data generators (e.g., patients_data.py) for population.

7. Current Status and Gaps

7.1 Implemented

  • Full CRUD for core entities.
  • Web UI for key modules (inpatients, HR, facility).
  • Backend APIs and integrations ready.

7.2 Potential Gaps

  • No explicit mobile/responsive UI details.
  • Advanced features (e.g., AI analytics) not evident.
  • Full end-to-end testing coverage unknown.
  • Deployment config (e.g., ASGI in hospital_management/asgi.py).

7.3 Next Steps Recommendations

  • Implement user roles/permissions.
  • Add real-time features (e.g., WebSockets for notifications).
  • Integrate with external APIs (e.g., via integration).
  • Conduct security audits and performance testing.

This PRD is based on the codebase analysis as of 9/21/2025. Total models: 144+, indicating a mature, feature-rich system.