Skip to content

Commit

Permalink
check for ram; year arg optional (#23)
Browse files Browse the repository at this point in the history
  • Loading branch information
erikarasnick authored Apr 18, 2022
1 parent 39e57fd commit a664ac3
Show file tree
Hide file tree
Showing 12 changed files with 12 additions and 8 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/build-deploy-pr.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
docker build -t ${{ env.container }} .
- name: test run container
run: |
docker run --rm -v "${PWD}/test":/tmp ${{ env.container }} my_address_file_geocoded.csv 2010
docker run --rm -v "${PWD}/test":/tmp ${{ env.container }} my_address_file_geocoded.csv
docker run --rm -v "${PWD}/test":/tmp ${{ env.container }} my_address_file_geocoded.csv 2000
docker run --rm -v "${PWD}/test":/tmp ${{ env.container }} my_address_file_geocoded.csv 1990
docker run --rm -v "${PWD}/test":/tmp ${{ env.container }} my_address_file_geocoded.csv 1980
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/build-deploy-release.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@ jobs:
docker build -t ${{ env.container }} .
- name: test container
run: |
docker run --rm -v "${PWD}/test":/tmp ${{ env.container }} my_address_file_geocoded.csv 2010
docker run --rm -v "${PWD}/test":/tmp ${{ env.container }} my_address_file_geocoded.csv
docker run --rm -v "${PWD}/test":/tmp ${{ env.container }} my_address_file_geocoded.csv 2000
docker run --rm -v "${PWD}/test":/tmp ${{ env.container }} my_address_file_geocoded.csv 1990
docker run --rm -v "${PWD}/test":/tmp ${{ env.container }} my_address_file_geocoded.csv 1980
Expand Down
2 changes: 1 addition & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ FROM rocker/r-ver:4.0.4

# DeGAUSS container metadata
ENV degauss_name="census_block_group"
ENV degauss_version="0.5.0"
ENV degauss_version="0.5.1"
ENV degauss_description="census block group and tract"
ENV degauss_argument="census year [default: 2010]"

Expand Down
2 changes: 1 addition & 1 deletion Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@ build:

test:
docker run --rm -v "${PWD}/test":/tmp census_block_group my_address_file_geocoded.csv 2020
docker run --rm -v "${PWD}/test":/tmp census_block_group my_address_file_geocoded.csv 2010
docker run --rm -v "${PWD}/test":/tmp census_block_group my_address_file_geocoded.csv
docker run --rm -v "${PWD}/test":/tmp census_block_group my_address_file_geocoded.csv 2000
docker run --rm -v "${PWD}/test":/tmp census_block_group my_address_file_geocoded.csv 1990
docker run --rm -v "${PWD}/test":/tmp census_block_group my_address_file_geocoded.csv 1980
Expand Down
6 changes: 3 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -8,10 +8,10 @@
If `my_address_file_geocoded.csv` is a file in the current working directory with coordinate columns named `lat` and `lon`, then the [DeGAUSS command](https://degauss.org/using_degauss.html#DeGAUSS_Commands):

```sh
docker run --rm -v $PWD:/tmp ghcr.io/degauss-org/census_block_group:0.5.0 my_address_file_geocoded.csv
docker run --rm -v $PWD:/tmp ghcr.io/degauss-org/census_block_group:0.5.1 my_address_file_geocoded.csv
```

will produce `my_address_file_geocoded_census_block_group_0.5.0_2010.csv` with added columns:
will produce `my_address_file_geocoded_census_block_group_0.5.1_2010.csv` with added columns:

- **`fips_block_group_id_2010`**: identifier for 2010 block group
- **`fips_tract_id_2010`**: identifier for 2010 tract
Expand All @@ -24,7 +24,7 @@ The default census year is 2010, but can be changed by supplying an optional arg
docker run --rm -v $PWD:/tmp ghcr.io/degauss-org/census_block_group:0.5.0 my_address_file_geocoded.csv 1990
```

will produce `my_address_file_geocoded_census_block_group_0.5.0_1990.csv`, with columns called **`fips_block_group_id_1990`** and **`fips_tract_id_1990`**.
will produce `my_address_file_geocoded_census_block_group_0.5.1_1990.csv`, with columns called **`fips_block_group_id_1990`** and **`fips_tract_id_1990`**.

Available years for census block group and census tract identifiers include 1990, 2000, 2010, and 2020. Additionally, tracts identifiers are available for 1970 and 1980.

Expand Down
6 changes: 5 additions & 1 deletion entrypoint.R
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ withr::with_message_sink("/dev/null", library(sf))

doc <- "
Usage:
entrypoint.R <filename> <census_year>
entrypoint.R <filename> [<census_year>]
"

opt <- docopt::docopt(doc)
Expand All @@ -22,6 +22,10 @@ if (is.null(opt$census_year)) {
cli::cli_alert("No census year provided. Using 2010.")
}

if(opt$census_year == 2010 | opt$census_year == 2020) {
dht::check_ram(5)
}

if(! opt$census_year %in% c('2020', '2010', '2000', '1990', '1980', '1970')) {
cli::cli_alert_danger('Available census geographies include years 1970, 1980, 1990, 2000, 2010, and 2020.')
stop()
Expand Down

0 comments on commit a664ac3

Please sign in to comment.