# asadsoomr0/boston-311-pipeline architecture

> Architecture diagram of the GitHub repository asadsoomr0/boston-311-pipeline, 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/asadsoomr0/boston-311-pipeline
- Repository: https://github.com/asadsoomr0/boston-311-pipeline

## Overview

Boston 311 Service Request Map combines a daily two-feed ingestion pipeline with a static, browser-side map. The workflow fetches both CKAN resources, normalizes and resolves cases, upserts them to PostgreSQL, then precomputes JSON for neighborhood rates, response times, metadata and recent-case drill-down. The frontend loads those artifacts and supports category/status filters, neighborhood exploration, response-time views and case pins. README documents automatic daily updates and an optional local Airflow wrapper; workflow orchestration details are not otherwise mapped. Frontend runtime connections are limited to the sampled excerpts.

Main entry points: [`pipeline/run.py`](https://github.com/asadsoomr0/boston-311-pipeline/blob/main/pipeline/run.py) (Pipeline runner), [`pipeline/build.py`](https://github.com/asadsoomr0/boston-311-pipeline/blob/main/pipeline/build.py) (Static data build), [`pipeline/load.py`](https://github.com/asadsoomr0/boston-311-pipeline/blob/main/pipeline/load.py) (Schema and upserts), [`frontend/app.js`](https://github.com/asadsoomr0/boston-311-pipeline/blob/main/frontend/app.js) (Map and case views)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingestion["Ingestion pipeline"]
  node_extract["Fetch 311 feeds<br/>[extract.py]"]
  node_transform["Normalize cases<br/>[transform.py]"]
  node_resolver["Resolve neighborhoods<br/>[transform.py]"]
  node_runner["Pipeline runner<br/>[run.py]"]
  node_config["Pipeline settings<br/>[config.py]"]
end

subgraph group_warehouse["Warehouse and build"]
  node_categories["Topic categories"]
  node_loader["Schema and upserts<br/>[load.py]"]
  node_postgres[("Postgres warehouse")]
  node_builder["Static data build<br/>[build.py]"]
  node_population["Neighborhood population seed<br/>[seed.py]"]
end

subgraph group_site["Interactive map"]
  node_jsondata["Map JSON data"]
  node_frontend["Map and case views<br/>[app.js]"]
  node_neighborhoods["Neighborhood geometry"]
  node_mapconfig["Map configuration<br/>[config.js]"]
end

subgraph group_orchestration["Scheduling"]
  node_airflow["Airflow DAG<br/>[update_311_data.py]"]
end

node_city(("Analyze Boston CKAN"))
node_visitor(("Map visitor"))
node_basemap["Basemap tiles"]

node_runner -->|"fetches feeds"| node_extract
node_extract -->|"queries"| node_city
node_runner -->|"normalizes records"| node_transform
node_runner -->|"resolves neighborhoods"| node_resolver
node_resolver -.->|"reads geometry"| node_neighborhoods
node_runner -->|"upserts cases"| node_loader
node_loader -->|"writes cases"| node_postgres
node_loader -->|"reads mappings"| node_categories
node_loader -->|"syncs mappings"| node_postgres
node_runner -->|"builds site data"| node_builder
node_builder -->|"queries warehouse"| node_postgres
node_builder -->|"reads topic mappings"| node_loader
node_builder -->|"cleans topics"| node_transform
node_builder -->|"writes JSON"| node_jsondata
node_frontend -.->|"loads data"| node_jsondata
node_frontend -.->|"renders boundaries"| node_neighborhoods
node_visitor -->|"filters and explores"| node_frontend
node_frontend -->|"loads tiles"| node_basemap
node_frontend -.->|"uses settings"| node_mapconfig
node_airflow -->|"runs ingestion"| node_runner
node_airflow -->|"runs build"| node_builder
node_airflow -->|"prepares warehouse"| node_loader
node_population -->|"seeds populations"| node_postgres

click node_extract "https://github.com/asadsoomr0/boston-311-pipeline/blob/main/pipeline/extract.py"
click node_transform "https://github.com/asadsoomr0/boston-311-pipeline/blob/main/pipeline/transform.py"
click node_resolver "https://github.com/asadsoomr0/boston-311-pipeline/blob/main/pipeline/transform.py"
click node_runner "https://github.com/asadsoomr0/boston-311-pipeline/blob/main/pipeline/run.py"
click node_config "https://github.com/asadsoomr0/boston-311-pipeline/blob/main/pipeline/config.py"
click node_categories "https://github.com/asadsoomr0/boston-311-pipeline/blob/main/pipeline/topic_categories.csv"
click node_loader "https://github.com/asadsoomr0/boston-311-pipeline/blob/main/pipeline/load.py"
click node_builder "https://github.com/asadsoomr0/boston-311-pipeline/blob/main/pipeline/build.py"
click node_frontend "https://github.com/asadsoomr0/boston-311-pipeline/blob/main/frontend/app.js"
click node_neighborhoods "https://github.com/asadsoomr0/boston-311-pipeline/blob/main/frontend/boston_neighborhoods.json"
click node_mapconfig "https://github.com/asadsoomr0/boston-311-pipeline/blob/main/frontend/config.js"
click node_airflow "https://github.com/asadsoomr0/boston-311-pipeline/blob/main/dags/update_311_data.py"
click node_population "https://github.com/asadsoomr0/boston-311-pipeline/blob/main/pipeline/seed.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_extract,node_transform,node_resolver,node_runner,node_config toneBlue
class node_categories,node_loader,node_postgres,node_builder,node_population toneAmber
class node_jsondata,node_frontend,node_neighborhoods,node_mapconfig toneMint
class node_airflow toneRose
class node_city,node_visitor,node_basemap toneIndigo
```

## Components

### Ingestion pipeline

- [Fetch 311 feeds](https://github.com/asadsoomr0/boston-311-pipeline/blob/main/pipeline/extract.py): `pipeline/extract.py`
- [Normalize cases](https://github.com/asadsoomr0/boston-311-pipeline/blob/main/pipeline/transform.py): `pipeline/transform.py`
- [Resolve neighborhoods](https://github.com/asadsoomr0/boston-311-pipeline/blob/main/pipeline/transform.py): `pipeline/transform.py`
- [Pipeline runner](https://github.com/asadsoomr0/boston-311-pipeline/blob/main/pipeline/run.py): `pipeline/run.py`
- [Pipeline settings](https://github.com/asadsoomr0/boston-311-pipeline/blob/main/pipeline/config.py): `pipeline/config.py`

### Warehouse and build

- [Topic categories](https://github.com/asadsoomr0/boston-311-pipeline/blob/main/pipeline/topic_categories.csv): `pipeline/topic_categories.csv`
- [Schema and upserts](https://github.com/asadsoomr0/boston-311-pipeline/blob/main/pipeline/load.py): `pipeline/load.py`
- **Postgres warehouse**
- [Static data build](https://github.com/asadsoomr0/boston-311-pipeline/blob/main/pipeline/build.py): `pipeline/build.py`
- [Neighborhood population seed](https://github.com/asadsoomr0/boston-311-pipeline/blob/main/pipeline/seed.py): `pipeline/seed.py`

### Interactive map

- **Map JSON data**
- [Map and case views](https://github.com/asadsoomr0/boston-311-pipeline/blob/main/frontend/app.js): `frontend/app.js`
- [Neighborhood geometry](https://github.com/asadsoomr0/boston-311-pipeline/blob/main/frontend/boston_neighborhoods.json): `frontend/boston_neighborhoods.json`
- [Map configuration](https://github.com/asadsoomr0/boston-311-pipeline/blob/main/frontend/config.js): `frontend/config.js`

### Scheduling

- [Airflow DAG](https://github.com/asadsoomr0/boston-311-pipeline/blob/main/dags/update_311_data.py): `dags/update_311_data.py`

### Other components

- **Analyze Boston CKAN**
- **Map visitor**
- **Basemap tiles**

## Connections

- Pipeline runner → Fetch 311 feeds: fetches feeds (evidence: `pipeline/run.py`)
- Fetch 311 feeds → Analyze Boston CKAN: queries (evidence: `pipeline/extract.py`)
- Pipeline runner → Normalize cases: normalizes records (evidence: `pipeline/run.py`)
- Pipeline runner → Resolve neighborhoods: resolves neighborhoods (evidence: `pipeline/run.py`)
- Resolve neighborhoods → Neighborhood geometry: reads geometry
- Pipeline runner → Schema and upserts: upserts cases (evidence: `pipeline/run.py`)
- Schema and upserts → Postgres warehouse: writes cases (evidence: `pipeline/load.py`)
- Schema and upserts → Topic categories: reads mappings (evidence: `pipeline/load.py`)
- Schema and upserts → Postgres warehouse: syncs mappings (evidence: `pipeline/load.py`)
- Pipeline runner → Static data build: builds site data (evidence: `pipeline/run.py`)
- Static data build → Postgres warehouse: queries warehouse (evidence: `pipeline/build.py`)
- Static data build → Schema and upserts: reads topic mappings (evidence: `pipeline/build.py`)
- Static data build → Normalize cases: cleans topics (evidence: `pipeline/build.py`)
- Static data build → Map JSON data: writes JSON (evidence: `pipeline/build.py`)
- Map and case views → Map JSON data: loads data
- Map and case views → Neighborhood geometry: renders boundaries
- Map visitor → Map and case views: filters and explores (evidence: `frontend/app.js`)
- Map and case views → Basemap tiles: loads tiles (evidence: `frontend/app.js`)
- Map and case views → Map configuration: uses settings
- Airflow DAG → Pipeline runner: runs ingestion (evidence: `dags/update_311_data.py`)
- Airflow DAG → Static data build: runs build (evidence: `dags/update_311_data.py`)
- Airflow DAG → Schema and upserts: prepares warehouse (evidence: `dags/update_311_data.py`)
- Neighborhood population seed → Postgres warehouse: seeds populations (evidence: `pipeline/seed.py`)
