Merged
Conversation
- chi_race_7 is no longer in rads.data::misc_chi_byvars - replaced it with race4 in the test helper file and test-chi_calc() - confirmed now passes all tests
Critical fix to update to latest CHI standards
- based heavily on rads::suppress - main improvement is that it suppresses on denominators (not just numerators) - also add caution when numerator == 0 - more validation - more customizable arguments, but defaults are for CHI output - many more tests - passes all tests without errors or warnings in devtools::check()
- gets latest version from main on GitHub - get local version - compares and gives notice if you're behind - passes all tests
fucntion to check if latest version installed
- added to the columns_to_suppress default - no other changes needed because validation of columns_to_suppress already notifies of missing columns and will remove from columns_to_suppress
- gets latest version from main on GitHub - get local version - compares and gives notice if you're behind - passes all tests
- Implements request batching to minimize get_population database calls by consolidating similar queries -- this can save substantial amounts of time - Adds `is_chars` parameter to support CHARS data processing where King County is defined by ZIP codes beginning with #980 | #981 - Refactor code into modular helper functions for maintenance and troubleshooting - Fixes issue in process_template_row() function parameter reference - Fixed assign_geographic_crosswalks() helper function which did not have catvarname passed as a parameter and was looking for it in the wrong scope. This fix allowed for the output of pov200grp (which is defined by zip or block) - Fixed error for 'race' where it looked for 'Race/ethnicity' for the cat#_group but it shoudl have looked for 'Race/Ethnicity' (capitalization matters!) - Output structure is identical to previous verison of the function
chi_suppress_results created
- separate helper functions into a distinct file - pass only necessary subset of population data to process_template_row() to avoid memory problems - allow for sequential processing if future plan not set - improved helpfile with example of how to set-up futures - tested successfully with Ron's death ETL
- implemented for rads.data and requested by Daniel for rads, so adding to apde.chi.tools for consistency
- updated from rads::suppress to apde.chi.tools::chi_suppress_results - specify definitions of values when have NA or zero for numerator and or denominator
Refactored `chi_get_proper_pop` - faster due to batching population pulls from SQL and post-processing for each row of pop.template - improved memory management when using future_lapply (dividing and saving population data rather than passing one huge reference file) - improved helpfile, with description of how to set up future plan - tested with death, chars, and birth data Fixed `chi_calc()` - Correctly ascribe SE and RSE when numerator or denominator is zero or NA - call on `chi_suppress_results()` rather than `rads::suppress()`
abstract check for latest version to a function
- now gives a warning and drops rows outside of the available range
- added qs to imports - changed .() to list() in chi_get_proper_pop()
chi_calc validation & address devtools::check
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
New
chi_suppress_results()- applies primary and secondary suppressioncheck_version()- checks if you have the latest version installed. Autochecks when attaching library.Improvements
chi_calc()- validate analysis years requested by ph.instructions compared to available chi_years in ph.datachi_calc()- correct values for SE and RSE when numerator and or denominare are zero or NAchi_get_proper_pop()- optimize to run faster by batching pulls from rads::get_population.chi_get_proper_pop()- addis_charsparamater to allow for differnt definition of King County for CHARS analyseschi_get_proper_pop()- fixed assign_geographic_crosswalk helper function (catvarname was not passed but was expected)chi_get_proper_pop()- Fixed small bug for race/ethnicity (capitalization matters)