Skip to content
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

refactor: ♻️ function to create LPR2 #152

Draft
wants to merge 1 commit into
base: main
Choose a base branch
from

Conversation

lwjohnst86
Copy link
Member

@lwjohnst86 lwjohnst86 commented Sep 20, 2024

Based on updates from #133.

Since there were several clarifications made about how LPR2 is created and the variables needed, I created several functions to create the needed LPR2 dataset. Draft for now, I am not done.

Copy link
Collaborator

@Aastedet Aastedet left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Awesome!

get_department <- function(x) {
dplyr::case_when(
# TODO: Include this in algorithm dataframe some how?
x == "08" ~ "endocrinology",
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

the real world data for some users may be weird if it's been converted from SAS format and changed to integer type in the process, so maybe we should make this piece of code robust to those sort of quirks? e.g. x == "08" | == 8?

# TODO: Include this in algorithm dataframe some how?
x == "08" ~ "endocrinology",
# < 8 and between 9-30
stringr::str_detect(x, "(0[0-8]|9|[1-3][0-9])") ~ "other medical"
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

also potential for data quirks here, of course.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Status: In Progress
Development

Successfully merging this pull request may close these issues.

2 participants