Skip to content

Add LTDB as a source for 2010 to 2000 tract crosswalks - #25

Open
wcurrangroome wants to merge 1 commit into
issue-22-geocorr-2000from
issue-21-ltdb
Open

wcurrangroome wants to merge 1 commit into
issue-22-geocorr-2000from
issue-21-ltdb

Conversation

@wcurrangroome

Copy link
Copy Markdown
Collaborator

Closes #21. Stacked on the Geocorr 2000 PR (#22's branch); review #23 and that one first.

What this changes

  • The Longitudinal Tract Database (LTDB, Brown University) now serves tract 2010 → tract 2000. NHGIS publishes no crosswalk with 2000 as the target year.
  • NHGIS is still used for every pair it publishes. LTDB is the least preferred source for year-to-year steps, so later years chain automatically. For example, tract 2020 → 2000 runs NHGIS 2020 → 2010, then LTDB 2010 → 2000.
  • Combined with Geocorr 2000 from the previous PR, a request that also changes geography is planned as two steps. For example, 2010 tracts → 2000 PUMAs runs LTDB 2010 → 2000 tracts, then Geocorr 2000 tracts → PUMAs.
  • get_ltdb_crosswalk():
    • downloads the LTDB file, which needs no registration (about 1 MB);
    • reads it with haven;
    • renames its columns to the package's standard columns;
    • checks that each tract's allocation factors sum to 1;
    • caches the result.
  • LTDB has one weight, which combines land area and block population. Requests for any other weight stop with an error before anything is downloaded.
  • Users are told how to cite LTDB in the same places and the same way as NHGIS:
    • a message each time a crosswalk is returned, including reads from the cache;
    • the crosswalk_metadata fields;
    • the README "Citations" section.
  • The message links LTDB's downloads page, where LTDB states its citation request. The US2010 Project address that LTDB gives no longer loads, so the README and metadata name the page's current address.
  • Adds haven and its dependency forcats to DESCRIPTION and renv.lock.

Decisions

  • LTDB is not offered as an alternative to NHGIS for 2020 → 2010. LTDB's 2020 file maps blocks to tracts using only land-area weights.
  • Download when requested and cache locally; LTDB files are never shipped inside the package.

Known limitation

Geocorr 2000's population-weighted output leaves out tracts that had no population in 2000. LTDB includes them. In the 2010 tract → 2000 PUMA chain, 123 of LTDB's 65,274 tract IDs for 2000 are missing from Geocorr 2000's list. As a result, 144 of 72,531 tracts from 2010 lose some or all of their allocation at step 2 (161 rows, with allocation factors summing to 34.9). Only chains that use LTDB and then Geocorr 2000 are affected.

Testing

  • test-get_ltdb_crosswalk.R: 14 tests, 0 failed, 2 skipped. Skipped: the slow tests without CROSSWALK_RUN_SLOW_TESTS, and the 2020 → 2000 chain, which needs IPUMS_API_KEY. The agent ran the real-download test with slow tests on and it passed.
  • On this branch, which contains all three PRs: the weights, LTDB, Geocorr 2000, Geocorr 2018, planner, available-crosswalks and silent-mode test files all report 0 failed.
  • Live check of the 2010 tract → 2000 PUMA chain: it returns 2,071 PUMAs, with the coverage gap described above.

🤖 Generated with Claude Code

The Longitudinal Tract Database (LTDB, Brown University) now serves
tract 2010 -> tract 2000, which NHGIS does not publish. The planner adds
LTDB as the least preferred source for year-to-year steps, so later
years chain automatically (e.g., tract 2020 -> 2000 runs NHGIS
2020 -> 2010, then LTDB 2010 -> 2000).

- get_ltdb_crosswalk() downloads the LTDB file (no registration needed),
  reads it with haven, renames its columns to the package's standard
  columns, checks that each tract's allocation factors sum to 1, and
  caches the result.
- LTDB has one weight, which combines land area and block population.
  Requests for any other weight stop with an error before downloading.
- Users are told how to cite LTDB in the same places and the same way as
  for NHGIS: a message each time a crosswalk is returned, the
  crosswalk_metadata fields, and the README.
- Adds haven (and its dependency forcats) to DESCRIPTION and renv.lock.

Closes #21

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