redcap export file - part-cw/lambdanative GitHub Wiki
(redcap-export-file host token record field . xargs)
redcap-export-file
exports a file from a REDCap project.
Note: The response is either a string, in case errors are encountered, or a list with the header in the first field and the u8vector data in the second field. The filename can be retrieved from the header using (redcap-get-filename).
Parameter | Description |
---|---|
host | Server hostname |
token | Authentication token (project and user specific!) |
record | Primary id of record |
field | Field variable name for which the file to be downloaded |
xargs | Optional parameters; see below |
Optional parameters must come in pairs of 'symbol "string"
.
Optional Parameter | Description |
---|---|
'event "[event]" | Downloads from the record with the given event in longitudinal projects. |
'repeat "[repeat]" | Downloads from the record with the given instance number in projects with repeatable events. |
Examples
Example 1: Export a file from a project, filed under the field file2
, which exists in study 1 but not study 4.
> (define redcap:token "54CC....CC10")
> (define redcap:hostname "redcap.INSTITUTIONNAME.ca")
> (let ((fileout (redcap-export-file redcap:hostname redcap:token "4" "file2")))
(if (string? fileout) (display fileout))
(if (list? fileout) (display (u8vector->string (cadr fileout)))))
There is no file to download for this record
> (let ((fileout (redcap-export-file redcap:hostname redcap:token "1" "file2")))
(if (string? fileout) (display fileout))
(if (list? fileout) (display (u8vector->string (cadr fileout)))))
"Name","Color","Number"
"Sven","red",3
"Tom","green",44