tie together the various constants used for parsing the redcap CSV #54
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
I refactored the plethora of hard-coded dictionaries we had into a single
Enum
with anInstrument
class. The goal of this was to (1) tie together all these constants so we wouldn't forget to add acolumns
variable for a questionnaire with thename
variable, (2) reduce the number of hard-coded values, and (3) reduce the complexity of multiple dictionaries interacting.Instrument
class contains the hard-coded constants we need for each type of redcap instrument, e.g. thesession_id
which unique identifiers it, the name of the JSON file with the columns, and the name of the FHIR schema that was automatically converted from ReproSchemaredcap_instrument
column in the loaded CSV (so I renamed this to be specific to loading a redcap CSV). This makes it easier for the later code to filter rows/columns together, since we can rely on theredcap_instrument
column always having a valuefind_*
methods return a list ofPath
objects, no more awkward dictionary stuff. This also fixed a bug where multiple sessions for a participant were merged together implicitly. It's a better signature in general IMO.list_*
methods