Skip to content

DDI round trips: a CDL codebook that converts back to the same form #155

Description

@jstet

Goal: a DDI Codebook that formtransform writes carries the whole form, so XLSForm → DDI → XLSForm gives back the same form. "Same" is judged on the Instrument model, not on bytes.

Approach (B: every field in the DDI itself)

The DDI stays the single source of truth. Everything the form needs goes into standard DDI elements where one fits, and otherwise into CDL-typed <notes>. The DDI 2.5 XSD provides type and subject on <notes> for exactly this kind of controlled vocabulary. An edit made in qwacback (concept tags, merged studies) therefore flows back into the form.

Rejected: embedding the whole form as JSON in one note (A). It's exact by construction, but it creates a second source of truth that drifts as soon as qwacback edits the DDI.

Parts

  1. Convention: carry relevant/constraint in DDI as typed <notes> plus <universe> prose #151: relevant / constraint / constraint_message as typed notes plus <universe> prose. See the comment there for corrections.
  2. DDI round trips: keep question order, every group, and notes apart from hints #152: survey order, a <varGrp> for every group, notes kept apart from hints.
  3. DDI round trips: every form field in standard DDI where possible, cdl: notes only for the rest #153: every other field as a cdl: note (type, required, default, appearance, parameters, list name, settings), plus a registry guard that no Instrument field is unmapped.
  4. DDI round trips: DDI → Instrument parser, ddi2xlsform, and a round-trip contract #154: DDI → Instrument parser, ddi2xlsform, the round-trip contract test (fixtures + generated forms), Schematron rules for the vocabulary, and the ARCHITECTURE.md scope change.

1–3 are independent emitter changes, each useful on its own for codebook readers. 4 needs them.

Limits

  • Only DDI that formtransform wrote round-trips. Any other DDI converts best-effort, with a warning per missing field.
  • Byte-identical round trips are not a goal.

Decisions for qwacback

Activity

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

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions