# dulguuntsatsralt-cell/undeklared44 architecture

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

- Interactive diagram: https://gitdiagram.com/dulguuntsatsralt-cell/undeklared44
- Repository: https://github.com/dulguuntsatsralt-cell/undeklared44
- Video tour (about a minute): https://gitdiagram.com/dulguuntsatsralt-cell/undeklared44/video

## Overview

Coalcast is a research workflow for building independent satellite signals of Mongolian coal exports and testing them against declared export statistics. The principal path is AOI and mask preparation, Sentinel scene acquisition, radar or optical signal construction, monthly comparison, and out-of-sample evaluation; stockpile tests and yard timelines provide distinct analysis branches. Core feature extraction and evaluation are represented from sampled source. Some data-fetching and comparison scripts are indexed but unsampled, so their internal relationships are not inferred.

Main entry points: [`scripts/make_masks.py`](https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/scripts/make_masks.py) (Mask builder), [`src/coalcast/evaluate.py`](https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/src/coalcast/evaluate.py) (Evaluation methods), [`src/coalcast/features.py`](https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/src/coalcast/features.py) (Feature extraction), [`scripts/build_s1_signal.py`](https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/scripts/build_s1_signal.py) (Radar signal)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_setup["Study setup"]
  node_aois["Study areas<br/>[aois.py]"]
  node_mask_builder["Mask builder<br/>[make_masks.py]"]
  node_masks["AOI masks"]
end

subgraph group_imagery["Imagery signals"]
  node_fetch["Scene access<br/>[fetch.py]"]
  node_s1_builder["Radar signal<br/>[build_s1_signal.py]"]
  node_s2_builder["Stockpile signal<br/>[build_s2_signal.py]"]
  node_features["Feature extraction<br/>[features.py]"]
  node_yard_timeline["Yard timeline<br/>[yard_timeline.py]"]
end

subgraph group_comparison["Export comparison"]
  node_exports["Declared exports"]
  node_nso_exports["NSO exports"]
  node_trade_fetch["Trade collection<br/>[fetch_trade.py]"]
  node_mirror_gap["Mirror comparison<br/>[mirror_gap.py]"]
end

subgraph group_analysis["Research analysis"]
  node_evaluation["Evaluation methods<br/>[evaluate.py]"]
  node_score_stockpile["Stockpile test<br/>[score_stockpile.py]"]
  node_score_v2["Fixed-rule test"]
  node_results["Experiment results<br/>[README.md]"]
end

node_researcher(("Researcher"))
node_planetary["Planetary Computer"]

node_researcher -->|"defines masks"| node_mask_builder
node_mask_builder -->|"uses area"| node_aois
node_mask_builder -->|"reads polygons"| node_masks
node_mask_builder -->|"rasterizes polygons"| node_features
node_s1_builder -->|"selects area"| node_aois
node_s1_builder -->|"downloads scenes"| node_fetch
node_s2_builder -->|"selects area"| node_aois
node_s2_builder -->|"downloads scenes"| node_fetch
node_fetch -->|"queries scenes"| node_planetary
node_s1_builder -->|"computes radar measures"| node_features
node_s2_builder -->|"computes yard measures"| node_features
node_yard_timeline -->|"uses clear classes"| node_features
node_score_stockpile -->|"runs stockpile test"| node_evaluation
node_score_v2 -->|"runs fixed-rule test"| node_evaluation
node_score_stockpile -->|"reads figures"| node_exports
node_score_v2 -->|"reads figures"| node_nso_exports
node_researcher -.->|"collects trade data"| node_trade_fetch
node_researcher -.->|"compares trade series"| node_mirror_gap
node_exports -.->|"provides target series"| node_evaluation
node_evaluation -.->|"informs experiment record"| node_results

click node_aois "https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/src/coalcast/aois.py"
click node_mask_builder "https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/scripts/make_masks.py"
click node_masks "https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/data/masks_gashuunsukhait.geojson"
click node_fetch "https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/src/coalcast/fetch.py"
click node_s1_builder "https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/scripts/build_s1_signal.py"
click node_s2_builder "https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/scripts/build_s2_signal.py"
click node_features "https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/src/coalcast/features.py"
click node_yard_timeline "https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/scripts/yard_timeline.py"
click node_exports "https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/data/exports_monthly.csv"
click node_nso_exports "https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/data/exports_nso_monthly.csv"
click node_trade_fetch "https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/scripts/fetch_trade.py"
click node_mirror_gap "https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/scripts/mirror_gap.py"
click node_evaluation "https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/src/coalcast/evaluate.py"
click node_score_stockpile "https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/scripts/score_stockpile.py"
click node_score_v2 "https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/scripts/score_stockpile_v2.py"
click node_results "https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/results/README.md"

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_aois,node_mask_builder,node_masks toneBlue
class node_fetch,node_s1_builder,node_s2_builder,node_features,node_yard_timeline toneAmber
class node_exports,node_nso_exports,node_trade_fetch,node_mirror_gap toneMint
class node_evaluation,node_score_stockpile,node_score_v2,node_results toneRose
class node_researcher,node_planetary toneIndigo
```

## Components

### Study setup

- [Study areas](https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/src/coalcast/aois.py): `src/coalcast/aois.py`
- [Mask builder](https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/scripts/make_masks.py): `scripts/make_masks.py`
- [AOI masks](https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/data/masks_gashuunsukhait.geojson): `data/masks_gashuunsukhait.geojson`

### Imagery signals

- [Scene access](https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/src/coalcast/fetch.py): `src/coalcast/fetch.py`
- [Radar signal](https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/scripts/build_s1_signal.py): `scripts/build_s1_signal.py`
- [Stockpile signal](https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/scripts/build_s2_signal.py): `scripts/build_s2_signal.py`
- [Feature extraction](https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/src/coalcast/features.py): `src/coalcast/features.py`
- [Yard timeline](https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/scripts/yard_timeline.py): `scripts/yard_timeline.py`

### Export comparison

- [Declared exports](https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/data/exports_monthly.csv): `data/exports_monthly.csv`
- [NSO exports](https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/data/exports_nso_monthly.csv): `data/exports_nso_monthly.csv`
- [Trade collection](https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/scripts/fetch_trade.py): `scripts/fetch_trade.py`
- [Mirror comparison](https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/scripts/mirror_gap.py): `scripts/mirror_gap.py`

### Research analysis

- [Evaluation methods](https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/src/coalcast/evaluate.py): `src/coalcast/evaluate.py`
- [Stockpile test](https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/scripts/score_stockpile.py): `scripts/score_stockpile.py`
- [Fixed-rule test](https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/scripts/score_stockpile_v2.py): `scripts/score_stockpile_v2.py`
- [Experiment results](https://github.com/dulguuntsatsralt-cell/undeklared44/blob/main/results/README.md): `results/README.md`

### Other components

- **Researcher**
- **Planetary Computer**

## Connections

- Researcher → Mask builder: defines masks (evidence: `README.md`)
- Mask builder → Study areas: uses area (evidence: `scripts/make_masks.py`)
- Mask builder → AOI masks: reads polygons (evidence: `scripts/make_masks.py`)
- Mask builder → Feature extraction: rasterizes polygons (evidence: `scripts/make_masks.py`)
- Radar signal → Study areas: selects area (evidence: `scripts/build_s1_signal.py`)
- Radar signal → Scene access: downloads scenes (evidence: `scripts/build_s1_signal.py`)
- Stockpile signal → Study areas: selects area (evidence: `scripts/build_s2_signal.py`)
- Stockpile signal → Scene access: downloads scenes (evidence: `scripts/build_s2_signal.py`)
- Scene access → Planetary Computer: queries scenes (evidence: `src/coalcast/fetch.py`)
- Radar signal → Feature extraction: computes radar measures (evidence: `scripts/build_s1_signal.py`)
- Stockpile signal → Feature extraction: computes yard measures (evidence: `scripts/build_s2_signal.py`)
- Yard timeline → Feature extraction: uses clear classes (evidence: `scripts/yard_timeline.py`)
- Stockpile test → Evaluation methods: runs stockpile test (evidence: `scripts/score_stockpile.py`)
- Fixed-rule test → Evaluation methods: runs fixed-rule test (evidence: `scripts/score_stockpile_v2.py`)
- Stockpile test → Declared exports: reads figures (evidence: `scripts/score_stockpile.py`)
- Fixed-rule test → NSO exports: reads figures (evidence: `scripts/score_stockpile_v2.py`)
- Researcher → Trade collection: collects trade data
- Researcher → Mirror comparison: compares trade series
- Declared exports → Evaluation methods: provides target series (evidence: `README.md`)
- Evaluation methods → Experiment results: informs experiment record (evidence: `README.md`)
