# datasets/exchange-rates architecture

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

- Interactive diagram: https://gitdiagram.com/datasets/exchange-rates
- Repository: https://github.com/datasets/exchange-rates

## Overview

This repository publishes Federal Reserve exchange-rate data at daily, monthly, and yearly granularities. An operator runs the Dataflows pipeline, which fetches country series, normalizes dates and values (including inverted currencies), and writes CSV resources with metadata and validation. A separate script provides a direct CSV-update route. The graph reflects the sampled source and README; the direct script’s invocation and any downstream use of the checked-in data are not shown.

Main entry points: [`scripts/main.py`](https://github.com/datasets/exchange-rates/blob/main/scripts/main.py) (Direct updater), [`exchange_rates_flow.py`](https://github.com/datasets/exchange-rates/blob/main/exchange_rates_flow.py) (Flow entry), [`data/daily.csv`](https://github.com/datasets/exchange-rates/blob/main/data/daily.csv) (Daily rates), [`data/monthly.csv`](https://github.com/datasets/exchange-rates/blob/main/data/monthly.csv) (Monthly rates)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_pipeline["Data pipeline"]
  node_flow_entry["Flow entry"]
  node_series_extract["Series extraction"]
  node_country_map["Country codes<br/>[country_codes.py]"]
  node_direct_updater["Direct updater<br/>[main.py]"]
end

subgraph group_catalog["Dataset catalog"]
  node_resource_setup["Resource setup"]
  node_metadata_views["Metadata and views"]
  node_validation["Schema validation"]
end

subgraph group_outputs["CSV resources"]
  node_daily_csv[("Daily rates<br/>[daily.csv]")]
  node_monthly_csv[("Monthly rates<br/>[monthly.csv]")]
  node_annual_csv[("Annual rates<br/>[annual.csv]")]
  node_yearly_csv[("Yearly data<br/>[yearly.csv]")]
end

node_operator(("Operator"))
node_fred[("FRED data")]

node_operator -->|"runs process"| node_flow_entry
node_flow_entry -->|"configures series"| node_series_extract
node_series_extract -->|"fetches rates"| node_fred
node_direct_updater -->|"imports codes"| node_country_map
node_direct_updater -->|"fetches rates"| node_fred
node_flow_entry -->|"configures resources"| node_resource_setup
node_flow_entry -->|"adds metadata"| node_metadata_views
node_flow_entry -->|"validates flow"| node_validation
node_resource_setup -->|"writes resource"| node_daily_csv
node_resource_setup -->|"writes resource"| node_monthly_csv
node_resource_setup -->|"writes resource"| node_annual_csv
node_direct_updater -->|"writes CSV"| node_daily_csv
node_direct_updater -->|"writes CSV"| node_monthly_csv
node_direct_updater -->|"writes CSV"| node_annual_csv

click node_flow_entry "https://github.com/datasets/exchange-rates/blob/main/exchange_rates_flow.py"
click node_series_extract "https://github.com/datasets/exchange-rates/blob/main/exchange_rates_flow.py"
click node_country_map "https://github.com/datasets/exchange-rates/blob/main/scripts/country_codes.py"
click node_direct_updater "https://github.com/datasets/exchange-rates/blob/main/scripts/main.py"
click node_resource_setup "https://github.com/datasets/exchange-rates/blob/main/exchange_rates_flow.py"
click node_metadata_views "https://github.com/datasets/exchange-rates/blob/main/exchange_rates_flow.py"
click node_validation "https://github.com/datasets/exchange-rates/blob/main/exchange_rates_flow.py"
click node_daily_csv "https://github.com/datasets/exchange-rates/blob/main/data/daily.csv"
click node_monthly_csv "https://github.com/datasets/exchange-rates/blob/main/data/monthly.csv"
click node_annual_csv "https://github.com/datasets/exchange-rates/blob/main/data/annual.csv"
click node_yearly_csv "https://github.com/datasets/exchange-rates/blob/main/data/yearly.csv"

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_flow_entry,node_series_extract,node_country_map,node_direct_updater toneBlue
class node_resource_setup,node_metadata_views,node_validation,node_fred toneAmber
class node_daily_csv,node_monthly_csv,node_annual_csv,node_yearly_csv toneMint
class node_operator toneIndigo
```

## Components

### Data pipeline

- [Flow entry](https://github.com/datasets/exchange-rates/blob/main/exchange_rates_flow.py): `exchange_rates_flow.py`
- [Series extraction](https://github.com/datasets/exchange-rates/blob/main/exchange_rates_flow.py): `exchange_rates_flow.py`
- [Country codes](https://github.com/datasets/exchange-rates/blob/main/scripts/country_codes.py): `scripts/country_codes.py`
- [Direct updater](https://github.com/datasets/exchange-rates/blob/main/scripts/main.py): `scripts/main.py`

### Dataset catalog

- [Resource setup](https://github.com/datasets/exchange-rates/blob/main/exchange_rates_flow.py): `exchange_rates_flow.py`
- [Metadata and views](https://github.com/datasets/exchange-rates/blob/main/exchange_rates_flow.py): `exchange_rates_flow.py`
- [Schema validation](https://github.com/datasets/exchange-rates/blob/main/exchange_rates_flow.py): `exchange_rates_flow.py`

### CSV resources

- [Daily rates](https://github.com/datasets/exchange-rates/blob/main/data/daily.csv): `data/daily.csv`
- [Monthly rates](https://github.com/datasets/exchange-rates/blob/main/data/monthly.csv): `data/monthly.csv`
- [Annual rates](https://github.com/datasets/exchange-rates/blob/main/data/annual.csv): `data/annual.csv`
- [Yearly data](https://github.com/datasets/exchange-rates/blob/main/data/yearly.csv): `data/yearly.csv`

### Other components

- **Operator**
- **FRED data**

## Connections

- Operator → Flow entry: runs process (evidence: `README.md`)
- Flow entry → Series extraction: configures series (evidence: `exchange_rates_flow.py`)
- Series extraction → FRED data: fetches rates (evidence: `exchange_rates_flow.py`)
- Direct updater → Country codes: imports codes (evidence: `scripts/main.py`)
- Direct updater → FRED data: fetches rates (evidence: `scripts/main.py`)
- Flow entry → Resource setup: configures resources (evidence: `exchange_rates_flow.py`)
- Flow entry → Metadata and views: adds metadata (evidence: `exchange_rates_flow.py`)
- Flow entry → Schema validation: validates flow (evidence: `exchange_rates_flow.py`)
- Resource setup → Daily rates: writes resource (evidence: `exchange_rates_flow.py`)
- Resource setup → Monthly rates: writes resource (evidence: `exchange_rates_flow.py`)
- Resource setup → Annual rates: writes resource (evidence: `exchange_rates_flow.py`)
- Direct updater → Daily rates: writes CSV (evidence: `scripts/main.py`)
- Direct updater → Monthly rates: writes CSV (evidence: `scripts/main.py`)
- Direct updater → Annual rates: writes CSV (evidence: `scripts/main.py`)
