Skip to content

REDCap data dictionary adapter (closes #204)#213

Open
amc-corey-cox wants to merge 1 commit into
mainfrom
redcap-adapter
Open

REDCap data dictionary adapter (closes #204)#213
amc-corey-cox wants to merge 1 commit into
mainfrom
redcap-adapter

Conversation

@amc-corey-cox
Copy link
Copy Markdown
Contributor

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

Copilot AI review requested due to automatic review settings May 18, 2026 20:08
Copy link
Copy Markdown
Contributor

Copilot AI left a comment

Choose a reason for hiding this comment

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

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.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants