Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
65 changes: 65 additions & 0 deletions LAB_11_DIAGRAM.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,65 @@
# Lab 11 Data Flow Diagram

Open this file in Markdown Preview to render the Mermaid diagram.

```mermaid
%%{init: {'theme': 'neutral', 'flowchart': {'curve': 'linear', 'nodeSpacing': 35, 'rankSpacing': 55}}}%%
flowchart TD
A["MTA operations generate daily ridership and traffic estimates"]:::source
B["NYC health reporting systems generate daily COVID case counts"]:::source

C["Open NY API<br/>Dataset: vxuj-8kew"]:::api
D["NYC Open Data API<br/>Dataset: rc75-m7u3"]:::api

E["Python batch loader<br/>load_data_to_bq.py"]:::loader
F["Cleaning and type conversion<br/>pandas parsing + column renaming"]:::loader
G["BigQuery tables<br/>mta_data.daily_ridership<br/>mta_data.nyc_covid_cases"]:::storage
H["Shared query utilities<br/>utils.py"]:::app
I["Streamlit pages<br/>dashboard + analysis views"]:::app
J["User-facing output<br/>charts, KPIs, and recovery analysis"]:::output

R1["Risk: upstream definitions or collection methods change"]:::risk
R2["Risk: API outage, timeout, or schema drift"]:::risk
R3["Risk: authentication failure or bad full refresh"]:::risk
R4["Risk: permissions, cache, or query errors"]:::risk

A --> C
B --> D
C --> E
D --> E
E --> F --> G --> H --> I --> J

A -.-> R1
B -.-> R1
C -.-> R2
D -.-> R2
E -.-> R3
G -.-> R4
H -.-> R4
I -.-> R4

classDef source fill:#d2e3fc,stroke:#5b9cf6,color:#202124,stroke-width:2px;
classDef api fill:#e4d7ff,stroke:#8b5cf6,color:#202124,stroke-width:2px;
classDef loader fill:#fde7c3,stroke:#f59e0b,color:#202124,stroke-width:2px;
classDef storage fill:#fbd3d0,stroke:#e56b5d,color:#202124,stroke-width:2px;
classDef app fill:#d7f1ea,stroke:#2ea76d,color:#202124,stroke-width:2px;
classDef output fill:#dbeafe,stroke:#3b82f6,color:#202124,stroke-width:2px;
classDef risk fill:#fff4cc,stroke:#d97706,color:#7c2d12,stroke-width:2px;
```

## What Happens

- Two upstream organizations generate the source data.
- The project pulls both datasets from public JSON APIs.
- `load_data_to_bq.py` cleans the data and fully refreshes two BigQuery tables.
- `utils.py` queries BigQuery and prepares data for the app.
- Streamlit renders charts and analysis for the user.

## What Can Go Wrong

- Source definitions or field names may change upstream.
- Public APIs may fail, timeout, or return unexpected schemas.
- A failed batch load can overwrite a previously good table.
- BigQuery permissions, caching, or app queries may fail.

If Mermaid Preview is unavailable, use [LAB_11_DIAGRAM.svg](./LAB_11_DIAGRAM.svg) as the screenshot version.
136 changes: 136 additions & 0 deletions LAB_11_DIAGRAM.svg
Loading
Sorry, something went wrong. Reload?
Sorry, we cannot display this file.
Sorry, this file is invalid so it cannot be displayed.
Loading