Repository navigation
Add new Commerce EDA USASpending import - #2171
Open
shvngisingh wants to merge 27 commits into
Open
shvngisingh wants to merge 27 commits into
shvngisingh wants to merge 27 commits into
Conversation
Contributor
There was a problem hiding this comment.
Code Review
This pull request introduces a new automated importer for U.S. Economic Development Administration (EDA) investment datasets sourced from USASpending.gov, including preprocessing scripts, configuration files, and documentation. Feedback on the changes suggests improving the robustness of the preprocessing script by raising exceptions on API failures, adding guard checks for date parsing, and removing redundant code that attempts to update a commented-out metadata field. Additionally, it is recommended to explicitly map the 'Total' category in the PV map to properly represent aggregation.
shvngisingh
force-pushed
the
commerce_eda_usaspending_import
branch
5 times, most recently
from
August 21, 2026 13:19
63a311b to
b78097b
Compare
shvngisingh
force-pushed
the
commerce_eda_usaspending_import
branch
from
August 21, 2026 13:24
b78097b to
68b26e6
Compare
…mmerce EDA USASpending import
…t and modernize unit tests
…tion, and complete MCF schema in Commerce EDA USASpending import
…deobligation consistency, validation config, and cap PR sample to 200 rows
…gative and observation checks in validation_config.json while keeping active_programs_freshness
…tespace, and add StatVar names
saanikaaa
reviewed
Sep 11, 2026
saanikaaa
reviewed
Sep 11, 2026
saanikaaa
reviewed
Sep 11, 2026
…adata/pvmap with underscores, remove STATE_ABBREV, fix pvmap Place rule, and add correct input file
saanikaaa
reviewed
Sep 18, 2026
…ery in validation_config.json
…mport) - Correct CFDA 11.030 program name to 'Science and Research Park Development Grants' - Add golden_summary_report.csv and golden_observations.csv with GOLDENS_CHECK validation rules - Make active_programs_freshness validation rule dynamic using current year - Clarify check_deleted_records_percent description - Add counters/* and golden_data/*.csv to manifest.json source_files - Add defensive file-size checks before atomic replace and empty results guard in process.py - Remove duplicate OH entry in investment_pvmap.csv - Update README.md output artifact names and program coverage
…mport) - Deduplicate awards across multi-year queries by internal ID in process.py - Regenerate golden_summary_report.csv from full production dataset covering all 58 places - Add raw payload archival via input_files/* in manifest.json source_files - Remove 59 redundant full state name mappings from investment_pvmap.csv - Add investment_schema.mcf with explicit provisional schema enums and register in manifest.json - Add deduplication unit tests in process_test.py
- Cap input_files/investment_cleaned.csv to 200 sample rows to prevent repository bloat - Add --existing_schema_mcf=investment_schema.mcf to stat_var_processor.py execution in README.md
- Remove extraneous investment_output_stat_vars_schema.mcf output from README.md - Request generated_internal_id explicitly in USAspending API fields payload - Replace non-ASCII emoji in process.py logging with [SUCCESS] - Add test assertion in process_test.py for generated_internal_id field projection - Add PR_2171_DESCRIPTION.md with complete pre-merge checklist details
- Fix node_mcf in manifest.json by declaring investment_schema.mcf as separate import input - Add ProgramPlanning and TechnicalAssistance to active_programs_freshness in validation_config.json - Add spell_allow_words,recompete to investment_metadata.csv to eliminate error-spell-words - Add MAX_PAGES_PER_FY threshold ceiling to fetch_usaspending_data in process.py - Replace logging.fatal and unreachable return with logging.error and RuntimeError in process.py - Fix StatVar DCID for CFDA 11.030 in PR_2171_DESCRIPTION.md - Update unit tests in process_test.py for RuntimeError and pagination ceiling
- Fix node_mcf in manifest.json by declaring investment_schema.mcf as separate import input - Add ProgramPlanning and TechnicalAssistance to active_programs_freshness in validation_config.json - Add spell_allow_words,recompete to investment_metadata.csv to eliminate error-spell-words - Add MAX_PAGES_PER_FY threshold ceiling to fetch_usaspending_data in process.py - Replace logging.fatal and unreachable return with logging.error and RuntimeError in process.py - Fix StatVar DCID for CFDA 11.030 in PR_2171_DESCRIPTION.md - Update unit tests in process_test.py for RuntimeError and pagination ceiling
…d strip pvmap header delimiters - Consolidate import_inputs in manifest.json to a single entry so ValidationRunner succeeds on input0 - Add copy_schema_to_output in process.py to emit investment_schema.mcf into output/ for output/*.mcf globbing - Add unit test in process_test.py for copy_schema_to_output - Strip trailing empty columns from investment_pvmap.csv header and date row - Document output/investment_schema.mcf in README.md
copybara-service Bot
pushed a commit
to datacommonsorg/schema
that referenced
this pull request
Oct 9, 2026
… schema enums and StatisticalVariables, add dataset entries to prod_dataset_info.textproto and data_sources.json, and add resolved MCF provenance definition.
1. Upstream Source Migration / Data Acquisition by U.S. Economic Development Administration (EDA):
- Ingests federal investment assistance awards by state and program dynamically from the official USAspending REST API (U.S. Department of the Treasury / U.S. Department of Commerce - EDA):
* Landing Page: https://www.usaspending.gov/
* API Endpoint: https://api.usaspending.gov/api/v2/search/spending_by_award/
- Ingests annual investment obligation amounts across 58 U.S. states, DC, and outlying territories from FY 2012 through Present across 11 EDA assistance programs and Total investments.
2. Data Preprocessing & StatVar Alignment:
- Added automated weekly pipeline under statvar_imports/commerce_eda_usaspending (PR #2171: datacommonsorg/data#2171).
- Maps EDA assistance programs to 12 StatisticalVariables (Amount_Investment and 11 program-specific Amount_Investment_<Program> variables, including 4 new canonical InvestmentProgramEnum values: DistressedAreaRecompetePilotProgram, RegionalTechnologyAndInnovationHubs, STEMTalentChallenge, and ScienceAndResearchParkDevelopmentGrants).
- Normalizes state/territory codes to standard Data Commons FIPS place DCIDs (geoId/{state_fips}) across all 50 states, DC, and 7 territories.
- Enforces automated quality gates via 3 custom rules in validation_config.json (check_deleted_records_percent with 0.1% threshold, active_programs_freshness SQL validator across all 12 StatVars with total_svs = 12, and non_negative_investment_amounts).
PiperOrigin-RevId: 982670020
…t/*.mcf wildcard in node_mcf
…s condition, and fix README differ_output flag
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.
[PR #2171] Add Commerce_EDA_USAspending Dataset Import
1. Overview
Adds the automated weekly data import pipeline for Commerce_EDA_USAspending (
statvar_imports/commerce_eda_usaspending), ingesting U.S. Economic Development Administration (EDA) federal investment assistance awards by state/territory and program from the official USAspending.gov REST API (https://api.usaspending.gov/api/v2/search/spending_by_award/).b/547801183cl/9826700202. Key Changes
process.py):/api/v2/search/spending_by_award/across federal fiscal years2012throughget_current_fiscal_year()(accounting for the October 1 federal fiscal year boundary).Department of Commerce) and sub-agency (Economic Development Administration) across assistance award types (02,03,04,05).Award ID/generated_internal_id.Total(Amount_Investmentand 11 program-specificAmount_Investment_<Program>StatisticalVariables).geoId/{state_fips}DCIDs..tmpfile.investment_pvmap.csv,investment_metadata.csv,investment_schema.mcf,manifest.json):statvar_dcidoverrides aligned with canonical Google3 StatVar definitions.InvestmentProgramEnuminstances (DistressedAreaRecompetePilotProgram,RegionalTechnologyAndInnovationHubs,STEMTalentChallenge,ScienceAndResearchParkDevelopmentGrants).30 05 * * 1),import_groups: ["frequent", "infrequent"],node_mcf: ["investment_schema.mcf", "output/*.mcf"], andprovenance_url: "https://www.usaspending.gov/".validation_config.json,process_test.py,test_data/,README.md):check_deleted_records_percentat0.1%threshold,active_programs_freshnessverifying all 12 StatVars withtotal_svs = 12and cohort-awareMaxDatebounds, andnon_negative_investment_amounts).process_test.pyand sample fixtures intest_data/(sample_awards.json,sample_output.csv) covering API pagination, deduplication, retry/failure handling, de-obligation filtering, all-non-positive award guards, dynamic fiscal year boundaries, territory mapping, and rounding.3. Validation & Test Evidence
16 / 16 PASSED(pytest statvar_imports/commerce_eda_usaspending/process_test.py)tools.import_validation.runner):6 / 6 PASSED(2,695observations across58states/territories and12StatisticalVariables,2,703total nodes,0missing refs,0lint errors,0.0%deleted records).datcom-infosys-dev):commerce-eda-usaspending-shvngisingh-20261009-172155(commerce-eda-usasp-c45bf705-7412-4cf30,SUCCEEDED)gs://datcom-import-test/statvar_imports/commerce_eda_usaspending/Commerce_EDA_USAspending/2026_10_09T10_24_52_712858_07_00