feat(dbt): ISO 4217 currency seed + FX validation (#91 part A)
Open-source Excel-native EPM and consolidation for SAP & Dynamics
Brought to you by:
konsolid-at
Originally created by: grynn-in
Part A of [#91] — the always-needed foundation. (Parts B & C tracked as remaining below.)
No ISO 4217 reference existed: from_currency / to_currency in silver_exchange_rates and entity accounting/reporting currencies were unvalidated free strings with no names.
seeds/currencies.csv — ISO 4217 reference (currency_code, currency_name, symbol, minor_unit), covering reserve / G20 / EU currencies plus every currency in the demo FX data (44 rows; extensible to the full ~180)._seeds.yml — register currencies with unique + not_null on currency_code.tests/assert_exchange_rate_currencies_are_iso.sql — every FX currency must be a known ISO code. Uses NOT IN (ClickHouse left joins fill a miss with '', not NULL). Verified 0 violations against the live demo (CHF/EUR/USD all covered).silver_exchange_rates via the existing clickhouse.execute read pattern; join ISO names from this seed).Exchange Rate doctype → epm_staging.manual_exchange_rates, UNIONed into stg_exchange_rates as a new erp_source. Builds on the sync_doctype docstatus fix in grynn-in/konsol#48 (#92 [#1]) so it won't inherit the draft/cancel leak.currencies.csv: 44 unique 3-letter codes, valid minor_units; _seeds.yml valid YAML.epm_silver.silver_exchange_rates.dbt seed/test run pending CI (isolated worktree, not the mounted project).🤖 Generated with Claude Code
Originally posted by: grynn-in
Code review (×2 independent passes) — both SHIP, no changes
Review A — ISO 4217 data accuracy: all 44
minor_unitvalues verified correct against ISO 4217 (zero-decimal CLP/ISK/JPY/KRW/VND; three-decimal BHD/KWD/OMR; the deceptive 2-decimal ones HUF/COP/TWD/IDR all right). No code/name typos. All G20 + the full SDR basket covered. No omissions.Review B — dbt/ClickHouse wiring: installed dbt-core 1.11.11 / dbt-clickhouse 1.10.0 →
data_testsis the canonical key, so theunique/not_nulltests do run (not silently skipped).column_typesmatch the CSV header exactly;minor_unitUInt8-safe (0/2/3); singular test usesref()so the seed builds first;union distinct+not in (subquery)valid ClickHouse. Consistent with existing seedconfig.column_typespattern.Note (no action): repo model schemas use legacy
tests:; seeds had no prior test precedent, and both keys function identically on 1.11. No fixes required.Part A complete; [#91] stays open for B (read surface) + C (manual Exchange Rate doctype).
Related
Tickets:
#91Ticket changed by: grynn-in