# michaelbacus-lab/dep-data-engineering-open-track architecture

> Architecture diagram of the GitHub repository michaelbacus-lab/dep-data-engineering-open-track, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-26). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/michaelbacus-lab/dep-data-engineering-open-track
- Repository: https://github.com/michaelbacus-lab/dep-data-engineering-open-track

## Overview

This project turns public DPWH flood-control records into cleaned and analysis-ready project data, audit-prioritisation KPIs, and an interactive dashboard. The principal workflow is optional Kaggle ingestion, cleaning, deduplication and regional outlier benchmarking, segmentation/KPI production, then dashboard generation. A separate SQL runner answers business questions from the cleaned table. The sampled scripts and README support these runtime relationships; unsampled notebook and dashboard-deployment internals are not expanded.

Main entry points: [`scripts/analysis/m5_segmentation_kpis.py`](https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/scripts/analysis/m5_segmentation_kpis.py) (Segmentation and KPI analysis), [`scripts/run_pipeline.py`](https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/scripts/run_pipeline.py) (Pipeline orchestrator), [`scripts/build_dashboard.py`](https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/scripts/build_dashboard.py) (Dashboard builder), [`scripts/run_sql_queries.py`](https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/scripts/run_sql_queries.py) (SQL query runner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_pipeline["Data pipeline"]
  node_ingest["Dataset ingestion<br/>[ingest.py]"]
  node_raw["Raw project CSV"]
  node_cleaning["Cleaning and validation<br/>[transform.py]"]
  node_cleaned["Cleaned project CSV"]
  node_benchmark["Deduplication and benchmarking"]
  node_ready["Analysis-ready projects"]
  node_runner["Pipeline orchestrator<br/>[run_pipeline.py]"]
end

subgraph group_analysis["Risk analysis"]
  node_segmentation["Segmentation and KPI analysis"]
  node_kpis["Quarterly KPI tables"]
  node_summary["KPI summary<br/>[m5_kpi_summary.csv]"]
  node_concentration["Province concentration"]
  node_shortlist["Review shortlist"]
  node_segments["Segment tables"]
  node_figures["Analysis figures"]
end

subgraph group_presentation["Dashboard"]
  node_dashboard_builder["Dashboard builder<br/>[build_dashboard.py]"]
  node_dashboard["Interactive review dashboard<br/>[index.html]"]
end

subgraph group_queries["SQL exploration"]
  node_sql_runner["SQL query runner<br/>[run_sql_queries.py]"]
  node_sql_questions["Business questions"]
  node_sqlite[("In-memory query table")]
end

node_analyst(("Auditor or researcher"))
node_kaggle[("Kaggle dataset")]

node_analyst -->|"runs pipeline"| node_runner
node_runner -->|"optionally runs"| node_ingest
node_kaggle -->|"provides dataset"| node_ingest
node_ingest -->|"downloads CSV"| node_raw
node_runner -->|"runs"| node_cleaning
node_raw -->|"reads"| node_cleaning
node_cleaning -->|"writes"| node_cleaned
node_runner -->|"runs"| node_benchmark
node_cleaned -->|"reads"| node_benchmark
node_benchmark -->|"writes"| node_ready
node_runner -->|"runs"| node_segmentation
node_ready -->|"reads"| node_segmentation
node_segmentation -->|"writes"| node_kpis
node_segmentation -->|"writes"| node_summary
node_segmentation -->|"writes"| node_concentration
node_segmentation -->|"writes"| node_shortlist
node_segmentation -->|"writes"| node_segments
node_segmentation -->|"saves charts"| node_figures
node_runner -->|"runs"| node_dashboard_builder
node_dashboard_builder -->|"reads"| node_ready
node_dashboard_builder -->|"reads"| node_kpis
node_dashboard_builder -->|"reads"| node_concentration
node_dashboard_builder -.->|"reads"| node_shortlist
node_dashboard_builder -->|"generates"| node_dashboard
node_analyst -->|"reviews patterns"| node_dashboard
node_analyst -->|"runs queries"| node_sql_runner
node_sql_runner -->|"loads CSV"| node_cleaned
node_sql_runner -->|"loads table"| node_sqlite
node_sql_runner -->|"executes queries"| node_sql_questions
node_sql_runner -->|"prints results"| node_analyst

click node_ingest "https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/scripts/ingest.py"
click node_raw "https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/data/raw/dpwh_flood_control_projects.csv"
click node_cleaning "https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/scripts/transform.py"
click node_cleaned "https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/data/processed/dpwh_flood_control_projects_cleaned.csv"
click node_benchmark "https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/scripts/advanced_transform.py"
click node_ready "https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/data/processed/dpwh_flood_control_analysis_ready.csv"
click node_runner "https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/scripts/run_pipeline.py"
click node_segmentation "https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/scripts/analysis/m5_segmentation_kpis.py"
click node_kpis "https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/data/processed/m5_kpi_quarterly.csv"
click node_summary "https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/data/processed/m5_kpi_summary.csv"
click node_concentration "https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/data/processed/m5_province_concentration.csv"
click node_shortlist "https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/data/processed/m5_review_shortlist.csv"
click node_segments "https://github.com/michaelbacus-lab/dep-data-engineering-open-track/tree/main/data/processed"
click node_figures "https://github.com/michaelbacus-lab/dep-data-engineering-open-track/tree/main/output/figures"
click node_dashboard_builder "https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/scripts/build_dashboard.py"
click node_dashboard "https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/dashboard/index.html"
click node_sql_runner "https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/scripts/run_sql_queries.py"
click node_sql_questions "https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/sql/business_questions.sql"

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_ingest,node_raw,node_cleaning,node_cleaned,node_benchmark,node_ready,node_runner toneBlue
class node_segmentation,node_kpis,node_summary,node_concentration,node_shortlist,node_segments,node_figures,node_kaggle toneAmber
class node_dashboard_builder,node_dashboard toneMint
class node_sql_runner,node_sql_questions,node_sqlite toneRose
class node_analyst toneIndigo
```

## Components

### Data pipeline

- [Dataset ingestion](https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/scripts/ingest.py): `scripts/ingest.py`
- [Raw project CSV](https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/data/raw/dpwh_flood_control_projects.csv): `data/raw/dpwh_flood_control_projects.csv`
- [Cleaning and validation](https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/scripts/transform.py): `scripts/transform.py`
- [Cleaned project CSV](https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/data/processed/dpwh_flood_control_projects_cleaned.csv): `data/processed/dpwh_flood_control_projects_cleaned.csv`
- [Deduplication and benchmarking](https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/scripts/advanced_transform.py): `scripts/advanced_transform.py`
- [Analysis-ready projects](https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/data/processed/dpwh_flood_control_analysis_ready.csv): `data/processed/dpwh_flood_control_analysis_ready.csv`
- [Pipeline orchestrator](https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/scripts/run_pipeline.py): `scripts/run_pipeline.py`

### Risk analysis

- [Segmentation and KPI analysis](https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/scripts/analysis/m5_segmentation_kpis.py): `scripts/analysis/m5_segmentation_kpis.py`
- [Quarterly KPI tables](https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/data/processed/m5_kpi_quarterly.csv): `data/processed/m5_kpi_quarterly.csv`
- [KPI summary](https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/data/processed/m5_kpi_summary.csv): `data/processed/m5_kpi_summary.csv`
- [Province concentration](https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/data/processed/m5_province_concentration.csv): `data/processed/m5_province_concentration.csv`
- [Review shortlist](https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/data/processed/m5_review_shortlist.csv): `data/processed/m5_review_shortlist.csv`
- [Segment tables](https://github.com/michaelbacus-lab/dep-data-engineering-open-track/tree/main/data/processed): `data/processed`
- [Analysis figures](https://github.com/michaelbacus-lab/dep-data-engineering-open-track/tree/main/output/figures): `output/figures`

### Dashboard

- [Dashboard builder](https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/scripts/build_dashboard.py): `scripts/build_dashboard.py`
- [Interactive review dashboard](https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/dashboard/index.html): `dashboard/index.html`

### SQL exploration

- [SQL query runner](https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/scripts/run_sql_queries.py): `scripts/run_sql_queries.py`
- [Business questions](https://github.com/michaelbacus-lab/dep-data-engineering-open-track/blob/main/sql/business_questions.sql): `sql/business_questions.sql`
- **In-memory query table**

### Other components

- **Auditor or researcher**
- **Kaggle dataset**

## Connections

- Auditor or researcher → Pipeline orchestrator: runs pipeline (evidence: `README.md`)
- Pipeline orchestrator → Dataset ingestion: optionally runs (evidence: `scripts/run_pipeline.py`)
- Kaggle dataset → Dataset ingestion: provides dataset (evidence: `scripts/ingest.py`)
- Dataset ingestion → Raw project CSV: downloads CSV (evidence: `scripts/ingest.py`)
- Pipeline orchestrator → Cleaning and validation: runs (evidence: `scripts/run_pipeline.py`)
- Raw project CSV → Cleaning and validation: reads (evidence: `scripts/transform.py`)
- Cleaning and validation → Cleaned project CSV: writes (evidence: `scripts/transform.py`)
- Pipeline orchestrator → Deduplication and benchmarking: runs (evidence: `scripts/run_pipeline.py`)
- Cleaned project CSV → Deduplication and benchmarking: reads (evidence: `scripts/advanced_transform.py`)
- Deduplication and benchmarking → Analysis-ready projects: writes (evidence: `scripts/advanced_transform.py`)
- Pipeline orchestrator → Segmentation and KPI analysis: runs (evidence: `scripts/run_pipeline.py`)
- Analysis-ready projects → Segmentation and KPI analysis: reads (evidence: `scripts/analysis/m5_segmentation_kpis.py`)
- Segmentation and KPI analysis → Quarterly KPI tables: writes (evidence: `scripts/analysis/m5_segmentation_kpis.py`)
- Segmentation and KPI analysis → KPI summary: writes (evidence: `scripts/analysis/m5_segmentation_kpis.py`)
- Segmentation and KPI analysis → Province concentration: writes (evidence: `scripts/analysis/m5_segmentation_kpis.py`)
- Segmentation and KPI analysis → Review shortlist: writes (evidence: `scripts/analysis/m5_segmentation_kpis.py`)
- Segmentation and KPI analysis → Segment tables: writes (evidence: `scripts/analysis/m5_segmentation_kpis.py`)
- Segmentation and KPI analysis → Analysis figures: saves charts (evidence: `scripts/analysis/m5_segmentation_kpis.py`)
- Pipeline orchestrator → Dashboard builder: runs (evidence: `scripts/run_pipeline.py`)
- Dashboard builder → Analysis-ready projects: reads (evidence: `scripts/build_dashboard.py`)
- Dashboard builder → Quarterly KPI tables: reads (evidence: `scripts/build_dashboard.py`)
- Dashboard builder → Province concentration: reads (evidence: `scripts/build_dashboard.py`)
- Dashboard builder → Review shortlist: reads
- Dashboard builder → Interactive review dashboard: generates (evidence: `README.md`)
- Auditor or researcher → Interactive review dashboard: reviews patterns (evidence: `README.md`)
- Auditor or researcher → SQL query runner: runs queries (evidence: `README.md`)
- SQL query runner → Cleaned project CSV: loads CSV (evidence: `scripts/run_sql_queries.py`)
- SQL query runner → In-memory query table: loads table (evidence: `scripts/run_sql_queries.py`)
- SQL query runner → Business questions: executes queries (evidence: `scripts/run_sql_queries.py`)
- SQL query runner → Auditor or researcher: prints results (evidence: `scripts/run_sql_queries.py`)
