# novaoc/rarebox-price-history architecture

> Architecture diagram of the GitHub repository novaoc/rarebox-price-history, 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/novaoc/rarebox-price-history
- Repository: https://github.com/novaoc/rarebox-price-history

## Overview

This repository builds and publishes daily TCGplayer price histories as per-set JSON for seven trading-card games. The workflow maps TCGplayer groups and products to each game’s card/set identifiers, ingests dated price archives, then appends and compacts price points in the static data files consumed by Rarebox. The mapping and ingestion scripts share path, HTTP, normalization, and JSON helpers. Source excerpts show the scripts’ calls and storage behavior; README statements establish the static serving and consumer relationship.

Main entry points: [`scripts/build_maps.py`](https://github.com/novaoc/rarebox-price-history/blob/main/scripts/build_maps.py) (Build join maps), [`scripts/ingest.py`](https://github.com/novaoc/rarebox-price-history/blob/main/scripts/ingest.py) (Ingest price archives), [`scripts/common.py`](https://github.com/novaoc/rarebox-price-history/blob/main/scripts/common.py) (Shared utilities), [`maps`](https://github.com/novaoc/rarebox-price-history/tree/main/maps) (Set and product maps)

## Diagram (Mermaid)

```mermaid
flowchart TD

subgraph group_mapping["Catalog mapping"]
  node_mapbuilder["Build join maps<br/>[build_maps.py]"]
  node_shared["Shared utilities<br/>[common.py]"]
  node_joinmaps[("Set and product maps")]
end

subgraph group_ingestion["Price ingestion"]
  node_ingestor["Ingest price archives<br/>[ingest.py]"]
end

subgraph group_publication["Price datasets"]
  node_history[("Per-set price history")]
end

node_rarebox(("Rarebox app"))
node_tcgcsv["TCGCSV"]
node_gameapis["Game card APIs"]
node_archives["Daily price archives"]
node_rawhost["Raw GitHub hosting"]

node_mapbuilder -->|"uses helpers"| node_shared
node_ingestor -->|"uses helpers"| node_shared
node_mapbuilder -->|"fetches catalogs"| node_tcgcsv
node_mapbuilder -->|"fetches set indexes"| node_gameapis
node_mapbuilder -->|"writes maps"| node_joinmaps
node_ingestor -->|"reads maps"| node_joinmaps
node_ingestor -->|"downloads prices"| node_archives
node_ingestor -->|"appends histories"| node_history
node_rarebox -->|"fetches JSON"| node_rawhost
node_rawhost -->|"serves static files"| node_history

click node_mapbuilder "https://github.com/novaoc/rarebox-price-history/blob/main/scripts/build_maps.py"
click node_shared "https://github.com/novaoc/rarebox-price-history/blob/main/scripts/common.py"
click node_joinmaps "https://github.com/novaoc/rarebox-price-history/tree/main/maps"
click node_ingestor "https://github.com/novaoc/rarebox-price-history/blob/main/scripts/ingest.py"
click node_history "https://github.com/novaoc/rarebox-price-history/tree/main/data"

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_mapbuilder,node_shared,node_joinmaps toneBlue
class node_ingestor toneAmber
class node_history,node_gameapis toneMint
class node_rarebox,node_tcgcsv,node_archives,node_rawhost toneIndigo
```

## Components

### Catalog mapping

- [Build join maps](https://github.com/novaoc/rarebox-price-history/blob/main/scripts/build_maps.py): `scripts/build_maps.py`
- [Shared utilities](https://github.com/novaoc/rarebox-price-history/blob/main/scripts/common.py): `scripts/common.py`
- [Set and product maps](https://github.com/novaoc/rarebox-price-history/tree/main/maps): `maps`

### Price ingestion

- [Ingest price archives](https://github.com/novaoc/rarebox-price-history/blob/main/scripts/ingest.py): `scripts/ingest.py`

### Price datasets

- [Per-set price history](https://github.com/novaoc/rarebox-price-history/tree/main/data): `data`

### Other components

- **Rarebox app**
- **TCGCSV**
- **Game card APIs**
- **Daily price archives**
- **Raw GitHub hosting**

## Connections

- Build join maps → Shared utilities: uses helpers (evidence: `scripts/build_maps.py`)
- Ingest price archives → Shared utilities: uses helpers (evidence: `scripts/ingest.py`)
- Build join maps → TCGCSV: fetches catalogs (evidence: `scripts/build_maps.py`)
- Build join maps → Game card APIs: fetches set indexes (evidence: `scripts/build_maps.py`)
- Build join maps → Set and product maps: writes maps (evidence: `scripts/build_maps.py`)
- Ingest price archives → Set and product maps: reads maps (evidence: `scripts/ingest.py`)
- Ingest price archives → Daily price archives: downloads prices (evidence: `scripts/ingest.py`)
- Ingest price archives → Per-set price history: appends histories (evidence: `scripts/ingest.py`)
- Rarebox app → Raw GitHub hosting: fetches JSON (evidence: `README.md`)
- Raw GitHub hosting → Per-set price history: serves static files (evidence: `README.md`)
