Skip to content

[redcap] bulk importer #9808

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 30 commits into
base: 27.0-release
Choose a base branch
from

Conversation

regisoc
Copy link
Contributor

@regisoc regisoc commented May 23, 2025

Brief summary of changes

This PR adds a new tool to bulk import data from REDCap linked instances/projects.
It will be mostly useful for retrospective data, or to do targeted batch import.

Multiple caveats and todos:

  • arguments need to be defined. There are in the script for now.
  • difficult for me to test as is, I need to make some edits/overrides for ibis to actually use it (difference in instrument names between LORIS/REDCap).
  • I purposefully let some code as comments, these snippets are already tested and might be useful if we decide to wrangle on event/instruments names.
  • REDCap has a event-instrument mapping endpoint, that conveniently has the unique_event_name and the form_name . I used the LORIS corresponding class to get these two, but again, that only works if the names are exactly the same on both ends (LORIS and REDCap).
  • Participant IDs/Record IDs will also need mappings I guess if they are not clearly the same on both ends.
  • we can add restrictive arguments later.

Link(s) to related issue(s)

No related issue.

@regisoc regisoc self-assigned this May 23, 2025
@regisoc regisoc added Category: Feature PR or issue that aims to introduce a new feature State: Needs work PR awaiting additional work by the author to proceed Priority: High PR or issue should be prioritised over others for review and testing Proposal PR or issue suggesting an improvement that can be accepted, rejected or altered Language: PHP PR or issue that update PHP code Project: IBIS Issue or PR related to the IBIS project Project: C-BIG Issue or PR related to the C-BIG project Difficulty: Complex PR or issue that require a great effort to implementat, review, or test Area: Instruments PR or issue related instruments Module: redcap PR or issue related to redcap module labels May 23, 2025
Copy link
Contributor

@MaximeBICMTL MaximeBICMTL left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Thanks for tackling this work! I will do a deeper review once the PR is out of draft. Just a few small comments based on what I am seeing now.

I will quickly say that I prefer snake_case to camelCase, but this is non-blocking, and LORIS uses both namings anyway (and even some others...).

Comment on lines +463 to +465
* @return array<mixed|RedcapConfig|null>[] a REDCap configuration with the form
* [REDCap instance URL => [REDCap Project ID => REDCapConfig object]]
* else null
Copy link
Contributor

@MaximeBICMTL MaximeBICMTL Jun 8, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This return type is too complex IMO. I would prefer to return a simple list of RedcapConfig. The caller can handle special cases like the empty list itself, and the instance URLs and project IDs are available in each RedcapConfig if needed.

Comment on lines +515 to +519
$configParser = new RedcapConfigParser(
$loris,
$redcapInstanceURL,
$redcapProjectID
);
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ideally I guess I should refactor the parser to more elegantly handle the "get all project configurations" and "get single project configuration" cases, but this is out of scope for this PR, your code is fine 👍

@regisoc regisoc marked this pull request as ready for review July 9, 2025 18:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Area: Instruments PR or issue related instruments Category: Feature PR or issue that aims to introduce a new feature Difficulty: Complex PR or issue that require a great effort to implementat, review, or test Language: PHP PR or issue that update PHP code Module: redcap PR or issue related to redcap module Priority: High PR or issue should be prioritised over others for review and testing Project: C-BIG Issue or PR related to the C-BIG project Project: IBIS Issue or PR related to the IBIS project Proposal PR or issue suggesting an improvement that can be accepted, rejected or altered State: Needs work PR awaiting additional work by the author to proceed
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants