-
Notifications
You must be signed in to change notification settings - Fork 5
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
update: psych extract #283
base: master
Are you sure you want to change the base?
Conversation
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you all of this new code, it's a lot!! Couldn't find anything that needed fixing upon first glance and we'll see how it goes in production
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Ty for doing these!! The Arkansas approach makes sense, I'll make an issue for our future selves so we don't forget! Also, the Virginia one is a doozy, very impressed with that.
One issue with North Carolina, but otherwise lgtm!
north_carolina_psychiatric_extract <- function(x){ | ||
x | ||
main_mat <- x[[1]][[1]] | ||
|
||
comb_df <- bind_rows(lapply(x, function(z){ | ||
main_mat <- z[[1]] | ||
first_name <- unlist(main_mat[1,]) | ||
first_name[which(first_name != "")-1] <- unname( | ||
first_name[which(first_name != "")]) | ||
second_name <- unlist(main_mat[2,]) %>% | ||
{ifelse(. == "Cases", "Confirmed", .)} %>% | ||
str_remove_all("\\*") | ||
|
||
names(main_mat) <- str_c(first_name, second_name, sep = ".") %>% | ||
str_replace(".Facility", "Facility") | ||
|
||
main_mat[3:nrow(main_mat),] %>% | ||
as_tibble() | ||
})) |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Hmm I think something is happening here where the actual Resident Deaths are being assigned to .Deaths
(which gets dropped in the validate()
and then the column called Residents.Deaths
is just NAs and 0s.
Added 4 new scrapers. Wrote up what a potential scraper looks like for Arkansas and I think we should keep collecting the raw file however the data in the file includes more than just Psychiatric facilities and overlaps with prisons and jails. Additionally, the facility level data that is reported is inconsistent and I think we should just pull that data manually at the end of the project. The CA staff psychiatric data is no longer needed as that data is grabbed in the the main ca psychiatric scraper.