-
Notifications
You must be signed in to change notification settings - Fork 199
[redcap] REDCap import records script #9905
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
Changes from all commits
a89365b
b55a6b3
78d74a4
d397436
190ba48
0836dad
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -200,6 +200,42 @@ class RedcapMapper | |
| return $visit_config ? $visit_config : null; | ||
| } | ||
|
|
||
| /** | ||
| * Get the REDCap event associated with a REDCap visit mapping configuration | ||
| * node. | ||
| * | ||
| * @param RedcapConfigVisit $visit_config A REDCap visit mapping configuration | ||
|
adamdaudrich marked this conversation as resolved.
|
||
| * node. | ||
| * | ||
| * @return RedcapEvent The associated REDCap event. | ||
| */ | ||
| public function getVisitConfigEvent( | ||
| RedcapConfigVisit $visit_config, | ||
| ): RedcapEvent { | ||
| // Get the list of all the REDCap arms for this REDCap project. | ||
|
Contributor
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. REDCap Arms. A documentation thought: The documentation.md should guide the developer into the overall design of the module: all the more basic REDCap parameters should be clearly outlined there. The deeper level documentation should just be stripped of the redundant association.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Same thing as my other reply, this. This is partly due to the way I write comments: I look for consistency and non-ambiguity above all, so if I use a name to refer to something in one place, I will use that same name everywhere, even if it is sometimes verbose. I agree this method could be improved, but as with the other comment, these conventions are already used in the module so I think it is out-of-scope for this PR.
|
||
| $redcap_arms = $this->_redcap_client->getArms(); | ||
|
|
||
| // Find the REDCap arm that matches the configuration arm name. | ||
| $redcap_arm = array_find( | ||
| $redcap_arms, | ||
| fn($redcap_arm) => $redcap_arm->name === $visit_config->redcap_arm_name, | ||
| ); | ||
|
|
||
| // Get the list of all the REDCap events for this REDCap project. | ||
| $redcap_events = $this->_redcap_client->getEvents(); | ||
|
|
||
| // Find the REDCap event that matches the arm and configuration event name. | ||
| $redcap_event = array_find( | ||
| $redcap_events, | ||
| fn($redcap_event) => ( | ||
| $redcap_event->arm_number === $redcap_arm->number | ||
| && $redcap_event->name === $visit_config->redcap_event_name | ||
| ), | ||
| ); | ||
|
|
||
| return $redcap_event; | ||
| } | ||
|
|
||
| /** | ||
| * Check that a session exists or create it using the REDCap module automatic | ||
| * session creation configuration. Throw an exception if the session does not | ||
|
|
||

There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
What is the ? for ?
And also: why the double spacing ? A new convention ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In PHP
?typemeans "nullable type", a.k.a a value oftypeornull. The double spaces are just alignment of the parameter names enforced by the linter.