Skip to content

Commit

Permalink
Merge pull request #70 from getwilds/test
Browse files Browse the repository at this point in the history
Test
  • Loading branch information
realbp authored Mar 11, 2024
2 parents d9bf492 + 70266f6 commit c3ff69e
Show file tree
Hide file tree
Showing 27 changed files with 89 additions and 262 deletions.
3 changes: 0 additions & 3 deletions NAMESPACE
Original file line number Diff line number Diff line change
Expand Up @@ -27,17 +27,14 @@ importFrom(dplyr,filter)
importFrom(dplyr,mutate)
importFrom(dplyr,mutate_all)
importFrom(dplyr,na_if)
importFrom(dplyr,rename)
importFrom(httr2,req_perform)
importFrom(httr2,req_url_query)
importFrom(httr2,request)
importFrom(httr2,resp_body_string)
importFrom(magrittr,"%>%")
importFrom(rlang,":=")
importFrom(rlang,is_na)
importFrom(rlang,sym)
importFrom(stats,setNames)
importFrom(stringr,str_pad)
importFrom(stringr,str_replace_all)
importFrom(utils,data)
importFrom(utils,read.csv)
6 changes: 6 additions & 0 deletions R/cancerprof-package.R
Original file line number Diff line number Diff line change
@@ -0,0 +1,6 @@
#' @keywords internal
"_PACKAGE"

## usethis namespace: start
## usethis namespace: end
NULL
18 changes: 9 additions & 9 deletions R/demo-crowding.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,17 +52,14 @@
#' race = "black"
#' )
#' }
#'
demo_crowding <- function(area, areatype,
crowding = "household with >1 person per room",
race) {
areatype <- tolower(areatype)
demo_crowding <- function(area, areatype, crowding, race) {

req <- create_request("demographics")

resp <- req %>%
req_url_query(
stateFIPS = fips_scp(area),
areatype = areatype,
areatype = tolower(areatype),
topic = "crowd",
demo = handle_crowding(crowding),
race = handle_race(race),
Expand All @@ -73,7 +70,7 @@ demo_crowding <- function(area, areatype,
) %>%
req_perform()

resp <- process_response(resp)
resp <- process_resp(resp, "demographics")

areatype_map <- c(
"county" = "County", "hsa" = "Health_Service_Area",
Expand All @@ -86,8 +83,11 @@ demo_crowding <- function(area, areatype,

resp %>%
setNames(c(
areatype_title, areacode_title, "Percent",
"Households", "Rank"
areatype_title,
areacode_title,
"Percent",
"Households",
"Rank"
)) %>%
mutate(across(c("Percent", "Households"), \(x) as.numeric(x)))
}
2 changes: 1 addition & 1 deletion R/demo-education.R
Original file line number Diff line number Diff line change
Expand Up @@ -93,7 +93,7 @@ demo_education <- function(area, areatype, education, sex = NULL, race = NULL) {
resp <- resp %>%
req_perform()

resp <- process_response(resp)
resp <- process_resp(resp, "demographics")

areatype_map <- c(
"county" = "County",
Expand Down
2 changes: 1 addition & 1 deletion R/demo-food-access.R
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ demo_food <- function(area, areatype, food, race = NULL) {
resp <- req_draft %>%
req_perform()

resp <- process_response(resp) %>%
resp <- process_resp(resp, "demographics") %>%
mutate(Value..Percent. = as.integer(Value..Percent.))

areatype_map <- c("county" = "County", "state" = "State")
Expand Down
2 changes: 1 addition & 1 deletion R/demo-income.R
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ demo_income <- function(area, areatype, income, race) {
) %>%
req_perform()

resp <- process_response(resp) %>%
resp <- process_resp(resp, "demographics") %>%
mutate(Value..Dollars. = as.integer(Value..Dollars.))

areatype_map <- c("county" = "County", "state" = "State")
Expand Down
5 changes: 2 additions & 3 deletions R/demo-insurance.R
Original file line number Diff line number Diff line change
Expand Up @@ -89,10 +89,9 @@ demo_insurance <- function(area, areatype, insurance, sex, age, race = NULL) {
"asian non-hispanic", "hispanic (any race)"
)


req <- create_request("demographics")

if ((sex == "males" || sex == "females") & (age == "under 19 years" || age == "21 to 64 years")) {
if ((sex == "males" || sex == "females") && (age == "under 19 years" || age == "21 to 64 years")) {
cli_abort("For males and females, age CANNOT be under 19 years OR 21 to 64 years")
} else if (areatype == "state" && is.null(race)) {
cli_abort("For areatype State, Race must not be null")
Expand Down Expand Up @@ -127,7 +126,7 @@ demo_insurance <- function(area, areatype, insurance, sex, age, race = NULL) {
resp <- resp %>%
req_perform()

resp <- process_response(resp)
resp <- process_resp(resp, "demographics")

areatype_map <- c(
"county" = "County",
Expand Down
2 changes: 1 addition & 1 deletion R/demo-mobility.R
Original file line number Diff line number Diff line change
Expand Up @@ -60,7 +60,7 @@ demo_mobility <- function(area, areatype, mobility) {
) %>%
req_perform()

resp <- process_response(resp)
resp <- process_resp(resp, "demographics")

areatype_map <- c(
"county" = "County",
Expand Down
2 changes: 1 addition & 1 deletion R/demo-non-english-language.R
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ demo_language <- function(area, areatype, language) {
req_perform()


resp <- process_response(resp)
resp <- process_resp(resp, "demographics")

areatype_map <- c(
"county" = "County",
Expand Down
2 changes: 1 addition & 1 deletion R/demo-population.R
Original file line number Diff line number Diff line change
Expand Up @@ -115,7 +115,7 @@ demo_population <- function(area, areatype, population, race = NULL, sex = NULL)
resp <- resp %>%
req_perform()

resp <- process_response(resp)
resp <- process_resp(resp, "demographics")

areatype_map <- c(
"county" = "County",
Expand Down
2 changes: 1 addition & 1 deletion R/demo-poverty.R
Original file line number Diff line number Diff line change
Expand Up @@ -95,7 +95,7 @@ demo_poverty <- function(area, areatype, poverty, race = NULL, sex = NULL) {
resp <- resp %>%
req_perform()

resp <- process_response(resp)
resp <- process_resp(resp, "demographics")

areatype_map <- c(
"county" = "County",
Expand Down
2 changes: 1 addition & 1 deletion R/demo-svi.R
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ demo_svi <- function(area, svi) {
req_perform()


resp <- process_response(resp)
resp <- process_resp(resp, "demographics")

resp %>%
setNames(c("County", "FIPS", "Score"))
Expand Down
4 changes: 2 additions & 2 deletions R/demo-workforce.R
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ demo_workforce <- function(area, areatype, workforce, race, sex) {
req_url_query(
stateFIPS = fips_scp(area),
areatype = tolower(areatype),
topic = "crowd",
topic = "work",
demo = handle_workforce(workforce),
race = handle_race(race),
sex = handle_sex(sex),
Expand All @@ -74,7 +74,7 @@ demo_workforce <- function(area, areatype, workforce, race, sex) {
) %>%
req_perform()

resp <- process_response(resp)
resp <- process_resp(resp, "demographics")

areatype_map <- c(
"county" = "County",
Expand Down
2 changes: 1 addition & 1 deletion R/incidence-cancer.R
Original file line number Diff line number Diff line change
Expand Up @@ -168,7 +168,7 @@ incidence_cancer <- function(area, areatype, cancer, race, sex, age, stage, year
resp <- resp %>%
req_perform()

resp <- process_incidence(resp)
resp <- process_resp(resp, "incidence")


areatype_map <- c(
Expand Down
2 changes: 1 addition & 1 deletion R/mortality-cancer.R
Original file line number Diff line number Diff line change
Expand Up @@ -147,7 +147,7 @@ mortality_cancer <- function(area, areatype, cancer, race, sex, age, year) {
resp <- resp %>%
req_perform()

resp <- process_mortality(resp)
resp <- process_resp(resp, "mortality")

areatype_map <- c(
"county" = "County",
Expand Down
69 changes: 0 additions & 69 deletions R/process-incidence.R

This file was deleted.

69 changes: 0 additions & 69 deletions R/process-mortality.R

This file was deleted.

51 changes: 0 additions & 51 deletions R/process-screening.R

This file was deleted.

Loading

0 comments on commit c3ff69e

Please sign in to comment.