Repository navigation
feat: add ISO 4217 currencies dictionary - #22
Conversation
Add currencies.json with all ISO 4217 currency codes and common currency symbols for monetary amount detection. This data file is available for future use to replace hardcoded currency codes in the monetary amount regex pattern (requires async detector refactor).
|
| Filename | Overview |
|---|---|
| packages/data/config/currencies.json | New data file adding 155 ISO 4217 currency codes and 22 currency symbols. JSON is valid, codes are alphabetically sorted, symbols are sorted by Unicode codepoint, and a _comment documents scope. One issue: ZWG (Zimbabwe Gold, active since April 2024) is absent while its withdrawn predecessor ZWL is present and undocumented as withdrawn. |
Flowchart
%%{init: {'theme': 'neutral'}}%%
flowchart TD
A["currencies.json\n(codes + symbols)"] -->|"future async load\n(tracked separately)"| B["monetary-amount detector\npackages/anonymize/src/detectors/regex.ts"]
B -->|"currently hardcoded"| C["USD|EUR|GBP|CZK|PLN\n|HUF|CHF|SEK|NOK|DKK\n|RON|JPY|CNY"]
B -->|"future: dynamic alternation\nbuilt from codes array"| D["AED|AFN|ALL|…|ZWG\n(155+ codes)"]
style A fill:#d4edda,stroke:#28a745
style C fill:#fff3cd,stroke:#ffc107
style D fill:#cce5ff,stroke:#004085
Last reviewed commit: "fix: document scope,..."
- Update _comment to clarify list includes recently withdrawn codes (e.g. HRK) for historical document support - Add ₾ (U+20BE, Georgian Lari) to symbols list - Codes count is 155, not 158 as originally stated
| "XCD", | ||
| "XOF", | ||
| "XPF", | ||
| "YER", |
There was a problem hiding this comment.
ZWG (Zimbabwe Gold) missing; ZWL is withdrawn
ZWL (Zimbabwean Dollar, 4th) was formally withdrawn when Zimbabwe introduced the Zimbabwe Gold (ZWG) in April 2024 — roughly the same timeline as HRK. As of today ZWG is the active ISO 4217 code for Zimbabwe, yet it is absent from the codes array while its superseded predecessor ZWL is present.
Since the intent is "active + recently withdrawn for historical document support", ZWG should be added to the list as an active currency, and ZWL should ideally be documented alongside HRK in the _comment field to make clear it is a recently withdrawn entry (or removed if only HRK-era withdrawals are in scope).
Suggested fix:
| "YER", | |
| "ZWG", | |
| "ZWL" |
And update _comment to reference ZWL alongside HRK, e.g.:
"_comment": "ISO 4217 currency codes (active + recently withdrawn, e.g. HRK, ZWL, for historical document support) and common currency symbols for monetary amount detection."
Summary
packages/data/config/currencies.jsonwith 155 active ISO 4217 currency codes (plus recently withdrawn codes like HRK for historical document support) and 22 common currency symbolssort-json.ts(codes alphabetically, symbols by Unicode codepoint)USD|EUR|GBP|...alternationNotes
Wiring this into the regex detector requires making the detector async (similar to
date-months.json), which is a larger change tracked separately.Test plan