# buildabida/infra-project-monitoring architecture

> Architecture diagram of the GitHub repository buildabida/infra-project-monitoring, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-10-13). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/buildabida/infra-project-monitoring
- Repository: https://github.com/buildabida/infra-project-monitoring

## Overview

Infrastructure Project Monitoring is a Databricks batch data pipeline for comparing public infrastructure investment with population and flood exposure. Its principal workflow preserves six approved R2 snapshots in Bronze, transforms and reconciles them through Silver, builds Gold analytical dimensions and facts, then serves analysis through the dashboard and Genie. A separate validation branch records data-quality results; the README says Gold validation is still planned. Silver and Gold relationships are shown at the documented layer level because their notebook implementations were not sampled.

Main entry points: [`notebooks/01_bronze`](https://github.com/buildabida/infra-project-monitoring/tree/main/notebooks/01_bronze) (Bronze tables), [`notebooks/03_gold`](https://github.com/buildabida/infra-project-monitoring/tree/main/notebooks/03_gold) (Gold facts), [`notebooks/04_validation`](https://github.com/buildabida/infra-project-monitoring/tree/main/notebooks/04_validation) (Layer validation), [`notebooks/02_silver/00_config_mappings.ipynb`](https://github.com/buildabida/infra-project-monitoring/blob/main/notebooks/02_silver/00_config_mappings.ipynb) (Mapping configuration)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_bronze["Bronze ingestion"]
  node_coordinator["Batch coordinator<br/>[run_all.py]"]
  node_source_contracts["Source contracts<br/>[config.py]"]
  node_snapshot_loader["Snapshot loader<br/>[bronze.py]"]
  node_bronze_tables[("Bronze tables")]
end

subgraph group_silver["Silver modeling"]
  node_silver_config["Mapping configuration"]
  node_silver_geography["Geography population"]
  node_silver_projects["Project foundation"]
  node_source_reconciliation["Source reconciliation"]
  node_project_region["Project region mapping"]
  node_flood_area["Flood exposure"]
  node_project_flood["Project flood mapping"]
end

subgraph group_gold["Gold analytics"]
  node_gold_dimensions["Gold dimensions"]
  node_gold_facts["Gold facts"]
end

subgraph group_quality["Data validation"]
  node_bronze_validation["Bronze validation"]
  node_pipeline_validation["Layer validation"]
  node_dq_results[("Quality results")]
end

subgraph group_consumption["Analysis access"]
  node_dashboard["Dashboard"]
  node_genie["Genie"]
end

node_sources[("R2 snapshots")]

node_coordinator -->|"runs sources"| node_bronze_tables
node_sources -->|"loads snapshots"| node_bronze_tables
node_source_contracts -->|"configures loading"| node_snapshot_loader
node_bronze_tables -->|"transforms into"| node_silver_config
node_bronze_tables -->|"transforms into"| node_silver_geography
node_bronze_tables -->|"transforms into"| node_silver_projects
node_bronze_tables -->|"reconciles sources"| node_source_reconciliation
node_bronze_tables -->|"maps projects"| node_project_region
node_bronze_tables -->|"calculates exposure"| node_flood_area
node_bronze_tables -->|"classifies projects"| node_project_flood
node_silver_config -->|"models into"| node_gold_dimensions
node_silver_geography -->|"models into"| node_gold_facts
node_silver_projects -->|"models into"| node_gold_facts
node_gold_dimensions -->|"serves analysis"| node_dashboard
node_gold_facts -->|"serves analysis"| node_dashboard
node_gold_dimensions -->|"serves analysis"| node_genie
node_gold_facts -->|"serves analysis"| node_genie
node_bronze_tables -->|"checks quality"| node_bronze_validation
node_bronze_validation -->|"writes results"| node_dq_results
node_bronze_tables -->|"checks quality"| node_pipeline_validation
node_gold_facts -.->|"checks quality"| node_pipeline_validation
node_pipeline_validation -.->|"records results"| node_dq_results

click node_coordinator "https://github.com/buildabida/infra-project-monitoring/blob/main/notebooks/run_all.py"
click node_source_contracts "https://github.com/buildabida/infra-project-monitoring/blob/main/src/config.py"
click node_snapshot_loader "https://github.com/buildabida/infra-project-monitoring/blob/main/src/bronze.py"
click node_bronze_tables "https://github.com/buildabida/infra-project-monitoring/tree/main/notebooks/01_bronze"
click node_silver_config "https://github.com/buildabida/infra-project-monitoring/blob/main/notebooks/02_silver/00_config_mappings.ipynb"
click node_silver_geography "https://github.com/buildabida/infra-project-monitoring/tree/main/notebooks/02_silver"
click node_silver_projects "https://github.com/buildabida/infra-project-monitoring/tree/main/notebooks/02_silver"
click node_source_reconciliation "https://github.com/buildabida/infra-project-monitoring/blob/main/notebooks/02_silver/07_silver_project_source_match.ipynb"
click node_project_region "https://github.com/buildabida/infra-project-monitoring/blob/main/notebooks/02_silver/08_silver_project_region_map.ipynb"
click node_flood_area "https://github.com/buildabida/infra-project-monitoring/blob/main/notebooks/02_silver/08a_silver_mgb_flood_area.ipynb"
click node_project_flood "https://github.com/buildabida/infra-project-monitoring/blob/main/notebooks/02_silver/10_silver_project_flood_map.ipynb"
click node_gold_dimensions "https://github.com/buildabida/infra-project-monitoring/tree/main/notebooks/03_gold"
click node_gold_facts "https://github.com/buildabida/infra-project-monitoring/tree/main/notebooks/03_gold"
click node_bronze_validation "https://github.com/buildabida/infra-project-monitoring/blob/main/notebooks/04_validation/01_validation_bronze.py"
click node_pipeline_validation "https://github.com/buildabida/infra-project-monitoring/tree/main/notebooks/04_validation"
click node_dq_results "https://github.com/buildabida/infra-project-monitoring/tree/main/notebooks/04_validation"
click node_dashboard "https://github.com/buildabida/infra-project-monitoring/tree/main/dashboard"
click node_genie "https://github.com/buildabida/infra-project-monitoring/tree/main/dashboard"

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_coordinator,node_source_contracts,node_snapshot_loader,node_bronze_tables toneBlue
class node_silver_config,node_silver_geography,node_silver_projects,node_source_reconciliation,node_project_region,node_flood_area,node_project_flood,node_sources toneAmber
class node_gold_dimensions,node_gold_facts toneMint
class node_bronze_validation,node_pipeline_validation,node_dq_results toneRose
class node_dashboard,node_genie toneIndigo
```

## Components

### Bronze ingestion

- [Batch coordinator](https://github.com/buildabida/infra-project-monitoring/blob/main/notebooks/run_all.py): `notebooks/run_all.py`
- [Source contracts](https://github.com/buildabida/infra-project-monitoring/blob/main/src/config.py): `src/config.py`
- [Snapshot loader](https://github.com/buildabida/infra-project-monitoring/blob/main/src/bronze.py): `src/bronze.py`
- [Bronze tables](https://github.com/buildabida/infra-project-monitoring/tree/main/notebooks/01_bronze): `notebooks/01_bronze`

### Silver modeling

- [Mapping configuration](https://github.com/buildabida/infra-project-monitoring/blob/main/notebooks/02_silver/00_config_mappings.ipynb): `notebooks/02_silver/00_config_mappings.ipynb`
- [Geography population](https://github.com/buildabida/infra-project-monitoring/tree/main/notebooks/02_silver): `notebooks/02_silver`
- [Project foundation](https://github.com/buildabida/infra-project-monitoring/tree/main/notebooks/02_silver): `notebooks/02_silver`
- [Source reconciliation](https://github.com/buildabida/infra-project-monitoring/blob/main/notebooks/02_silver/07_silver_project_source_match.ipynb): `notebooks/02_silver/07_silver_project_source_match.ipynb`
- [Project region mapping](https://github.com/buildabida/infra-project-monitoring/blob/main/notebooks/02_silver/08_silver_project_region_map.ipynb): `notebooks/02_silver/08_silver_project_region_map.ipynb`
- [Flood exposure](https://github.com/buildabida/infra-project-monitoring/blob/main/notebooks/02_silver/08a_silver_mgb_flood_area.ipynb): `notebooks/02_silver/08a_silver_mgb_flood_area.ipynb`
- [Project flood mapping](https://github.com/buildabida/infra-project-monitoring/blob/main/notebooks/02_silver/10_silver_project_flood_map.ipynb): `notebooks/02_silver/10_silver_project_flood_map.ipynb`

### Gold analytics

- [Gold dimensions](https://github.com/buildabida/infra-project-monitoring/tree/main/notebooks/03_gold): `notebooks/03_gold`
- [Gold facts](https://github.com/buildabida/infra-project-monitoring/tree/main/notebooks/03_gold): `notebooks/03_gold`

### Data validation

- [Bronze validation](https://github.com/buildabida/infra-project-monitoring/blob/main/notebooks/04_validation/01_validation_bronze.py): `notebooks/04_validation/01_validation_bronze.py`
- [Layer validation](https://github.com/buildabida/infra-project-monitoring/tree/main/notebooks/04_validation): `notebooks/04_validation`
- [Quality results](https://github.com/buildabida/infra-project-monitoring/tree/main/notebooks/04_validation): `notebooks/04_validation`

### Analysis access

- [Dashboard](https://github.com/buildabida/infra-project-monitoring/tree/main/dashboard): `dashboard`
- [Genie](https://github.com/buildabida/infra-project-monitoring/tree/main/dashboard): `dashboard`

### Other components

- **R2 snapshots**

## Connections

- Batch coordinator → Bronze tables: runs sources (evidence: `notebooks/run_all.py`)
- R2 snapshots → Bronze tables: loads snapshots (evidence: `README.md`)
- Source contracts → Snapshot loader: configures loading (evidence: `notebooks/01_bronze/01_bronze_dpwh_projects.py`)
- Bronze tables → Mapping configuration: transforms into (evidence: `README.md`)
- Bronze tables → Geography population: transforms into (evidence: `README.md`)
- Bronze tables → Project foundation: transforms into (evidence: `README.md`)
- Bronze tables → Source reconciliation: reconciles sources (evidence: `README.md`)
- Bronze tables → Project region mapping: maps projects (evidence: `README.md`)
- Bronze tables → Flood exposure: calculates exposure (evidence: `README.md`)
- Bronze tables → Project flood mapping: classifies projects (evidence: `README.md`)
- Mapping configuration → Gold dimensions: models into (evidence: `README.md`)
- Geography population → Gold facts: models into (evidence: `README.md`)
- Project foundation → Gold facts: models into (evidence: `README.md`)
- Gold dimensions → Dashboard: serves analysis (evidence: `README.md`)
- Gold facts → Dashboard: serves analysis (evidence: `README.md`)
- Gold dimensions → Genie: serves analysis (evidence: `README.md`)
- Gold facts → Genie: serves analysis (evidence: `README.md`)
- Bronze tables → Bronze validation: checks quality (evidence: `README.md`)
- Bronze validation → Quality results: writes results (evidence: `notebooks/04_validation/01_validation_bronze.py`)
- Bronze tables → Layer validation: checks quality (evidence: `README.md`)
- Gold facts → Layer validation: checks quality
- Layer validation → Quality results: records results
