Skip to content

Generator: optional concept, label_short, form_title_short and form_subtitle - #72

Merged
jstet merged 1 commit into
mainfrom
feat/ddi-fields
Oct 29, 2026
Merged

jstet merged 1 commit into
mainfrom
feat/ddi-fields

Conversation

@jstet

@jstet jstet commented Oct 29, 2026

Copy link
Copy Markdown
Member

This adds the form fields that formtransform 0.8.0–0.9.x introduced for the DDI, as an optional feature. A form without them is written exactly as before: no new columns or settings, and existing snapshot entries are unchanged.

What changed

  • Output schema:
    • Question gets concept and labelShort. The parser reads concept, and label_short or labelShort.
    • Survey gets titleShort and subtitle. They are new optional outputs of the generator signature (titleShort?, subtitle?), and lead.ts passes them to the survey.
  • Workbook (xlsform_generator.ts):
    • The concept and label_short columns are only written when some question has them.
    • form_title_short and form_subtitle are only added to the settings when set.
  • UI: SurveyView shows the subtitle and short title under the title. A question's details show its concept and short label.
  • Prompts:
    • generate-instructions.md documents concept: the construct a question measures; for a question-bank item, take its concept; never copy the label.
    • It documents label_short: only for a select_multiple or a question with a Sonstiges follow-up, since only those become a DDI varGrp.
    • It says when to fill titleShort / subtitle.
    • The repair prompt keeps these fields.
    • The skill was rebuilt by the pre-commit hook.
  • Tests:
    • New unit tests in src/lib/agents/ddi_fields.test.ts. They check that validateSubset gives no findings and that one xlsformToDdi conversion carries everything through:
      • <concept> comes from the concept column only, on just the one question that has it;
      • varGrp/labl comes from label_short;
      • altTitl and subTitl come from the settings.
    • New e2e fixture concept-and-short-label (pyxform + ODK Validate). Only new snapshot entries were added.
    • pyxform also accepts the new settings without warnings.

Choices made

  • Columns and settings are written only when used, so existing forms keep their exact layout.
  • label_short is limited in the prompt to questions that become a varGrp. formtransform keeps it on other rows only as a cdl:column.
  • The qwac demographics don't get a concept automatically, even though qwac has one. That would change what existing forms produce, so it is left for a separate decision.
  • concept is in the language of the questions. There is no per-language variant (concept::<lang>), because the web app writes single-language forms.

Checks (local)

bun run lint, bun run check (0 errors), bun run test (169 passed), bun run test:e2e (73 vitest + 15 pytest passed) and bun run build all pass.

Closes #70

🤖 Generated with Claude Code

…itle

The fields formtransform 0.8.0–0.9.x added for the DDI, all optional:
- Question gets `concept` (the `concept` column, DDI <concept>) and
  `labelShort` (`label_short`, the varGrp's labl), parsed from the model
  output and written only when some question has them;
- Survey gets `titleShort` and `subtitle`, optional generator outputs,
  written to the settings form_title_short / form_subtitle when set;
- the survey view shows the subtitle and short title in the header and
  concept / short label in a question's details;
- generate-instructions.md says when to fill them, and the repair prompt
  keeps them.

Forms without them are written exactly as before.

Closes #70

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
@jstet
jstet merged commit 5ffe28e into main Oct 29, 2026
1 check passed
@jstet
jstet deleted the feat/ddi-fields branch October 29, 2026 17:33
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.

Generator: label_short, form_title_short/form_subtitle, concept

1 participant