# b4ian0-1980/sage-gere architecture

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

- Interactive diagram: https://gitdiagram.com/b4ian0-1980/sage-gere
- Repository: https://github.com/b4ian0-1980/sage-gere

## Overview

GERE is a municipal health-secretariat system for tracking parliamentary amendments and extraordinary resources from registration through action-plan approval and execution. Staff enter resources and plans, route plans through configurable internal validation and the granting authority, then update item progress and financial positions; DIPLAN and management also use monitoring panels. A separate captação subsystem tracks regular FNS/FES transfers and produces monthly reports. The graph includes documented product stages and sampled service/model layers; several view and reporting connections rely on README descriptions because those implementations were not excerpted.

Main entry points: [`emendas/servicos/fluxo.py`](https://github.com/b4ian0-1980/sage-gere/blob/main/emendas/servicos/fluxo.py) (Plan validation flow), [`emendas/servicos/financeiro.py`](https://github.com/b4ian0-1980/sage-gere/blob/main/emendas/servicos/financeiro.py) (Balance and execution), [`emendas/importacao/carga.py`](https://github.com/b4ian0-1980/sage-gere/blob/main/emendas/importacao/carga.py) (Import to records), [`emendas/views/painel.py`](https://github.com/b4ian0-1980/sage-gere/blob/main/emendas/views/painel.py) (Monitoring panels)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_workflow["Resource workflow"]
  node_resource_ui["Resource screens<br/>[recursos.py]"]
  node_resources[("Resource records<br/>[recurso.py]")]
  node_plan_ui["Plan screens<br/>[planos.py]"]
  node_plans[("Plans and items<br/>[plano.py]")]
  node_approval["Plan validation flow<br/>[fluxo.py]"]
end

subgraph group_finance["Finance and monitoring"]
  node_finance_ui["Finance screens<br/>[financeiro.py]"]
  node_finance_service["Balance and execution<br/>[financeiro.py]"]
  node_financial_records[("Transfers and positions<br/>[financeiro.py]")]
  node_dashboard["Monitoring panels<br/>[painel.py]"]
end

subgraph group_capture["Regular transfers"]
  node_capture_ui["Captação screens<br/>[views.py]"]
  node_capture_records[("Transfer records<br/>[models.py]")]
  node_fns_collector["FNS collection<br/>[coletor_fns.py]"]
  node_fes_collector["FES collection<br/>[coletor_fes.py]"]
  node_capture_report["Monthly capture reports<br/>[relatorio.py]"]
end

subgraph group_support["Shared services"]
  node_permissions["Role permissions<br/>[permissoes.py]"]
  node_alerts["Alerts and notifications<br/>[notificacoes.py]"]
  node_web_scan["Official notice scan<br/>[varredura.py]"]
  node_dou_parser["DOU parsing<br/>[parser_dou.py]"]
  node_spreadsheet["Spreadsheet import<br/>[planilha.py]"]
  node_import_writer["Import to records<br/>[carga.py]"]
end

node_staff(("DIPLAN and staff"))
node_fns["FNS portal"]
node_fes["FES source"]
node_dou["Official gazette"]

node_staff -->|"registers resources"| node_resource_ui
node_resource_ui -.->|"records"| node_resources
node_staff -->|"drafts plans"| node_plan_ui
node_plan_ui -.->|"edits plans"| node_plans
node_staff -->|"submits plans"| node_approval
node_approval -->|"updates status"| node_plans
node_approval -->|"notifies validators"| node_alerts
node_approval -->|"checks authority"| node_permissions
node_staff -->|"reports execution"| node_finance_ui
node_finance_ui -.->|"records positions"| node_finance_service
node_finance_service -->|"writes positions"| node_financial_records
node_finance_service -->|"checks completion"| node_approval
node_dashboard -->|"reads status"| node_finance_service
node_dashboard -->|"reads alerts"| node_alerts
node_staff -->|"monitors resources"| node_dashboard
node_web_scan -->|"parses notices"| node_dou_parser
node_web_scan -.->|"ingests findings"| node_resources
node_dou_parser -.->|"retrieves publications"| node_dou
node_spreadsheet -->|"supplies parsed rows"| node_import_writer
node_import_writer -->|"creates resources"| node_resources
node_import_writer -.->|"creates initial plans"| node_plans
node_staff -->|"monitors transfers"| node_capture_ui
node_fns -->|"provides payments"| node_fns_collector
node_fns_collector -->|"normalizes transfers"| node_capture_records
node_fes -.->|"provides transfers"| node_fes_collector
node_fes_collector -.->|"collects transfer data"| node_capture_records
node_capture_ui -.->|"requests reports"| node_capture_report
node_capture_report -.->|"summarizes transfers"| node_capture_records

click node_resource_ui "https://github.com/b4ian0-1980/sage-gere/blob/main/emendas/views/recursos.py"
click node_resources "https://github.com/b4ian0-1980/sage-gere/blob/main/emendas/models/recurso.py"
click node_plan_ui "https://github.com/b4ian0-1980/sage-gere/blob/main/emendas/views/planos.py"
click node_plans "https://github.com/b4ian0-1980/sage-gere/blob/main/emendas/models/plano.py"
click node_approval "https://github.com/b4ian0-1980/sage-gere/blob/main/emendas/servicos/fluxo.py"
click node_permissions "https://github.com/b4ian0-1980/sage-gere/blob/main/emendas/permissoes.py"
click node_finance_ui "https://github.com/b4ian0-1980/sage-gere/blob/main/emendas/views/financeiro.py"
click node_finance_service "https://github.com/b4ian0-1980/sage-gere/blob/main/emendas/servicos/financeiro.py"
click node_financial_records "https://github.com/b4ian0-1980/sage-gere/blob/main/emendas/models/financeiro.py"
click node_dashboard "https://github.com/b4ian0-1980/sage-gere/blob/main/emendas/views/painel.py"
click node_alerts "https://github.com/b4ian0-1980/sage-gere/blob/main/emendas/servicos/notificacoes.py"
click node_web_scan "https://github.com/b4ian0-1980/sage-gere/blob/main/emendas/servicos/coletor_web/varredura.py"
click node_dou_parser "https://github.com/b4ian0-1980/sage-gere/blob/main/emendas/servicos/coletor_web/parser_dou.py"
click node_spreadsheet "https://github.com/b4ian0-1980/sage-gere/blob/main/emendas/importacao/planilha.py"
click node_import_writer "https://github.com/b4ian0-1980/sage-gere/blob/main/emendas/importacao/carga.py"
click node_capture_ui "https://github.com/b4ian0-1980/sage-gere/blob/main/captacao/views.py"
click node_capture_records "https://github.com/b4ian0-1980/sage-gere/blob/main/captacao/models.py"
click node_fns_collector "https://github.com/b4ian0-1980/sage-gere/blob/main/captacao/servicos/coletor_fns.py"
click node_fes_collector "https://github.com/b4ian0-1980/sage-gere/blob/main/captacao/servicos/coletor_fes.py"
click node_capture_report "https://github.com/b4ian0-1980/sage-gere/blob/main/captacao/servicos/relatorio.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_resource_ui,node_resources,node_plan_ui,node_plans,node_approval toneBlue
class node_finance_ui,node_finance_service,node_financial_records,node_dashboard toneAmber
class node_capture_ui,node_capture_records,node_fns_collector,node_fes_collector,node_capture_report toneMint
class node_permissions,node_alerts,node_web_scan,node_dou_parser,node_spreadsheet,node_import_writer toneRose
class node_staff,node_fns,node_fes,node_dou toneIndigo
```

## Components

### Resource workflow

- [Resource screens](https://github.com/b4ian0-1980/sage-gere/blob/main/emendas/views/recursos.py): `emendas/views/recursos.py`
- [Resource records](https://github.com/b4ian0-1980/sage-gere/blob/main/emendas/models/recurso.py): `emendas/models/recurso.py`
- [Plan screens](https://github.com/b4ian0-1980/sage-gere/blob/main/emendas/views/planos.py): `emendas/views/planos.py`
- [Plans and items](https://github.com/b4ian0-1980/sage-gere/blob/main/emendas/models/plano.py): `emendas/models/plano.py`
- [Plan validation flow](https://github.com/b4ian0-1980/sage-gere/blob/main/emendas/servicos/fluxo.py): `emendas/servicos/fluxo.py`

### Finance and monitoring

- [Finance screens](https://github.com/b4ian0-1980/sage-gere/blob/main/emendas/views/financeiro.py): `emendas/views/financeiro.py`
- [Balance and execution](https://github.com/b4ian0-1980/sage-gere/blob/main/emendas/servicos/financeiro.py): `emendas/servicos/financeiro.py`
- [Transfers and positions](https://github.com/b4ian0-1980/sage-gere/blob/main/emendas/models/financeiro.py): `emendas/models/financeiro.py`
- [Monitoring panels](https://github.com/b4ian0-1980/sage-gere/blob/main/emendas/views/painel.py): `emendas/views/painel.py`

### Regular transfers

- [Captação screens](https://github.com/b4ian0-1980/sage-gere/blob/main/captacao/views.py): `captacao/views.py`
- [Transfer records](https://github.com/b4ian0-1980/sage-gere/blob/main/captacao/models.py): `captacao/models.py`
- [FNS collection](https://github.com/b4ian0-1980/sage-gere/blob/main/captacao/servicos/coletor_fns.py): `captacao/servicos/coletor_fns.py`
- [FES collection](https://github.com/b4ian0-1980/sage-gere/blob/main/captacao/servicos/coletor_fes.py): `captacao/servicos/coletor_fes.py`
- [Monthly capture reports](https://github.com/b4ian0-1980/sage-gere/blob/main/captacao/servicos/relatorio.py): `captacao/servicos/relatorio.py`

### Shared services

- [Role permissions](https://github.com/b4ian0-1980/sage-gere/blob/main/emendas/permissoes.py): `emendas/permissoes.py`
- [Alerts and notifications](https://github.com/b4ian0-1980/sage-gere/blob/main/emendas/servicos/notificacoes.py): `emendas/servicos/notificacoes.py`
- [Official notice scan](https://github.com/b4ian0-1980/sage-gere/blob/main/emendas/servicos/coletor_web/varredura.py): `emendas/servicos/coletor_web/varredura.py`
- [DOU parsing](https://github.com/b4ian0-1980/sage-gere/blob/main/emendas/servicos/coletor_web/parser_dou.py): `emendas/servicos/coletor_web/parser_dou.py`
- [Spreadsheet import](https://github.com/b4ian0-1980/sage-gere/blob/main/emendas/importacao/planilha.py): `emendas/importacao/planilha.py`
- [Import to records](https://github.com/b4ian0-1980/sage-gere/blob/main/emendas/importacao/carga.py): `emendas/importacao/carga.py`

### Other components

- **DIPLAN and staff**
- **FNS portal**
- **FES source**
- **Official gazette**

## Connections

- DIPLAN and staff → Resource screens: registers resources (evidence: `README.md`)
- Resource screens → Resource records: records
- DIPLAN and staff → Plan screens: drafts plans (evidence: `README.md`)
- Plan screens → Plans and items: edits plans
- DIPLAN and staff → Plan validation flow: submits plans (evidence: `README.md`)
- Plan validation flow → Plans and items: updates status (evidence: `emendas/servicos/fluxo.py`)
- Plan validation flow → Alerts and notifications: notifies validators (evidence: `emendas/servicos/fluxo.py`)
- Plan validation flow → Role permissions: checks authority (evidence: `emendas/servicos/fluxo.py`)
- DIPLAN and staff → Finance screens: reports execution (evidence: `README.md`)
- Finance screens → Balance and execution: records positions
- Balance and execution → Transfers and positions: writes positions (evidence: `emendas/servicos/financeiro.py`)
- Balance and execution → Plan validation flow: checks completion (evidence: `emendas/servicos/financeiro.py`)
- Monitoring panels → Balance and execution: reads status (evidence: `emendas/views/painel.py`)
- Monitoring panels → Alerts and notifications: reads alerts (evidence: `emendas/views/painel.py`)
- DIPLAN and staff → Monitoring panels: monitors resources (evidence: `README.md`)
- Official notice scan → DOU parsing: parses notices (evidence: `emendas/servicos/coletor_web/varredura.py`)
- Official notice scan → Resource records: ingests findings
- DOU parsing → Official gazette: retrieves publications
- Spreadsheet import → Import to records: supplies parsed rows (evidence: `emendas/importacao/carga.py`)
- Import to records → Resource records: creates resources (evidence: `emendas/importacao/carga.py`)
- Import to records → Plans and items: creates initial plans
- DIPLAN and staff → Captação screens: monitors transfers (evidence: `README.md`)
- FNS portal → FNS collection: provides payments (evidence: `captacao/servicos/coletor_fns.py`)
- FNS collection → Transfer records: normalizes transfers (evidence: `captacao/servicos/coletor_fns.py`)
- FES source → FES collection: provides transfers
- FES collection → Transfer records: collects transfer data
- Captação screens → Monthly capture reports: requests reports
- Monthly capture reports → Transfer records: summarizes transfers
