# kavicente/nowalert architecture

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

- Interactive diagram: https://gitdiagram.com/kavicente/nowalert
- Repository: https://github.com/kavicente/nowalert

## Overview

AlertNow is a multi-agency emergency alert and response system: users submit incident alerts, the server routes them to agency dashboards in real time, agencies record responses, and dashboards provide incident analytics and prediction outputs. The excerpts show alert handling, Socket.IO dispatch, response persistence, and some chart/report queries; unsampled routes and model-loading details limit how precisely other workflow links can be drawn.

Main entry points: [`database/users_web.db`](https://github.com/kavicente/nowalert/blob/main/database/users_web.db) (Application database), [`static/js/analytics.js`](https://github.com/kavicente/nowalert/blob/main/static/js/analytics.js) (Analytics client), [`AlertNow.py`](https://github.com/kavicente/nowalert/blob/main/AlertNow.py) (Alert server), [`submission.py`](https://github.com/kavicente/nowalert/blob/main/submission.py) (Agency responses)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_access["Accounts and Access"]
  node_login["Agency login<br/>[AgencyIn.py]"]
  node_account["Account registration<br/>[AgencyUp.py]"]
  node_signup["Public signup<br/>[SignUpPage.py]"]
  node_reset["Password reset<br/>[PassReset.py]"]
end

subgraph group_response["Alerts and Response"]
  node_alertserver["Alert server<br/>[AlertNow.py]"]
  node_responsehandlers["Agency responses<br/>[submission.py]"]
  node_liveclient["Live alert client<br/>[dashboard.js]"]
end

subgraph group_insight["Analytics and Prediction"]
  node_alertdata["Incident datasets"]
  node_modelcode["Prediction code<br/>[models.py]"]
  node_roadmodel["Road prediction code<br/>[road_models.py]"]
  node_modelassets["Trained models"]
  node_chartmodules["Role chart endpoints<br/>[BarangayCharts.py]"]
  node_healthcharts["Health charts<br/>[HealthCharts.py]"]
  node_hospitalcharts["Hospital charts<br/>[HospitalCharts.py]"]
  node_dilg["DILG reports<br/>[DILGDashboard.py]"]
  node_chartclient["Analytics client<br/>[analytics.js]"]
end

subgraph group_state["Application State"]
  node_store[("Application database<br/>[users_web.db]")]
end

node_public(("Alert submitters"))
node_agencyusers(("Agency users"))
node_browser(("Web dashboards"))

node_agencyusers -->|"signs in"| node_login
node_login -->|"checks accounts"| node_store
node_agencyusers -->|"registers"| node_account
node_account -->|"stores account"| node_store
node_public -->|"creates account"| node_signup
node_signup -->|"stores account"| node_store
node_public -->|"requests reset"| node_reset
node_reset -->|"updates credentials"| node_store
node_public -->|"submits alert"| node_alertserver
node_alertserver -->|"writes incident"| node_store
node_alertserver -->|"broadcasts alerts"| node_liveclient
node_liveclient -->|"updates dashboard"| node_browser
node_agencyusers -->|"submits response"| node_responsehandlers
node_responsehandlers -->|"saves response"| node_store
node_responsehandlers -->|"emits updates"| node_liveclient
node_alertdata -.->|"provides training data"| node_modelcode
node_modelassets -.->|"supplies models"| node_modelcode
node_modelassets -.->|"supplies forecasts"| node_roadmodel
node_chartmodules -->|"queries incidents"| node_store
node_healthcharts -->|"queries incidents"| node_store
node_hospitalcharts -->|"queries responses"| node_store
node_dilg -->|"queries reports"| node_store
node_browser -->|"views analytics"| node_chartclient
node_chartclient -->|"requests charts"| node_chartmodules
node_chartclient -->|"requests charts"| node_healthcharts
node_chartclient -->|"requests charts"| node_hospitalcharts

click node_login "https://github.com/kavicente/nowalert/blob/main/AgencyIn.py"
click node_account "https://github.com/kavicente/nowalert/blob/main/AgencyUp.py"
click node_signup "https://github.com/kavicente/nowalert/blob/main/SignUpPage.py"
click node_reset "https://github.com/kavicente/nowalert/blob/main/PassReset.py"
click node_alertserver "https://github.com/kavicente/nowalert/blob/main/AlertNow.py"
click node_responsehandlers "https://github.com/kavicente/nowalert/blob/main/submission.py"
click node_liveclient "https://github.com/kavicente/nowalert/blob/main/static/js/dashboard.js"
click node_alertdata "https://github.com/kavicente/nowalert/tree/main/dataset"
click node_modelcode "https://github.com/kavicente/nowalert/blob/main/models.py"
click node_roadmodel "https://github.com/kavicente/nowalert/blob/main/road_models.py"
click node_modelassets "https://github.com/kavicente/nowalert/tree/main/training"
click node_chartmodules "https://github.com/kavicente/nowalert/blob/main/BarangayCharts.py"
click node_healthcharts "https://github.com/kavicente/nowalert/blob/main/HealthCharts.py"
click node_hospitalcharts "https://github.com/kavicente/nowalert/blob/main/HospitalCharts.py"
click node_dilg "https://github.com/kavicente/nowalert/blob/main/DILGDashboard.py"
click node_chartclient "https://github.com/kavicente/nowalert/blob/main/static/js/analytics.js"
click node_store "https://github.com/kavicente/nowalert/blob/main/database/users_web.db"

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_login,node_account,node_signup,node_reset,node_agencyusers toneBlue
class node_alertserver,node_responsehandlers,node_liveclient toneAmber
class node_alertdata,node_modelcode,node_roadmodel,node_modelassets,node_chartmodules,node_healthcharts,node_hospitalcharts,node_dilg,node_chartclient toneMint
class node_store toneRose
class node_public,node_browser toneIndigo
```

## Components

### Accounts and Access

- [Agency login](https://github.com/kavicente/nowalert/blob/main/AgencyIn.py): `AgencyIn.py`
- [Account registration](https://github.com/kavicente/nowalert/blob/main/AgencyUp.py): `AgencyUp.py`
- [Public signup](https://github.com/kavicente/nowalert/blob/main/SignUpPage.py): `SignUpPage.py`
- [Password reset](https://github.com/kavicente/nowalert/blob/main/PassReset.py): `PassReset.py`

### Alerts and Response

- [Alert server](https://github.com/kavicente/nowalert/blob/main/AlertNow.py): `AlertNow.py`
- [Agency responses](https://github.com/kavicente/nowalert/blob/main/submission.py): `submission.py`
- [Live alert client](https://github.com/kavicente/nowalert/blob/main/static/js/dashboard.js): `static/js/dashboard.js`

### Analytics and Prediction

- [Incident datasets](https://github.com/kavicente/nowalert/tree/main/dataset): `dataset`
- [Prediction code](https://github.com/kavicente/nowalert/blob/main/models.py): `models.py`
- [Road prediction code](https://github.com/kavicente/nowalert/blob/main/road_models.py): `road_models.py`
- [Trained models](https://github.com/kavicente/nowalert/tree/main/training): `training`
- [Role chart endpoints](https://github.com/kavicente/nowalert/blob/main/BarangayCharts.py): `BarangayCharts.py`
- [Health charts](https://github.com/kavicente/nowalert/blob/main/HealthCharts.py): `HealthCharts.py`
- [Hospital charts](https://github.com/kavicente/nowalert/blob/main/HospitalCharts.py): `HospitalCharts.py`
- [DILG reports](https://github.com/kavicente/nowalert/blob/main/DILGDashboard.py): `DILGDashboard.py`
- [Analytics client](https://github.com/kavicente/nowalert/blob/main/static/js/analytics.js): `static/js/analytics.js`

### Application State

- [Application database](https://github.com/kavicente/nowalert/blob/main/database/users_web.db): `database/users_web.db`

### Other components

- **Alert submitters**
- **Agency users**
- **Web dashboards**

## Connections

- Agency users → Agency login: signs in
- Agency login → Application database: checks accounts
- Agency users → Account registration: registers
- Account registration → Application database: stores account
- Alert submitters → Public signup: creates account
- Public signup → Application database: stores account
- Alert submitters → Password reset: requests reset
- Password reset → Application database: updates credentials
- Alert submitters → Alert server: submits alert
- Alert server → Application database: writes incident
- Alert server → Live alert client: broadcasts alerts
- Live alert client → Web dashboards: updates dashboard
- Agency users → Agency responses: submits response
- Agency responses → Application database: saves response
- Agency responses → Live alert client: emits updates
- Incident datasets → Prediction code: provides training data
- Trained models → Prediction code: supplies models
- Trained models → Road prediction code: supplies forecasts
- Role chart endpoints → Application database: queries incidents
- Health charts → Application database: queries incidents
- Hospital charts → Application database: queries responses
- DILG reports → Application database: queries reports
- Web dashboards → Analytics client: views analytics
- Analytics client → Role chart endpoints: requests charts
- Analytics client → Health charts: requests charts
- Analytics client → Hospital charts: requests charts
