# leosousajesus/sistema-denuncias architecture

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

- Interactive diagram: https://gitdiagram.com/leosousajesus/sistema-denuncias
- Repository: https://github.com/leosousajesus/sistema-denuncias

## Overview

EcoAlert is a PHP web application for citizens to report environmental incidents and for staff to manage them. The main journey is report creation with location and optional image, processing and protocol issuance, then public status tracking or map viewing; staff authenticate, review and update or delete reports. The graph includes the documented geolocation integrations and admin workflow. README describes some capabilities whose wiring is not visible in sampled source; those relationships are omitted rather than inferred.

Main entry points: [`includes/db.php`](https://github.com/leosousajesus/sistema-denuncias/blob/main/includes/db.php) (MySQL connection), [`index.php`](https://github.com/leosousajesus/sistema-denuncias/blob/main/index.php) (Landing page), [`admin/painel.php`](https://github.com/leosousajesus/sistema-denuncias/blob/main/admin/painel.php) (Admin dashboard), [`denuncia.php`](https://github.com/leosousajesus/sistema-denuncias/blob/main/denuncia.php) (Report form)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_citizen["Citizen reporting"]
  node_home["Landing page<br/>[index.php]"]
  node_report["Report form<br/>[denuncia.php]"]
  node_geolocation["Location lookup<br/>[denuncia.php]"]
  node_report_handler["Report processor"]
end

subgraph group_public["Public follow-up"]
  node_confirmation["Submission confirmation<br/>[sucesso.php]"]
  node_tracking["Protocol tracking<br/>[status.php]"]
  node_public_map["Incident map<br/>[mapa.php]"]
end

subgraph group_oversight["Staff oversight"]
  node_admin_login["Staff login<br/>[login.php]"]
  node_admin_panel["Admin dashboard<br/>[painel.php]"]
  node_report_detail["Report management<br/>[detalhe.php]"]
  node_admin_logout["Session logout<br/>[logout.php]"]
end

subgraph group_data["Persistence and shared UI"]
  node_database[("Denunciation database")]
  node_db_connection["MySQL connection<br/>[db.php]"]
  node_shared_header["Public header<br/>[header.php]"]
  node_shared_footer["Public footer<br/>[footer.php]"]
end

node_citizen(("Citizen"))
node_osm["OpenStreetMap tiles"]
node_nominatim["Nominatim geocoding"]
node_leaflet["Leaflet maps"]

node_citizen -->|"opens"| node_home
node_home -->|"starts report"| node_report
node_home -->|"opens tracking"| node_tracking
node_home -->|"opens map"| node_public_map
node_report -->|"selects location"| node_geolocation
node_geolocation -.->|"reverse geocodes"| node_nominatim
node_geolocation -->|"renders picker"| node_leaflet
node_leaflet -->|"loads tiles"| node_osm
node_report -.->|"submits form"| node_report_handler
node_report_handler -->|"inserts report"| node_db_connection
node_db_connection -.->|"writes"| node_database
node_report_handler -->|"redirects"| node_confirmation
node_confirmation -->|"links to"| node_tracking
node_tracking -->|"queries protocol"| node_db_connection
node_public_map -->|"queries reports"| node_db_connection
node_public_map -->|"renders markers"| node_leaflet
node_admin_login -.->|"authenticates"| node_db_connection
node_admin_panel -->|"queries reports"| node_db_connection
node_admin_panel -->|"opens details"| node_report_detail
node_report_detail -->|"reads and updates"| node_db_connection
node_admin_panel -->|"links logout"| node_admin_logout
node_admin_logout -.->|"ends session"| node_admin_login
node_home -->|"includes"| node_shared_header
node_home -->|"includes"| node_shared_footer

click node_home "https://github.com/leosousajesus/sistema-denuncias/blob/main/index.php"
click node_report "https://github.com/leosousajesus/sistema-denuncias/blob/main/denuncia.php"
click node_geolocation "https://github.com/leosousajesus/sistema-denuncias/blob/main/denuncia.php"
click node_report_handler "https://github.com/leosousajesus/sistema-denuncias/blob/main/process/salvar_denuncia.php"
click node_confirmation "https://github.com/leosousajesus/sistema-denuncias/blob/main/sucesso.php"
click node_tracking "https://github.com/leosousajesus/sistema-denuncias/blob/main/status.php"
click node_public_map "https://github.com/leosousajesus/sistema-denuncias/blob/main/mapa.php"
click node_admin_login "https://github.com/leosousajesus/sistema-denuncias/blob/main/admin/login.php"
click node_admin_panel "https://github.com/leosousajesus/sistema-denuncias/blob/main/admin/painel.php"
click node_report_detail "https://github.com/leosousajesus/sistema-denuncias/blob/main/admin/detalhe.php"
click node_admin_logout "https://github.com/leosousajesus/sistema-denuncias/blob/main/admin/logout.php"
click node_database "https://github.com/leosousajesus/sistema-denuncias/blob/main/banco/db_sistema_denuncia.sql"
click node_db_connection "https://github.com/leosousajesus/sistema-denuncias/blob/main/includes/db.php"
click node_shared_header "https://github.com/leosousajesus/sistema-denuncias/blob/main/includes/header.php"
click node_shared_footer "https://github.com/leosousajesus/sistema-denuncias/blob/main/includes/footer.php"

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_home,node_report,node_geolocation,node_report_handler toneBlue
class node_confirmation,node_tracking,node_public_map toneAmber
class node_admin_login,node_admin_panel,node_report_detail,node_admin_logout toneMint
class node_database,node_db_connection,node_shared_header,node_shared_footer toneRose
class node_citizen,node_osm,node_nominatim,node_leaflet toneIndigo
```

## Components

### Citizen reporting

- [Landing page](https://github.com/leosousajesus/sistema-denuncias/blob/main/index.php): `index.php`
- [Report form](https://github.com/leosousajesus/sistema-denuncias/blob/main/denuncia.php): `denuncia.php`
- [Location lookup](https://github.com/leosousajesus/sistema-denuncias/blob/main/denuncia.php): `denuncia.php`
- [Report processor](https://github.com/leosousajesus/sistema-denuncias/blob/main/process/salvar_denuncia.php): `process/salvar_denuncia.php`

### Public follow-up

- [Submission confirmation](https://github.com/leosousajesus/sistema-denuncias/blob/main/sucesso.php): `sucesso.php`
- [Protocol tracking](https://github.com/leosousajesus/sistema-denuncias/blob/main/status.php): `status.php`
- [Incident map](https://github.com/leosousajesus/sistema-denuncias/blob/main/mapa.php): `mapa.php`

### Staff oversight

- [Staff login](https://github.com/leosousajesus/sistema-denuncias/blob/main/admin/login.php): `admin/login.php`
- [Admin dashboard](https://github.com/leosousajesus/sistema-denuncias/blob/main/admin/painel.php): `admin/painel.php`
- [Report management](https://github.com/leosousajesus/sistema-denuncias/blob/main/admin/detalhe.php): `admin/detalhe.php`
- [Session logout](https://github.com/leosousajesus/sistema-denuncias/blob/main/admin/logout.php): `admin/logout.php`

### Persistence and shared UI

- [Denunciation database](https://github.com/leosousajesus/sistema-denuncias/blob/main/banco/db_sistema_denuncia.sql): `banco/db_sistema_denuncia.sql`
- [MySQL connection](https://github.com/leosousajesus/sistema-denuncias/blob/main/includes/db.php): `includes/db.php`
- [Public header](https://github.com/leosousajesus/sistema-denuncias/blob/main/includes/header.php): `includes/header.php`
- [Public footer](https://github.com/leosousajesus/sistema-denuncias/blob/main/includes/footer.php): `includes/footer.php`

### Other components

- **Citizen**
- **OpenStreetMap tiles**
- **Nominatim geocoding**
- **Leaflet maps**

## Connections

- Citizen → Landing page: opens (evidence: `index.php`)
- Landing page → Report form: starts report (evidence: `index.php`)
- Landing page → Protocol tracking: opens tracking (evidence: `index.php`)
- Landing page → Incident map: opens map (evidence: `index.php`)
- Report form → Location lookup: selects location (evidence: `denuncia.php`)
- Location lookup → Nominatim geocoding: reverse geocodes (evidence: `README.md`)
- Location lookup → Leaflet maps: renders picker (evidence: `denuncia.php`)
- Leaflet maps → OpenStreetMap tiles: loads tiles
- Report form → Report processor: submits form
- Report processor → MySQL connection: inserts report (evidence: `process/salvar_denuncia.php`)
- MySQL connection → Denunciation database: writes
- Report processor → Submission confirmation: redirects (evidence: `process/salvar_denuncia.php`)
- Submission confirmation → Protocol tracking: links to (evidence: `sucesso.php`)
- Protocol tracking → MySQL connection: queries protocol (evidence: `status.php`)
- Incident map → MySQL connection: queries reports (evidence: `mapa.php`)
- Incident map → Leaflet maps: renders markers (evidence: `mapa.php`)
- Staff login → MySQL connection: authenticates
- Admin dashboard → MySQL connection: queries reports (evidence: `admin/painel.php`)
- Admin dashboard → Report management: opens details (evidence: `admin/detalhe.php`)
- Report management → MySQL connection: reads and updates (evidence: `admin/detalhe.php`)
- Admin dashboard → Session logout: links logout (evidence: `admin/painel.php`)
- Session logout → Staff login: ends session
- Landing page → Public header: includes (evidence: `index.php`)
- Landing page → Public footer: includes (evidence: `index.php`)
