Skip to content

Commit

Permalink
todo: add TODO comments
Browse files Browse the repository at this point in the history
  • Loading branch information
rossellhayes committed Dec 8, 2023
1 parent 4ff2f0f commit 7be05c0
Show file tree
Hide file tree
Showing 4 changed files with 14 additions and 0 deletions.
5 changes: 5 additions & 0 deletions R/census_helper_v2.R
Original file line number Diff line number Diff line change
Expand Up @@ -160,6 +160,7 @@ census_helper_new <- function(
state_must_be_downloaded <- toDownload ||
is.null(census.data[[state]]) ||
census.data[[state]]$year != year ||
# TODO: Why do we always redownload if sex or age == TRUE?
census.data[[state]]$age != FALSE ||
census.data[[state]]$sex != FALSE

Expand All @@ -174,6 +175,10 @@ census_helper_new <- function(

## Calculate Pr(Geolocation | Race)
if (any(c("P2_005N", "P005003") %in% names(census))) {
# TODO: Add message that they're using a legacy data source
# TODO: Add test that we get the same ratios with legacy and new tables for 2020
# Old table: Redistricting (Pl-some numbers) (does not have age, sex, or ZCTAs)
# New table: DHC (does have age, sex, and ZCTA)
vars_ <- census_geo_api_names_legacy(year = year)
} else {
vars_ <- census_geo_api_names(year)
Expand Down
4 changes: 4 additions & 0 deletions README.Rmd
Original file line number Diff line number Diff line change
Expand Up @@ -210,6 +210,10 @@ future::plan(future.callr::callr)
# ...
```

```{comment}
Add guidance for starting a new analysis vs. replicating a previous analysis
```

## Census Data

This package uses the Census Bureau Data API but is not endorsed or certified by the Census Bureau.
Expand Down
3 changes: 3 additions & 0 deletions tests/testthat/test-census_geo_api.R
Original file line number Diff line number Diff line change
@@ -1,6 +1,9 @@
skip_if_not(nzchar(Sys.getenv("CENSUS_API_KEY")))

test_that("snapshot", {
# TODO: Test that sub-geographies sum to match pooled geographies (e.g. blocks sum to block groups, sum to tracts, sum to counties)
# TODO: Test that age/sex subsets sum to race totals

# These snapshots were generated using the calculations in v2.0.0
# and verified that the calculations resulted in the same numbers for PR #120.
expect_snapshot_value(
Expand Down
2 changes: 2 additions & 0 deletions tests/testthat/test-census_geo_api_names.R
Original file line number Diff line number Diff line change
@@ -1,4 +1,6 @@
test_that("census_geo_api_names() for 2020", {
# TODO: Verify against table names here: https://api.census.gov/data/2020/dec/dhc/variables.html

expect_equal(
census_geo_api_names("2020"),
list(
Expand Down

0 comments on commit 7be05c0

Please sign in to comment.