# acrasiajuramento/alert-cia architecture

> Architecture diagram of the GitHub repository acrasiajuramento/alert-cia, 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/acrasiajuramento/alert-cia
- Repository: https://github.com/acrasiajuramento/alert-cia

## Overview

ALERT-CIA is an emergency-response operations application for an MDRRMO command center, with a companion news scraper. The principal workflow runs from incident monitoring through dispatch and field response to Patient Care Report (PCR) handoff, review, and export. Supporting branches provide public information, GIS warnings, analytics, audit history, and ambulance management. Device-saved PCR drafts and queued changes can sync when connectivity returns. The scraper’s run and article-analysis entry points are visible in sampled source; other subsystem wiring is based on README capabilities and the file tree.

Main entry points: [`src/app/App.jsx`](https://github.com/acrasiajuramento/alert-cia/blob/main/src/app/App.jsx) (Application Shell), [`src/app/services/supabase`](https://github.com/acrasiajuramento/alert-cia/tree/main/src/app/services/supabase) (Cloud Data Services), [`src/app/pages/PCRModule.jsx`](https://github.com/acrasiajuramento/alert-cia/blob/main/src/app/pages/PCRModule.jsx) (PCR Workflow), [`src/app/pages`](https://github.com/acrasiajuramento/alert-cia/tree/main/src/app/pages) (Dispatch Workflow)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_operations["Response Operations"]
  node_app["Application Shell<br/>[App.jsx]"]
  node_access["Role Access<br/>[rbac.js]"]
  node_incidents["Incident Monitoring"]
  node_dispatch["Dispatch Workflow"]
  node_ambulance["Ambulance Units"]
  node_pcr["PCR Workflow<br/>[PCRModule.jsx]"]
  node_pcrdocs["PCR Export<br/>[pcrStorage.js]"]
  node_audit["Audit History<br/>[AuditLogs.jsx]"]
end

subgraph group_mapping["Mapping and Public Info"]
  node_maps["GIS Mapping"]
  node_public["Public Views"]
  node_advisories["Public Advisories<br/>[AdvisoryModule.jsx]"]
  node_analytics["Analytics Reports<br/>[Analytics.jsx]"]
end

subgraph group_data["Data and Sync"]
  node_services["Cloud Data Services"]
  node_localdb[("Device Draft Store")]
  node_sync["Offline Sync Engine<br/>[sync-engine.js]"]
  node_connectivity["Connectivity Manager"]
end

subgraph group_scraper["News Scraper"]
  node_scraperui["Scraper Review<br/>[ScraperReview.jsx]"]
  node_scraperapi["Scraper API<br/>[route.js]"]
  node_analysisapi["Article Analysis API<br/>[route.js]"]
  node_scraper["Scraper Runtime<br/>[runScraper.js]"]
end

node_responder(("Operators and Responders"))
node_supabase[("Supabase")]
node_news["News Sources"]

node_responder -->|"uses"| node_app
node_app -->|"checks roles"| node_access
node_app -->|"routes to"| node_incidents
node_app -->|"routes to"| node_dispatch
node_app -->|"routes to"| node_pcr
node_incidents -->|"loads incidents"| node_services
node_dispatch -->|"manages dispatches"| node_services
node_dispatch -->|"manages units"| node_ambulance
node_dispatch -->|"hands off response"| node_pcr
node_pcr -->|"stores and reviews"| node_services
node_pcr -->|"saves drafts"| node_localdb
node_pcr -->|"exports report"| node_pcrdocs
node_services -->|"reads and writes"| node_supabase
node_pcr -->|"queues changes"| node_sync
node_sync -->|"reads and updates"| node_localdb
node_sync -->|"delivers cloud changes"| node_services
node_sync -->|"checks connection"| node_connectivity
node_connectivity -->|"checks health"| node_supabase
node_app -->|"routes to"| node_maps
node_maps -->|"loads map data"| node_services
node_app -->|"routes to"| node_public
node_public -->|"loads public data"| node_services
node_app -->|"routes to"| node_advisories
node_advisories -->|"manages advisories"| node_services
node_app -->|"routes to"| node_analytics
node_analytics -->|"loads metrics"| node_services
node_app -->|"routes to"| node_audit
node_audit -->|"loads audit history"| node_services
node_app -->|"routes to"| node_scraperui
node_scraperui -->|"requests scraper runs"| node_scraperapi
node_scraperapi -->|"runs job"| node_scraper
node_scraper -->|"fetches reports"| node_news
node_scraperui -->|"requests analysis"| node_analysisapi
node_analysisapi -->|"analyzes supplied article"| node_news

click node_app "https://github.com/acrasiajuramento/alert-cia/blob/main/src/app/App.jsx"
click node_access "https://github.com/acrasiajuramento/alert-cia/blob/main/src/app/access/rbac.js"
click node_incidents "https://github.com/acrasiajuramento/alert-cia/tree/main/src/app/pages"
click node_dispatch "https://github.com/acrasiajuramento/alert-cia/tree/main/src/app/pages"
click node_ambulance "https://github.com/acrasiajuramento/alert-cia/blob/main/src/app/components/AmbulanceUnitManager.jsx"
click node_pcr "https://github.com/acrasiajuramento/alert-cia/blob/main/src/app/pages/PCRModule.jsx"
click node_pcrdocs "https://github.com/acrasiajuramento/alert-cia/blob/main/src/app/utils/pcrStorage.js"
click node_maps "https://github.com/acrasiajuramento/alert-cia/tree/main/src/app/components/map"
click node_public "https://github.com/acrasiajuramento/alert-cia/tree/main/src/app/pages/public"
click node_advisories "https://github.com/acrasiajuramento/alert-cia/blob/main/src/app/pages/AdvisoryModule.jsx"
click node_analytics "https://github.com/acrasiajuramento/alert-cia/blob/main/src/app/pages/Analytics.jsx"
click node_audit "https://github.com/acrasiajuramento/alert-cia/blob/main/src/app/pages/AuditLogs.jsx"
click node_services "https://github.com/acrasiajuramento/alert-cia/tree/main/src/app/services/supabase"
click node_localdb "https://github.com/acrasiajuramento/alert-cia/tree/main/src/app/db"
click node_sync "https://github.com/acrasiajuramento/alert-cia/blob/main/src/app/sync/sync-engine.js"
click node_connectivity "https://github.com/acrasiajuramento/alert-cia/blob/main/src/app/network/connection-manager.js"
click node_scraperui "https://github.com/acrasiajuramento/alert-cia/blob/main/src/app/pages/ScraperReview.jsx"
click node_scraperapi "https://github.com/acrasiajuramento/alert-cia/blob/main/alert-cia-scraper/src/app/api/run/route.js"
click node_analysisapi "https://github.com/acrasiajuramento/alert-cia/blob/main/alert-cia-scraper/src/app/api/analyze/route.js"
click node_scraper "https://github.com/acrasiajuramento/alert-cia/blob/main/alert-cia-scraper/src/lib/runScraper.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_app,node_access,node_incidents,node_dispatch,node_ambulance,node_pcr,node_pcrdocs,node_audit toneBlue
class node_maps,node_public,node_advisories,node_analytics,node_supabase toneAmber
class node_services,node_localdb,node_sync,node_connectivity toneMint
class node_scraperui,node_scraperapi,node_analysisapi,node_scraper toneRose
class node_responder,node_news toneIndigo
```

## Components

### Response Operations

- [Application Shell](https://github.com/acrasiajuramento/alert-cia/blob/main/src/app/App.jsx): `src/app/App.jsx`
- [Role Access](https://github.com/acrasiajuramento/alert-cia/blob/main/src/app/access/rbac.js): `src/app/access/rbac.js`
- [Incident Monitoring](https://github.com/acrasiajuramento/alert-cia/tree/main/src/app/pages): `src/app/pages`
- [Dispatch Workflow](https://github.com/acrasiajuramento/alert-cia/tree/main/src/app/pages): `src/app/pages`
- [Ambulance Units](https://github.com/acrasiajuramento/alert-cia/blob/main/src/app/components/AmbulanceUnitManager.jsx): `src/app/components/AmbulanceUnitManager.jsx`
- [PCR Workflow](https://github.com/acrasiajuramento/alert-cia/blob/main/src/app/pages/PCRModule.jsx): `src/app/pages/PCRModule.jsx`
- [PCR Export](https://github.com/acrasiajuramento/alert-cia/blob/main/src/app/utils/pcrStorage.js): `src/app/utils/pcrStorage.js`
- [Audit History](https://github.com/acrasiajuramento/alert-cia/blob/main/src/app/pages/AuditLogs.jsx): `src/app/pages/AuditLogs.jsx`

### Mapping and Public Info

- [GIS Mapping](https://github.com/acrasiajuramento/alert-cia/tree/main/src/app/components/map): `src/app/components/map`
- [Public Views](https://github.com/acrasiajuramento/alert-cia/tree/main/src/app/pages/public): `src/app/pages/public`
- [Public Advisories](https://github.com/acrasiajuramento/alert-cia/blob/main/src/app/pages/AdvisoryModule.jsx): `src/app/pages/AdvisoryModule.jsx`
- [Analytics Reports](https://github.com/acrasiajuramento/alert-cia/blob/main/src/app/pages/Analytics.jsx): `src/app/pages/Analytics.jsx`

### Data and Sync

- [Cloud Data Services](https://github.com/acrasiajuramento/alert-cia/tree/main/src/app/services/supabase): `src/app/services/supabase`
- [Device Draft Store](https://github.com/acrasiajuramento/alert-cia/tree/main/src/app/db): `src/app/db`
- [Offline Sync Engine](https://github.com/acrasiajuramento/alert-cia/blob/main/src/app/sync/sync-engine.js): `src/app/sync/sync-engine.js`
- [Connectivity Manager](https://github.com/acrasiajuramento/alert-cia/blob/main/src/app/network/connection-manager.js): `src/app/network/connection-manager.js`

### News Scraper

- [Scraper Review](https://github.com/acrasiajuramento/alert-cia/blob/main/src/app/pages/ScraperReview.jsx): `src/app/pages/ScraperReview.jsx`
- [Scraper API](https://github.com/acrasiajuramento/alert-cia/blob/main/alert-cia-scraper/src/app/api/run/route.js): `alert-cia-scraper/src/app/api/run/route.js`
- [Article Analysis API](https://github.com/acrasiajuramento/alert-cia/blob/main/alert-cia-scraper/src/app/api/analyze/route.js): `alert-cia-scraper/src/app/api/analyze/route.js`
- [Scraper Runtime](https://github.com/acrasiajuramento/alert-cia/blob/main/alert-cia-scraper/src/lib/runScraper.js): `alert-cia-scraper/src/lib/runScraper.js`

### Other components

- **Operators and Responders**
- **Supabase**
- **News Sources**

## Connections

- Operators and Responders → Application Shell: uses
- Application Shell → Role Access: checks roles
- Application Shell → Incident Monitoring: routes to
- Application Shell → Dispatch Workflow: routes to
- Application Shell → PCR Workflow: routes to
- Incident Monitoring → Cloud Data Services: loads incidents
- Dispatch Workflow → Cloud Data Services: manages dispatches
- Dispatch Workflow → Ambulance Units: manages units
- Dispatch Workflow → PCR Workflow: hands off response
- PCR Workflow → Cloud Data Services: stores and reviews
- PCR Workflow → Device Draft Store: saves drafts
- PCR Workflow → PCR Export: exports report
- Cloud Data Services → Supabase: reads and writes
- PCR Workflow → Offline Sync Engine: queues changes
- Offline Sync Engine → Device Draft Store: reads and updates
- Offline Sync Engine → Cloud Data Services: delivers cloud changes
- Offline Sync Engine → Connectivity Manager: checks connection
- Connectivity Manager → Supabase: checks health
- Application Shell → GIS Mapping: routes to
- GIS Mapping → Cloud Data Services: loads map data
- Application Shell → Public Views: routes to
- Public Views → Cloud Data Services: loads public data
- Application Shell → Public Advisories: routes to
- Public Advisories → Cloud Data Services: manages advisories
- Application Shell → Analytics Reports: routes to
- Analytics Reports → Cloud Data Services: loads metrics
- Application Shell → Audit History: routes to
- Audit History → Cloud Data Services: loads audit history
- Application Shell → Scraper Review: routes to
- Scraper Review → Scraper API: requests scraper runs
- Scraper API → Scraper Runtime: runs job
- Scraper Runtime → News Sources: fetches reports
- Scraper Review → Article Analysis API: requests analysis
- Article Analysis API → News Sources: analyzes supplied article
