Repository navigation
Fix FAO_Currency_statvar Golden Validation Error - #2284
Open
shvngisingh wants to merge 2 commits into
Open
shvngisingh wants to merge 2 commits into
shvngisingh wants to merge 2 commits into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request adds 'Naoero' mapped to 'country/NRU' in the FAO currency place map CSV file. Additionally, it updates two entries in the golden summary report CSV file to include '[P1Y, P1M]' instead of '[P1Y]'. There are no review comments to address, and I have no feedback to provide.
shvngisingh
force-pushed
the
fix-fao-currency-statvar
branch
2 times, most recently
from
October 21, 2026 07:37
d63d19d to
39188bc
Compare
shvngisingh
force-pushed
the
fix-fao-currency-statvar
branch
from
October 21, 2026 09:52
39188bc to
a8d4d83
Compare
…te freshness rules
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
FAO_Currency_statvar: Fix Naoero Place Mapping and Update Validation Config
1. Overview
Fixes the weekly production validation failure in
FAO_Currency_statvar(statvar_imports/fao_currency_and_exchange_rate/fao_currency_statvar:FAO_Currency_statvar, e.g., Cloud Batch jobfao-currency-statvar-1792047600) wherecheck_goldens_summary_reportandcheck_goldens_output_csvfailed and 791 Nauru (dcid:country/NRU) observations were dropped.2. Root Cause & Changes
Two upstream changes in the FAO source file (
Exchange_rate_E_All_Data.csv) caused the failure:Upstream Place Rename (
"Nauru"->"Naoero") —CurrencyFAO_place_map.csv:Area Code = 148,M49 = '520) to"Naoero".Naoerowas missing fromCurrencyFAO_place_map.csv,stat_var_processor.pydropped all 791dcid:country/NRUobservations (1:process_input_dropped-svobs-unresolved-place: 791), reducingNumPlacesby 1 for two Australian Dollar (AUD) StatVars (LocalCurrency_ExchangeRate_Currency_FromCurrency_USD_ToCurrency_AUD:6 -> 5;StandardizedCurrency_ExchangeRate_Currency_FromCurrency_USD_ToCurrency_AUD:4 -> 3).Naoero,country/NRUtoCurrencyFAO_place_map.csv(retainingNauru,country/NRUfor backward compatibility), restoring all 791country/NRUobservations (150,346->151,137rows) and returningNumPlacesto6and4.Brittle Static Golden Checks on Upstream Historical Backfills —
manifest.json,validation_config.json, &golden_data/:January–December, mapped toP1M) rows in addition toAnnual valuefor Lao PDR (LAJ, +120 observations) and Mauritania (MRU, +103 observations), updatingobservationPeriodsinsummary_report.csvfrom"[P1Y]"to"[P1Y, P1M]".golden_data/directory (golden_observations.csvandgolden_summary_report.csv), removed"golden_data/*.csv"fromsource_filesinmanifest.json, and updatedvalidation_config.jsonto replace staticGOLDENS_CHECKrules with dynamic validation rules:check_deleted_records_percent(DELETED_RECORDS_PERCENT,threshold: 0.1)check_min_value(MIN_VALUE_CHECK,minimum: 0— verifies non-negativity across all 429 StatVars, noting that 22 historical pre-redenomination hyperinflation currencies have 1970s–1990s rates< 5e-6that round to0.0atstat_var_processor.py's default 5-decimal precision)check_num_places_count(NUM_PLACES_COUNT,minimum: 1)check_positive_exchange_rate_values(SQL_VALIDATOR— verifiesMaxValue > 0across all 429 StatVars andMinValue > 0across all 407 non-redenominated StatVars)check_active_currency_date_freshness(SQL_VALIDATOR— verifies monthlyLocalCurrency_active major currenciesEUR|INR|GBP|JPY|CAD|AUD|CHF|CNYhaveMaxDate >= '2026-01'and all 149 active annualStandardizedCurrency_series haveMaxDate >= '2025')check_empty_import,check_missing_refs_count,check_lint_error_count).3. Testing & Verification
./run_tests.sh -p statvar_imports/fao_currency_and_exchange_rate/fao_currency_statvar(1/1 PASSEDin0.001s).datcom-infosys-dev, against Prod Baseline2026_09_10T00_03_06_615047_07_00):fao-currency-statvar-shvngisingh-20261023-082902(uid: fao-currency-statv-96bb9749-8659-4f990)SUCCEEDED(ImportStatus.STAGING,num_rows_processed: 151,137,execution_time: 1254s)gs://datcom-import-test/statvar_imports/fao_currency_and_exchange_rate/fao_currency_statvar/FAO_Currency_statvar/2026_10_23T01_32_10_227337_07_00/(Pantheon Link)input0/validation/differ_summary.json):current_obs_count: 151,137,previous_obs_count: 145,749,added_obs_count: 5,391,deleted_obs_count: 3(0.0021%),modified_obs_count: 1,402(Pantheon Link)input0/validation/validation_output.csv) — 8/8 RulesPASSED(Pantheon Link):ValidationNameStatusDetailsValidationParamscheck_deleted_records_percentPASSED{"deleted_records_count": 3, "previous_obs_count": 145749, "percent": 0.0020583331618055697, "threshold": 0.1}{"threshold": 0.1}check_empty_importPASSED{"num_nodes": 151137, "num_rows": 151137}check_missing_refs_countPASSED{"missing_refs_count": 0}{"threshold": 0}check_lint_error_countPASSED{"lint_error_count": 0}{"threshold": 0}check_min_valuePASSED{"rows_processed": 429, "rows_succeeded": 429, "rows_failed": 0}{"minimum": 0}check_num_places_countPASSED{"rows_processed": 429, "rows_succeeded": 429, "rows_failed": 0}{"minimum": 1}check_positive_exchange_rate_valuesPASSED{"query": "SELECT StatVar, MinValue, MaxValue FROM stats", "condition": "MaxValue > 0 AND (MinValue > 0 OR regexp_matches(StatVar, '_ToCurrency_(AOA|AOK|AON|AOS|ARP|ARS|BRB|BRC|BRN|BRL|BYN|CDF|GEL|NIC|NIG|NIO|PEN|PES|RSD|TMT|VED|ZRZ)$'))"}check_active_currency_date_freshnessPASSED{"query": "SELECT StatVar, MaxDate FROM stats WHERE regexp_matches(StatVar, '_ToCurrency_(EUR|INR|GBP|JPY|CAD|AUD|CHF|CNY)$') OR (StatVar LIKE 'StandardizedCurrency_%' AND NOT regexp_matches(StatVar, '_ToCurrency_(YUN|CSK|NIO)$'))", "condition": "(StatVar LIKE 'LocalCurrency_%' AND MaxDate >= '2026-01') OR (StatVar LIKE 'StandardizedCurrency_%' AND MaxDate >= '2025')"}