Skip to content

Exercises: Extend QTI 2.1 import/export to more question types #9285

Open

Description

@ybtbeez

Context

Chamilo has about 30 exercise question types, but QTI 2.1 import/export only covers a few of them. After #1377 (PR #9281), coverage is:

Type Import Export
Unique answer ✅ ✅
Multiple answer ✅ ✅
Free answer ✅ ✅
Fill in the blanks ✅ ✅ (#1377)
Matching ✅ (#1377) ✅
Draggable matching ⚠️ imported as plain matching ✅

All other types are skipped on export and can't be imported. This issue proposes extending QTI 2.1 support to the remaining types, grouped by effort. Type numbers are the constants in public/main/inc/lib/api.lib.php. The QTI mapping below is a proposal and still needs to be checked against other QTI tools (e.g. Moodle, TAO, Canvas).

Easy: these map directly to standard QTI 2.1 interactions

  • Unique answer variants: unique answer with "don't know" option (10), unique answer with images (17) and unique answer in dropdown (29) map to choiceInteraction (single cardinality) or inlineChoiceInteraction for the dropdown.
  • Exact combination (9) maps to choiceInteraction (multiple cardinality), scored all-or-nothing in responseProcessing.
  • Multiple answer true/false (11) and its combination variant (12) map to matchInteraction (statements × True/False/Don't know).
    • The "degree of certainty" variant (22) maps the same way but would lose the certainty part, which has no QTI equivalent.
  • Sequence ordering (18) maps to orderInteraction.
  • Draggable matching on import (19): export already exists, but the import should restore type 19 instead of plain matching (e.g. from a marker in the exported item). This is a small change.

Medium: these also need images (or files) packaged in the export zip and listed in the manifest

  • Image zones / hotspot (6) maps to hotspotInteraction / selectPointInteraction.
  • Ordered image zones (7) maps to graphicOrderInteraction.
  • Upload answer (23) and oral expression (13) map to uploadInteraction. The question structure is portable, but each platform handles the submitted files its own way.

Hard, or not a good fit for QTI

  • Calculated answer (16) would need QTI templates (templateDeclaration / templateProcessing), which few tools import correctly.
  • Free-shape image zones (8) and annotation (20) have no clean QTI equivalent.
  • Media question (15), reading comprehension (21) and page break (31) are layout or grouping types rather than gradable questions. They could map to shared stimulus or test sections at best.
  • "Combination" scoring variants (24–28) would mostly need Chamilo-specific extensions to responseProcessing.

Suggested approach

  1. Start with the "easy" group, one question type per PR. Each PR should round-trip the type through export and then import (as Exportar más tipos de preguntas en QTI #1377 does for matching and fill in the blanks) and include PHPUnit tests for both directions.
  2. Then do the image-based types, which need the export zip and the imsmanifest.xml resource list to include the media files.
  3. Leave the "hard" group out unless there's a concrete interoperability need. On export, skip those types and show a clear warning that lists what was left out, rather than dropping them silently.

Imported content should keep going through the same HTMLPurifier sanitizing that #1377 added for matching and fill in the blanks.

Activity

  1. added this to the 3.1 milestone on Oct 20, 2026
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

      Milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions