-
Notifications
You must be signed in to change notification settings - Fork 189
[redcap] REDCap UI #9910
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
base: main
Are you sure you want to change the base?
[redcap] REDCap UI #9910
Conversation
MaximeBICMTL
left a comment
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.
I know this is just a work-in-progress, but I did a small review notably of the Javascript side.
I know this requires some work, but I would heavily prefer to use Typescript and function components for the UI, untyped JS and class components are a lot harder to maintain in my opinion and I would rather not have them in newer code.
This is my main concern, outside of that, all the nits do not need to be addressed, those are just me stating my opinions on some pieces of code.
| baseURL={loris.BaseURL} | ||
| moduleURL={loris.BaseURL + '/redcap'} | ||
| hasPermission={loris.userHasPermission} |
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.
I am not sure about passing these values as props to the module.
- The first two can be obtained from the
lorisinstance, no need to use props IMO. - The latter one is not used right now (but I guess that may change).
| baseURL: props.baseURL, | ||
| data: {}, | ||
| error: false, | ||
| isLoaded: false, |
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.
Maybe just use data !== null instead of isLoaded ?
|
|
||
| return ( | ||
| <div> | ||
| {this.state.data == null |
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.
I don't think this.state.data can ever be null, it is initialized with an empty object {} or a JSON received from the back-end. I would also avoid loose equality in our code (use === instead of ==).
| super(props); | ||
|
|
||
| this.state = { | ||
| baseURL: props.baseURL, |
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.
I would avoid putting constant data in a component state, I would rather use loris.BaseURL directly.
| this.state = { | ||
| baseURL: props.baseURL, | ||
| moduleURL: props.moduleURL, | ||
| data: {}, | ||
| error: false, | ||
| isLoaded: false, | ||
| }; |
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.
Same comments about constant data in state and isLoaded.
| * @return {*} a formatted table cell for a given column | ||
| */ | ||
| formatColumn(column, cell, rowData, rowHeaders) { | ||
| let result = (<td>{cell}</td>); |
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.
I would use return directly in the matchswitch instead of putting things in result, using break, and then returning.
| // The fields configured for display/hide. | ||
| let fields = [ |
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.
Same comment about constant data.
Brief summary of changes
This PR adds a UI for designated users with new permission
redcap_ui_view.The UI is mainly targeted at people managing REDCap data integration, and adapts to one or multiple connected REDCap instances and projects.
The current UI composed by 3 tabs (more can be added) to give information and help navigate, this is particularly useful for issues arising when importing REDCap data e.g. missing notifications, network issues, out-of-sync instruments dictionary.
Images of current included tabs
Notifications received:
REDCap Dictionary in use:
REDCap import issues in issue tracker:
This PR also updates the
redcap2linst:module/redcap/toolsas a module specific tool.redcap_dictionarytable update when parsing the redcap dictionary.To discuss:
Testing instructions (if applicable)
redcapmodule in modules manager.Tools > REDCapmenu item.