Skip to content

Conversation

@iwatt11
Copy link
Contributor

@iwatt11 iwatt11 commented Nov 11, 2025

TL;DR

Improved handling of placeholder currencies (e.g., "National currency") in unit labels and normalization.

What changed?

  • Enhanced buildNormalizedUnit to properly handle placeholder currencies (marked as "UNKNOWN") by preserving the original label instead of attempting to replace it with a target currency
  • Updated currency selection logic for unit labels:
    • When FX conversion occurs, use the target currency
    • When no conversion occurs, use the known effective currency
    • For placeholder currencies with no FX, preserve the original unit label
  • Added special handling for per-capita and time-scale indicators with placeholder currencies
  • Fixed currency component fields in explain metadata to properly reflect when a currency is unknown

How to test?

  1. Test with indicators that use placeholder currencies like "National currency"
  2. Verify that:
    • Original labels are preserved when no FX conversion occurs
    • Time scales are properly appended when appropriate
    • Per-capita calculations maintain the correct unit format
    • Currency components in explain metadata correctly reflect unknown currencies

Why make this change?

Previously, the system would attempt to replace placeholder currencies with target currencies even when no actual FX conversion was possible, resulting in misleading unit labels. This change ensures that when dealing with placeholder currencies like "National currency," the original label is preserved unless an actual currency conversion occurs, providing more accurate and meaningful unit representations.

Copy link
Contributor Author

iwatt11 commented Nov 11, 2025

This stack of pull requests is managed by Graphite. Learn more about stacking.

@iwatt11 iwatt11 changed the title fix: don't just say USD when no conversion has taken place Improve handling of placeholder currencies in unit normalization Nov 11, 2025
@iwatt11 iwatt11 marked this pull request as ready for review November 11, 2025 21:54
@iwatt11 iwatt11 force-pushed the 11-11-fix_don_t_just_say_usd_when_no_conversion_has_taken_place branch from c24d538 to 925897a Compare November 11, 2025 22:05
Apply suggested changes
@iwatt11 iwatt11 merged commit 79a27a6 into main Nov 11, 2025
2 of 6 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants