# zipecchia/2025-group-project-gruppo_4 architecture

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

- Interactive diagram: https://gitdiagram.com/zipecchia/2025-group-project-gruppo_4
- Repository: https://github.com/zipecchia/2025-group-project-gruppo_4

## Overview

This is a browser-based explorer of metro systems worldwide. Users search or select a city, then inspect its systems, lines, and stations on an interactive map; a year timeline animates construction and operation over time. Startup loads and unpacks the bundled transit datasets, filters them, and chooses the city-list or map view. Map rendering builds line and station features from section and station data. The excerpts show the main UI and data flow; unsampled files and data contents limit certainty about other capabilities.

Main entry points: [`view_map.js`](https://github.com/zipecchia/2025-group-project-gruppo_4/blob/main/view_map.js) (City map view), [`logic_map.js`](https://github.com/zipecchia/2025-group-project-gruppo_4/blob/main/logic_map.js) (Map rendering), [`sketch.js`](https://github.com/zipecchia/2025-group-project-gruppo_4/blob/main/sketch.js) (App startup), [`logic_animation.js`](https://github.com/zipecchia/2025-group-project-gruppo_4/blob/main/logic_animation.js) (Year animation)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_startup["Startup and data"]
  node_startup["App startup<br/>[sketch.js]"]
  node_rawdata[("Transit datasets")]
  node_filter["Dataset filtering<br/>[data_filter.js]"]
  node_state["App state<br/>[globals.js]"]
end

subgraph group_browse["City browsing"]
  node_citylist["City search<br/>[view_list.js]"]
  node_mapview["City map view<br/>[view_map.js]"]
end

subgraph group_mapping["Map and timeline"]
  node_maplogic["Map rendering<br/>[logic_map.js]"]
  node_animation["Year animation<br/>[logic_animation.js]"]
end

subgraph group_shared["Shared logic"]
  node_hierarchy["City hierarchy<br/>[helpers.js]"]
  node_geometry["Geometry helpers<br/>[helpers.js]"]
end

node_visitor(("Visitor"))
node_mapbox["Mapbox GL"]

node_visitor -->|"searches cities"| node_citylist
node_visitor -->|"selects city"| node_mapview
node_startup -->|"loads JSON"| node_rawdata
node_startup -->|"filters datasets"| node_filter
node_startup -->|"opens default"| node_citylist
node_startup -->|"opens URL city"| node_mapview
node_mapview -->|"updates state"| node_state
node_mapview -->|"builds sidebar"| node_hierarchy
node_mapview -->|"draws city map"| node_maplogic
node_mapview -->|"starts playback"| node_animation
node_maplogic -->|"parses geometry"| node_geometry
node_maplogic -->|"reads timeline state"| node_state
node_maplogic -->|"adds map layers"| node_mapbox
node_animation -->|"updates year"| node_state
node_animation -->|"refreshes filters"| node_maplogic

click node_startup "https://github.com/zipecchia/2025-group-project-gruppo_4/blob/main/sketch.js"
click node_rawdata "https://github.com/zipecchia/2025-group-project-gruppo_4/tree/main/data"
click node_filter "https://github.com/zipecchia/2025-group-project-gruppo_4/blob/main/data_filter.js"
click node_state "https://github.com/zipecchia/2025-group-project-gruppo_4/blob/main/globals.js"
click node_citylist "https://github.com/zipecchia/2025-group-project-gruppo_4/blob/main/view_list.js"
click node_mapview "https://github.com/zipecchia/2025-group-project-gruppo_4/blob/main/view_map.js"
click node_hierarchy "https://github.com/zipecchia/2025-group-project-gruppo_4/blob/main/helpers.js"
click node_geometry "https://github.com/zipecchia/2025-group-project-gruppo_4/blob/main/helpers.js"
click node_maplogic "https://github.com/zipecchia/2025-group-project-gruppo_4/blob/main/logic_map.js"
click node_animation "https://github.com/zipecchia/2025-group-project-gruppo_4/blob/main/logic_animation.js"

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_startup,node_rawdata,node_filter,node_state toneBlue
class node_citylist,node_mapview toneAmber
class node_maplogic,node_animation toneMint
class node_hierarchy,node_geometry toneRose
class node_visitor,node_mapbox toneIndigo
```

## Components

### Startup and data

- [App startup](https://github.com/zipecchia/2025-group-project-gruppo_4/blob/main/sketch.js): `sketch.js`
- [Transit datasets](https://github.com/zipecchia/2025-group-project-gruppo_4/tree/main/data): `data`
- [Dataset filtering](https://github.com/zipecchia/2025-group-project-gruppo_4/blob/main/data_filter.js): `data_filter.js`
- [App state](https://github.com/zipecchia/2025-group-project-gruppo_4/blob/main/globals.js): `globals.js`

### City browsing

- [City search](https://github.com/zipecchia/2025-group-project-gruppo_4/blob/main/view_list.js): `view_list.js`
- [City map view](https://github.com/zipecchia/2025-group-project-gruppo_4/blob/main/view_map.js): `view_map.js`

### Map and timeline

- [Map rendering](https://github.com/zipecchia/2025-group-project-gruppo_4/blob/main/logic_map.js): `logic_map.js`
- [Year animation](https://github.com/zipecchia/2025-group-project-gruppo_4/blob/main/logic_animation.js): `logic_animation.js`

### Shared logic

- [City hierarchy](https://github.com/zipecchia/2025-group-project-gruppo_4/blob/main/helpers.js): `helpers.js`
- [Geometry helpers](https://github.com/zipecchia/2025-group-project-gruppo_4/blob/main/helpers.js): `helpers.js`

### Other components

- **Visitor**
- **Mapbox GL**

## Connections

- Visitor → City search: searches cities (evidence: `view_list.js`)
- Visitor → City map view: selects city
- App startup → Transit datasets: loads JSON (evidence: `sketch.js`)
- App startup → Dataset filtering: filters datasets (evidence: `sketch.js`)
- App startup → City search: opens default (evidence: `sketch.js`)
- App startup → City map view: opens URL city (evidence: `sketch.js`)
- City map view → App state: updates state (evidence: `view_map.js`)
- City map view → City hierarchy: builds sidebar (evidence: `view_map.js`)
- City map view → Map rendering: draws city map (evidence: `view_map.js`)
- City map view → Year animation: starts playback (evidence: `view_map.js`)
- Map rendering → Geometry helpers: parses geometry (evidence: `logic_map.js`)
- Map rendering → App state: reads timeline state (evidence: `logic_map.js`)
- Map rendering → Mapbox GL: adds map layers (evidence: `logic_map.js`)
- Year animation → App state: updates year (evidence: `logic_animation.js`)
- Year animation → Map rendering: refreshes filters (evidence: `logic_animation.js`)
