# sienta01/simple-emr architecture

> Architecture diagram of the GitHub repository sienta01/simple-emr, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-12-04). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/sienta01/simple-emr
- Repository: https://github.com/sienta01/simple-emr

## Overview

Simple EMR is a role-based clinic record system. Staff sign in, register or find a patient, place visits in a queue, and clinicians record SOAP notes, diagnoses and procedures; patient history, ancillary results and monthly reports extend that workflow. The graph includes the shared model, permission, form and audit layers, plus documented phone-upload and patient-card capabilities. Several views and integrations are unsampled, so their links are included only where the README or source index establishes them.

Main entry points: [`core/models.py`](https://github.com/sienta01/simple-emr/blob/main/core/models.py) (EMR data store), [`core/views/visits.py`](https://github.com/sienta01/simple-emr/blob/main/core/views/visits.py) (SOAP and procedures), [`core/views/patients.py`](https://github.com/sienta01/simple-emr/blob/main/core/views/patients.py) (Patient records), [`core/views/penunjang.py`](https://github.com/sienta01/simple-emr/blob/main/core/views/penunjang.py) (Ancillary results)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Access and Roles"]
  node_auth["Sign-in<br/>[auth.py]"]
  node_permissions["Role permissions<br/>[permissions.py]"]
  node_users["User management<br/>[users.py]"]
end

subgraph group_patients["Patient and Queue"]
  node_patients["Patient records<br/>[patients.py]"]
  node_registration["Visit registration<br/>[visits.py]"]
  node_queue["Queue context<br/>[common.py]"]
  node_card["Patient card and scan<br/>[utils.py]"]
end

subgraph group_clinical["Clinical Records"]
  node_soap["SOAP and procedures<br/>[visits.py]"]
  node_history["Patient history<br/>[patients.py]"]
end

subgraph group_extensions["Results and Reports"]
  node_penunjang["Ancillary results<br/>[penunjang.py]"]
  node_mobile["Phone upload<br/>[mobile.py]"]
  node_reports["DM HT reports<br/>[laporan.py]"]
  node_report_logic["Report calculations<br/>[reports.py]"]
end

subgraph group_shared["Shared Core"]
  node_models[("EMR data store<br/>[models.py]")]
  node_forms["Clinical forms<br/>[forms.py]"]
  node_imaging["Image processing<br/>[imaging.py]"]
  node_audit["Audit trail<br/>[audit.py]"]
  node_medpp["MedPP import<br/>[import_medpp.py]"]
  node_dbf["DBF reader<br/>[dbf.py]"]
  node_icd["ICD-10 loader<br/>[load_icd10.py]"]
end

node_staff(("Clinic staff"))

node_staff -->|"signs in"| node_auth
node_auth -->|"checks access"| node_permissions
node_staff -->|"finds or edits"| node_patients
node_patients -->|"reads and updates"| node_models
node_staff -->|"registers visit"| node_registration
node_registration -->|"creates visit"| node_models
node_registration -->|"builds queue"| node_queue
node_queue -->|"queries visits"| node_models
node_staff -->|"records examination"| node_soap
node_soap -->|"saves clinical data"| node_models
node_soap -->|"validates codes"| node_forms
node_staff -->|"reviews history"| node_history
node_history -->|"reads patient visits"| node_models
node_staff -->|"uploads results"| node_penunjang
node_penunjang -->|"processes files"| node_imaging
node_penunjang -->|"stores result metadata"| node_models
node_staff -->|"uploads by phone"| node_mobile
node_staff -->|"requests report"| node_reports
node_reports -->|"builds report"| node_report_logic
node_report_logic -->|"queries visits"| node_models
node_soap -->|"records save"| node_audit
node_patients -->|"records changes"| node_audit
node_staff -->|"prints or scans"| node_card
node_medpp -->|"reads legacy files"| node_dbf
node_medpp -->|"imports records"| node_models
node_icd -->|"loads code data"| node_models
node_users -.->|"assigns roles"| node_permissions

click node_auth "https://github.com/sienta01/simple-emr/blob/main/core/views/auth.py"
click node_permissions "https://github.com/sienta01/simple-emr/blob/main/core/permissions.py"
click node_users "https://github.com/sienta01/simple-emr/blob/main/core/views/users.py"
click node_patients "https://github.com/sienta01/simple-emr/blob/main/core/views/patients.py"
click node_registration "https://github.com/sienta01/simple-emr/blob/main/core/views/visits.py"
click node_queue "https://github.com/sienta01/simple-emr/blob/main/core/views/common.py"
click node_models "https://github.com/sienta01/simple-emr/blob/main/core/models.py"
click node_forms "https://github.com/sienta01/simple-emr/blob/main/core/forms.py"
click node_soap "https://github.com/sienta01/simple-emr/blob/main/core/views/visits.py"
click node_history "https://github.com/sienta01/simple-emr/blob/main/core/views/patients.py"
click node_penunjang "https://github.com/sienta01/simple-emr/blob/main/core/views/penunjang.py"
click node_imaging "https://github.com/sienta01/simple-emr/blob/main/core/imaging.py"
click node_mobile "https://github.com/sienta01/simple-emr/blob/main/core/views/mobile.py"
click node_reports "https://github.com/sienta01/simple-emr/blob/main/core/views/laporan.py"
click node_report_logic "https://github.com/sienta01/simple-emr/blob/main/core/reports.py"
click node_audit "https://github.com/sienta01/simple-emr/blob/main/core/audit.py"
click node_card "https://github.com/sienta01/simple-emr/blob/main/core/utils.py"
click node_medpp "https://github.com/sienta01/simple-emr/blob/main/core/management/commands/import_medpp.py"
click node_dbf "https://github.com/sienta01/simple-emr/blob/main/core/dbf.py"
click node_icd "https://github.com/sienta01/simple-emr/blob/main/core/management/commands/load_icd10.py"

classDef toneNeutral fill:#f8fafc,stroke:#334155,stroke-width:1.5px,color:#0f172a
classDef toneBlue fill:#dbeafe,stroke:#2563eb,stroke-width:1.5px,color:#172554
classDef toneAmber fill:#fef3c7,stroke:#d97706,stroke-width:1.5px,color:#78350f
classDef toneMint fill:#dcfce7,stroke:#16a34a,stroke-width:1.5px,color:#14532d
classDef toneRose fill:#ffe4e6,stroke:#e11d48,stroke-width:1.5px,color:#881337
classDef toneIndigo fill:#e0e7ff,stroke:#4f46e5,stroke-width:1.5px,color:#312e81
classDef toneTeal fill:#ccfbf1,stroke:#0f766e,stroke-width:1.5px,color:#134e4a
class node_auth,node_permissions,node_users toneBlue
class node_patients,node_registration,node_queue,node_card toneAmber
class node_soap,node_history toneMint
class node_penunjang,node_mobile,node_reports,node_report_logic toneRose
class node_models,node_forms,node_imaging,node_audit,node_medpp,node_dbf,node_icd,node_staff toneIndigo
```

## Components

### Access and Roles

- [Sign-in](https://github.com/sienta01/simple-emr/blob/main/core/views/auth.py): `core/views/auth.py`
- [Role permissions](https://github.com/sienta01/simple-emr/blob/main/core/permissions.py): `core/permissions.py`
- [User management](https://github.com/sienta01/simple-emr/blob/main/core/views/users.py): `core/views/users.py`

### Patient and Queue

- [Patient records](https://github.com/sienta01/simple-emr/blob/main/core/views/patients.py): `core/views/patients.py`
- [Visit registration](https://github.com/sienta01/simple-emr/blob/main/core/views/visits.py): `core/views/visits.py`
- [Queue context](https://github.com/sienta01/simple-emr/blob/main/core/views/common.py): `core/views/common.py`
- [Patient card and scan](https://github.com/sienta01/simple-emr/blob/main/core/utils.py): `core/utils.py`

### Clinical Records

- [SOAP and procedures](https://github.com/sienta01/simple-emr/blob/main/core/views/visits.py): `core/views/visits.py`
- [Patient history](https://github.com/sienta01/simple-emr/blob/main/core/views/patients.py): `core/views/patients.py`

### Results and Reports

- [Ancillary results](https://github.com/sienta01/simple-emr/blob/main/core/views/penunjang.py): `core/views/penunjang.py`
- [Phone upload](https://github.com/sienta01/simple-emr/blob/main/core/views/mobile.py): `core/views/mobile.py`
- [DM HT reports](https://github.com/sienta01/simple-emr/blob/main/core/views/laporan.py): `core/views/laporan.py`
- [Report calculations](https://github.com/sienta01/simple-emr/blob/main/core/reports.py): `core/reports.py`

### Shared Core

- [EMR data store](https://github.com/sienta01/simple-emr/blob/main/core/models.py): `core/models.py`
- [Clinical forms](https://github.com/sienta01/simple-emr/blob/main/core/forms.py): `core/forms.py`
- [Image processing](https://github.com/sienta01/simple-emr/blob/main/core/imaging.py): `core/imaging.py`
- [Audit trail](https://github.com/sienta01/simple-emr/blob/main/core/audit.py): `core/audit.py`
- [MedPP import](https://github.com/sienta01/simple-emr/blob/main/core/management/commands/import_medpp.py): `core/management/commands/import_medpp.py`
- [DBF reader](https://github.com/sienta01/simple-emr/blob/main/core/dbf.py): `core/dbf.py`
- [ICD-10 loader](https://github.com/sienta01/simple-emr/blob/main/core/management/commands/load_icd10.py): `core/management/commands/load_icd10.py`

### Other components

- **Clinic staff**

## Connections

- Clinic staff → Sign-in: signs in
- Sign-in → Role permissions: checks access (evidence: `core/views/auth.py`)
- Clinic staff → Patient records: finds or edits
- Patient records → EMR data store: reads and updates (evidence: `core/views/patients.py`)
- Clinic staff → Visit registration: registers visit
- Visit registration → EMR data store: creates visit (evidence: `core/views/visits.py`)
- Visit registration → Queue context: builds queue (evidence: `core/views/visits.py`)
- Queue context → EMR data store: queries visits (evidence: `core/views/common.py`)
- Clinic staff → SOAP and procedures: records examination
- SOAP and procedures → EMR data store: saves clinical data (evidence: `core/views/visits.py`)
- SOAP and procedures → Clinical forms: validates codes (evidence: `core/views/visits.py`)
- Clinic staff → Patient history: reviews history
- Patient history → EMR data store: reads patient visits (evidence: `core/views/patients.py`)
- Clinic staff → Ancillary results: uploads results
- Ancillary results → Image processing: processes files (evidence: `core/views/penunjang.py`)
- Ancillary results → EMR data store: stores result metadata (evidence: `core/views/penunjang.py`)
- Clinic staff → Phone upload: uploads by phone
- Clinic staff → DM HT reports: requests report
- DM HT reports → Report calculations: builds report (evidence: `core/views/laporan.py`)
- Report calculations → EMR data store: queries visits (evidence: `core/reports.py`)
- SOAP and procedures → Audit trail: records save (evidence: `core/views/visits.py`)
- Patient records → Audit trail: records changes (evidence: `core/views/patients.py`)
- Clinic staff → Patient card and scan: prints or scans
- MedPP import → DBF reader: reads legacy files (evidence: `core/management/commands/import_medpp.py`)
- MedPP import → EMR data store: imports records (evidence: `core/management/commands/import_medpp.py`)
- ICD-10 loader → EMR data store: loads code data (evidence: `core/management/commands/load_icd10.py`)
- User management → Role permissions: assigns roles
