# alanvaa06/termo architecture

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

- Interactive diagram: https://gitdiagram.com/alanvaa06/termo
- Repository: https://github.com/alanvaa06/termo

## Overview

TERMO is a weekly, descriptive Treasury-curve regime monitor: it turns hash-checked FRED data into ranked features, phase/confidence/driver readings, and committee reports. It also supports registered experiments, walk-forward validation, descriptive checks, and monthly summaries. The README documents the product workflow; source-index references and excerpts support internal calls where noted. Several entry-point and report-generation implementations were not sampled, so those links follow README documentation rather than inspected call sites.

Main entry points: [`src/termo/operation/shadow.py`](https://github.com/alanvaa06/termo/blob/main/src/termo/operation/shadow.py) (Shadow operation), [`src/termo/reading.py`](https://github.com/alanvaa06/termo/blob/main/src/termo/reading.py) (Weekly reading), [`src/termo/validation/walkforward.py`](https://github.com/alanvaa06/termo/blob/main/src/termo/validation/walkforward.py) (Walk-forward fits), [`src/termo/surrogate/model.py`](https://github.com/alanvaa06/termo/blob/main/src/termo/surrogate/model.py) (Phase surrogate)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingest["Data intake"]
  node_fred_fetch["FRED fetch<br/>[fred.py]"]
  node_snapshot[("Verified snapshot<br/>[snapshot.py]")]
  node_curve_loader["Curve loader<br/>[loader.py]"]
  node_dataset["Analysis dataset<br/>[dataset.py]"]
end

subgraph group_model["Regime reading"]
  node_features["Feature pipeline<br/>[pipeline.py]"]
  node_rank_features["Move ranks<br/>[tyccles.py]"]
  node_walkforward["Walk-forward fits<br/>[walkforward.py]"]
  node_jump_model["Jump regime model<br/>[model.py]"]
  node_surrogate["Phase surrogate<br/>[model.py]"]
  node_shap["Driver attribution<br/>[explain.py]"]
end

subgraph group_evidence["Validation"]
  node_experiments["Experiment stages<br/>[core.py]"]
  node_trial_log[("Trial registry<br/>[trials.py]")]
  node_descriptive["Phase criteria<br/>[criteria.py]"]
  node_validation["Validation metrics<br/>[metrics.py]"]
end

subgraph group_delivery["Committee outputs"]
  node_weekly["Weekly runner<br/>[run_week.py]"]
  node_reading["Weekly reading<br/>[reading.py]"]
  node_shadow["Shadow operation<br/>[shadow.py]"]
  node_macro["Macro context<br/>[macro.py]"]
  node_sheet["Weekly sheet and CSV<br/>[sheet_es.py]"]
  node_monthly["Monthly summary<br/>[monthly.py]"]
  node_visual_data["Report data<br/>[datos.py]"]
  node_visual_page["HTML report<br/>[pagina.py]"]
end

node_committee(("Investment committee"))
node_fred["FRED yields"]

node_fred -->|"provides yields"| node_fred_fetch
node_fred_fetch -->|"stores download"| node_snapshot
node_curve_loader -->|"reads and verifies"| node_snapshot
node_weekly -->|"runs weekly"| node_shadow
node_shadow -->|"loads curve"| node_curve_loader
node_shadow -->|"builds analysis data"| node_dataset
node_dataset -->|"builds features"| node_features
node_features -->|"uses rank recipe"| node_rank_features
node_walkforward -->|"fits pipeline"| node_features
node_walkforward -->|"fits regimes"| node_jump_model
node_jump_model -->|"supplies phase labels"| node_surrogate
node_surrogate -->|"explains predictions"| node_shap
node_shadow -->|"creates reading"| node_reading
node_surrogate -->|"supplies confidence"| node_reading
node_shap -->|"supplies drivers"| node_reading
node_shadow -->|"adds context"| node_macro
node_shadow -->|"writes sheet"| node_sheet
node_reading -->|"included in deliverable"| node_sheet
node_monthly -->|"provides monthly ficha"| node_committee
node_visual_data -->|"supplies report data"| node_visual_page
node_sheet -->|"renders weekly report"| node_visual_page
node_visual_page -->|"presents HTML report"| node_committee
node_committee -->|"requests reading"| node_weekly
node_experiments -->|"records trial results"| node_trial_log
node_walkforward -->|"measures refits"| node_validation
node_descriptive -->|"uses metrics"| node_validation
node_shadow -->|"checks phase criteria"| node_descriptive

click node_weekly "https://github.com/alanvaa06/termo/blob/main/src/termo/run_week.py"
click node_fred_fetch "https://github.com/alanvaa06/termo/blob/main/src/termo/data/fred.py"
click node_snapshot "https://github.com/alanvaa06/termo/blob/main/src/termo/data/snapshot.py"
click node_curve_loader "https://github.com/alanvaa06/termo/blob/main/src/termo/data/loader.py"
click node_dataset "https://github.com/alanvaa06/termo/blob/main/src/termo/dataset.py"
click node_features "https://github.com/alanvaa06/termo/blob/main/src/termo/features/pipeline.py"
click node_rank_features "https://github.com/alanvaa06/termo/blob/main/src/termo/features/tyccles.py"
click node_walkforward "https://github.com/alanvaa06/termo/blob/main/src/termo/validation/walkforward.py"
click node_jump_model "https://github.com/alanvaa06/termo/blob/main/src/termo/regime/model.py"
click node_surrogate "https://github.com/alanvaa06/termo/blob/main/src/termo/surrogate/model.py"
click node_shap "https://github.com/alanvaa06/termo/blob/main/src/termo/surrogate/explain.py"
click node_reading "https://github.com/alanvaa06/termo/blob/main/src/termo/reading.py"
click node_shadow "https://github.com/alanvaa06/termo/blob/main/src/termo/operation/shadow.py"
click node_macro "https://github.com/alanvaa06/termo/blob/main/src/termo/operation/macro.py"
click node_sheet "https://github.com/alanvaa06/termo/blob/main/src/termo/operation/sheet_es.py"
click node_monthly "https://github.com/alanvaa06/termo/blob/main/src/termo/operation/monthly.py"
click node_visual_data "https://github.com/alanvaa06/termo/blob/main/src/termo/operation/visual/datos.py"
click node_visual_page "https://github.com/alanvaa06/termo/blob/main/src/termo/operation/visual/pagina.py"
click node_experiments "https://github.com/alanvaa06/termo/blob/main/src/termo/core.py"
click node_trial_log "https://github.com/alanvaa06/termo/blob/main/src/termo/validation/trials.py"
click node_descriptive "https://github.com/alanvaa06/termo/blob/main/src/termo/descriptive/criteria.py"
click node_validation "https://github.com/alanvaa06/termo/blob/main/src/termo/validation/metrics.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_fred_fetch,node_snapshot,node_curve_loader,node_dataset toneBlue
class node_features,node_rank_features,node_walkforward,node_jump_model,node_surrogate,node_shap toneAmber
class node_experiments,node_trial_log,node_descriptive,node_validation toneMint
class node_weekly,node_reading,node_shadow,node_macro,node_sheet,node_monthly,node_visual_data,node_visual_page toneRose
class node_committee,node_fred toneIndigo
```

## Components

### Data intake

- [FRED fetch](https://github.com/alanvaa06/termo/blob/main/src/termo/data/fred.py): `src/termo/data/fred.py`
- [Verified snapshot](https://github.com/alanvaa06/termo/blob/main/src/termo/data/snapshot.py): `src/termo/data/snapshot.py`
- [Curve loader](https://github.com/alanvaa06/termo/blob/main/src/termo/data/loader.py): `src/termo/data/loader.py`
- [Analysis dataset](https://github.com/alanvaa06/termo/blob/main/src/termo/dataset.py): `src/termo/dataset.py`

### Regime reading

- [Feature pipeline](https://github.com/alanvaa06/termo/blob/main/src/termo/features/pipeline.py): `src/termo/features/pipeline.py`
- [Move ranks](https://github.com/alanvaa06/termo/blob/main/src/termo/features/tyccles.py): `src/termo/features/tyccles.py`
- [Walk-forward fits](https://github.com/alanvaa06/termo/blob/main/src/termo/validation/walkforward.py): `src/termo/validation/walkforward.py`
- [Jump regime model](https://github.com/alanvaa06/termo/blob/main/src/termo/regime/model.py): `src/termo/regime/model.py`
- [Phase surrogate](https://github.com/alanvaa06/termo/blob/main/src/termo/surrogate/model.py): `src/termo/surrogate/model.py`
- [Driver attribution](https://github.com/alanvaa06/termo/blob/main/src/termo/surrogate/explain.py): `src/termo/surrogate/explain.py`

### Validation

- [Experiment stages](https://github.com/alanvaa06/termo/blob/main/src/termo/core.py): `src/termo/core.py`
- [Trial registry](https://github.com/alanvaa06/termo/blob/main/src/termo/validation/trials.py): `src/termo/validation/trials.py`
- [Phase criteria](https://github.com/alanvaa06/termo/blob/main/src/termo/descriptive/criteria.py): `src/termo/descriptive/criteria.py`
- [Validation metrics](https://github.com/alanvaa06/termo/blob/main/src/termo/validation/metrics.py): `src/termo/validation/metrics.py`

### Committee outputs

- [Weekly runner](https://github.com/alanvaa06/termo/blob/main/src/termo/run_week.py): `src/termo/run_week.py`
- [Weekly reading](https://github.com/alanvaa06/termo/blob/main/src/termo/reading.py): `src/termo/reading.py`
- [Shadow operation](https://github.com/alanvaa06/termo/blob/main/src/termo/operation/shadow.py): `src/termo/operation/shadow.py`
- [Macro context](https://github.com/alanvaa06/termo/blob/main/src/termo/operation/macro.py): `src/termo/operation/macro.py`
- [Weekly sheet and CSV](https://github.com/alanvaa06/termo/blob/main/src/termo/operation/sheet_es.py): `src/termo/operation/sheet_es.py`
- [Monthly summary](https://github.com/alanvaa06/termo/blob/main/src/termo/operation/monthly.py): `src/termo/operation/monthly.py`
- [Report data](https://github.com/alanvaa06/termo/blob/main/src/termo/operation/visual/datos.py): `src/termo/operation/visual/datos.py`
- [HTML report](https://github.com/alanvaa06/termo/blob/main/src/termo/operation/visual/pagina.py): `src/termo/operation/visual/pagina.py`

### Other components

- **Investment committee**
- **FRED yields**

## Connections

- FRED yields → FRED fetch: provides yields (evidence: `README.md`)
- FRED fetch → Verified snapshot: stores download (evidence: `README.md`)
- Curve loader → Verified snapshot: reads and verifies (evidence: `src/termo/data/loader.py`)
- Weekly runner → Shadow operation: runs weekly (evidence: `README.md`)
- Shadow operation → Curve loader: loads curve (evidence: `src/termo/operation/shadow.py`)
- Shadow operation → Analysis dataset: builds analysis data (evidence: `src/termo/operation/shadow.py`)
- Analysis dataset → Feature pipeline: builds features (evidence: `src/termo/dataset.py`)
- Feature pipeline → Move ranks: uses rank recipe (evidence: `src/termo/features/pipeline.py`)
- Walk-forward fits → Feature pipeline: fits pipeline (evidence: `src/termo/validation/walkforward.py`)
- Walk-forward fits → Jump regime model: fits regimes (evidence: `src/termo/validation/walkforward.py`)
- Jump regime model → Phase surrogate: supplies phase labels (evidence: `README.md`)
- Phase surrogate → Driver attribution: explains predictions (evidence: `src/termo/surrogate/explain.py`)
- Shadow operation → Weekly reading: creates reading (evidence: `src/termo/operation/shadow.py`)
- Phase surrogate → Weekly reading: supplies confidence (evidence: `README.md`)
- Driver attribution → Weekly reading: supplies drivers (evidence: `README.md`)
- Shadow operation → Macro context: adds context (evidence: `src/termo/operation/shadow.py`)
- Shadow operation → Weekly sheet and CSV: writes sheet (evidence: `src/termo/operation/shadow.py`)
- Weekly reading → Weekly sheet and CSV: included in deliverable (evidence: `README.md`)
- Monthly summary → Investment committee: provides monthly ficha (evidence: `README.md`)
- Report data → HTML report: supplies report data (evidence: `src/termo/operation/visual/pagina.py`)
- Weekly sheet and CSV → HTML report: renders weekly report (evidence: `src/termo/operation/visual/pagina.py`)
- HTML report → Investment committee: presents HTML report (evidence: `README.md`)
- Investment committee → Weekly runner: requests reading (evidence: `README.md`)
- Experiment stages → Trial registry: records trial results (evidence: `src/termo/core.py`)
- Walk-forward fits → Validation metrics: measures refits (evidence: `src/termo/validation/walkforward.py`)
- Phase criteria → Validation metrics: uses metrics (evidence: `src/termo/descriptive/criteria.py`)
- Shadow operation → Phase criteria: checks phase criteria (evidence: `src/termo/operation/shadow.py`)
