@learnosity/lib-qti-converter 0.10.4 → 0.12.1
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/README.md +110 -23
- package/docs/DIAGNOSTICS.md +43 -24
- package/docs/EXAMPLES.md +84 -34
- package/docs/FAQ.md +6 -6
- package/docs/GETTING_STARTED.md +91 -6
- package/docs/LEARNOSITY_BUNDLE_FORMAT.md +61 -86
- package/docs/LEARNOSITY_SECTIONS.md +27 -16
- package/docs/QTI_METADATA_TO_TAGS.md +19 -6
- package/docs/QTI_STRUCTURE.md +67 -18
- package/docs/SUPPORTED_INTERACTIONS.md +90 -5
- package/docs/_sidebar.md +0 -1
- package/node.d.ts +2 -0
- package/node.js +9 -0
- package/package.json +31 -28
- package/packages/cli/dist/batchProcessors-B8EQvMbH.js +2550 -0
- package/packages/cli/dist/batchProcessors-B8EQvMbH.js.map +1 -0
- package/packages/cli/dist/batchWorker.d.ts +1 -0
- package/packages/cli/dist/batchWorker.js +26 -0
- package/packages/cli/dist/batchWorker.js.map +1 -0
- package/packages/cli/dist/main.d.ts +1 -0
- package/packages/cli/dist/main.js +29177 -34653
- package/packages/cli/dist/main.js.map +1 -0
- package/packages/core/dist/index.d.ts +1022 -1071
- package/packages/core/dist/index.js +22551 -23075
- package/packages/core/dist/node.d.ts +2909 -0
- package/packages/core/dist/node.js +32987 -0
- package/docs/ROADMAP.md +0 -232
|
@@ -4,7 +4,7 @@ This document lists all supported QTI interaction types and their corresponding
|
|
|
4
4
|
|
|
5
5
|
## Overview
|
|
6
6
|
|
|
7
|
-
The converter supports **11 interaction types** for QTI → Learnosity conversion, and **
|
|
7
|
+
The converter supports **11 interaction types** for QTI → Learnosity conversion, and **21 Learnosity question types** for Learnosity → QTI conversion.
|
|
8
8
|
|
|
9
9
|
## QTI → Learnosity Mappings
|
|
10
10
|
|
|
@@ -38,12 +38,16 @@ The reverse direction (Learnosity to QTI) supports additional question types tha
|
|
|
38
38
|
| `classification` | `associateInteraction` | Drag-and-drop items into category columns |
|
|
39
39
|
| `clozeassociation` | `gapMatchInteraction` | Drag-and-drop text into gaps |
|
|
40
40
|
| `clozedropdown` | `inlineChoiceInteraction` | Dropdown selection within text |
|
|
41
|
+
| `clozeformula` | `textEntryInteraction` | Math formula fill-in-the-blank; ⚠ not scored |
|
|
42
|
+
| `clozeformulaV2` | `textEntryInteraction` | Math formula fill-in-the-blank v2; ⚠ not scored |
|
|
41
43
|
| `clozetext` | `textEntryInteraction` | Inline text entry (fill-in-the-blank) |
|
|
42
44
|
| `drawing` | `drawingInteraction` | Freehand drawing with optional background image |
|
|
43
45
|
| `fileupload` | `uploadInteraction` | File upload for manual scoring |
|
|
44
46
|
| `formulaessayV2` | `extendedTextInteraction` | Math formula essay (treated as extended text) |
|
|
47
|
+
| `formulaV2` | `textEntryInteraction` | Math formula input; ⚠ not scored |
|
|
45
48
|
| `hotspot` | `hotspotInteraction` | Click on image areas |
|
|
46
49
|
| `imageclozeassociationV2` | `graphicGapMatchInteraction` | Drag image labels onto hotspot areas |
|
|
50
|
+
| `imageclozeformulaV2` | `textEntryInteraction` | Image with math formula blanks; ⚠ not scored |
|
|
47
51
|
| `longtextV2` | `extendedTextInteraction` | Essay/extended response |
|
|
48
52
|
| `mcq` | `choiceInteraction` | Single or multiple choice |
|
|
49
53
|
| `orderlist` | `orderInteraction` | Ordering items in sequence |
|
|
@@ -57,7 +61,15 @@ The reverse direction (Learnosity to QTI) supports additional question types tha
|
|
|
57
61
|
- Both `clozetext` and `shorttext` map to `textEntryInteraction` (inline vs standalone)
|
|
58
62
|
- `fileupload` maps to `uploadInteraction` with MIME type support
|
|
59
63
|
- `drawing` maps to `drawingInteraction` with background image support
|
|
60
|
-
- `classification` maps to `associateInteraction
|
|
64
|
+
- `classification` maps to `associateInteraction`, emitting one `simpleAssociableChoice` per table cell (`CAT_n`) plus one per draggable item (`RESP_n`), with `baseType="pair"` correct responses
|
|
65
|
+
|
|
66
|
+
**Math types (`clozeformula`, `clozeformulaV2`, `formulaV2`, `imageclozeformulaV2`):**
|
|
67
|
+
|
|
68
|
+
- The converter attempts to include `responseDeclaration` and `responseProcessing` in the QTI output, but can only map to an exact match scoring rule
|
|
69
|
+
- Learnosity math types support scoring methods (e.g. symbolic equivalence, simplified form, factored form) that have no equivalent in QTI — this may result in a loss of scoring fidelity
|
|
70
|
+
- Depending on how the Learnosity items were configured, users may want to treat the converted QTI items as manually scored rather than relying on the exact match response processing
|
|
71
|
+
- `imageclozeformulaV2` presents additional challenges: QTI has no native interaction that positions text inputs over a background image using coordinates. The converter simulates this layout with CSS absolute positioning, but some QTI rendering engines may strip inline styles, resulting in a degraded or broken layout
|
|
72
|
+
- For scoring to work, it is likely that LaTeX will need to be used in the response area
|
|
61
73
|
|
|
62
74
|
## Detailed Interaction Descriptions
|
|
63
75
|
|
|
@@ -113,12 +125,57 @@ The IMS QTI `associateInteraction` presents a flat list of `simpleAssociableChoi
|
|
|
113
125
|
|
|
114
126
|
**Conversion Strategy:**
|
|
115
127
|
|
|
116
|
-
- **QTI → Learnosity**: ALL `simpleAssociableChoice` elements → `possible_responses` (preserving declaration order). Synthetic `column_headers` are generated as `"Pair 1"`, `"Pair 2"`, … (one per correct response pair). `valid_response.value`
|
|
117
|
-
- **Learnosity → QTI**:
|
|
128
|
+
- **QTI → Learnosity**: ALL `simpleAssociableChoice` elements → `possible_responses` (preserving declaration order). Synthetic `column_headers` are generated as `"Pair 1"`, `"Pair 2"`, … (one per correct response pair). `valid_response.value` holds one entry per pair, each listing the **two 0-based indices** into `possible_responses` that form that pair. `ui_style.column_count` = number of pairs; `ui_style.row_count` = 2 (fixed — each pair always has exactly 2 choices).
|
|
129
|
+
- **Learnosity → QTI**: authored `classification` items are cell-based, not pair-based. `validation.valid_response.value` holds one entry per **table cell**, and each entry lists the `possible_responses` indices dropped into that cell — one index, several, or none (`null` / `[]`). Because `associateInteraction` has no notion of categories, each cell is emitted as its own `simpleAssociableChoice` (`CAT_0`, `CAT_1`, …) labelled from `ui_style.column_titles` / `ui_style.row_titles` (with `column_headers` accepted as an alias, falling back to `"Group n"`), followed by one choice per draggable item (`RESP_0`, `RESP_1`, …). Every index in cell _n_ becomes a correct `pair` value `"CAT_n RESP_i"`.
|
|
130
|
+
|
|
131
|
+
**Learnosity → QTI example (cell-based validation):**
|
|
132
|
+
|
|
133
|
+
```json
|
|
134
|
+
{
|
|
135
|
+
"type": "classification",
|
|
136
|
+
"possible_responses": ["Apple", "Carrot", "Banana", "Potato"],
|
|
137
|
+
"ui_style": { "column_count": 2, "column_titles": ["Fruit", "Vegetable"] },
|
|
138
|
+
"validation": {
|
|
139
|
+
"scoring_type": "exactMatch",
|
|
140
|
+
"valid_response": {
|
|
141
|
+
"score": 1,
|
|
142
|
+
"value": [
|
|
143
|
+
[0, 2],
|
|
144
|
+
[1, 3]
|
|
145
|
+
]
|
|
146
|
+
}
|
|
147
|
+
}
|
|
148
|
+
}
|
|
149
|
+
```
|
|
150
|
+
|
|
151
|
+
```xml
|
|
152
|
+
<correctResponse>
|
|
153
|
+
<value>CAT_0 RESP_0</value>
|
|
154
|
+
<value>CAT_0 RESP_2</value>
|
|
155
|
+
<value>CAT_1 RESP_1</value>
|
|
156
|
+
<value>CAT_1 RESP_3</value>
|
|
157
|
+
</correctResponse>
|
|
158
|
+
...
|
|
159
|
+
<simpleAssociableChoice identifier="CAT_0" matchMax="2">Fruit</simpleAssociableChoice>
|
|
160
|
+
<simpleAssociableChoice identifier="CAT_1" matchMax="2">Vegetable</simpleAssociableChoice>
|
|
161
|
+
<simpleAssociableChoice identifier="RESP_0" matchMax="1">Apple</simpleAssociableChoice>
|
|
162
|
+
<simpleAssociableChoice identifier="RESP_1" matchMax="1">Carrot</simpleAssociableChoice>
|
|
163
|
+
<simpleAssociableChoice identifier="RESP_2" matchMax="1">Banana</simpleAssociableChoice>
|
|
164
|
+
<simpleAssociableChoice identifier="RESP_3" matchMax="1">Potato</simpleAssociableChoice>
|
|
165
|
+
```
|
|
166
|
+
|
|
167
|
+
**Learnosity → QTI details:**
|
|
168
|
+
|
|
169
|
+
- Cells are numbered **row-major** (`index = row * column_count + column`), matching the rendered table's reading order. For multi-row tables an `LRN_CLASSIFICATION_CELL_ORDER_ASSUMED` info diagnostic flags the assumption, since ordering determines which label a response is paired with.
|
|
170
|
+
- `matchMax` on a `CAT_n` choice is `max_response_per_cell` when authored, otherwise the number of responses that cell expects, otherwise `0` (unlimited).
|
|
171
|
+
- `matchMax` on a `RESP_n` choice is `0` (unlimited) when `duplicate_responses` is `true`, otherwise the number of cells that response belongs to (normally `1`).
|
|
172
|
+
- `maxAssociations` is the total number of correct pairs, or the number of `possible_responses` when the item has no validation.
|
|
173
|
+
- Shuffle is read from `shuffle_options` (the documented classification attribute) or `shuffle_items`.
|
|
174
|
+
- Out-of-range indices and non-array cells are skipped with an `LRN_INVALID_VALIDATION` warning. Validation defining more cells than `column_count × row_count` also warns, and the extra cells still get categories so no correct response is dropped.
|
|
118
175
|
|
|
119
176
|
**Features:**
|
|
120
177
|
|
|
121
|
-
- Bidirectional conversion (QTI ↔ Learnosity)
|
|
178
|
+
- Bidirectional conversion (QTI ↔ Learnosity), though not round-trip symmetric: converting QTI → Learnosity → QTI turns the synthetic `"Pair n"` headers into `CAT_n` choices, and Learnosity → QTI → Learnosity flattens category labels into `possible_responses`
|
|
122
179
|
- Shuffle support
|
|
123
180
|
- Exact match scoring
|
|
124
181
|
- `baseType="pair"` (undirected) in the QTI `responseDeclaration` — `"A P"` and `"P A"` are equivalent
|
|
@@ -502,6 +559,28 @@ These are ignored in the **Learnosity → QTI** direction.
|
|
|
502
559
|
|
|
503
560
|
## Conversion Notes
|
|
504
561
|
|
|
562
|
+
### Shuffling Choices (`@shuffle` ↔ `shuffle_options`)
|
|
563
|
+
|
|
564
|
+
The QTI `shuffle` attribute is an authoring-time flag (default `false`) that tells the delivery engine to randomise the presentation order of an interaction's choices. It is present on interactions built around a set of `simpleChoice` / `simpleAssociableChoice` / `gapText` / `gapImg` / `inlineChoice` elements. It maps to the root-level `shuffle_options` boolean on the equivalent Learnosity question type. Neither side performs the randomisation itself — the delivery engine does that per candidate/attempt.
|
|
565
|
+
|
|
566
|
+
| QTI Interaction | `@shuffle` maps to |
|
|
567
|
+
| ---------------------------- | ----------------------------------------- |
|
|
568
|
+
| `choiceInteraction` | `mcq.shuffle_options` |
|
|
569
|
+
| `orderInteraction` | `orderlist.shuffle_options` |
|
|
570
|
+
| `associateInteraction` | `classification.shuffle_options` |
|
|
571
|
+
| `matchInteraction` | `choicematrix.shuffle_options` |
|
|
572
|
+
| `gapMatchInteraction` | `clozeassociation.shuffle_options` |
|
|
573
|
+
| `inlineChoiceInteraction` | `clozedropdown.shuffle_options` |
|
|
574
|
+
| `graphicGapMatchInteraction` | `imageclozeassociationV2.shuffle_options` |
|
|
575
|
+
| `hottextInteraction` | Not representable — see below |
|
|
576
|
+
|
|
577
|
+
Notes:
|
|
578
|
+
|
|
579
|
+
- **`inlineChoiceInteraction`**: QTI carries `shuffle` on each interaction, while Learnosity clozedropdown has a single question-level flag covering every dropdown. `shuffle_options` is set to `true` if any of the item's `inlineChoiceInteraction` elements requests shuffling. On the way back, the flag is applied to every `inlineChoiceInteraction`.
|
|
580
|
+
- **`hottextInteraction`**: Learnosity `tokenhighlight` renders its tokens inline within the template, so their order cannot be randomised and there is no `shuffle_options` attribute. `@shuffle="true"` is dropped with a `QTI_SHUFFLE_NOT_SUPPORTED` warning.
|
|
581
|
+
- **`associateInteraction`**: `shuffle_options` is the classification question attribute. `shuffle_items` is an activity-level Items/Assess API config for shuffling the order of Items and is unrelated, though it is still accepted on input for backwards compatibility.
|
|
582
|
+
- **`graphicOrderInteraction` / `graphicAssociateInteraction`**: not supported by the converter, so their `shuffle` attribute is not mapped.
|
|
583
|
+
|
|
505
584
|
### Coordinate Systems
|
|
506
585
|
|
|
507
586
|
- **QTI**: Uses absolute pixel coordinates (e.g., `coords="100,150,200,250"`)
|
|
@@ -591,6 +670,12 @@ For detailed information about metadata conversion, see [QTI Metadata to Tags](h
|
|
|
591
670
|
|
|
592
671
|
---
|
|
593
672
|
|
|
673
|
+
## Known Limitations
|
|
674
|
+
|
|
675
|
+
- **Math cloze reverse conversion**: Reverse conversion (QTI → Learnosity) is not supported for items produced by the math cloze converter (`clozeformula`, `clozeformulaV2`, `formulaV2`, `imageclozeformulaV2`). A `textEntryInteraction` QTI item will always map to `clozetext` or `shorttext` during QTI-to-Learnosity conversion.
|
|
676
|
+
|
|
677
|
+
---
|
|
678
|
+
|
|
594
679
|
## See Also
|
|
595
680
|
|
|
596
681
|
- [Getting Started](https://learnosity.github.io/lib-qti-converter/#/GETTING_STARTED) - Installation and basic usage
|
package/docs/_sidebar.md
CHANGED
package/node.d.ts
ADDED
package/node.js
ADDED
|
@@ -0,0 +1,9 @@
|
|
|
1
|
+
// Node.js entry point for @learnosity/lib-qti-converter.
|
|
2
|
+
// Re-exports the browser-safe API plus the filesystem/ZIP helpers and
|
|
3
|
+
// disk-based conversions from the core package's `./node` build.
|
|
4
|
+
//
|
|
5
|
+
// This physical file exists so that legacy ("node10") resolution — which
|
|
6
|
+
// resolves subpaths to a real file rather than reading the "exports" map — can
|
|
7
|
+
// still resolve `@learnosity/lib-qti-converter/node`. Modern resolvers use the
|
|
8
|
+
// "exports" map, which points here as well.
|
|
9
|
+
export * from './packages/core/dist/node.js';
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@learnosity/lib-qti-converter",
|
|
3
|
-
"version": "0.
|
|
3
|
+
"version": "0.12.1",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"description": "QTI ↔ Learnosity JSON converter",
|
|
6
6
|
"license": "MIT",
|
|
@@ -21,6 +21,10 @@
|
|
|
21
21
|
".": {
|
|
22
22
|
"types": "./packages/core/dist/index.d.ts",
|
|
23
23
|
"import": "./packages/core/dist/index.js"
|
|
24
|
+
},
|
|
25
|
+
"./node": {
|
|
26
|
+
"types": "./node.d.ts",
|
|
27
|
+
"import": "./node.js"
|
|
24
28
|
}
|
|
25
29
|
},
|
|
26
30
|
"bin": {
|
|
@@ -29,18 +33,19 @@
|
|
|
29
33
|
},
|
|
30
34
|
"sideEffects": false,
|
|
31
35
|
"files": [
|
|
32
|
-
"
|
|
36
|
+
"node.js",
|
|
37
|
+
"node.d.ts",
|
|
38
|
+
"packages/cli/dist",
|
|
33
39
|
"packages/core/dist/index.js",
|
|
34
40
|
"packages/core/dist/index.d.ts",
|
|
41
|
+
"packages/core/dist/node.js",
|
|
42
|
+
"packages/core/dist/node.d.ts",
|
|
35
43
|
"docs/*.md"
|
|
36
44
|
],
|
|
37
|
-
"workspaces": [
|
|
38
|
-
"packages/*"
|
|
39
|
-
],
|
|
40
45
|
"scripts": {
|
|
41
46
|
"build": "pnpm --filter @learnosity/converter-core build && pnpm --filter @learnosity/converter-cli build",
|
|
42
47
|
"check:exports": "publint && attw --pack . --ignore-rules cjs-resolves-to-esm",
|
|
43
|
-
"clean": "rm -rf node_modules packages/*/node_modules tools/*/node_modules pnpm-lock.yaml tools/*/package-lock.json packages/*/dist packages/*/*.tsbuildinfo",
|
|
48
|
+
"clean": "rm -rf node_modules packages/*/node_modules compat/*/node_modules tools/*/node_modules pnpm-lock.yaml package-lock.json tools/*/package-lock.json packages/*/dist packages/*/*.tsbuildinfo",
|
|
44
49
|
"coverage": "pnpm --recursive coverage",
|
|
45
50
|
"coverage:cli": "pnpm --filter @learnosity/converter-cli coverage",
|
|
46
51
|
"coverage:core": "pnpm --filter @learnosity/converter-core coverage",
|
|
@@ -52,39 +57,37 @@
|
|
|
52
57
|
"prepublishOnly": "pnpm test",
|
|
53
58
|
"preview:items": "pnpm --filter verify-json start --",
|
|
54
59
|
"rebuild": "pnpm build && pnpm install --force",
|
|
55
|
-
"security": "trivy
|
|
60
|
+
"security": "pnpm security:trivy && pnpm security:semgrep",
|
|
61
|
+
"security:semgrep": "semgrep scan --config auto --error .",
|
|
62
|
+
"security:trivy": "trivy fs --scanners vuln,secret,misconfig .",
|
|
56
63
|
"setup:python": "python3 -m venv .venv && . .venv/bin/activate && pip install -r requirements-dev.txt",
|
|
57
|
-
"test": "pnpm test:core && pnpm test:cli
|
|
64
|
+
"test": "pnpm test:core && pnpm test:cli",
|
|
58
65
|
"test:cli": "pnpm --filter @learnosity/converter-cli test",
|
|
59
66
|
"test:core": "pnpm --filter @learnosity/converter-core test",
|
|
67
|
+
"typecheck": "tsc --noEmit -p packages/core/tsconfig.json && tsc --noEmit -p packages/cli/tsconfig.json",
|
|
60
68
|
"validate:learnosity": "tsx bin/validateLearnosity.ts",
|
|
61
69
|
"validate:qti": "XML_CATALOG_FILES=./schemas/catalog.xml ./.venv/bin/python ./bin/validateQti.py",
|
|
62
70
|
"validate:qti:debug": "VALIDATE_DEBUG=1 XML_CATALOG_FILES=./schemas/catalog.xml ./.venv/bin/python ./bin/validateQti.py",
|
|
63
|
-
"verify": "pnpm run build && pnpm run lint && pnpm test:cli && pnpm test:core && pnpm run check:exports"
|
|
71
|
+
"verify": "pnpm run build && pnpm run lint && pnpm run typecheck && pnpm test:cli && pnpm test:core && pnpm run check:exports"
|
|
64
72
|
},
|
|
65
73
|
"devDependencies": {
|
|
66
|
-
"@arethetypeswrong/cli": "^0.18.
|
|
67
|
-
"@types/node": "^
|
|
68
|
-
"@typescript-eslint/eslint-plugin": "^8.
|
|
69
|
-
"@typescript-eslint/parser": "^8.
|
|
70
|
-
"@
|
|
71
|
-
"
|
|
74
|
+
"@arethetypeswrong/cli": "^0.18.5",
|
|
75
|
+
"@types/node": "^26.2.0",
|
|
76
|
+
"@typescript-eslint/eslint-plugin": "^8.67.0",
|
|
77
|
+
"@typescript-eslint/parser": "^8.67.0",
|
|
78
|
+
"@typescript/native": "npm:typescript@^7.0.2",
|
|
79
|
+
"@vitest/coverage-v8": "^4.1.10",
|
|
80
|
+
"eslint": "^10.8.1",
|
|
72
81
|
"glob": "^13.0.6",
|
|
73
|
-
"publint": "^0.3.
|
|
74
|
-
"tsdown": "^0.22.
|
|
75
|
-
"tsx": "^4.
|
|
76
|
-
"typescript": "
|
|
77
|
-
"vite": "^8.1
|
|
78
|
-
"vitest": "^4.1.
|
|
82
|
+
"publint": "^0.3.23",
|
|
83
|
+
"tsdown": "^0.22.14",
|
|
84
|
+
"tsx": "^4.23.12",
|
|
85
|
+
"typescript": "npm:@typescript/typescript6@^6.0.2",
|
|
86
|
+
"vite": "^8.2.1",
|
|
87
|
+
"vitest": "^4.1.10"
|
|
79
88
|
},
|
|
80
89
|
"engines": {
|
|
81
90
|
"node": ">=22.0.0"
|
|
82
91
|
},
|
|
83
|
-
"
|
|
84
|
-
"overrides": {
|
|
85
|
-
"esbuild@>=0.27.3 <0.28.1": ">=0.28.1",
|
|
86
|
-
"fflate": "0.8.2"
|
|
87
|
-
}
|
|
88
|
-
},
|
|
89
|
-
"packageManager": "pnpm@10.30.1"
|
|
92
|
+
"packageManager": "pnpm@11.21.0"
|
|
90
93
|
}
|