Metadata-Version: 2.4
Name: dst-fsv
Version: 0.1.0
Summary: DST Forskningsservice grunddatabank catalog (offline): 531 registers, variable/period availability, orderable datasets, bilingual labels, and an inventory diff tool
Author: danish-registry-schema project
License: MIT
Project-URL: Source, https://github.com/EZlzh/danish-registry-schema
Requires-Python: >=3.9
Description-Content-Type: text/markdown

# dst-fsv

DST Forskningsservice **grunddatabank catalog, offline**, as a
zero-dependency pip package: 531 registers, 29,234 variables with
period-level availability (YYYY / YYYYMM), 6,675 orderable datasets with
row counts, register histories, and bilingual (da/en) labels — plus a
diff tool for checking locally delivered data against the catalog.
Snapshot 2026-08-30; pipeline: github.com/EZlzh/danish-registry-schema.

Built for air-gapped use (Gefion / DST): pure stdlib, installs from the
wheel with no network.

## Build (on a machine with the working repo)

```bash
cd pkg/dst_fsv
python3 prep_data.py          # stage data payload from ../../data/schema
pip wheel . -w dist/          # -> dist/dst_fsv-0.1.0-py3-none-any.whl
```

## Install on the target (offline)

```bash
pip install dst_fsv-0.1.0-py3-none-any.whl
```

## Query API

```python
import dst_fsv
dst_fsv.registers()["BEF"]          # catalog row incl. freshness dates
dst_fsv.variables("BEF")            # variables with label_da/label_en
dst_fsv.availability("BEF", "CIVST")  # exact periods
dst_fsv.datasets("BEF")             # orderable datasets w/ row counts
dst_fsv.orderability("CIVST")       # all registers carrying a variable
```

## Inventory diff

Compare what you actually received against what the catalog says exists.
Inventory JSON: `{"<dataset>": {"<VARIABLE>": "<type>", ...}}`, e.g.
`{"IDAS1983": {"LBNR": "String", "ARBGNR": "String"}}`.

```bash
dst-fsv-diff inventory.json          # human-readable report
python -m dst_fsv inventory.json --json
```

```python
result = dst_fsv.diff("inventory.json")   # or a dict
print(dst_fsv.format_report(result))
```

Per dataset the report gives: resolution (register + period; flags
datasets absent from the catalog), variables **missing** (expected at
that period, absent locally), **undocumented** (delivered but not in the
catalog for that period, local types echoed), the match count, and the
catalog's own n_variables / n_observations for the dataset. It also
lists catalog periods NOT in your inventory, per touched register.
Notes: the catalog has no type information, so types are echoed, not
validated; for Forløb registers (single cumulative extraction) expected
variables fall back to the register's full variable list.

Exit code is 1 when anything is missing/unknown — usable as a delivery
gate in scripts.
