Files
nvi/api/datasets/README.md

24 lines
873 B
Markdown

# Datasets
One subdirectory per dataset. The folder name is the dataset's identity —
used as:
- the `NVI_DATASET` env var value that selects it,
- the Postgres schema where its tables live,
- the SQLite filename in `ctrl/seed/data/<name>.sqlite` that the loader
reads from.
## Adding a new dataset
1. Place the source SQLite at `ctrl/seed/data/<name>.sqlite` (or adapt
`ctrl/seed/download.sh` to fetch it).
2. Create `api/datasets/<name>/`:
- `schema_docs.yaml` — table and column descriptions.
- `metrics.yaml` — canonical SQL for business terms.
3. Set `NVI_DATASET=<name>` and restart the api.
4. `make seed` will load `<name>.sqlite` into Postgres schema `<name>`.
The Plan/Analyses/Tools/Runtime code references no dataset name; only the
loader (`api.tools.schema.load_schema`) and the engine (`api.tools.db`)
consult the active-dataset setting.