Repository navigation
Releases
Releases · tomcrojo/spain-book-analytics
v1.0.0 — 28.6M Public Madrid Loans Medallion, Gold Star Schema & Classic BI
First public release of Spain Book Analytics: a reproducible Medallion pipeline over 28.6 million open Madrid public-library loan records, with a Gold star schema, a semantic layer, a default-deny publication gate and a static BI dashboard.
What's included
- Medallion pipeline (Polars + DuckDB): Bronze parser for 139 monthly CSVs and 11 header schemas, with quoting repair and width quarantine; Silver typing, network mapping and deduplication on
barcode + timestampwithin each month; Gold star schema (fact_loansplus conformed dimensions and marts). - Semantic layer:
semantic/metrics.yaml, validated against the public Gold Parquet files byscripts/validate_semantic.py. - Publication gate: default-deny, hash-bound policy;
scripts/export_audit.pyaudits the git inventory for oversized files, forbidden paths, cells below 5 and small values recoverable by subtraction. - Public aggregates:
gold_public/madrid/andseeds/public/, with no per-loan rows, barcodes or timestamps. - Dashboard:
dashboard/index.html, plain JavaScript and hand-built SVG, no build step or CDN. - CI: secret scan (Gitleaks 8.30.1), ruff, reviewed tree inventory, export audit, semantic validation, synthetic and public-sample pipeline runs, publication gate, pytest and chart reproducibility.
Measured on the full local run
- 28,587,254 raw rows parsed; 615,244 duplicate loan events removed; 27,883,133 loans in the analytical universe (the
2025-05file repeats April and is quarantined). - Months missing at source (2017-11, 2018-01, 2020-04, 2020-05) are kept as
NULL, never0. - S1-2026 reconciliation against the published municipal figure: 99.8 %.
Not included
Raw files, Bronze/Silver Parquet and the private Gold database stay on the machine that ran the pipeline; rebuild instructions are in the README. Data keeps its own terms (see DATA_LICENSES.md); code and documentation are MIT. Databricks (v2.0) and predictive BI (v3.0) are planned and not built.