# eqasim-org/eqasim-switzerland architecture

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

- Interactive diagram: https://gitdiagram.com/eqasim-org/eqasim-switzerland
- Repository: https://github.com/eqasim-org/eqasim-switzerland

## Overview

This repository builds a Swiss synthetic population and travel, converts the result into a MATSim/eqasim scenario, runs agent-based simulations, and supports end-of-pipeline analysis and visualization. The principal workflow is configured and chained by synpp. Source excerpts show selected data preparation, spatial imputation, population export, and eqasim runtime behavior; README statements establish the broader stages. Several synthesis and conversion modules are unsampled, so their internal relationships are not inferred.

Main entry points: [`data/structural_survey/structural_survey.py`](https://github.com/eqasim-org/eqasim-switzerland/blob/develop/data/structural_survey/structural_survey.py) (Structural survey), [`data/statpop/statpop.py`](https://github.com/eqasim-org/eqasim-switzerland/blob/develop/data/statpop/statpop.py) (STATPOP population), [`data/spatial/zones.py`](https://github.com/eqasim-org/eqasim-switzerland/blob/develop/data/spatial/zones.py) (Spatial zones), [`synthesis/population`](https://github.com/eqasim-org/eqasim-switzerland/tree/develop/synthesis/population) (Population synthesis)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_inputs["Data preparation"]
  node_census["Census datasets<br/>[persons.py]"]
  node_statpop["STATPOP population<br/>[statpop.py]"]
  node_survey["Structural survey"]
  node_spatial["Spatial zones<br/>[zones.py]"]
  node_freightdata["Freight data"]
  node_transitdata["Transit data"]
end

subgraph group_synthesis["Population and travel"]
  node_pop_synthesis["Population synthesis"]
  node_spatial_assign["Location assignment"]
  node_trip_synthesis["Person trips<br/>[trips.py]"]
  node_freight_synthesis["Freight trips"]
  node_vehicle_synthesis["Vehicle assignment<br/>[vehicles.py]"]
  node_output["Pipeline output<br/>[output.py]"]
end

subgraph group_scenario["MATSim scenario"]
  node_network["Network conversion"]
  node_scenario_prep["Scenario preparation"]
  node_population_export["Population XML export<br/>[population.py]"]
  node_xml_writers["MATSim XML writers<br/>[writers.py]"]
end

subgraph group_runtime["Simulation runtime"]
  node_sim_prep["Simulation preparation<br/>[prepare.py]"]
  node_eqasim["Eqasim runtime<br/>[eqasim.py]"]
  node_simulation["MATSim simulation<br/>[run.py]"]
end

subgraph group_analysis["Analysis"]
  node_analysis["Results analysis<br/>[analysis.py]"]
  node_plotting["Visualization tools<br/>[myplottools.py]"]
end

node_engineer(("Pipeline operator"))
node_synpp["Stage pipeline"]

node_engineer -->|"configures and runs"| node_synpp
node_synpp -->|"chains stages"| node_census
node_synpp -->|"chains stages"| node_statpop
node_synpp -->|"chains stages"| node_survey
node_synpp -->|"chains stages"| node_spatial
node_synpp -->|"chains stages"| node_freightdata
node_synpp -->|"chains stages"| node_transitdata
node_synpp -->|"chains stages"| node_pop_synthesis
node_synpp -->|"chains stages"| node_spatial_assign
node_synpp -->|"chains stages"| node_trip_synthesis
node_synpp -->|"chains stages"| node_freight_synthesis
node_synpp -->|"chains stages"| node_vehicle_synthesis
node_synpp -->|"chains stages"| node_network
node_synpp -->|"chains stages"| node_scenario_prep
node_synpp -->|"runs requested stage"| node_simulation
node_survey -->|"requests stage"| node_statpop
node_statpop -->|"uses zone imputation"| node_spatial
node_survey -->|"uses zone data"| node_spatial
node_pop_synthesis -.->|"produces pipeline output"| node_output
node_synpp -->|"saves configured output"| node_output
node_scenario_prep -.->|"prepares scenario inputs"| node_population_export
node_population_export -->|"writes population XML"| node_xml_writers
node_synpp -->|"chains stages"| node_sim_prep
node_sim_prep -->|"requests stage"| node_eqasim
node_eqasim -.->|"provides runtime"| node_simulation
node_synpp -->|"chains stages"| node_analysis
node_analysis -->|"uses plotting tools"| node_plotting

click node_census "https://github.com/eqasim-org/eqasim-switzerland/blob/develop/data/microcensus/persons.py"
click node_statpop "https://github.com/eqasim-org/eqasim-switzerland/blob/develop/data/statpop/statpop.py"
click node_survey "https://github.com/eqasim-org/eqasim-switzerland/blob/develop/data/structural_survey/structural_survey.py"
click node_spatial "https://github.com/eqasim-org/eqasim-switzerland/blob/develop/data/spatial/zones.py"
click node_freightdata "https://github.com/eqasim-org/eqasim-switzerland/tree/develop/data/freight"
click node_transitdata "https://github.com/eqasim-org/eqasim-switzerland/tree/develop/data/gtfs"
click node_pop_synthesis "https://github.com/eqasim-org/eqasim-switzerland/tree/develop/synthesis/population"
click node_spatial_assign "https://github.com/eqasim-org/eqasim-switzerland/tree/develop/synthesis/population/spatial"
click node_trip_synthesis "https://github.com/eqasim-org/eqasim-switzerland/blob/develop/synthesis/population/trips.py"
click node_freight_synthesis "https://github.com/eqasim-org/eqasim-switzerland/tree/develop/synthesis/freight"
click node_vehicle_synthesis "https://github.com/eqasim-org/eqasim-switzerland/blob/develop/synthesis/vehicles/vehicles.py"
click node_output "https://github.com/eqasim-org/eqasim-switzerland/blob/develop/synthesis/output.py"
click node_network "https://github.com/eqasim-org/eqasim-switzerland/tree/develop/matsim/scenario/network"
click node_scenario_prep "https://github.com/eqasim-org/eqasim-switzerland/tree/develop/matsim/scenario"
click node_population_export "https://github.com/eqasim-org/eqasim-switzerland/blob/develop/matsim/scenario/population.py"
click node_xml_writers "https://github.com/eqasim-org/eqasim-switzerland/blob/develop/matsim/writers.py"
click node_sim_prep "https://github.com/eqasim-org/eqasim-switzerland/blob/develop/matsim/simulation/prepare.py"
click node_eqasim "https://github.com/eqasim-org/eqasim-switzerland/blob/develop/matsim/runtime/eqasim.py"
click node_simulation "https://github.com/eqasim-org/eqasim-switzerland/blob/develop/matsim/simulation/run.py"
click node_analysis "https://github.com/eqasim-org/eqasim-switzerland/blob/develop/analysis/analysis.py"
click node_plotting "https://github.com/eqasim-org/eqasim-switzerland/blob/develop/analysis/myplottools.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_census,node_statpop,node_survey,node_spatial,node_freightdata,node_transitdata toneBlue
class node_pop_synthesis,node_spatial_assign,node_trip_synthesis,node_freight_synthesis,node_vehicle_synthesis,node_output toneAmber
class node_network,node_scenario_prep,node_population_export,node_xml_writers toneMint
class node_sim_prep,node_eqasim,node_simulation toneRose
class node_analysis,node_plotting,node_engineer,node_synpp toneIndigo
```

## Components

### Data preparation

- [Census datasets](https://github.com/eqasim-org/eqasim-switzerland/blob/develop/data/microcensus/persons.py): `data/microcensus/persons.py`
- [STATPOP population](https://github.com/eqasim-org/eqasim-switzerland/blob/develop/data/statpop/statpop.py): `data/statpop/statpop.py`
- [Structural survey](https://github.com/eqasim-org/eqasim-switzerland/blob/develop/data/structural_survey/structural_survey.py): `data/structural_survey/structural_survey.py`
- [Spatial zones](https://github.com/eqasim-org/eqasim-switzerland/blob/develop/data/spatial/zones.py): `data/spatial/zones.py`
- [Freight data](https://github.com/eqasim-org/eqasim-switzerland/tree/develop/data/freight): `data/freight`
- [Transit data](https://github.com/eqasim-org/eqasim-switzerland/tree/develop/data/gtfs): `data/gtfs`

### Population and travel

- [Population synthesis](https://github.com/eqasim-org/eqasim-switzerland/tree/develop/synthesis/population): `synthesis/population`
- [Location assignment](https://github.com/eqasim-org/eqasim-switzerland/tree/develop/synthesis/population/spatial): `synthesis/population/spatial`
- [Person trips](https://github.com/eqasim-org/eqasim-switzerland/blob/develop/synthesis/population/trips.py): `synthesis/population/trips.py`
- [Freight trips](https://github.com/eqasim-org/eqasim-switzerland/tree/develop/synthesis/freight): `synthesis/freight`
- [Vehicle assignment](https://github.com/eqasim-org/eqasim-switzerland/blob/develop/synthesis/vehicles/vehicles.py): `synthesis/vehicles/vehicles.py`
- [Pipeline output](https://github.com/eqasim-org/eqasim-switzerland/blob/develop/synthesis/output.py): `synthesis/output.py`

### MATSim scenario

- [Network conversion](https://github.com/eqasim-org/eqasim-switzerland/tree/develop/matsim/scenario/network): `matsim/scenario/network`
- [Scenario preparation](https://github.com/eqasim-org/eqasim-switzerland/tree/develop/matsim/scenario): `matsim/scenario`
- [Population XML export](https://github.com/eqasim-org/eqasim-switzerland/blob/develop/matsim/scenario/population.py): `matsim/scenario/population.py`
- [MATSim XML writers](https://github.com/eqasim-org/eqasim-switzerland/blob/develop/matsim/writers.py): `matsim/writers.py`

### Simulation runtime

- [Simulation preparation](https://github.com/eqasim-org/eqasim-switzerland/blob/develop/matsim/simulation/prepare.py): `matsim/simulation/prepare.py`
- [Eqasim runtime](https://github.com/eqasim-org/eqasim-switzerland/blob/develop/matsim/runtime/eqasim.py): `matsim/runtime/eqasim.py`
- [MATSim simulation](https://github.com/eqasim-org/eqasim-switzerland/blob/develop/matsim/simulation/run.py): `matsim/simulation/run.py`

### Analysis

- [Results analysis](https://github.com/eqasim-org/eqasim-switzerland/blob/develop/analysis/analysis.py): `analysis/analysis.py`
- [Visualization tools](https://github.com/eqasim-org/eqasim-switzerland/blob/develop/analysis/myplottools.py): `analysis/myplottools.py`

### Other components

- **Pipeline operator**
- **Stage pipeline**

## Connections

- Pipeline operator → Stage pipeline: configures and runs
- Stage pipeline → Census datasets: chains stages
- Stage pipeline → STATPOP population: chains stages
- Stage pipeline → Structural survey: chains stages
- Stage pipeline → Spatial zones: chains stages
- Stage pipeline → Freight data: chains stages
- Stage pipeline → Transit data: chains stages
- Stage pipeline → Population synthesis: chains stages
- Stage pipeline → Location assignment: chains stages
- Stage pipeline → Person trips: chains stages
- Stage pipeline → Freight trips: chains stages
- Stage pipeline → Vehicle assignment: chains stages
- Stage pipeline → Network conversion: chains stages
- Stage pipeline → Scenario preparation: chains stages
- Stage pipeline → MATSim simulation: runs requested stage
- Structural survey → STATPOP population: requests stage (evidence: `data/structural_survey/structural_survey.py`)
- STATPOP population → Spatial zones: uses zone imputation (evidence: `data/statpop/statpop.py`)
- Structural survey → Spatial zones: uses zone data (evidence: `data/structural_survey/structural_survey.py`)
- Population synthesis → Pipeline output: produces pipeline output
- Stage pipeline → Pipeline output: saves configured output
- Scenario preparation → Population XML export: prepares scenario inputs
- Population XML export → MATSim XML writers: writes population XML (evidence: `matsim/scenario/population.py`)
- Stage pipeline → Simulation preparation: chains stages
- Simulation preparation → Eqasim runtime: requests stage (evidence: `matsim/simulation/prepare.py`)
- Eqasim runtime → MATSim simulation: provides runtime
- Stage pipeline → Results analysis: chains stages
- Results analysis → Visualization tools: uses plotting tools (evidence: `analysis/analysis.py`)
