ctsit / rcc.billing

Automated, data-driven service billing implemented on REDCap Custodian
https://ctsit.github.io/rcc.billing/
Apache License 2.0
0 stars 3 forks source link

Limit scope of projects effected by `cleanup_project_ownership_table.R` and cron it #52

Closed pbchase closed 2 years ago

pbchase commented 2 years ago

We need to limit scope of projects effected by cleanup_project_ownership_table.R to give us more time to correct email addresses. We need to limit it to change ownership of projects with a birthday in the current month. This can probably be done by adding a filter to the end of https://github.com/ctsit/rcc.billing/blob/c99da3da38b67f330bdee378f58610b691c39518/etl/cleanup_project_ownership_table.R#L34

The new code might instead read:

redcap_projects_needing_correction <- redcap_projects %>%
  filter(project_id %in% projects_with_ownership_issues) %>%
  filter(get_script_run_time() - creation_time > years(1)) %>%
  filter(month(get_script_run_time()) == month(creation_time))

We also need to schedule this job to run on a regular basis. Please also add a cron entry to run etl/cleanup_project_ownership_table.R daily at 00:47 a.m. I time I chose just because. :-)

pbchase commented 2 years ago

Addressed by PR #53