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

🐛 Fix coltypes for projects with dags #472

Merged
merged 9 commits into from
Apr 18, 2023
3 changes: 2 additions & 1 deletion R/redcap-metadata-coltypes.R
Original file line number Diff line number Diff line change
Expand Up @@ -380,7 +380,8 @@ redcap_metadata_internal <- function(
dplyr::mutate(
response =
dplyr::case_when(
autonumber & !dags ~ paste0("col_integer()" , "~~record_autonumbering is enabled for a project without DAGs"),
dags ~ paste0("col_character()" , "~~DAGs are enabled for the project"),
Copy link
Member

Choose a reason for hiding this comment

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

Sorry for so much blabbing over one line. Can you check my logic? Wouldn't it be better to change dags to autonumber & dags? Otherwise, I think it would execute for all variables in any project with dags.

Copy link
Contributor Author

Choose a reason for hiding this comment

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

No worries haha. dags will only evaluate to TRUE when the field is the .record_id field AND the project has DAGs (similar to how autonumber already works

https://github.com/pwildenhain/REDCapR/blob/ef2171960807ede2136172e59b866953b7928666/R/redcap-metadata-coltypes.R#L375-L379

autonumber & !dags ~ paste0("col_integer()" , "~~record_autonumbering is enabled and DAGs are disabled for the project"),
field_type == "event_name" ~ paste0("col_character()" , "~~longitudinal event_name"),
field_type == "repeat_instrument" ~ paste0("col_character()" , "~~repeat_instrument"),
field_type == "repeat_instance" ~ paste0("col_integer()" , "~~repeat_instance"),
Expand Down