How neoastra303/remedium-hms works
1. System shape: a Django modular monolith
Remedium HMS is a single Django project (remedium_hms) composed of many domain apps. Each app owns its own models, migrations, templates, URLs, serializers, and tests, but they all run inside one process and one shared database. The architecture is intentionally modular rather than microservice-based.
2. Shared platform layer lives in core
core provides cross-cutting concerns: RBAC/permissions, dashboard selection, audit-log UI, shared serializer helpers, context processors, and template tags. It also contains management commands that initialize groups and seed role-based demo users, which makes it the foundation for authorization and first-run setup.
3. Patients are the primary domain anchor
The patients app is the central clinical record. Other domains reference patients for appointments, encounters, vitals, prescriptions, invoices, and admissions. The README emphasizes PHI encryption for sensitive patient fields, and the models/migrations show historical tracking, so patient data is treated as a regulated, auditable core entity.
4. Clinical workflow spans multiple apps
- appointments handles scheduling, queueing, and conflict-aware bookings.
- medical_records stores encounters and patient documents.
- care_monitoring captures patient care notes and vital trends.
- laboratory manages lab tests and result entry.
- surgery tracks surgical cases.
These apps form the clinical workflow from intake through treatment and follow-up, with each domain keeping its own CRUD views and APIs while linking back to patients and staff.
5. Operations and revenue are separate but connected
- billing owns invoices, payments, and invoice numbering.
- pharmacy manages prescriptions and dispense workflows.
- inventory tracks stock items and costs.
- hospital manages wards, rooms, services, and occupancy.
- staff manages personnel, shifts, and availability.
These apps support the operational side of the hospital and consume data from the clinical layer to generate charges, allocate resources, and schedule staff.
6. Notifications and integrations are event-driven support layers
notifications stores user notifications and uses signals to generate them. integration stores external integration metadata and API keys, acting as the system’s boundary for third-party connections. pharmacy/openfda_service.py is the clearest external service touchpoint, calling the FDA API for drug-related data.
7. Two delivery surfaces: server-rendered UI and REST API
Every major app includes Django views and HTML templates for the staff-facing UI, plus api_views.py and serializers.py for REST access. The API is versioned under /api/v1/, documented by openapi-schema.yml, and surfaced through Swagger/ReDoc. This means the same business models are exposed through both page-based workflows and programmatic clients.
8. Role-based dashboards are a major navigation boundary
The templates/dashboards folder contains separate experiences for admin, doctor, nurse, pharmacist, receptionist, lab tech, and surgeon roles. Access control is enforced by core.permissions and role groups, so dashboard routing is not just cosmetic—it is the primary presentation boundary between different hospital user types.
9. Data integrity and auditability are built into the model layer
Many apps include historical migrations and soft-delete fields, indicating a strong audit trail approach. simple-history-style historical models and delete markers appear across domains like patients, billing, pharmacy, appointments, and more. This means the system preserves record lineage instead of hard-deleting clinical and financial data.
10. Frontend structure is shared and template-driven
The main UI uses a common templates/base.html, partials for pagination/cards/forms, and app-specific templates for list/detail/form pages. Static assets in static/js and static/css provide shared UI behavior and styling. The design/prototypes directory appears to be mockups/reference material rather than runtime code.
11. Deployment and runtime are conventional but production-oriented
The stack is Django 5.2 on Python 3.13, with SQLite for development and PostgreSQL for production. Containerization is provided via Docker and docker-compose.yml, with gunicorn/Procfile for app serving and nginx.conf for reverse-proxy/static delivery. WhiteNoise and GitHub Actions CI round out the deployment and validation story.
12. Main request flow
A typical request enters through Django routing in remedium_hms/urls.py, hits an app’s HTML view or API view, uses models/serializers/forms to validate and persist data, and may trigger signals or external calls. The response then renders a role-specific dashboard or returns JSON. In diagram terms, the most important boundaries are: browser/API client → Django core/auth → domain app → database, with selected side paths to notifications, billing, and OpenFDA.
Main entry points: urls.py Root routing · patients Patients · staff Staff · templates Shared UI
Components 20
Platform
Shared Django foundation, auth, routing, and presentation plumbing.
- Django app · Single Django monolith running all hospital domains in one process and database.
remedium_hms/settings.py - Root routing · Central URL dispatcher that fans requests into app-specific views and APIs.
remedium_hms/urls.py - Core platform · RBAC, dashboards, audit UI, serializer helpers, context processors, and setup commands.
core - Notifications · User notifications generated from signals and workflow events.
notifications - Integrations · External integration metadata and API keys for third-party connections.
integration
Clinical
Patient-centered care workflow and clinical records.
- Patients · Primary clinical record and anchor entity for downstream workflows.
patients - Appointments · Scheduling, queueing, and conflict-aware booking workflow.
appointments - Medical records · Encounters and patient documents that capture care history.
medical_records - Care monitoring · Care notes and vital trends used for ongoing observation.
care_monitoring - Laboratory · Lab tests and result entry for diagnostic workflows.
laboratory - Surgery · Surgical case tracking and procedure workflow.
surgery
Operations
Revenue, pharmacy, inventory, facilities, and staff operations.
- Billing · Invoices, payments, and invoice numbering.
billing - Pharmacy · Prescriptions and dispense workflow, including external drug lookup.
pharmacy - Inventory · Stock items and cost tracking for operational supplies.
inventory - Hospital ops · Wards, rooms, services, and occupancy management.
hospital - Staff · Personnel, shifts, availability, and user-linked staffing data.
staff - OpenFDA · Drug-data lookup used by pharmacy through an outbound API call.
pharmacy/openfda_service.py
Delivery
Primary user-facing and API delivery surfaces.
- Shared UI · Base templates, dashboards, partials, and auth pages shared across the app.
templates - Static assets · Shared CSS and JavaScript used by the server-rendered UI.
static - REST API · Versioned API exposure documented in the OpenAPI schema.
openapi-schema.yml
Connections 38
- Root routing → Patients: routes · Root URLs dispatch into patient workflows.
- Root routing → Appointments: routes · Root URLs dispatch into scheduling workflows.
- Root routing → Medical records: routes · Root URLs dispatch into record workflows.
- Root routing → Care monitoring: routes · Root URLs dispatch into monitoring workflows.
- Root routing → Laboratory: routes · Root URLs dispatch into lab workflows.
- Root routing → Surgery: routes · Root URLs dispatch into surgical workflows.
- Root routing → Billing: routes · Root URLs dispatch into billing workflows.
- Root routing → Pharmacy: routes · Root URLs dispatch into pharmacy workflows.
- Root routing → Inventory: routes · Root URLs dispatch into inventory workflows.
- Root routing → Hospital ops: routes · Root URLs dispatch into hospital operations workflows.
- Root routing → Staff: routes · Root URLs dispatch into staffing workflows.
- Root routing → Notifications: routes · Root URLs dispatch into notification views.
- Root routing → Integrations: routes · Root URLs dispatch into integration administration.
- Core platform → Shared UI: renders · Core provides shared dashboard and audit templates.
- Core platform → Patients: authz · Core permissions and role groups govern access to patient data.
- Core platform → Staff: roles · Core setup commands seed role-based users and groups.
- Shared UI → Patients: UI · Shared templates frame patient-facing screens.
- Shared UI → Appointments: UI · Shared templates frame scheduling screens.
- Shared UI → Billing: UI · Shared templates frame billing screens.
- Static assets → Shared UI: assets · Static JavaScript and CSS support the shared template UI.
- REST API → Core platform: serializes · API layer relies on shared serializer helpers and auth boundary.
- Patients → Appointments: linked by · Appointments reference patients as the primary clinical subject.
- Patients → Medical records: linked by · Encounters and documents are organized around patients.
- Patients → Care monitoring: linked by · Care notes and vital trends are tracked per patient.
- Patients → Laboratory: linked by · Lab orders and results are associated with patients.
- Patients → Surgery: linked by · Surgical cases are tied back to patients.
- Patients → Billing: charges · Billing records use patient context for invoices and payments.
- Patients → Pharmacy: prescribes · Prescriptions are created in the context of patient care.
- Patients → Hospital ops: admit · Admissions and occupancy connect patients to wards and rooms.
- Patients → Appointments: schedule · Scheduling workflows begin from patient records.
- Staff → Appointments: availability · Staff availability influences appointment booking and queues.
- Staff → Surgery: assigns · Surgeons and support staff are assigned to surgical cases.
- Staff → Hospital ops: operates · Staff manage wards, rooms, and service operations.
- Staff → Billing: administers · Staff roles support billing and operational workflows.
- Billing → Inventory: costs · Operational consumption and supply costs inform revenue work.
- Pharmacy → OpenFDA: calls · Pharmacy reaches out to OpenFDA for drug-related data.
- Notifications → Core platform: signals · Notification generation is driven by application events and shared authorization context.
- Integrations → Pharmacy: boundary · Integration metadata supports external service touchpoints.