-
Notifications
You must be signed in to change notification settings - Fork 3
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Bill for some support requests without project IDs #257
Remove filters that require a PID in get_service_request_lines(). Use probono_reason to exclude some PID-less service requests. Add months_previous parameter to get_service_request_lines() to simplify testing. Add comments to get_service_request_lines() to improve readability. Add detail to docs for get_service_request_lines(). Update test data and add tests for get_service_request_lines(). Update test data for get_service_request_line_items(). Fix documentation with bad cross-references. Fix package dependencies.
- Loading branch information
Showing
19 changed files
with
148 additions
and
52 deletions.
There are no files selected for viewing
This file contains 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
This file contains 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
This file contains 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
This file contains 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
This file contains 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
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
Binary file modified
BIN
+1.33 KB
(120%)
tests/testthat/get_service_request_line_items/invoice_line_item.rds
Binary file not shown.
This file contains 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
Binary file modified
BIN
-82 Bytes
(97%)
tests/testthat/get_service_request_line_items/redcap_entity_project_ownership.rds
Binary file not shown.
Binary file modified
BIN
+504 Bytes
(100%)
tests/testthat/get_service_request_line_items/redcap_projects.rds
Binary file not shown.
Binary file modified
BIN
+49 KB
(100%)
tests/testthat/get_service_request_line_items/redcap_user_information.rds
Binary file not shown.
Binary file modified
BIN
+116 Bytes
(100%)
tests/testthat/get_service_request_line_items/service_requests.rds
Binary file not shown.
This file contains 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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -7,7 +7,20 @@ library(rcc.billing) | |
load_dot_env("prod.env") | ||
source_credentials <- get_redcap_credentials(Sys.getenv("REDCAP_SERVICE_REQUEST_PID")) | ||
|
||
record_ids <- c(3, 6267, 6436, 6445,6473, 6469) | ||
record_ids <- c( | ||
3, # A very old request that has no billable rate | ||
6267, # a record with responses that span two months | ||
6436, # a non-billable record | ||
6445, # a non-billable record | ||
6473, # a record we will choose to make billable in a mutate below | ||
6469, # a record we will choose to make billable in a mutate below | ||
7057, # A manually-marked non-billable record with no project ID. | ||
# Records without project IDs that have been manually marked as | ||
# probono are ignored instead of marked as billable. The number of | ||
# probono records created would be a non-revenue generating burden | ||
# on fiscal staff. | ||
7093 # A billable record with no project ID. | ||
) | ||
|
||
read_service_requests <- redcap_read( | ||
redcap_uri = source_credentials$redcap_uri, | ||
|
@@ -17,7 +30,11 @@ read_service_requests <- redcap_read( | |
)$data | ||
|
||
service_requests <- read_service_requests |> | ||
# filter for only the requests we are testing | ||
filter(record_id %in% record_ids) |> | ||
# filter for only the responses we are testing (Because we'll | ||
# be adding data to record 7093 for years) | ||
filter(is.na(start_date) | start_date <= ymd("2024-12-18")) |> | ||
select( | ||
record_id, | ||
redcap_repeat_instrument, | ||
|
@@ -33,11 +50,13 @@ service_requests <- read_service_requests |> | |
redcap_username, | ||
gatorlink, | ||
billable_rate, | ||
probono_reason, | ||
time2, | ||
time_more, | ||
mtg_scheduled_yn, | ||
meeting_date_time, | ||
date_of_work, | ||
start_date, | ||
end_date, | ||
response, | ||
comments, | ||
|
@@ -46,17 +65,27 @@ service_requests <- read_service_requests |> | |
fiscal_contact_email, | ||
help_desk_response_complete | ||
) |> | ||
# de-identify the person and study identifiers | ||
mutate( | ||
irb_number = if_else(!is.na(irb_number), "123", irb_number), | ||
pi = if_else(!is.na(pi), "Dr. Bogus PI", pi), | ||
last_name = if_else(!is.na(last_name), "l_name", last_name), | ||
first_name = if_else(!is.na(first_name), "f_name", first_name), | ||
pi_email = if_else(!is.na(pi_email), "[email protected]", pi_email), | ||
email = if_else(!is.na(email), "[email protected]", email), | ||
redcap_username = if_else(!is.na(redcap_username), "bogus_rc_username", redcap_username), | ||
gatorlink= if_else(!is.na(gatorlink), "bogus_gatorlink", gatorlink), | ||
gatorlink = if_else(!is.na(gatorlink), "bogus_gatorlink", gatorlink), | ||
response = if_else(!is.na(response), "fake response", response), | ||
comments = if_else(!is.na(comments), "fake comment", comments)) | ||
comments = if_else(!is.na(comments), "fake comment", comments) | ||
) |> | ||
# de-identify more person identifiers | ||
mutate( | ||
across(c("last_name", "fiscal_contact_ln"), ~ if_else(!is.na(.), "l_name", .)), | ||
across(c("first_name", "fiscal_contact_fn"), ~ if_else(!is.na(.), "f_name", .)), | ||
across(c("pi_email"), ~ if_else(!is.na(.), "[email protected]", .)), | ||
across(c("email", "fiscal_contact_email"), ~ if_else(!is.na(.), "[email protected]", .)) | ||
) |> | ||
# make a few more rows billable | ||
mutate( | ||
billable_rate = if_else(record_id %in% c(6473, 6469) & !is.na(redcap_repeat_instrument), 130, billable_rate) | ||
) | ||
|
||
saveRDS( | ||
service_requests, | ||
testthat::test_path( | ||
|
Binary file modified
BIN
+186 Bytes
(120%)
tests/testthat/get_service_request_lines/service_requests.rds
Binary file not shown.
Oops, something went wrong.