Skip to content

Suggestion: DDI → XLSForm tab (formtransform ddiToXlsform) #21

Description

@jstet

Suggestion, not planned yet.

Since formtransform v0.7.0 (#154, #160), the library has ddiToXlsform(xml, { onWarning }). It turns DDI-Codebook 2.5 XML back into an XLSForm and runs in the browser. The app could offer it as a fourth tab, "DDI → XLSForm".

What the library gives

  • ddiToXlsform(xml, options?) → { survey, choices, settings } (sheet rows, XlsformOutput).
  • It reads a whole codebook, a dataDscr, or bare var / varGrp elements, and never refuses DDI it can parse.
  • A CDL codebook (written by this app's Kobo tab or by xlsformToDdi) comes back exactly. The library round-trip tests DDI → XLSForm → DDI byte for byte.
  • DDI from other tools converts as far as its standard elements go, with a ddi-field-missing warning per field it can't supply.
  • Still lost: unregistered types such as calculate, and a few cell spellings (src/pipelines/ddi2xlsform/README.md in the library).

What the app would need

  • A Ddi2XlsformTab.svelte: file input for .xml, Convert, download form.xlsx, and an optional preview of the survey sheet.
  • Writing the three sheets to .xlsx with SheetJS, which is already a dependency (xlsx). Keep the column order the library returns.
  • Warnings through the existing ErrorBox (warnings prop). They matter here: DDI from other tools produces ddi-field-missing findings the user should see.
  • i18n strings (DE/EN) for the tab label, file label and hint.
  • A short line in the scope notice or the tab: exact round trips only for CDL codebooks.

Tests

  • Golden: for every ddi.xml in the fixtures archive (registry types and survey fixtures), upload it and compare the downloaded workbook's sheets with the library's own ddiToXlsform(xml) output.
  • Round trip through the GUI: Kobo tab → survey.xml → DDI tab → form.xlsx → Kobo tab gives the same DDI.
  • GUI: a non-CDL DDI fragment converts and shows ddi-field-missing warnings.
  • Accessibility: add the tab to accessibility.spec.ts.

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

    enhancementNew feature or request

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions