# cheese-cracker/emrlite architecture

> Architecture diagram of the GitHub repository cheese-cracker/emrlite, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-01). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/cheese-cracker/emrlite
- Repository: https://github.com/cheese-cracker/emrlite

## Overview

EMRLite is a hospital EMR focused on patient management and billing, with staff login and appointment support. The main workflow is staff authentication, patient or appointment selection, choosing billable items, creating a bill, and viewing its history or final details. Patient records, appointments, bill items, and bills are represented in the Django data models. The excerpts show routing, authentication, bill creation, and selected page rendering; other feature links are documented in the README, so their internal wiring is not inferred.

Main entry points: [`main/views.py`](https://github.com/cheese-cracker/emrlite/blob/master/main/views.py) (Request handlers), [`main/models.py`](https://github.com/cheese-cracker/emrlite/blob/master/main/models.py) (EMR data models), [`Central/urls.py`](https://github.com/cheese-cracker/emrlite/blob/master/Central/urls.py) (Root routes), [`main/urls.py`](https://github.com/cheese-cracker/emrlite/blob/master/main/urls.py) (Application routes)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_web["Web workflow"]
  node_root_routes["Root routes<br/>[urls.py]"]
  node_app_routes["Application routes<br/>[urls.py]"]
  node_views["Request handlers<br/>[views.py]"]
  node_login_page["Login page<br/>[login.html]"]
end

subgraph group_clinical["Patient and appointments"]
  node_patient_portal["Patient portal"]
  node_appointments_page["Appointment list<br/>[appointselect.html]"]
  node_clinical_records["Clinical records<br/>[models.py]"]
end

subgraph group_billing["Billing"]
  node_bill_items["Bill items<br/>[models.py]"]
  node_billing_cart["Billing cart<br/>[cart.html]"]
  node_bill_generation["Bill generation<br/>[views.py]"]
  node_bill_history["Bill history<br/>[billlist.html]"]
  node_final_bill["Final bill<br/>[finalbill.html]"]
end

subgraph group_data["Data and administration"]
  node_domain_models[("EMR data models<br/>[models.py]")]
  node_django_auth["Django authentication"]
  node_admin["Admin and import/export<br/>[admin.py]"]
  node_sqlite[("SQLite database")]
end

node_staff(("Hospital staff"))

node_staff -->|"opens system"| node_root_routes
node_root_routes -->|"routes home"| node_views
node_root_routes -->|"includes routes"| node_app_routes
node_app_routes -->|"dispatches requests"| node_views
node_views -->|"authenticates staff"| node_django_auth
node_views -->|"reads and writes"| node_domain_models
node_views -->|"renders login"| node_login_page
node_views -->|"renders cart"| node_billing_cart
node_views -->|"renders bill"| node_final_bill
node_staff -->|"manages patients"| node_patient_portal
node_staff -->|"uses appointments"| node_appointments_page
node_staff -.->|"reviews bills"| node_bill_history
node_views -->|"handles requests"| node_bill_generation
node_bill_generation -->|"creates bill"| node_domain_models
node_domain_models -->|"stores patient and appointment data"| node_clinical_records
node_domain_models -->|"stores billable items"| node_bill_items
node_admin -->|"registers models"| node_domain_models
node_sqlite -.->|"configured for persistence"| node_domain_models
node_staff -->|"selects bill items"| node_billing_cart
node_staff -->|"views generated bill"| node_final_bill

click node_root_routes "https://github.com/cheese-cracker/emrlite/blob/master/Central/urls.py"
click node_app_routes "https://github.com/cheese-cracker/emrlite/blob/master/main/urls.py"
click node_views "https://github.com/cheese-cracker/emrlite/blob/master/main/views.py"
click node_login_page "https://github.com/cheese-cracker/emrlite/blob/master/main/templates/main/login.html"
click node_patient_portal "https://github.com/cheese-cracker/emrlite/blob/master/main/templates/main/patientselector.html"
click node_appointments_page "https://github.com/cheese-cracker/emrlite/blob/master/main/templates/main/appointselect.html"
click node_clinical_records "https://github.com/cheese-cracker/emrlite/blob/master/main/models.py"
click node_bill_items "https://github.com/cheese-cracker/emrlite/blob/master/main/models.py"
click node_billing_cart "https://github.com/cheese-cracker/emrlite/blob/master/main/templates/main/cart.html"
click node_bill_generation "https://github.com/cheese-cracker/emrlite/blob/master/main/views.py"
click node_bill_history "https://github.com/cheese-cracker/emrlite/blob/master/main/templates/main/billlist.html"
click node_final_bill "https://github.com/cheese-cracker/emrlite/blob/master/main/templates/main/finalbill.html"
click node_domain_models "https://github.com/cheese-cracker/emrlite/blob/master/main/models.py"
click node_admin "https://github.com/cheese-cracker/emrlite/blob/master/main/admin.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_root_routes,node_app_routes,node_views,node_login_page toneBlue
class node_patient_portal,node_appointments_page,node_clinical_records toneAmber
class node_bill_items,node_billing_cart,node_bill_generation,node_bill_history,node_final_bill toneMint
class node_domain_models,node_django_auth,node_admin,node_sqlite toneRose
class node_staff toneIndigo
```

## Components

### Web workflow

- [Root routes](https://github.com/cheese-cracker/emrlite/blob/master/Central/urls.py): `Central/urls.py`
- [Application routes](https://github.com/cheese-cracker/emrlite/blob/master/main/urls.py): `main/urls.py`
- [Request handlers](https://github.com/cheese-cracker/emrlite/blob/master/main/views.py): `main/views.py`
- [Login page](https://github.com/cheese-cracker/emrlite/blob/master/main/templates/main/login.html): `main/templates/main/login.html`

### Patient and appointments

- [Patient portal](https://github.com/cheese-cracker/emrlite/blob/master/main/templates/main/patientselector.html): `main/templates/main/patientselector.html`
- [Appointment list](https://github.com/cheese-cracker/emrlite/blob/master/main/templates/main/appointselect.html): `main/templates/main/appointselect.html`
- [Clinical records](https://github.com/cheese-cracker/emrlite/blob/master/main/models.py): `main/models.py`

### Billing

- [Bill items](https://github.com/cheese-cracker/emrlite/blob/master/main/models.py): `main/models.py`
- [Billing cart](https://github.com/cheese-cracker/emrlite/blob/master/main/templates/main/cart.html): `main/templates/main/cart.html`
- [Bill generation](https://github.com/cheese-cracker/emrlite/blob/master/main/views.py): `main/views.py`
- [Bill history](https://github.com/cheese-cracker/emrlite/blob/master/main/templates/main/billlist.html): `main/templates/main/billlist.html`
- [Final bill](https://github.com/cheese-cracker/emrlite/blob/master/main/templates/main/finalbill.html): `main/templates/main/finalbill.html`

### Data and administration

- [EMR data models](https://github.com/cheese-cracker/emrlite/blob/master/main/models.py): `main/models.py`
- **Django authentication**
- [Admin and import/export](https://github.com/cheese-cracker/emrlite/blob/master/main/admin.py): `main/admin.py`
- **SQLite database**

### Other components

- **Hospital staff**

## Connections

- Hospital staff → Root routes: opens system (evidence: `README.md`)
- Root routes → Request handlers: routes home (evidence: `Central/urls.py`)
- Root routes → Application routes: includes routes (evidence: `Central/urls.py`)
- Application routes → Request handlers: dispatches requests (evidence: `main/urls.py`)
- Request handlers → Django authentication: authenticates staff (evidence: `main/views.py`)
- Request handlers → EMR data models: reads and writes (evidence: `main/views.py`)
- Request handlers → Login page: renders login (evidence: `main/views.py`)
- Request handlers → Billing cart: renders cart (evidence: `main/views.py`)
- Request handlers → Final bill: renders bill (evidence: `main/views.py`)
- Hospital staff → Patient portal: manages patients (evidence: `README.md`)
- Hospital staff → Appointment list: uses appointments (evidence: `README.md`)
- Hospital staff → Bill history: reviews bills
- Request handlers → Bill generation: handles requests (evidence: `main/urls.py`)
- Bill generation → EMR data models: creates bill (evidence: `main/views.py`)
- EMR data models → Clinical records: stores patient and appointment data (evidence: `main/models.py`)
- EMR data models → Bill items: stores billable items (evidence: `main/models.py`)
- Admin and import/export → EMR data models: registers models (evidence: `main/admin.py`)
- SQLite database → EMR data models: configured for persistence
- Hospital staff → Billing cart: selects bill items (evidence: `README.md`)
- Hospital staff → Final bill: views generated bill (evidence: `README.md`)
