2.3 KiB
2.3 KiB
Database Governance
The repository intentionally keeps SQLite for the current private-team scale. This directory separates four different responsibilities:
| Layer | Database | Grain | Owner |
|---|---|---|---|
| L1 | L1/L1.db |
One raw network capture per match | Import pipeline |
| L2 | L2/L2.db |
Normalized match, player, round and event facts | L2 Builder |
| L3 | L3/L3.db |
Roster features and profile marts | L3 Builder |
| Web | Web/Web_App.sqlite |
Lineups, comments, jobs and editorial data | Flask app |
Rules
- Paths are defined only in
database/paths.py. - Schemas live next to their owning database.
- Builders may read the previous layer and write only their own layer.
- User-generated Web data is never restored as part of an ETL rollback.
- A full import must run through
database/pipeline.py. - Pipeline runs are serialized by
database/.pipeline.lock. - L1/L2/L3 are backed up before a full pipeline run.
- Missing metrics are stored as
NULL, not fabricated zero values. Admin -> Data Integrityis the operational source of truth.- Web schema changes increment
Config.WEB_SCHEMA_VERSION. YRTV_DATA_DIRowns runtime databases; code schemas always stay in Git.- Container and production deployments must keep runtime data outside the image and source checkout.
Entry Points
make l1 # Import output_arena JSON into L1
make l2 # Rebuild normalized facts
make l3 # Rebuild active-roster features
make pipeline # Run L1 -> L2 -> L3 with backup and validation
make check # Compile and run tests
make bootstrap # Initialize an empty runtime data root
make prepare-data # Copy legacy data into runtime-data
Directory Policy
- Without
YRTV_DATA_DIR,L1/,L2/,L3/,Web/remain the compatible development runtime. - With
YRTV_DATA_DIR, those folders provide code and schemas while databases live under the configured external directory. backups/: generated rollback snapshots; ignored by Git.schema_bkp/: historical schema research only; not used at runtime.L1B/: reserved demo-parser integration; not used at runtime.L3/Roadmap/: historical design notes; not used at runtime.
Large-scale directory moves are deliberately deferred until the legacy builders no longer depend on their current module layout.