# defendi22/sus-brasil architecture

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

- Interactive diagram: https://gitdiagram.com/defendi22/sus-brasil
- Repository: https://github.com/defendi22/sus-brasil

## Overview

SIM is a local mortality-data dashboard, with a companion extractor that downloads API records as CSV. The main workflow is to load a CSV in the browser, filter records, and inspect summary metrics and visual analyses; the extractor is an alternate way to obtain data. README documents the dashboard’s analyses and local-only processing. Some runtime wiring is unsampled, so the graph avoids asserting unshown calls between individual analysis views.

Main entry points: [`app.js`](https://github.com/defendi22/sus-brasil/blob/main/app.js) (Interactive filters), [`SIM_para_excel.py`](https://github.com/defendi22/sus-brasil/blob/main/SIM_para_excel.py) (API extractor), [`index.html`](https://github.com/defendi22/sus-brasil/blob/main/index.html) (Dashboard page), [`style.css`](https://github.com/defendi22/sus-brasil/blob/main/style.css) (Page styling)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_acquisition["Data acquisition"]
  node_extractor["API extractor<br/>[SIM_para_excel.py]"]
end

subgraph group_dashboard["Dashboard workflow"]
  node_csv_load["CSV loading<br/>[app.js]"]
  node_filters["Interactive filters<br/>[app.js]"]
end

subgraph group_analysis["Analysis views"]
  node_metrics["KPIs<br/>[app.js]"]
  node_timeline["Monthly timeline<br/>[app.js]"]
  node_states["State ranking<br/>[app.js]"]
  node_causes["Cause analyses<br/>[app.js]"]
  node_demographics["Demographic charts<br/>[app.js]"]
  node_circumstances["Occurrence and education<br/>[app.js]"]
  node_map["State heat map<br/>[app.js]"]
end

subgraph group_presentation["Page presentation"]
  node_page["Dashboard page<br/>[index.html]"]
  node_styles["Page styling<br/>[style.css]"]
end

node_user(("Analyst"))
node_api{{"Ministry API"}}
node_csv["CSV file"]

node_user -->|"runs extraction"| node_extractor
node_extractor -->|"fetches pages"| node_api
node_extractor -->|"saves CSV"| node_csv
node_user -->|"opens dashboard"| node_page
node_user -->|"loads or drops CSV"| node_csv_load
node_csv_load -->|"offers filters"| node_filters
node_filters -->|"updates analyses"| node_metrics
node_filters -->|"updates analyses"| node_timeline
node_filters -->|"updates analyses"| node_states
node_filters -->|"updates analyses"| node_causes
node_filters -->|"updates analyses"| node_demographics
node_filters -->|"updates analyses"| node_circumstances
node_filters -->|"updates analyses"| node_map
node_page -.->|"uses styles"| node_styles

click node_extractor "https://github.com/defendi22/sus-brasil/blob/main/SIM_para_excel.py"
click node_page "https://github.com/defendi22/sus-brasil/blob/main/index.html"
click node_styles "https://github.com/defendi22/sus-brasil/blob/main/style.css"
click node_csv_load "https://github.com/defendi22/sus-brasil/blob/main/app.js"
click node_filters "https://github.com/defendi22/sus-brasil/blob/main/app.js"
click node_metrics "https://github.com/defendi22/sus-brasil/blob/main/app.js"
click node_timeline "https://github.com/defendi22/sus-brasil/blob/main/app.js"
click node_states "https://github.com/defendi22/sus-brasil/blob/main/app.js"
click node_causes "https://github.com/defendi22/sus-brasil/blob/main/app.js"
click node_demographics "https://github.com/defendi22/sus-brasil/blob/main/app.js"
click node_circumstances "https://github.com/defendi22/sus-brasil/blob/main/app.js"
click node_map "https://github.com/defendi22/sus-brasil/blob/main/app.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_extractor toneBlue
class node_csv_load,node_filters toneAmber
class node_metrics,node_timeline,node_states,node_causes,node_demographics,node_circumstances,node_map,node_api toneMint
class node_page,node_styles toneRose
class node_user,node_csv toneIndigo
```

## Components

### Data acquisition

- [API extractor](https://github.com/defendi22/sus-brasil/blob/main/SIM_para_excel.py): `SIM_para_excel.py`

### Dashboard workflow

- [CSV loading](https://github.com/defendi22/sus-brasil/blob/main/app.js): `app.js`
- [Interactive filters](https://github.com/defendi22/sus-brasil/blob/main/app.js): `app.js`

### Analysis views

- [KPIs](https://github.com/defendi22/sus-brasil/blob/main/app.js): `app.js`
- [Monthly timeline](https://github.com/defendi22/sus-brasil/blob/main/app.js): `app.js`
- [State ranking](https://github.com/defendi22/sus-brasil/blob/main/app.js): `app.js`
- [Cause analyses](https://github.com/defendi22/sus-brasil/blob/main/app.js): `app.js`
- [Demographic charts](https://github.com/defendi22/sus-brasil/blob/main/app.js): `app.js`
- [Occurrence and education](https://github.com/defendi22/sus-brasil/blob/main/app.js): `app.js`
- [State heat map](https://github.com/defendi22/sus-brasil/blob/main/app.js): `app.js`

### Page presentation

- [Dashboard page](https://github.com/defendi22/sus-brasil/blob/main/index.html): `index.html`
- [Page styling](https://github.com/defendi22/sus-brasil/blob/main/style.css): `style.css`

### Other components

- **Analyst**
- **Ministry API**
- **CSV file**

## Connections

- Analyst → API extractor: runs extraction (evidence: `SIM_para_excel.py`)
- API extractor → Ministry API: fetches pages (evidence: `SIM_para_excel.py`)
- API extractor → CSV file: saves CSV (evidence: `SIM_para_excel.py`)
- Analyst → Dashboard page: opens dashboard (evidence: `README.md`)
- Analyst → CSV loading: loads or drops CSV (evidence: `app.js`)
- CSV loading → Interactive filters: offers filters (evidence: `README.md`)
- Interactive filters → KPIs: updates analyses (evidence: `README.md`)
- Interactive filters → Monthly timeline: updates analyses (evidence: `README.md`)
- Interactive filters → State ranking: updates analyses (evidence: `README.md`)
- Interactive filters → Cause analyses: updates analyses (evidence: `README.md`)
- Interactive filters → Demographic charts: updates analyses (evidence: `README.md`)
- Interactive filters → Occurrence and education: updates analyses (evidence: `README.md`)
- Interactive filters → State heat map: updates analyses (evidence: `README.md`)
- Dashboard page → Page styling: uses styles
