redcap import record - part-cw/lambdanative GitHub Wiki
(redcap-import-record host token record data . xargs)
redcap-import-record imports a record into REDCap.
| Parameter | Description |
|---|---|
| host | Server hostname |
| token | Authentication token (project and user specific!) |
| record | Record primary id, e.g. study_id or participant_id |
| data | list of lists with data to be imported |
| xargs | Optional parameters; see below |
Optional parameters must come in pairs of 'symbol "string".
| Optional Parameter | Description |
|---|---|
| 'event "[event]" | Sets the event for the record in longitudinal projects. |
| 'instrument "[instr]" | Sets the instrument for the record in projects with repeatable instruments. The instance parameters must also be present. |
| 'instance "[instn]" | Sets the instance for the record in projects with repeatable instruments or events. |
| 'type "[type]" | Declares the format of the data parameter. "[type]" may be "eav" (one data point per row) or "flat" (one record per row). Default is "eav". |
| 'overwrite "[over]" | Declares the overwrite behaviour for blank or empty values. "[over]" may be "normal" (no overwriting) or "overwrite". Default is "overwrite". |
Example
Example 1: Importing records to a project, where the first study is longitudinal and has an event_1_arm_1 event.
> (define redcap:token "54CC....CC10")
> (define redcap:hostname "redcap.INSTITUTIONNAME.ca")
> (redcap-import-record redcap:hostname redcap:token
"1" (list (list "study_id" "1")
(list "comments" (number->string ##now))
(list "last_name" "Smith") (list "first_name" "John"))
'event "event_1_arm_1")
#t
> (redcap-import-record redcap:hostname redcap:token
"2" (list (list "test2" "Jones")))
#t