statistics_poland: remove golden validation and config_override, adopt node_mcf pattern, and add freshness checks - #2244
Open
abhishekjaisw wants to merge 5 commits into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request enhances the robustness of the Statistics Poland data download script by implementing a requests session with automatic retries, backoff, and improved error handling. It also increases request timeouts and sleep intervals to mitigate transient network issues. Additionally, the PR removes several golden data files, updates the import manifest to use wildcard MCF files and reference validation_config.json, and cleans up the validation configuration by removing golden-check rules and configuration overrides. There are no review comments, so no feedback is provided.
…ess SQL and consistency validations
… missing slices/HTTP errors, remove dead imports, update freshness to 2025
abhishekjaisw
force-pushed
the
statistics_poland_remove_golden
branch
from
October 5, 2026 10:28
e776ae1 to
c195e62
Compare
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.
Description
Updates
statvar_imports/statistics_polandto align with the standardized Data Commons import configuration, hardening guidelines, and CRA review recommendations:GOLDENS_CHECKrules (check_goldens_summary_reportandcheck_goldens_observations) fromvalidation_config.json.golden_data/directory (golden_observations.csv,golden_summary_report.csv).config_overridefrommanifest.json(includinguse_autopush_dc_api: false), allowing standard executor defaults to resolve global schema.golden_data/*.csvwithvalidation_config.jsoninmanifest.jsonsource_files.node_mcfPattern:stat_var_mcfwith flexiblenode_mcf: "StatisticsPoland_output*.mcf"(aligning with PR #2232). Because all 108 StatVars are already merged into Data Commons globally (recon-lookup-schema = 109),stat_var_processor.pyavoids emitting duplicate local schema MCF files; using the wildcard pattern gracefully handles resolved global statvars without missing file errors.download_input_data.py):resp is not Nonecheck) so real status codes (403, 404, 429, 500) are logged instead ofNone.range(10)pagination with dynamic pagination (while True:) to consume all variable pages from GUS API (guidelines.md:107).RuntimeErroron failed variable metadata calls, unmapped demographic slices, and observation request failures.import traceback).KeyErrorswallowing withfinal_df.reindex(columns=...)for deterministic column alignment..tmpfiles andos.replace.def main(argv=None):with clean exit propagation.validation_config.json):check_all_statvars_freshness(SQL_VALIDATORwith per-StatVar window query assertingMaxDate >= '2025' AND total_svs > 0).check_max_date_consistent(MAX_DATE_CONSISTENT), verifying all 108 StatVars uniformly end at year2025.check_deleted_records_percentatthreshold: 0.1(0.1%, capped at<= 0.5%).LINT_ERROR_COUNT,MISSING_REFS_COUNT,EMPTY_IMPORT_CHECK), which run automatically in the executor.download_input_data_test.py):/variablesdynamic pagination, error propagation on unmapped slices and download failures, and end-to-end data transformation (100% pass in 1.4s).import io).README.mdwith operational guidance, updated freshness boundary (MaxDate >= '2025'), and testing instructions; enforced line length ceiling (<= 100chars).Dev Cloud Batch Verification (
us-west1)statistics-poland-abhishekjaisw-20261005-095516statistics-poland-26db8b91-8f0c-4e2500SUCCEEDED(ImportStatus.STAGING, execution time:243s)42,228observations (+1,836 new 2025 observations added,0deleted observations)Validation Output (
validation_output.csv)check_all_statvars_freshnessSQL_VALIDATORMaxDate >= '2025' AND total_svs > 0check_max_date_consistentMAX_DATE_CONSISTENTMaxDate: 2025(0 failed)check_deleted_records_percentDELETED_RECORDS_PERCENT0.0%, threshold: 0.1)check_empty_importEMPTY_IMPORT_CHECKnum_nodes: 42228,num_rows: 42228(default validator)check_missing_refs_countMISSING_REFS_COUNTcheck_lint_error_countLINT_ERROR_COUNTDiffer Summary (
differ_summary.json){ "current_obs_count": 42228, "previous_obs_count": 40392, "current_schema_count": 0, "previous_schema_count": 65, "added_obs_count": 1836, "deleted_obs_count": 0, "modified_obs_count": 0, "added_schema_count": 0, "deleted_schema_count": 65, "obs_diff_count": 1836, "schema_diff_count": 65 }(Note:
deleted_schema_count: 65reflects pruning redundant local schema definitions that now exist in canonical global Data Commons schema;deleted_obs_count: 0confirms 100% of data observations are preserved).