REDCap data dictionary adapter (closes #204)#213
Open
amc-corey-cox wants to merge 1 commit into
Open
Conversation
Contributor
There was a problem hiding this comment.
Pull request overview
Adds a new REDCap adapter to the adapter ecosystem (issue #204 under umbrella #202), enabling translation between REDCap’s exported data dictionary CSV and schema-automator’s canonical Data Dictionary format (with reverse direction gated on linkml-map >= 0.5.3, matching the existing Frictionless pattern).
Changes:
- Introduces a LinkML metamodel for REDCap data dictionary CSV plus linkml-map trans-specs for REDCap → DD and DD → REDCap.
- Adds a Python adapter implementing CSV load/dump and wiring both transform directions (including reverse-direction version checks and choice parsing/serialization).
- Adds a CLI command (
adapt-redcap) and comprehensive tests + fixture CSVs for forward direction and validation mappings (reverse tests xfail until linkml-map 0.5.3).
Reviewed changes
Copilot reviewed 10 out of 10 changed files in this pull request and generated no comments.
Show a summary per file
| File | Description |
|---|---|
tests/test_adapters/test_redcap.py |
Adds forward and (xfail-gated) reverse adapter tests for REDCap mappings. |
tests/resources/redcap/minimal.csv |
Adds a minimal REDCap CSV fixture covering core field types. |
tests/resources/redcap/validations.csv |
Adds a REDCap CSV fixture focused on validation/type refinement cases. |
schema_automator/metamodels/redcap.yaml |
Defines the REDCap data dictionary CSV schema in LinkML (source/target for transforms). |
schema_automator/cli.py |
Adds adapt-redcap CLI entry point with forward/reverse modes and CSV output in reverse. |
schema_automator/adapters/redcap/redcap_to_dd.transform.yaml |
Adds linkml-map trans-spec for REDCap → canonical DD (type dispatch, min/max, codes). |
schema_automator/adapters/redcap/dd_to_redcap.transform.yaml |
Adds linkml-map trans-spec for canonical DD → REDCap (field_type/validation/required/codes). |
schema_automator/adapters/redcap/adapter.py |
Implements CSV parsing/serialization and transform orchestration, including reverse-version checks. |
schema_automator/adapters/redcap/__init__.py |
Exposes the adapter’s public API (load + both directions). |
schema_automator/adapters/README.md |
Documents the new REDCap adapter and its lossy aspects / preprocessing behavior. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
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.
Final listed sub-issue of umbrella #202. Forward direction works on released linkml-map; reverse tests are xfail until 0.5.3 (same pattern as Frictionless).
Test plan
pytest tests/— 175 passed, 3 skipped, 18 xfailed