# kpdata-sci/pokeplan architecture

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

- Interactive diagram: https://gitdiagram.com/kpdata-sci/pokeplan
- Repository: https://github.com/kpdata-sci/pokeplan

## Overview

Pokeplan is a Pokémon API data-engineering project: it lands a static API snapshot, models it in Postgres, tests and serves the results, then exposes them through a dashboard. It also provides an API reference and domain notes, plus an unapplied AWS/Terraform design. The README documents the main pipeline sequence; sampled source confirms the dashboard and reference-generation behavior. AWS details beyond the sampled event publisher are represented at subsystem level because implementation wiring was not inspected.

Main entry points: [`pipeline/run_pipeline.sh`](https://github.com/kpdata-sci/pokeplan/blob/main/pipeline/run_pipeline.sh) (Pipeline runner), [`architecture/terraform/lambdas/check_commit/handler.py`](https://github.com/kpdata-sci/pokeplan/blob/main/architecture/terraform/lambdas/check_commit/handler.py) (Commit checker), [`dashboard/build_dashboard.py`](https://github.com/kpdata-sci/pokeplan/blob/main/dashboard/build_dashboard.py) (Dashboard builder), [`schema/05_load.sql`](https://github.com/kpdata-sci/pokeplan/blob/main/schema/05_load.sql) (Mart loader)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Ingestion"]
  node_pipeline["Pipeline runner<br/>[run_pipeline.sh]"]
  node_csv_lander["CSV lander<br/>[dump_to_csv.py]"]
end

subgraph group_warehouse["Postgres warehouse"]
  node_landing[("Raw landing<br/>[01_raw.sql]")]
  node_reference_tables[("Reference data<br/>[02_reference.sql]")]
  node_staging[("Staging views<br/>[03_staging.sql]")]
  node_marts[("Facts and dimensions<br/>[04_marts.sql]")]
  node_load["Mart loader<br/>[05_load.sql]"]
  node_tests["Data tests<br/>[06_tests.sql]"]
  node_serve[("Serving views<br/>[08_serve.sql]")]
end

subgraph group_products["Data products"]
  node_dashboard_data["Dashboard export query"]
  node_dashboard_builder["Dashboard builder<br/>[build_dashboard.py]"]
  node_dashboard_template["Pokédex dashboard"]
  node_api_catalog["API reference catalog<br/>[build_reference.py]"]
  node_reference_page["Reference page<br/>[build_page.py]"]
  node_domain_notes["Pokémon domain notes"]
  node_schema_page["Schema design page"]
end

subgraph group_aws["AWS design"]
  node_commit_checker["Commit checker<br/>[handler.py]"]
  node_event_bus["Event bus"]
  node_aws_stack["AWS data stack"]
  node_network["Network"]
  node_storage[("Storage")]
  node_compute["Compute"]
  node_governance["Governance"]
end

node_api_data["Static API data"]
node_scheduler(("EventBridge Scheduler"))
node_github_api["GitHub API"]

node_pipeline -->|"clones endpoints"| node_api_data
node_pipeline -->|"lands responses"| node_landing
node_csv_lander -->|"formats raw rows"| node_landing
node_pipeline -->|"calls load"| node_load
node_load -->|"builds marts"| node_marts
node_pipeline -->|"runs tests"| node_tests
node_pipeline -->|"creates views"| node_serve
node_pipeline -->|"exports data"| node_dashboard_data
node_dashboard_builder -->|"reads export"| node_dashboard_data
node_dashboard_builder -->|"fills template"| node_dashboard_template
node_api_catalog -->|"provides catalog"| node_reference_page
node_reference_page -->|"loads notes"| node_domain_notes
node_scheduler -->|"invokes nightly"| node_commit_checker
node_commit_checker -->|"fetches commit"| node_github_api
node_commit_checker -->|"publishes event"| node_event_bus

click node_pipeline "https://github.com/kpdata-sci/pokeplan/blob/main/pipeline/run_pipeline.sh"
click node_landing "https://github.com/kpdata-sci/pokeplan/blob/main/schema/01_raw.sql"
click node_reference_tables "https://github.com/kpdata-sci/pokeplan/blob/main/schema/02_reference.sql"
click node_staging "https://github.com/kpdata-sci/pokeplan/blob/main/schema/03_staging.sql"
click node_marts "https://github.com/kpdata-sci/pokeplan/blob/main/schema/04_marts.sql"
click node_load "https://github.com/kpdata-sci/pokeplan/blob/main/schema/05_load.sql"
click node_tests "https://github.com/kpdata-sci/pokeplan/blob/main/schema/06_tests.sql"
click node_serve "https://github.com/kpdata-sci/pokeplan/blob/main/schema/08_serve.sql"
click node_csv_lander "https://github.com/kpdata-sci/pokeplan/blob/main/schema/tools/dump_to_csv.py"
click node_dashboard_data "https://github.com/kpdata-sci/pokeplan/blob/main/dashboard/export_dashboard.sql"
click node_dashboard_builder "https://github.com/kpdata-sci/pokeplan/blob/main/dashboard/build_dashboard.py"
click node_dashboard_template "https://github.com/kpdata-sci/pokeplan/blob/main/dashboard/dashboard_template.html"
click node_api_catalog "https://github.com/kpdata-sci/pokeplan/blob/main/reference/build_reference.py"
click node_reference_page "https://github.com/kpdata-sci/pokeplan/blob/main/reference/build_page.py"
click node_domain_notes "https://github.com/kpdata-sci/pokeplan/blob/main/domain/pokemon_domain_notes.md"
click node_schema_page "https://github.com/kpdata-sci/pokeplan/blob/main/schema/design_page/build_schema_page.py"
click node_commit_checker "https://github.com/kpdata-sci/pokeplan/blob/main/architecture/terraform/lambdas/check_commit/handler.py"
click node_event_bus "https://github.com/kpdata-sci/pokeplan/tree/main/architecture/terraform/modules/events"
click node_aws_stack "https://github.com/kpdata-sci/pokeplan/tree/main/architecture/terraform"
click node_network "https://github.com/kpdata-sci/pokeplan/tree/main/architecture/terraform/modules/network"
click node_storage "https://github.com/kpdata-sci/pokeplan/tree/main/architecture/terraform/modules/storage"
click node_compute "https://github.com/kpdata-sci/pokeplan/tree/main/architecture/terraform/modules/compute"
click node_governance "https://github.com/kpdata-sci/pokeplan/tree/main/architecture/terraform/modules/governance"

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_pipeline,node_csv_lander toneBlue
class node_landing,node_reference_tables,node_staging,node_marts,node_load,node_tests,node_serve toneAmber
class node_dashboard_data,node_dashboard_builder,node_dashboard_template,node_api_catalog,node_reference_page,node_domain_notes,node_schema_page,node_api_data,node_github_api toneMint
class node_commit_checker,node_event_bus,node_aws_stack,node_network,node_storage,node_compute,node_governance,node_scheduler toneRose
```

## Components

### Ingestion

- [Pipeline runner](https://github.com/kpdata-sci/pokeplan/blob/main/pipeline/run_pipeline.sh): `pipeline/run_pipeline.sh`
- [CSV lander](https://github.com/kpdata-sci/pokeplan/blob/main/schema/tools/dump_to_csv.py): `schema/tools/dump_to_csv.py`

### Postgres warehouse

- [Raw landing](https://github.com/kpdata-sci/pokeplan/blob/main/schema/01_raw.sql): `schema/01_raw.sql`
- [Reference data](https://github.com/kpdata-sci/pokeplan/blob/main/schema/02_reference.sql): `schema/02_reference.sql`
- [Staging views](https://github.com/kpdata-sci/pokeplan/blob/main/schema/03_staging.sql): `schema/03_staging.sql`
- [Facts and dimensions](https://github.com/kpdata-sci/pokeplan/blob/main/schema/04_marts.sql): `schema/04_marts.sql`
- [Mart loader](https://github.com/kpdata-sci/pokeplan/blob/main/schema/05_load.sql): `schema/05_load.sql`
- [Data tests](https://github.com/kpdata-sci/pokeplan/blob/main/schema/06_tests.sql): `schema/06_tests.sql`
- [Serving views](https://github.com/kpdata-sci/pokeplan/blob/main/schema/08_serve.sql): `schema/08_serve.sql`

### Data products

- [Dashboard export query](https://github.com/kpdata-sci/pokeplan/blob/main/dashboard/export_dashboard.sql): `dashboard/export_dashboard.sql`
- [Dashboard builder](https://github.com/kpdata-sci/pokeplan/blob/main/dashboard/build_dashboard.py): `dashboard/build_dashboard.py`
- [Pokédex dashboard](https://github.com/kpdata-sci/pokeplan/blob/main/dashboard/dashboard_template.html): `dashboard/dashboard_template.html`
- [API reference catalog](https://github.com/kpdata-sci/pokeplan/blob/main/reference/build_reference.py): `reference/build_reference.py`
- [Reference page](https://github.com/kpdata-sci/pokeplan/blob/main/reference/build_page.py): `reference/build_page.py`
- [Pokémon domain notes](https://github.com/kpdata-sci/pokeplan/blob/main/domain/pokemon_domain_notes.md): `domain/pokemon_domain_notes.md`
- [Schema design page](https://github.com/kpdata-sci/pokeplan/blob/main/schema/design_page/build_schema_page.py): `schema/design_page/build_schema_page.py`

### AWS design

- [Commit checker](https://github.com/kpdata-sci/pokeplan/blob/main/architecture/terraform/lambdas/check_commit/handler.py): `architecture/terraform/lambdas/check_commit/handler.py`
- [Event bus](https://github.com/kpdata-sci/pokeplan/tree/main/architecture/terraform/modules/events): `architecture/terraform/modules/events`
- [AWS data stack](https://github.com/kpdata-sci/pokeplan/tree/main/architecture/terraform): `architecture/terraform`
- [Network](https://github.com/kpdata-sci/pokeplan/tree/main/architecture/terraform/modules/network): `architecture/terraform/modules/network`
- [Storage](https://github.com/kpdata-sci/pokeplan/tree/main/architecture/terraform/modules/storage): `architecture/terraform/modules/storage`
- [Compute](https://github.com/kpdata-sci/pokeplan/tree/main/architecture/terraform/modules/compute): `architecture/terraform/modules/compute`
- [Governance](https://github.com/kpdata-sci/pokeplan/tree/main/architecture/terraform/modules/governance): `architecture/terraform/modules/governance`

### Other components

- **Static API data**
- **EventBridge Scheduler**
- **GitHub API**

## Connections

- Pipeline runner → Static API data: clones endpoints (evidence: `README.md`)
- Pipeline runner → Raw landing: lands responses (evidence: `README.md`)
- CSV lander → Raw landing: formats raw rows (evidence: `schema/tools/dump_to_csv.py`)
- Pipeline runner → Mart loader: calls load (evidence: `README.md`)
- Mart loader → Facts and dimensions: builds marts (evidence: `README.md`)
- Pipeline runner → Data tests: runs tests (evidence: `README.md`)
- Pipeline runner → Serving views: creates views (evidence: `README.md`)
- Pipeline runner → Dashboard export query: exports data (evidence: `README.md`)
- Dashboard builder → Dashboard export query: reads export (evidence: `dashboard/build_dashboard.py`)
- Dashboard builder → Pokédex dashboard: fills template (evidence: `dashboard/build_dashboard.py`)
- API reference catalog → Reference page: provides catalog (evidence: `reference/build_page.py`)
- Reference page → Pokémon domain notes: loads notes (evidence: `reference/build_page.py`)
- EventBridge Scheduler → Commit checker: invokes nightly (evidence: `architecture/terraform/lambdas/check_commit/handler.py`)
- Commit checker → GitHub API: fetches commit (evidence: `architecture/terraform/lambdas/check_commit/handler.py`)
- Commit checker → Event bus: publishes event (evidence: `architecture/terraform/lambdas/check_commit/handler.py`)
