Skip to content

Add Geocorr 2000 for same-year 2000 crosswalks - #24

Open
wcurrangroome wants to merge 1 commit into
issue-20-household-weightsfrom
issue-22-geocorr-2000
Open

wcurrangroome wants to merge 1 commit into
issue-20-household-weightsfrom
issue-22-geocorr-2000

Conversation

@wcurrangroome

Copy link
Copy Markdown
Collaborator

Closes #22. Stacked on #23 (household weights); review that one first.

What this changes

  • Same-year crosswalks for years 2000–2009 now come from Geocorr 2000, which uses 2000 Census geography. Example: 2000 tracts to 2000 PUMAs, which NHGIS does not publish. Years before 2000 are still an error.
  • The package queries Geocorr 2000 directly. It uses the same address and form fields as Geocorr 2018, plus one empty uaucs field that Geocorr 2000 requires.
  • Supported geographies: block, block group, tract, county, place, ZCTA, puma (meaning puma5, the 2000 5% sample PUMA that 2005–2011 ACS microdata also use) and msacmsa (1999 MSAs and CMSAs). Asking for puma1 stops with a message pointing to puma5, because Geocorr 2000 returns no rows for it.
  • Geocorr 2000 leaves the MSA/CMSA code blank for New England, where 1999 metro areas were built from towns. Those 3,204 rows are dropped with a warning.
  • Changes to the shared Geocorr download code:
    • it finds the CSV link in either the page text or the page's links;
    • it stops with a clear message when Geocorr returns zero rows;
    • it uses each version's limit on states per block request (10 for 2000, 13 for later versions).
  • 11-character tract GEOIDs are built from the county code and Geocorr 2000's tract codes, which are written like 1234.56.
  • get_available_crosswalks() lists the 56 new combinations.

Decisions

  • Keep "msacmsa" as the name. 1999 PMSAs are not added.
  • For 2000, "puma" means puma5.
  • New England rows with no MSA/CMSA code are dropped with a warning.
  • No reader for hand-downloaded Geocorr 2000 CSV files, because automated queries work.

Testing

  • A live national request for tract → PUMA (2000) returned:
    • 2,071 PUMAs, the published count;
    • 50 states plus DC;
    • 11-character tract GEOIDs and 7-character PUMA GEOIDs;
    • a total population of 281,421,916;
    • allocation factors that sum to 1 for each tract.
  • test-get_geocorr_2000_crosswalk.R: all tests pass, including the 4 live ones. Run them with NOT_CRAN=true CROSSWALK_RUN_SLOW_TESTS=true.
  • test-get_geocorr_2018_crosswalk.R: 0 failed. One test that expected year 2000 to fail now uses 1990.
  • Live checks that the Geocorr 2022 and 2018 requests still return correct GEOID lengths after the shared download code changed.
  • devtools::check() without tests and vignettes: 0 errors, 0 warnings.

🤖 Generated with Claude Code

Same-year crosswalks for years 2000-2009 now come from Geocorr 2000, which
uses 2000 Census geography. For example, 2000 tracts to 2000 PUMAs, which
NHGIS does not provide. Years before 2000 remain an error.

- Geography codes: county, tract, block group, block, place, zcta, puma
  (the 2000 5% sample PUMA, puma5) and msacmsa (1999 MSAs and CMSAs).
  Requests for puma1 stop with a message pointing to puma5.
- Geocorr 2000 leaves the MSA/CMSA code blank for New England, where 1999
  metro areas were built from towns. Those rows are dropped with a warning.
- Shared Geocorr download code now finds the CSV link in either the page
  text or the page's links, stops when Geocorr returns no rows, and uses
  each version's limit on states per block request.
- Tract GEOIDs are built from Geocorr 2000's county code and its tract
  codes, which are written like 1234.56.
- get_available_crosswalks() lists the 56 new combinations.

Closes #22

Co-Authored-By: Claude Opus 5.5 (1M context) <noreply@anthropic.com>

This branch has not been deployed

No deployments
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.

1 participant