# will13cb/edmp_engine architecture

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

- Interactive diagram: https://gitdiagram.com/will13cb/edmp_engine
- Repository: https://github.com/will13cb/edmp_engine

## Overview

EDMP Engine is a reproducible, price-only market research pipeline: it fetches settled ETF prices, derives point-in-time features and forward labels, trains and evaluates logistic-regression predictions with expanding walk-forward folds, backtests trading rules with costs, and renders results. The documented pipeline also emphasizes independent SQL assertions and benchmark comparisons. The event layer is explicitly not built; data preparation currently writes an empty events file. Edges below use the README or shown source excerpts; SQL-stage wiring is based only on documented relationships, not inspection of unsampled SQL.

Main entry points: [`python/prepare_data.py`](https://github.com/will13cb/edmp_engine/blob/main/python/prepare_data.py) (Price preparation), [`python/make_charts.py`](https://github.com/will13cb/edmp_engine/blob/main/python/make_charts.py) (Charts and metrics), [`sql/50_training_dataset.sql`](https://github.com/will13cb/edmp_engine/blob/main/sql/50_training_dataset.sql) (Training dataset view), [`python/train_baseline_logreg.py`](https://github.com/will13cb/edmp_engine/blob/main/python/train_baseline_logreg.py) (Walk-forward training)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_ingestion["Price ingestion"]
  node_assets["Asset universe<br/>[assets.csv]"]
  node_prepare["Price preparation<br/>[prepare_data.py]"]
  node_rawcsv["Raw CSV data"]
end

subgraph group_warehouse["SQL warehouse"]
  node_schema[("Warehouse schema<br/>[00_schema.sql]")]
  node_validations["Raw validations<br/>[10_validations.sql]"]
  node_staging["Staging transforms"]
  node_features["Analytics features"]
  node_labels["Forward labels"]
  node_trainingview["Training dataset view"]
  node_assertions["Data assertions<br/>[90_assertions.sql]"]
  node_warehouse_db[("EDMP database")]
end

subgraph group_evaluation["Model evaluation"]
  node_trainer["Walk-forward training"]
  node_predictions[("Model predictions")]
  node_backtest["Strategy backtest"]
  node_backtestdata[("Backtest results")]
end

subgraph group_reporting["Results reporting"]
  node_charts["Charts and metrics<br/>[make_charts.py]"]
  node_figures["Result figures"]
end

node_operator(("Researcher"))
node_marketdata["Yahoo Finance"]

node_operator -.->|"runs pipeline"| node_prepare
node_prepare -->|"reads universe"| node_assets
node_prepare -->|"fetches prices"| node_marketdata
node_prepare -->|"writes CSV"| node_rawcsv
node_schema -.->|"defines tables"| node_warehouse_db
node_validations -.->|"validates raw data"| node_warehouse_db
node_staging -.->|"transforms data"| node_warehouse_db
node_features -->|"defines features"| node_warehouse_db
node_labels -->|"defines labels"| node_warehouse_db
node_trainingview -->|"joins features"| node_features
node_trainingview -->|"joins labels"| node_labels
node_assertions -->|"checks stored values"| node_warehouse_db
node_trainer -->|"loads training view"| node_warehouse_db
node_trainer -->|"writes predictions"| node_predictions
node_backtest -->|"loads predictions"| node_predictions
node_backtest -->|"stores results"| node_backtestdata
node_charts -->|"reads backtests"| node_backtestdata
node_charts -->|"reads predictions"| node_predictions
node_charts -->|"writes figures"| node_figures

click node_assets "https://github.com/will13cb/edmp_engine/blob/main/config/assets.csv"
click node_prepare "https://github.com/will13cb/edmp_engine/blob/main/python/prepare_data.py"
click node_schema "https://github.com/will13cb/edmp_engine/blob/main/sql/00_schema.sql"
click node_validations "https://github.com/will13cb/edmp_engine/blob/main/sql/10_validations.sql"
click node_staging "https://github.com/will13cb/edmp_engine/blob/main/sql/20_staging_transform.sql"
click node_features "https://github.com/will13cb/edmp_engine/blob/main/sql/30_analytics_features.sql"
click node_labels "https://github.com/will13cb/edmp_engine/blob/main/sql/40_analytics_labels.sql"
click node_trainingview "https://github.com/will13cb/edmp_engine/blob/main/sql/50_training_dataset.sql"
click node_assertions "https://github.com/will13cb/edmp_engine/blob/main/sql/90_assertions.sql"
click node_trainer "https://github.com/will13cb/edmp_engine/blob/main/python/train_baseline_logreg.py"
click node_backtest "https://github.com/will13cb/edmp_engine/blob/main/python/backtest_from_predictions.py"
click node_charts "https://github.com/will13cb/edmp_engine/blob/main/python/make_charts.py"
click node_figures "https://github.com/will13cb/edmp_engine/tree/main/docs/img"

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_assets,node_prepare,node_rawcsv toneBlue
class node_schema,node_validations,node_staging,node_features,node_labels,node_trainingview,node_assertions,node_warehouse_db toneAmber
class node_trainer,node_predictions,node_backtest,node_backtestdata toneMint
class node_charts,node_figures toneRose
class node_operator,node_marketdata toneIndigo
```

## Components

### Price ingestion

- [Asset universe](https://github.com/will13cb/edmp_engine/blob/main/config/assets.csv): `config/assets.csv`
- [Price preparation](https://github.com/will13cb/edmp_engine/blob/main/python/prepare_data.py): `python/prepare_data.py`
- **Raw CSV data**

### SQL warehouse

- [Warehouse schema](https://github.com/will13cb/edmp_engine/blob/main/sql/00_schema.sql): `sql/00_schema.sql`
- [Raw validations](https://github.com/will13cb/edmp_engine/blob/main/sql/10_validations.sql): `sql/10_validations.sql`
- [Staging transforms](https://github.com/will13cb/edmp_engine/blob/main/sql/20_staging_transform.sql): `sql/20_staging_transform.sql`
- [Analytics features](https://github.com/will13cb/edmp_engine/blob/main/sql/30_analytics_features.sql): `sql/30_analytics_features.sql`
- [Forward labels](https://github.com/will13cb/edmp_engine/blob/main/sql/40_analytics_labels.sql): `sql/40_analytics_labels.sql`
- [Training dataset view](https://github.com/will13cb/edmp_engine/blob/main/sql/50_training_dataset.sql): `sql/50_training_dataset.sql`
- [Data assertions](https://github.com/will13cb/edmp_engine/blob/main/sql/90_assertions.sql): `sql/90_assertions.sql`
- **EDMP database**

### Model evaluation

- [Walk-forward training](https://github.com/will13cb/edmp_engine/blob/main/python/train_baseline_logreg.py): `python/train_baseline_logreg.py`
- **Model predictions**
- [Strategy backtest](https://github.com/will13cb/edmp_engine/blob/main/python/backtest_from_predictions.py): `python/backtest_from_predictions.py`
- **Backtest results**

### Results reporting

- [Charts and metrics](https://github.com/will13cb/edmp_engine/blob/main/python/make_charts.py): `python/make_charts.py`
- [Result figures](https://github.com/will13cb/edmp_engine/tree/main/docs/img): `docs/img`

### Other components

- **Researcher**
- **Yahoo Finance**

## Connections

- Researcher → Price preparation: runs pipeline
- Price preparation → Asset universe: reads universe (evidence: `python/prepare_data.py`)
- Price preparation → Yahoo Finance: fetches prices (evidence: `python/prepare_data.py`)
- Price preparation → Raw CSV data: writes CSV (evidence: `python/prepare_data.py`)
- Warehouse schema → EDMP database: defines tables
- Raw validations → EDMP database: validates raw data
- Staging transforms → EDMP database: transforms data
- Analytics features → EDMP database: defines features (evidence: `README.md`)
- Forward labels → EDMP database: defines labels (evidence: `README.md`)
- Training dataset view → Analytics features: joins features (evidence: `README.md`)
- Training dataset view → Forward labels: joins labels (evidence: `README.md`)
- Data assertions → EDMP database: checks stored values (evidence: `README.md`)
- Walk-forward training → EDMP database: loads training view (evidence: `python/train_baseline_logreg.py`)
- Walk-forward training → Model predictions: writes predictions (evidence: `python/train_baseline_logreg.py`)
- Strategy backtest → Model predictions: loads predictions (evidence: `python/backtest_from_predictions.py`)
- Strategy backtest → Backtest results: stores results (evidence: `python/backtest_from_predictions.py`)
- Charts and metrics → Backtest results: reads backtests (evidence: `python/make_charts.py`)
- Charts and metrics → Model predictions: reads predictions (evidence: `python/make_charts.py`)
- Charts and metrics → Result figures: writes figures (evidence: `python/make_charts.py`)
