# ivan-cardenas/crosstwin architecture

> Architecture diagram of the GitHub repository ivan-cardenas/crosstwin, generated by GitDiagram from its file tree, README and a sample of source files (last updated 2026-11-21). It is an AI-made overview: check details against the source.

- Interactive diagram: https://gitdiagram.com/ivan-cardenas/crosstwin
- Repository: https://github.com/ivan-cardenas/crosstwin

## Overview

CrossTwin is a Django urban digital-twin platform for Dutch geospatial data. Users explore spatial layers and domain indicators through a map; the platform also supports data import, urbanisation analysis, and heat tools including LST and SOLWEIG. PostGIS-backed domain models and signal-driven updates form an important internal layer. The README establishes the product capabilities and stack, while source excerpts and the index support only selected implementation relationships; unverified workflow links are dashed.

Main entry points: [`administrative/models.py`](https://github.com/ivan-cardenas/crosstwin/blob/main/administrative/models.py) (Administrative geography), [`builtup/calculations/urbanisation.py`](https://github.com/ivan-cardenas/crosstwin/blob/main/builtup/calculations/urbanisation.py) (Urbanisation analysis), [`builtup/signals.py`](https://github.com/ivan-cardenas/crosstwin/blob/main/builtup/signals.py) (Built-up updates), [`physicalEnv/signals.py`](https://github.com/ivan-cardenas/crosstwin/blob/main/physicalEnv/signals.py) (Environment updates)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_platform["Platform and map"]
  node_django["Django application<br/>[settings.py]"]
  node_map["Map interface<br/>[mainMap.js]"]
  node_map_views["Map data views<br/>[views.py]"]
  node_import["Data import"]
  node_tiler["Raster tile service<br/>[tiler.py]"]
end

subgraph group_spatial["Spatial foundation"]
  node_spatial_db[("Spatial database")]
  node_admin_data["Administrative geography<br/>[models.py]"]
  node_population["Population projections<br/>[population.py]"]
  node_admin_signals["Administrative updates<br/>[signals.py]"]
  node_cache["Layer cache versions<br/>[cache.py]"]
end

subgraph group_urban["Built environment"]
  node_builtup_data["Built-up features<br/>[models.py]"]
  node_urbanisation["Urbanisation analysis<br/>[urbanisation.py]"]
  node_builtup_signals["Built-up updates<br/>[signals.py]"]
end

subgraph group_environment["Environment and climate"]
  node_physical_data["Physical environment<br/>[models.py]"]
  node_landcover["Land-cover overlays<br/>[landcover.py]"]
  node_physical_signals["Environment updates<br/>[signals.py]"]
end

subgraph group_domains["Urban systems"]
  node_housing["Housing indicators"]
  node_energy["Energy data<br/>[models.py]"]
  node_nature["Nature data<br/>[models.py]"]
  node_water["Water supply indicators<br/>[indicators.py]"]
  node_heat_lst["Land-surface temperature<br/>[pipeline.py]"]
  node_heat_solweig["Thermal comfort analysis<br/>[pipeline.py]"]
  node_weather["Weather and climate<br/>[climate.py]"]
end

node_user(("Map user"))

node_user -.->|"explores"| node_map
node_map -.->|"requests layers"| node_map_views
node_map_views -.->|"reads spatial data"| node_spatial_db
node_import -.->|"loads data"| node_spatial_db
node_spatial_db -.->|"serves raster tiles"| node_tiler
node_admin_data -->|"provides units"| node_population
node_admin_signals -->|"updates"| node_admin_data
node_admin_signals -->|"bumps versions"| node_cache
node_physical_signals -->|"rewrites overlays"| node_landcover
node_physical_signals -->|"updates"| node_physical_data
node_physical_signals -->|"reads features"| node_builtup_data
node_builtup_signals -->|"handles changes"| node_builtup_data
node_builtup_signals -->|"updates overlays"| node_landcover
node_builtup_signals -->|"bumps versions"| node_cache
node_urbanisation -->|"allocates population"| node_admin_data
node_urbanisation -->|"uses built features"| node_builtup_data
node_urbanisation -->|"uses projections"| node_population
node_heat_lst -->|"reads NDVI layers"| node_physical_data
node_heat_lst -->|"fetches scene inputs"| node_heat_lst
node_heat_solweig -->|"uses surface inputs"| node_physical_data
node_heat_solweig -.->|"uses weather inputs"| node_weather
node_water -->|"uses units"| node_admin_data
node_water -->|"uses population"| node_population
node_water -->|"uses water balance"| node_weather
node_housing -.->|"stores indicators"| node_spatial_db
node_energy -.->|"stores energy data"| node_spatial_db
node_nature -.->|"stores nature data"| node_spatial_db

click node_django "https://github.com/ivan-cardenas/crosstwin/blob/main/DigitalTwin/settings.py"
click node_map "https://github.com/ivan-cardenas/crosstwin/blob/main/core/static/js/mainMap.js"
click node_map_views "https://github.com/ivan-cardenas/crosstwin/blob/main/mainMap/views.py"
click node_import "https://github.com/ivan-cardenas/crosstwin/tree/main/importer"
click node_tiler "https://github.com/ivan-cardenas/crosstwin/blob/main/tiler.py"
click node_admin_data "https://github.com/ivan-cardenas/crosstwin/blob/main/administrative/models.py"
click node_population "https://github.com/ivan-cardenas/crosstwin/blob/main/administrative/calculations/population.py"
click node_admin_signals "https://github.com/ivan-cardenas/crosstwin/blob/main/administrative/signals.py"
click node_physical_data "https://github.com/ivan-cardenas/crosstwin/blob/main/physicalEnv/models.py"
click node_landcover "https://github.com/ivan-cardenas/crosstwin/blob/main/physicalEnv/calculations/landcover.py"
click node_physical_signals "https://github.com/ivan-cardenas/crosstwin/blob/main/physicalEnv/signals.py"
click node_builtup_data "https://github.com/ivan-cardenas/crosstwin/blob/main/builtup/models.py"
click node_urbanisation "https://github.com/ivan-cardenas/crosstwin/blob/main/builtup/calculations/urbanisation.py"
click node_builtup_signals "https://github.com/ivan-cardenas/crosstwin/blob/main/builtup/signals.py"
click node_housing "https://github.com/ivan-cardenas/crosstwin/tree/main/housing"
click node_energy "https://github.com/ivan-cardenas/crosstwin/blob/main/Energy/models.py"
click node_nature "https://github.com/ivan-cardenas/crosstwin/blob/main/nature/models.py"
click node_water "https://github.com/ivan-cardenas/crosstwin/blob/main/watersupply/calculations/indicators.py"
click node_heat_lst "https://github.com/ivan-cardenas/crosstwin/blob/main/urban_heat/lst/pipeline.py"
click node_heat_solweig "https://github.com/ivan-cardenas/crosstwin/blob/main/urban_heat/solweig/pipeline.py"
click node_weather "https://github.com/ivan-cardenas/crosstwin/blob/main/weather/calculations/climate.py"
click node_cache "https://github.com/ivan-cardenas/crosstwin/blob/main/core/cache.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_django,node_map,node_map_views,node_import,node_tiler,node_user toneBlue
class node_spatial_db,node_admin_data,node_population,node_admin_signals,node_cache toneAmber
class node_builtup_data,node_urbanisation,node_builtup_signals toneMint
class node_physical_data,node_landcover,node_physical_signals toneRose
class node_housing,node_energy,node_nature,node_water,node_heat_lst,node_heat_solweig,node_weather toneIndigo
```

## Components

### Platform and map

- [Django application](https://github.com/ivan-cardenas/crosstwin/blob/main/DigitalTwin/settings.py): `DigitalTwin/settings.py`
- [Map interface](https://github.com/ivan-cardenas/crosstwin/blob/main/core/static/js/mainMap.js): `core/static/js/mainMap.js`
- [Map data views](https://github.com/ivan-cardenas/crosstwin/blob/main/mainMap/views.py): `mainMap/views.py`
- [Data import](https://github.com/ivan-cardenas/crosstwin/tree/main/importer): `importer`
- [Raster tile service](https://github.com/ivan-cardenas/crosstwin/blob/main/tiler.py): `tiler.py`

### Spatial foundation

- **Spatial database**
- [Administrative geography](https://github.com/ivan-cardenas/crosstwin/blob/main/administrative/models.py): `administrative/models.py`
- [Population projections](https://github.com/ivan-cardenas/crosstwin/blob/main/administrative/calculations/population.py): `administrative/calculations/population.py`
- [Administrative updates](https://github.com/ivan-cardenas/crosstwin/blob/main/administrative/signals.py): `administrative/signals.py`
- [Layer cache versions](https://github.com/ivan-cardenas/crosstwin/blob/main/core/cache.py): `core/cache.py`

### Built environment

- [Built-up features](https://github.com/ivan-cardenas/crosstwin/blob/main/builtup/models.py): `builtup/models.py`
- [Urbanisation analysis](https://github.com/ivan-cardenas/crosstwin/blob/main/builtup/calculations/urbanisation.py): `builtup/calculations/urbanisation.py`
- [Built-up updates](https://github.com/ivan-cardenas/crosstwin/blob/main/builtup/signals.py): `builtup/signals.py`

### Environment and climate

- [Physical environment](https://github.com/ivan-cardenas/crosstwin/blob/main/physicalEnv/models.py): `physicalEnv/models.py`
- [Land-cover overlays](https://github.com/ivan-cardenas/crosstwin/blob/main/physicalEnv/calculations/landcover.py): `physicalEnv/calculations/landcover.py`
- [Environment updates](https://github.com/ivan-cardenas/crosstwin/blob/main/physicalEnv/signals.py): `physicalEnv/signals.py`

### Urban systems

- [Housing indicators](https://github.com/ivan-cardenas/crosstwin/tree/main/housing): `housing`
- [Energy data](https://github.com/ivan-cardenas/crosstwin/blob/main/Energy/models.py): `Energy/models.py`
- [Nature data](https://github.com/ivan-cardenas/crosstwin/blob/main/nature/models.py): `nature/models.py`
- [Water supply indicators](https://github.com/ivan-cardenas/crosstwin/blob/main/watersupply/calculations/indicators.py): `watersupply/calculations/indicators.py`
- [Land-surface temperature](https://github.com/ivan-cardenas/crosstwin/blob/main/urban_heat/lst/pipeline.py): `urban_heat/lst/pipeline.py`
- [Thermal comfort analysis](https://github.com/ivan-cardenas/crosstwin/blob/main/urban_heat/solweig/pipeline.py): `urban_heat/solweig/pipeline.py`
- [Weather and climate](https://github.com/ivan-cardenas/crosstwin/blob/main/weather/calculations/climate.py): `weather/calculations/climate.py`

### Other components

- **Map user**

## Connections

- Map user → Map interface: explores
- Map interface → Map data views: requests layers
- Map data views → Spatial database: reads spatial data
- Data import → Spatial database: loads data
- Spatial database → Raster tile service: serves raster tiles
- Administrative geography → Population projections: provides units (evidence: `administrative/calculations/population.py`)
- Administrative updates → Administrative geography: updates (evidence: `administrative/signals.py`)
- Administrative updates → Layer cache versions: bumps versions (evidence: `administrative/signals.py`)
- Environment updates → Land-cover overlays: rewrites overlays (evidence: `physicalEnv/signals.py`)
- Environment updates → Physical environment: updates (evidence: `physicalEnv/signals.py`)
- Environment updates → Built-up features: reads features (evidence: `physicalEnv/signals.py`)
- Built-up updates → Built-up features: handles changes (evidence: `builtup/signals.py`)
- Built-up updates → Land-cover overlays: updates overlays (evidence: `builtup/signals.py`)
- Built-up updates → Layer cache versions: bumps versions (evidence: `builtup/signals.py`)
- Urbanisation analysis → Administrative geography: allocates population (evidence: `builtup/calculations/urbanisation.py`)
- Urbanisation analysis → Built-up features: uses built features (evidence: `builtup/calculations/urbanisation.py`)
- Urbanisation analysis → Population projections: uses projections (evidence: `builtup/calculations/urbanisation.py`)
- Land-surface temperature → Physical environment: reads NDVI layers (evidence: `urban_heat/lst/pipeline.py`)
- Land-surface temperature → Land-surface temperature: fetches scene inputs (evidence: `urban_heat/lst/pipeline.py`)
- Thermal comfort analysis → Physical environment: uses surface inputs (evidence: `urban_heat/solweig/pipeline.py`)
- Thermal comfort analysis → Weather and climate: uses weather inputs
- Water supply indicators → Administrative geography: uses units (evidence: `watersupply/calculations/indicators.py`)
- Water supply indicators → Population projections: uses population (evidence: `watersupply/calculations/indicators.py`)
- Water supply indicators → Weather and climate: uses water balance (evidence: `watersupply/calculations/indicators.py`)
- Housing indicators → Spatial database: stores indicators
- Energy data → Spatial database: stores energy data
- Nature data → Spatial database: stores nature data
