[crdc_instructional_wifi_devices] Modified pvmap - #2237
Open
Krishnam24maheshwari wants to merge 5 commits into
Open
Krishnam24maheshwari wants to merge 5 commits into
Krishnam24maheshwari wants to merge 5 commits into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request updates the instructional Wi-Fi devices import configuration, including updating the README, adding a validation configuration file, and updating the manifest to output counters and include provisional MCF files. However, a critical issue was identified in common_pvmap.csv where the header row was modified to remove the column names p1, v1, p2, v2, which are required by the PropertyValueMapper and should be reverted.
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.
Summary
Fixes import validation failures and hardens the data pipeline for
crdc_instructional_wifi_devicesto support 2024 CRDC survey data. Updates column mappings forSCH_JUST, expands metadata column width to 15, quotes manifest input globs, enables telemetry counters, passes generated node MCFs, updates test fixtures, hardensdownload.pyfor dynamic multi-year ingestion, and configuresvalidation_config.jsonwith date freshness and consistency rules.Bug: b/565616431
Related CL: cl/983104185 (ProvisionalNodePlaces.mcf registering the 69 new 2024 CRDC NCES schools)
PR: #2237
Root Cause Analysis
manifest.jsonomitted"node_mcf": "output/*.mcf"underimport_inputs. Consequently, generated StatVar MCF definitions were not passed togenmcf, leading to reference check failures against unindexed StatVars.JJ→SCH_JUST):In the 2023–24 CRDC release (
Internet_Access_and_Devices_2024.csv), CRDC renamed the juvenile justice facility column fromJJtoSCH_JUSTand positioned it beyond column 8. Becausecommon_pvmap.csvonly mappedJJandcommon_metadata.csvhardcodedmapped_columns,8, the juvenile justice property was dropped for 2024 observations.download.py:The download script used bare
requests.get()without session reuse or retries, lacked timeouts, buffered multi-hundred megabyte zip files directly into RAM, performed unbounded zip extractions, swallowed download exceptions (exiting with code 0 on complete failure), and did not preserve leading zeros in NCES identifier codes (COMBOKEY,LEAID,SCHID).The processor script did not emit
--output_counters, andmanifest.jsonlacked a customvalidation_config_file, defaulting to zero-tolerance thresholds. In addition,validation_config.jsonwas omitted fromsource_files, preventing it from being archived during automated batch runs.Changes Made
1. Column Mapping & Schema Alignment
common_pvmap.csv:SCH_JUST:JJ.common_metadata.csv:mapped_columnsfrom 8 to 15 to ensure all 14/15 columns in the 2024 schema are fully processed across all survey years.2. Pipeline Hardening & Resilience (
download.py)requests.get()withrequests.Session()and an exponential backoffHTTPAdapterwithRetry(total=3, backoff_factor=1, status_forcelist=[429, 500, 502, 503, 504]).User-AgentandAcceptheaders to prevent CDN/CloudFront blocks, and set explicit 60-second timeouts.sys.exit(1)) if no datasets are successfully downloaded.dtype=strtopd.read_csv()to prevent truncation of leading zeros inCOMBOKEY,LEAID, andSCHID..csv.tmpfirst, verifies file size, and atomically replaces the target file using.replace().IndexErrorfallback with strict regex validation (r"^(\d{4})-(\d{2})$"), raisingValueErroron malformed years rather than emitting year0.OUTPUT_DIRrelative to script location (Path(__file__).resolve().parent / "input_files"), added Apache 2.0 license header, removed unused imports, and formatted lines to <= 100 characters.3. Manifest Configuration (
manifest.json)"node_mcf": "output/*.mcf"toimport_inputsto ensure generated StatVars are resolved.--input_data='input_files/*.csv'to prevent shell glob expansion.--output_counters=counters/instructional_wifi_devices_counters.csvto the processor script command and added"counters/*.csv"tosource_files."validation_config.json"tosource_filesand configured"validation_config_file": "validation_config.json".4. Validation Rules (
validation_config.json)check_latest_date_freshnessusingSQL_VALIDATOR(latest_year >= 2024) to assert observations reach the latest 2024 CRDC release.check_max_date_consistent(MAX_DATE_CONSISTENT) across both StatVars.check_deleted_records_percentwith"threshold": 0.1and an explicit description to account for biennial school churn.5. Test Data & Documentation
test_data/:Internet_Access_and_Devices_2021.csvto 51 rows (<100 rows).internet_access.*fixtures and regenerated manifest-alignedinstructional_wifi_devices.csvandinstructional_wifi_devices.tmcf.README.md:nces/{Data:0>12}).Count_School_JuvenileJusticeFacility_WifiEnabledDeviceandCount_School_NotJuvenileJusticeFacility_WifiEnabledDevice).Verification & Test Results
The import was tested via Cloud Batch in
datcom-infosys-dev:GCS Run Directory:
https://console.cloud.google.com/storage/browser/datcom-import-test/statvar_imports/crdc/instructional_wifi_devices/crdc_instructional_wifi_devices/2026_09_25T01_02_11_528535_07_00?project=datcom-infosys-dev
Validation Output (
validation_output.csv):https://console.cloud.google.com/storage/browser/_details/datcom-import-test/statvar_imports/crdc/instructional_wifi_devices/crdc_instructional_wifi_devices/2026_09_25T01_02_11_528535_07_00/input0/validation/validation_output.csv?project=datcom-infosys-dev
Differ Generated Locally:
https://console.cloud.google.com/storage/browser/unresolved_mcf/crdc_differ?project=datcom-204919