Open pbchase opened 1 week ago
delete_abandoned_projects.R needs to test the current sequestration state. As documented in issue #254, the test for sequestered_orphans is too simplistic at https://github.com/ctsit/rcc.billing/blob/4b94e38f6bacbea69e65cd7d66d6e70167624519/etl/delete_abandoned_projects.R#L37
delete_abandoned_projects.R
sequestered_orphans
That is a test for projects that were sequestered. The code should also test those projects are still sequestered.
You could fix that by adding this object
is_sequestered <- tbl(rc_conn, "redcap_projects") |> left_join(tbl(rc_conn, "redcap_entity_project_ownership"), by = c("project_id" = "pid")) |> filter(!is.na(completed_time) & sequestered == 1) |> select(project_id)|> collect() |> pull(project_id)
And using it to filter sequestered_orphans
delete_abandoned_projects.R
needs to test the current sequestration state. As documented in issue #254, the test forsequestered_orphans
is too simplistic at https://github.com/ctsit/rcc.billing/blob/4b94e38f6bacbea69e65cd7d66d6e70167624519/etl/delete_abandoned_projects.R#L37That is a test for projects that were sequestered. The code should also test those projects are still sequestered.
You could fix that by adding this object
And using it to filter
sequestered_orphans