REDCap interface

Matlab REDCap interface with basic commands to read and write data. The user needs proper token and user rights to a REDCap server.
41 Downloads
Aktualisiert 23. Apr 2025

Lizenz anzeigen

REDCap interface
Oliver D. Kripfgans, University of Michigan, 2019-2025
General notes
  1. The user needs an API token to communicate with REDCap server. Inquire with your administrator about obtaining a token.
  2. The user needs to have proper User Rights within the Project, such as 'Data Export Tool' ('Full Data Set'), 'API' ('Export', 'Import')
  3. The user may have to be on the database network or via VPN
  4. Read the examples provided, the REDCap manual and use the API playground. REDCap is very useful but under reported via google etc
REDCap.m Inputs
  • 'arm' - cell array list of all arms available
  • 'event' - cell array list of all events available, per arm
  • 'exportfieldnames' - provides a table with fieldnames used for export
  • 'filename' - returns the filename of a file associated with a field
  • 'generateNextRecordName' - number of next record (when generated)
  • 'init' - sets up token, url, etc.
  • 'read' - reads records, fields, files, etc. Reading a field provides the field content. Reading a file requires a pathname underwhich the file is to be stored. On macOS (and Unix) the path can be for example: '~/Downloads'. On Windows 10 the path can for exmaple be: 'C:\Users\--username--\Downloads'.
  • 'report' - cell array list of specified report, very useful way to extract large data amount
  • 'write' - writes records, fields, files, etc. to REDCap. The maximum file size may vary. In the present setup it is ~35 MB per file. Writing a field requires the field content in exactly the format specified within REDCap! Writing a file requires a pathname from which the file is read from. Successful write replies with a '{"count": 1}', indicating that one content was written.
REDCap.m Outputs
Errors within REDCap.m are reported as:
  • 0 : normal execution, no error
  • -1.2: malformed input arguments to REDCap.m
  • -1.3: too few arguments
  • -1.4: unknown command
  • -1.5: URL for REDCap server not declared
  • -1.6: token not declared
Errors within redcap server/database are reported as: '{"error":"....error description ...."}'
Compatibility/Requirements
Requires system/unix calls for curl etc. as well as the webwrite command (and weboptions).
Acknowledgements
REDCap Database software from Vanderbilt University (https://redcap.vanderbilt.edu).
Currently REDCap 11.4.3 - © 2021 Vanderbilt University.
Built on the basis of exmaple code for other, non-Matlab, code, provided by REDCap examples.

Zitieren als

Oliver_Kripfgans (2025). REDCap interface (https://de.mathworks.com/matlabcentral/fileexchange/101809-redcap-interface), MATLAB Central File Exchange. Abgerufen.

Kompatibilität der MATLAB-Version
Erstellt mit R2021b
Kompatibel mit R2021b bis R2023b
Plattform-Kompatibilität
Windows macOS Linux
Tags Tags hinzufügen

Community Treasure Hunt

Find the treasures in MATLAB Central and discover how the community can help you!

Start Hunting!
Version Veröffentlicht Versionshinweise
1.2.2

updated write function as well to contain a full path with space characters

1.2.1

Fixed issue with download files with spaces (' ') in their filenames.

1.2.0

Incorporate missing 'odd' function

1.1.0

Edits to 'write' function to overcome reported writing errors

1.0.0