ThomUK / SPCreporter

Creates Metric Reports using Statistical Process Control in the NHS style
https://thomuk.github.io/SPCreporter/
Other
6 stars 2 forks source link

Issue 117 #118

Closed francisbarton closed 1 day ago

francisbarton commented 8 months ago

@ThomUK please review this PR.

This addresses issue #117 (both the issue with get_updatedto_text() and with align_rebase_dates())

This PR enables these functions to handle dttm input by using an as.Date() step. This in turn reinstates the previously functional behaviour of lubridate::ceiling_date() (bump to start of next period) and the date-matching process in the rebase date function. These were not set up to handle dttms.

I have added some tests for get_updatedto_text() which document its expected behaviour, and have added in some assertion checks and slightly tidied up (perhaps) the case_when process. The use of "week.start = 1" (Monday) is made slightly more explicit using a withr::with_options() frame at the top of the case_when. (We don't have to do this - can be moved back to a line in case_when for agg == "week").

Tests for align_rebase_dates() have not yet been written.

Please confirm that you have: