Closed ljwoodley closed 8 months ago
Would mirror_data_to_redcap_project
be an upsert, overwrite or append? Trying to determine how best to create the record_id
.
Should we account for all these validation types?
date_dmy,
date_mdy,
date_ymd,
datetime_dmy,
datetime_mdy,
datetime_ymd,
datetime_seconds_dmy,
datetime_seconds_mdy,
datetime_seconds_ymd,
email,
integer,
alpha_only,
mrn_generic,
number,
number_1dp,
number_2dp,
number_3dp,
number_4dp,
phone,
ssn,
time_hh_mm_ss,
time, time_mm_ss,
zipcode
@pbchase
- Would
mirror_data_to_redcap_project
be an upsert, overwrite or append? Trying to determine how best to create therecord_id
.
You may assume that every mirrored table has a PK (aka record_id) and that every write event to that table you are mirroring into REDCap has that PK field in it.
2. Should we account for all these validation types?
date_dmy, date_mdy, date_ymd, datetime_dmy, datetime_mdy, datetime_ymd, datetime_seconds_dmy, datetime_seconds_mdy, datetime_seconds_ymd, email, integer, alpha_only, mrn_generic, number, number_1dp, number_2dp, number_3dp, number_4dp, phone, ssn, time_hh_mm_ss, time, time_mm_ss, zipcode
Please support these validations:
datetime_seconds_ymd
.datetime_ymd
.email
.number
.Everything else should probably be invalidated text. I say this, because REDCap is willing to do special things with columns if they are these types. The other column types are more to control data entry. I don't plan on any data entry for these forms, so there is no point in the additional complexity.
We need to mirror dataframes into REDCap.
Spec for
mirror_data_to_redcap_project
mirror_data_to_redcap_project
take a single parameter,table_name
<table_name>_pid
.CREDENTIALS_DB
.CREDENTIALS_DB
for the REDCap API credentials for the current user in the PID pointed to by the value of<table_name>_pid
.REDCapR::redcap_write()
Spec for
dataframe_to_redcap_dictionary
If we can't find one in another R package, we should write a helper function named something like
dataframe_to_redcap_dictionary
. The function should output a CSV we can import into an empty REDCap project so that we could write the data of that dataframe into that project. The function should do these things:field_name
form_name
with a value oftable_name
section_header
with a value ofas.character(NA)
field_type
with a value of "text"field_label
select_choices_or_calculations
with a value ofas.character(NA)
field_note
with a value ofas.character(NA)
If we do this, make this function part of REDCap Custodian.
For reference, see https://github.com/kamclean/collaborator/blob/master/R/data_dict.R which generates a different data dictionary despite being in a redcap-centric package. :-(
This issue was moved from https://github.com/ctsit/rcc.billing/issues/174