Search code examples
redcap

REDCap API, filter using DataAccessGroup


I have an .NET application which fetches data from REDCap API. But data is so huge, it give timeout (524). Is there option to filter using DataAccessGroups?

There is filterLogic option but when I try to do

filterLogic: [redcap_data_access_group]='1234_1234_test_v'

its not working.


Solution

  • Unfortunately, I'm not sure that we can filter via the data access group. Using the API playground, I've tried each of these

    • [redcap_data_access_group]='dag_name'
    • [redcap_data_access_group]=dag_id
    • [redcap_data_access_group]='dag_id'
    • [group_id_number]=dag_id

    Each one results in an empty response. (It's possible that the data access group is stored under a different name internally, but I don't know what that would be and don't have access to source code).

    There are a couple of options you can try.

    Batching

    You can try "batching" your calls to avoid the server time out. This is a strategy that has been employed by some of the R packages to handle this issue. Batching is done with this process

    • call the API and return only the record ID field.
    • Break the unique record IDs into groups of approximately equal size.
    • Call the API for each group, retrieving the full data set for only the records in the group.
    • Stack the data sets together

    As long as you're able to get the record IDs in a single call, this will work.

    switch your DAG

    If you, yourself, are assigned to a DAG, you should only be able to export the data for the DAG you are assigned to. You can use a combination of the 'Import User-Dag Assignment' and 'Switch DAG' methods to reassign yourself to each DAG and export the data for each one.

    Use the Report Builder If you have access to the report builder, you can build a report that filters to a single data access group. Build a report for each group and then export the reports. This is a lot of extra work and manual configuration though, and would be my least favored approach