# ninjaiwnl/cs50_finalproject_hp architecture

> Architecture diagram of the GitHub repository ninjaiwnl/cs50_finalproject_hp, 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/ninjaiwnl/cs50_finalproject_hp
- Repository: https://github.com/ninjaiwnl/cs50_finalproject_hp

## Overview

HoldingPattern has an offline preparation workflow and a server-rendered flight-history search. The documented flow cleans monthly CSVs, computes route-specific delay summaries, and stores them in SQLite; a traveler then searches by airline and flight, with Flask retrieving summaries and airport details before rendering results. The excerpts show the core cleaning, aggregation, routing, database, and API behavior. Other presentation details and the database schema are described only in the README, so their links rely on that documentation.

Main entry points: [`src/cs50_final_active/pages.py`](https://github.com/ninjaiwnl/cs50_finalproject_hp/blob/main/src/cs50_final_active/pages.py) (Search routes), [`src/cs50_final_active/templates/pages/home.html`](https://github.com/ninjaiwnl/cs50_finalproject_hp/blob/main/src/cs50_final_active/templates/pages/home.html) (Search and results page), [`src/cs50_final_active/data/analysis.py`](https://github.com/ninjaiwnl/cs50_finalproject_hp/blob/main/src/cs50_final_active/data/analysis.py) (Delay analysis), [`src/cs50_final_active/data/cleaning.py`](https://github.com/ninjaiwnl/cs50_finalproject_hp/blob/main/src/cs50_final_active/data/cleaning.py) (CSV cleaner)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_prep["Data preparation"]
  node_csvs["Monthly flight CSVs"]
  node_cleaner["CSV cleaner<br/>[cleaning.py]"]
  node_analysis["Delay analysis<br/>[analysis.py]"]
  node_summaries[("Flight summaries<br/>[flights.sqlite3]")]
end

subgraph group_web["Search application"]
  node_app["Flask factory<br/>[__init__.py]"]
  node_routes["Search routes<br/>[pages.py]"]
  node_page["Search and results page<br/>[home.html]"]
  node_airport_details["Airport details<br/>[pages.py]"]
end

subgraph group_external["Airport enrichment"]
  node_airport_api["API Ninjas"]
end

node_traveler(("Traveler"))

node_csvs -->|"supplies records"| node_cleaner
node_analysis -->|"loads with"| node_cleaner
node_analysis -->|"writes summaries"| node_summaries
node_app -->|"registers routes"| node_routes
node_traveler -->|"enters search"| node_page
node_page -->|"submits form"| node_routes
node_routes -->|"queries routes"| node_summaries
node_routes -->|"requests airport data"| node_airport_api
node_airport_api -->|"returns details"| node_airport_details
node_routes -->|"renders results"| node_page
node_page -->|"displays history"| node_traveler

click node_csvs "https://github.com/ninjaiwnl/cs50_finalproject_hp/tree/main/assets"
click node_cleaner "https://github.com/ninjaiwnl/cs50_finalproject_hp/blob/main/src/cs50_final_active/data/cleaning.py"
click node_analysis "https://github.com/ninjaiwnl/cs50_finalproject_hp/blob/main/src/cs50_final_active/data/analysis.py"
click node_summaries "https://github.com/ninjaiwnl/cs50_finalproject_hp/blob/main/deploy/flights.sqlite3"
click node_app "https://github.com/ninjaiwnl/cs50_finalproject_hp/blob/main/src/cs50_final_active/__init__.py"
click node_routes "https://github.com/ninjaiwnl/cs50_finalproject_hp/blob/main/src/cs50_final_active/pages.py"
click node_page "https://github.com/ninjaiwnl/cs50_finalproject_hp/blob/main/src/cs50_final_active/templates/pages/home.html"
click node_airport_details "https://github.com/ninjaiwnl/cs50_finalproject_hp/blob/main/src/cs50_final_active/pages.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_csvs,node_cleaner,node_analysis,node_summaries toneBlue
class node_app,node_routes,node_page,node_airport_details toneAmber
class node_airport_api toneMint
class node_traveler toneIndigo
```

## Components

### Data preparation

- [Monthly flight CSVs](https://github.com/ninjaiwnl/cs50_finalproject_hp/tree/main/assets): `assets`
- [CSV cleaner](https://github.com/ninjaiwnl/cs50_finalproject_hp/blob/main/src/cs50_final_active/data/cleaning.py): `src/cs50_final_active/data/cleaning.py`
- [Delay analysis](https://github.com/ninjaiwnl/cs50_finalproject_hp/blob/main/src/cs50_final_active/data/analysis.py): `src/cs50_final_active/data/analysis.py`
- [Flight summaries](https://github.com/ninjaiwnl/cs50_finalproject_hp/blob/main/deploy/flights.sqlite3): `deploy/flights.sqlite3`

### Search application

- [Flask factory](https://github.com/ninjaiwnl/cs50_finalproject_hp/blob/main/src/cs50_final_active/__init__.py): `src/cs50_final_active/__init__.py`
- [Search routes](https://github.com/ninjaiwnl/cs50_finalproject_hp/blob/main/src/cs50_final_active/pages.py): `src/cs50_final_active/pages.py`
- [Search and results page](https://github.com/ninjaiwnl/cs50_finalproject_hp/blob/main/src/cs50_final_active/templates/pages/home.html): `src/cs50_final_active/templates/pages/home.html`
- [Airport details](https://github.com/ninjaiwnl/cs50_finalproject_hp/blob/main/src/cs50_final_active/pages.py): `src/cs50_final_active/pages.py`

### Airport enrichment

- **API Ninjas**

### Other components

- **Traveler**

## Connections

- Monthly flight CSVs → CSV cleaner: supplies records (evidence: `README.md`)
- Delay analysis → CSV cleaner: loads with (evidence: `src/cs50_final_active/data/analysis.py`)
- Delay analysis → Flight summaries: writes summaries (evidence: `src/cs50_final_active/data/analysis.py`)
- Flask factory → Search routes: registers routes (evidence: `src/cs50_final_active/__init__.py`)
- Traveler → Search and results page: enters search (evidence: `README.md`)
- Search and results page → Search routes: submits form (evidence: `README.md`)
- Search routes → Flight summaries: queries routes (evidence: `src/cs50_final_active/pages.py`)
- Search routes → API Ninjas: requests airport data (evidence: `src/cs50_final_active/pages.py`)
- API Ninjas → Airport details: returns details (evidence: `README.md`)
- Search routes → Search and results page: renders results (evidence: `src/cs50_final_active/pages.py`)
- Search and results page → Traveler: displays history (evidence: `README.md`)
