Skip to content

LimeSurvey tab: accept a response export, as the Kobo tab does #22

Description

@jstet

The Kobo tab takes an XLSForm plus, optionally, the responses, and gives back the DDI with its case count and a data.csv. The LimeSurvey tab (Lstsv2DdiTab.svelte) takes only the structure file (lstsvToDdi(tsv, { assetName })), so a LimeSurvey survey's data can't be documented in the app.

formtransform already supports this in the library and CLI (formtransform lstsv2ddi survey.tsv --data responses.csv). The app doesn't expose it.

Change

Mirror the Kobo tab's two modes: structure only (as now) and with responses.

  • An optional second file input for the LimeSurvey response export (.csv, or .json from RemoteControl export_responses), with question codes as headings. Parse it with parseResponses(text, file.name), as the Kobo tab does.
  • With responses:
    const xml = lstsvToDdi(tsv, { assetName, submissions, onWarning });   // sets <caseQnty>
    const csv = lstsvToDataCsv(tsv, submissions, { onWarning });          // columns = the DDI's <var>s
    Offer both files for download, like the Kobo tab's result.
  • Show warnings via messages(findings, 'warning'). lstsvToDataCsv reports export columns it can't match to the structure.
  • i18n: add the hint text (de/en) for the new input, e.g. "LimeSurvey-Antwortexport (CSV mit Fragecodes als Spaltenköpfen)".

What the export may look like

normalizeLimeSurveyResponses handles LimeSurvey's quirks, so the app passes the rows through unchanged. It copes with:

  • stripped underscores and changed case in question codes (beruf_post → berufpost);
  • one q[code] = Y column per multiple-choice option, with codes truncated to 5 characters;
  • one array[sq] column per array subquestion;
  • the native "other": -oth- plus q[other].

formtransform tests these on real exports (tests/ts/contract/lstsvRealExports.test.ts).

Done when

  • The LimeSurvey tab converts structure-only as before.
  • With a response export, it gives a DDI whose <caseQnty> is the number of responses, and a data.csv whose header matches the DDI's <var name> order.
  • A test with one of formtransform's real LimeSurvey exports (fixtures tarball, formtransform-fixtures-<version>.tar.gz) passes.

Needs formtransform ≥ v0.7.1 (#20), though both functions exist since earlier releases.

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