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

feat: ✨ add include_podiatrist_services() with tests #182

Merged
merged 24 commits into from
Feb 7, 2025

Conversation

signekb
Copy link
Contributor

@signekb signekb commented Dec 20, 2024

Description

This PR adds:

  • The logic for podiatrist services to algorithm.csv
  • Theinclude_podiatrsit_services() function
  • A helper function for converting the honuge variable to a date (yyww_to_yyyymmdd()) + tests for this function
  • The lubridate package to our dependencies (needed for handling the date conversion)

I also reran the pipeline to include the podiatrist services logic.

Closes #90

Checklist

  • Ran just run-all (did not run this)

R/yyww-to-date.R Outdated
Copy link
Contributor Author

Choose a reason for hiding this comment

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

This whole thing feels a bit hacky. Let me know if this isn't clear or you have another idea of how to do this.

Copy link
Member

@lwjohnst86 lwjohnst86 left a comment

Choose a reason for hiding this comment

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

Nice! Some suggestions.

Copy link
Member

Choose a reason for hiding this comment

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

I think we should add this file to the git ignore, doesn't add anything of value to the git repo.

@@ -0,0 +1,28 @@
test_that("conversion works when 01-01 is Monday in week 1", {
Copy link
Member

Choose a reason for hiding this comment

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

I don't understand this message when compared to what is tested. What does 01-01 mean?

expect_equal(yyww_to_yyyymmdd("2439"), lubridate::ymd("2024-09-23"))
})

test_that("conversion works when 01-01 is Friday in week 52 of the prior year", {
Copy link
Member

Choose a reason for hiding this comment

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

Same as above.

expect_equal(yyww_to_yyyymmdd("9307"), lubridate::ymd("1993-02-15"))
})

test_that("conversion works for week 53", {
Copy link
Member

Choose a reason for hiding this comment

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

Could you add another test for when week number is 00 or 01?

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 work! I only have one minor suggestion.

Copy link
Member

@lwjohnst86 lwjohnst86 left a comment

Choose a reason for hiding this comment

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

I made some changes, mostly around documentation/comments. But I figured out the issue with the Arrow test failing.

Comment on lines +32 to +34
# Calculate the first day of the ISO year, which is when the first week
# has most of the week days in it (4th of January, or the first Thursday).
# See: https://en.wikipedia.org/wiki/ISO_week_date
Copy link
Member

Choose a reason for hiding this comment

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

Added some clarification comments, since it confused me what the code was actually doing.

Comment on lines +43 to +46
dplyr::mutate(
speciale = as.character(.data$speciale),
barnmak = as.integer(.data$barnmak)
) |>
Copy link
Member

Choose a reason for hiding this comment

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

Arrow needed this forcing to be character/integer in order for the filtering to work correctly.

#Conflicts:
#	R/sysdata.rda
#	_targets/meta/meta
@lwjohnst86 lwjohnst86 merged commit e068e16 into main Feb 7, 2025
1 check passed
@lwjohnst86 lwjohnst86 deleted the feat/include-podiatrist-services branch February 7, 2025 10:27
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Development

Successfully merging this pull request may close these issues.

Create function include_podiatrist_services()
3 participants