# jieisthebest/node_er_bot architecture

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

- Interactive diagram: https://gitdiagram.com/jieisthebest/node_er_bot
- Repository: https://github.com/jieisthebest/node_er_bot

## Overview

Node-ER Bot is an Express-based emergency-room triage and patient-record application. A clinician enters patient details and symptoms; the triage route stores the patient, matches symptom words against triage data, and redirects to diagnosis results. Separate screens support patient listing, editing, and deletion. The README also describes ER-visit alerts and a dark-themed interface. The sampled source shows the route and database flow; template internals and alert styling are not sampled, so those links are documented rather than inferred.

Main entry points: [`server.js`](https://github.com/jieisthebest/node_er_bot/blob/main/server.js) (Express server), [`views`](https://github.com/jieisthebest/node_er_bot/tree/main/views) (EJS views), [`db.js`](https://github.com/jieisthebest/node_er_bot/blob/main/db.js) (Patient database), [`routes/diagnosis.js`](https://github.com/jieisthebest/node_er_bot/blob/main/routes/diagnosis.js) (Diagnosis results)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_app["Web application"]
  node_server["Express server<br/>[server.js]"]
  node_views["EJS views"]
  node_styles["UI styling<br/>[style.css]"]
end

subgraph group_workflow["Triage workflow"]
  node_triage["Symptom intake<br/>[triage.js]"]
  node_diagnosis["Diagnosis results<br/>[diagnosis.js]"]
end

subgraph group_records["Patient records"]
  node_patientlist["Patient listing<br/>[patients.js]"]
  node_patientedit["Patient editing<br/>[update.js]"]
  node_patientdelete["Patient deletion<br/>[delete.js]"]
end

subgraph group_storage["SQLite storage"]
  node_dbaccess["Database access<br/>[db.js]"]
  node_patientdb[("Patient database<br/>[db.js]")]
  node_triagedb[("Triage database<br/>[db.js]")]
end

node_clinician(("Healthcare professional"))

node_clinician -->|"uses"| node_server
node_server -->|"routes requests"| node_triage
node_server -->|"routes requests"| node_diagnosis
node_server -->|"routes requests"| node_patientlist
node_server -->|"routes requests"| node_patientedit
node_server -->|"routes requests"| node_patientdelete
node_server -->|"opens databases"| node_dbaccess
node_server -->|"renders home"| node_views
node_triage -->|"stores patient"| node_patientdb
node_triage -->|"matches symptoms"| node_triagedb
node_triage -->|"redirects to"| node_diagnosis
node_triage -->|"renders intake"| node_views
node_diagnosis -->|"reads patient"| node_patientdb
node_diagnosis -->|"reads symptoms"| node_patientdb
node_diagnosis -->|"fetches diagnoses"| node_triagedb
node_diagnosis -->|"renders results"| node_views
node_patientlist -->|"gets symptom IDs"| node_dbaccess
node_patientlist -->|"reads records"| node_patientdb
node_patientlist -->|"joins symptom data"| node_triagedb
node_patientlist -->|"renders list"| node_views
node_patientedit -->|"reads and updates"| node_patientdb
node_patientedit -->|"renders edit page"| node_views
node_patientdelete -->|"reads and deletes"| node_patientdb
node_patientdelete -->|"renders delete page"| node_views
node_dbaccess -->|"initializes"| node_patientdb
node_dbaccess -->|"initializes"| node_triagedb
node_views -.->|"styled by"| node_styles

click node_server "https://github.com/jieisthebest/node_er_bot/blob/main/server.js"
click node_views "https://github.com/jieisthebest/node_er_bot/tree/main/views"
click node_styles "https://github.com/jieisthebest/node_er_bot/blob/main/public/css/style.css"
click node_triage "https://github.com/jieisthebest/node_er_bot/blob/main/routes/triage.js"
click node_diagnosis "https://github.com/jieisthebest/node_er_bot/blob/main/routes/diagnosis.js"
click node_patientlist "https://github.com/jieisthebest/node_er_bot/blob/main/routes/patients.js"
click node_patientedit "https://github.com/jieisthebest/node_er_bot/blob/main/routes/update.js"
click node_patientdelete "https://github.com/jieisthebest/node_er_bot/blob/main/routes/delete.js"
click node_dbaccess "https://github.com/jieisthebest/node_er_bot/blob/main/db.js"
click node_patientdb "https://github.com/jieisthebest/node_er_bot/blob/main/db.js"
click node_triagedb "https://github.com/jieisthebest/node_er_bot/blob/main/db.js"

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_server,node_views,node_styles toneBlue
class node_triage,node_diagnosis toneAmber
class node_patientlist,node_patientedit,node_patientdelete toneMint
class node_dbaccess,node_patientdb,node_triagedb toneRose
class node_clinician toneIndigo
```

## Components

### Web application

- [Express server](https://github.com/jieisthebest/node_er_bot/blob/main/server.js): `server.js`
- [EJS views](https://github.com/jieisthebest/node_er_bot/tree/main/views): `views`
- [UI styling](https://github.com/jieisthebest/node_er_bot/blob/main/public/css/style.css): `public/css/style.css`

### Triage workflow

- [Symptom intake](https://github.com/jieisthebest/node_er_bot/blob/main/routes/triage.js): `routes/triage.js`
- [Diagnosis results](https://github.com/jieisthebest/node_er_bot/blob/main/routes/diagnosis.js): `routes/diagnosis.js`

### Patient records

- [Patient listing](https://github.com/jieisthebest/node_er_bot/blob/main/routes/patients.js): `routes/patients.js`
- [Patient editing](https://github.com/jieisthebest/node_er_bot/blob/main/routes/update.js): `routes/update.js`
- [Patient deletion](https://github.com/jieisthebest/node_er_bot/blob/main/routes/delete.js): `routes/delete.js`

### SQLite storage

- [Database access](https://github.com/jieisthebest/node_er_bot/blob/main/db.js): `db.js`
- [Patient database](https://github.com/jieisthebest/node_er_bot/blob/main/db.js): `db.js`
- [Triage database](https://github.com/jieisthebest/node_er_bot/blob/main/db.js): `db.js`

### Other components

- **Healthcare professional**

## Connections

- Healthcare professional → Express server: uses (evidence: `README.md`)
- Express server → Symptom intake: routes requests (evidence: `server.js`)
- Express server → Diagnosis results: routes requests (evidence: `server.js`)
- Express server → Patient listing: routes requests (evidence: `server.js`)
- Express server → Patient editing: routes requests (evidence: `server.js`)
- Express server → Patient deletion: routes requests (evidence: `server.js`)
- Express server → Database access: opens databases (evidence: `server.js`)
- Express server → EJS views: renders home (evidence: `server.js`)
- Symptom intake → Patient database: stores patient (evidence: `routes/triage.js`)
- Symptom intake → Triage database: matches symptoms (evidence: `routes/triage.js`)
- Symptom intake → Diagnosis results: redirects to (evidence: `routes/triage.js`)
- Symptom intake → EJS views: renders intake (evidence: `routes/triage.js`)
- Diagnosis results → Patient database: reads patient (evidence: `routes/diagnosis.js`)
- Diagnosis results → Patient database: reads symptoms (evidence: `routes/diagnosis.js`)
- Diagnosis results → Triage database: fetches diagnoses (evidence: `routes/diagnosis.js`)
- Diagnosis results → EJS views: renders results (evidence: `routes/diagnosis.js`)
- Patient listing → Database access: gets symptom IDs (evidence: `routes/patients.js`)
- Patient listing → Patient database: reads records (evidence: `routes/patients.js`)
- Patient listing → Triage database: joins symptom data (evidence: `routes/patients.js`)
- Patient listing → EJS views: renders list (evidence: `routes/patients.js`)
- Patient editing → Patient database: reads and updates (evidence: `routes/update.js`)
- Patient editing → EJS views: renders edit page (evidence: `routes/update.js`)
- Patient deletion → Patient database: reads and deletes (evidence: `routes/delete.js`)
- Patient deletion → EJS views: renders delete page (evidence: `routes/delete.js`)
- Database access → Patient database: initializes (evidence: `db.js`)
- Database access → Triage database: initializes (evidence: `db.js`)
- EJS views → UI styling: styled by (evidence: `README.md`)
