@learnosity/lib-qti-converter 0.10.4
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/LICENSE +22 -0
- package/README.md +263 -0
- package/docs/DIAGNOSTICS.md +263 -0
- package/docs/EXAMPLES.md +869 -0
- package/docs/FAQ.md +415 -0
- package/docs/GETTING_STARTED.md +471 -0
- package/docs/LEARNOSITY_BUNDLE_FORMAT.md +338 -0
- package/docs/LEARNOSITY_SECTIONS.md +384 -0
- package/docs/QTI_METADATA_TO_TAGS.md +266 -0
- package/docs/QTI_STRUCTURE.md +353 -0
- package/docs/ROADMAP.md +232 -0
- package/docs/SUPPORTED_INTERACTIONS.md +601 -0
- package/docs/_sidebar.md +13 -0
- package/package.json +90 -0
- package/packages/cli/dist/main.js +45610 -0
- package/packages/core/dist/index.d.ts +2658 -0
- package/packages/core/dist/index.js +31706 -0
package/docs/FAQ.md
ADDED
|
@@ -0,0 +1,415 @@
|
|
|
1
|
+
# Frequently Asked Questions
|
|
2
|
+
|
|
3
|
+
Common questions and troubleshooting guide.
|
|
4
|
+
|
|
5
|
+
## Installation & Setup
|
|
6
|
+
|
|
7
|
+
### Q: What Node.js version is required?
|
|
8
|
+
|
|
9
|
+
**A:** Node.js >= 22.0.0. The package.json enforces this requirement.
|
|
10
|
+
|
|
11
|
+
Check your version:
|
|
12
|
+
|
|
13
|
+
```bash
|
|
14
|
+
node --version
|
|
15
|
+
```
|
|
16
|
+
|
|
17
|
+
### Q: Why do I need to run `pnpm run build`?
|
|
18
|
+
|
|
19
|
+
**A:** The project is written in TypeScript and must be compiled to JavaScript before use. The `build` command compiles:
|
|
20
|
+
|
|
21
|
+
- `packages/core/src/` → `packages/core/dist/`
|
|
22
|
+
- `packages/cli/src/` → `packages/cli/dist/`
|
|
23
|
+
|
|
24
|
+
The CLI executable and package imports all reference the compiled `dist/` folders.
|
|
25
|
+
|
|
26
|
+
### Q: Do I need to rebuild after changing code?
|
|
27
|
+
|
|
28
|
+
**A:** Yes. Any changes to `.ts` files in `src/` require running `pnpm run build` to update the compiled JavaScript in `dist/`.
|
|
29
|
+
|
|
30
|
+
## Using as a Library
|
|
31
|
+
|
|
32
|
+
### Q: Can I import the converter into my own project instead of using the CLI?
|
|
33
|
+
|
|
34
|
+
**A:** Yes. Install the package and import the conversion functions directly:
|
|
35
|
+
|
|
36
|
+
```typescript
|
|
37
|
+
import { convertQtiToLearnosity, convertLearnosityToQti } from '@learnosity/lib-qti-converter';
|
|
38
|
+
```
|
|
39
|
+
|
|
40
|
+
See [Examples — Library Usage](./EXAMPLES.md#library-usage) for detailed code samples.
|
|
41
|
+
|
|
42
|
+
### Q: Do I need to install any additional dependencies?
|
|
43
|
+
|
|
44
|
+
**A:** No. All dependencies are bundled into the package — there's nothing else to install.
|
|
45
|
+
|
|
46
|
+
### Q: What TypeScript types are available?
|
|
47
|
+
|
|
48
|
+
**A:** The package ships with full type declarations. Key types include `ConversionOptions`, `ConversionResult`, and `Diagnostic`. Import them directly:
|
|
49
|
+
|
|
50
|
+
```typescript
|
|
51
|
+
import type {
|
|
52
|
+
ConversionOptions,
|
|
53
|
+
ConversionResult,
|
|
54
|
+
Diagnostic,
|
|
55
|
+
} from '@learnosity/lib-qti-converter';
|
|
56
|
+
```
|
|
57
|
+
|
|
58
|
+
## Conversion Issues
|
|
59
|
+
|
|
60
|
+
### Q: Why does my conversion produce INFO diagnostics?
|
|
61
|
+
|
|
62
|
+
**A:** INFO diagnostics indicate transformations that were applied during conversion. They are not errors. Common examples:
|
|
63
|
+
|
|
64
|
+
- `CONTENT_HTML_VOID_ELEMENT_FIXED` - Self-closing tags normalized for XML format
|
|
65
|
+
- `CONTENT_HTML_STIMULUS_WRAPPED` - Text content wrapped in block elements
|
|
66
|
+
- `CONTENT_EDITOR_ARTEFACT_STRIPPED` - Document metadata tags (`<meta>`, `<link>`) or editor artifacts removed
|
|
67
|
+
|
|
68
|
+
These are expected and do not indicate problems.
|
|
69
|
+
|
|
70
|
+
### Q: Why are my alternate responses limited to 10?
|
|
71
|
+
|
|
72
|
+
**A:** There is a fundamental difference in scoring flexibility between QTI and Learnosity:
|
|
73
|
+
|
|
74
|
+
- **QTI** allows complex `<mapping>` rules and Cartesian products that can generate hundreds or thousands of valid response combinations
|
|
75
|
+
- **Learnosity** uses a simpler `alt_responses` array that is better suited for a curated list of alternatives
|
|
76
|
+
|
|
77
|
+
To prevent excessive JSON file sizes and potential performance issues, the converter caps `alt_responses` at **10 items maximum**. This applies to:
|
|
78
|
+
|
|
79
|
+
- Text entry interactions with extensive mapping rules
|
|
80
|
+
- Multi-gap clozetext with Cartesian product combinations
|
|
81
|
+
|
|
82
|
+
When alternate responses are trimmed, you'll receive a WARNING-level diagnostic: `QTI_ALT_RESPONSES_TRIMMED`.
|
|
83
|
+
|
|
84
|
+
**Recommendation:** If you need more than 10 alternate responses, consider:
|
|
85
|
+
|
|
86
|
+
- Simplifying your QTI mapping rules to focus on the most common alternatives
|
|
87
|
+
- Using Learnosity's custom scoring features for complex validation logic
|
|
88
|
+
- Manually editing the generated JSON to add additional alternatives (up to Learnosity's limits)
|
|
89
|
+
|
|
90
|
+
### Q: Why are `<meta>` and `<link>` tags removed from my content?
|
|
91
|
+
|
|
92
|
+
**A:** HTML document metadata elements like `<meta charset="utf-8">` and `<link rel="stylesheet">` are not allowed in QTI item content. These tags often appear when content is copy-pasted from web browsers or authoring tools.
|
|
93
|
+
|
|
94
|
+
The converter automatically strips these tags during sanitization because:
|
|
95
|
+
|
|
96
|
+
- They are document-level metadata, not content
|
|
97
|
+
- They have no semantic meaning in assessment items
|
|
98
|
+
- They violate the QTI schema
|
|
99
|
+
|
|
100
|
+
This is a safe transformation that doesn't affect the content's presentation or meaning. An INFO-level diagnostic is emitted when tags are stripped (hidden by default).
|
|
101
|
+
|
|
102
|
+
### Q: Why are inline elements like `<br />` wrapped in `<div>` tags?
|
|
103
|
+
|
|
104
|
+
**A:** The QTI 2.2 schema requires that all direct children of `<itemBody>` must be block-level elements or QTI interactions. Inline elements (also called "phrasing content") like `<br />`, `<span>`, `<img>`, or text nodes are not allowed as direct children.
|
|
105
|
+
|
|
106
|
+
The converter automatically wraps any inline elements at the root level of itemBody in `<div>` containers to ensure valid QTI:
|
|
107
|
+
|
|
108
|
+
**Before normalization (invalid):**
|
|
109
|
+
|
|
110
|
+
```xml
|
|
111
|
+
<itemBody>
|
|
112
|
+
<div>Some content</div>
|
|
113
|
+
<br />
|
|
114
|
+
<br />
|
|
115
|
+
<choiceInteraction>...</choiceInteraction>
|
|
116
|
+
</itemBody>
|
|
117
|
+
```
|
|
118
|
+
|
|
119
|
+
**After normalization (valid):**
|
|
120
|
+
|
|
121
|
+
```xml
|
|
122
|
+
<itemBody>
|
|
123
|
+
<div>Some content</div>
|
|
124
|
+
<div>
|
|
125
|
+
<br />
|
|
126
|
+
<br />
|
|
127
|
+
</div>
|
|
128
|
+
<choiceInteraction>...</choiceInteraction>
|
|
129
|
+
</itemBody>
|
|
130
|
+
```
|
|
131
|
+
|
|
132
|
+
This normalization:
|
|
133
|
+
|
|
134
|
+
- Is applied automatically to all itemBody content
|
|
135
|
+
- Preserves the visual presentation and meaning of the content
|
|
136
|
+
- Ensures the generated QTI validates against the schema
|
|
137
|
+
- Emits an INFO-level diagnostic: `QTI_ITEMBODY_WRAPPED_PHRASING`
|
|
138
|
+
|
|
139
|
+
See ADR-0005 (math content preservation strategy) in the `adr/` folder for technical details.
|
|
140
|
+
|
|
141
|
+
### Q: What does "NOT_IMPLEMENTED" mean?
|
|
142
|
+
|
|
143
|
+
**A:** The feature or question type is not yet supported. Check the compatibility matrix in the README to see supported question types.
|
|
144
|
+
|
|
145
|
+
### Q: Why are my images/assets not working?
|
|
146
|
+
|
|
147
|
+
**A:** When converting packages:
|
|
148
|
+
|
|
149
|
+
- QTI packages must include assets referenced in the imsmanifest.xml
|
|
150
|
+
- Asset paths are rewritten during conversion
|
|
151
|
+
- Verify assets are present in the original package
|
|
152
|
+
|
|
153
|
+
### Q: How do I convert multiple items at once?
|
|
154
|
+
|
|
155
|
+
**A:** Use QTI packages for batch conversion:
|
|
156
|
+
|
|
157
|
+
```bash
|
|
158
|
+
# Create QTI package with multiple items
|
|
159
|
+
lcon learnosity-to-qti-package --in ./bundle --out package.zip
|
|
160
|
+
|
|
161
|
+
# Convert QTI package to Learnosity bundle
|
|
162
|
+
lcon qti-package-to-learnosity --in package.zip --out ./output
|
|
163
|
+
```
|
|
164
|
+
|
|
165
|
+
For individual files, use shell scripting (see [EXAMPLES.md](./EXAMPLES.md#7-batch-conversion)).
|
|
166
|
+
|
|
167
|
+
## Diagnostics & Errors
|
|
168
|
+
|
|
169
|
+
### Q: How do I know if conversion succeeded?
|
|
170
|
+
|
|
171
|
+
**A:** Check the exit code and diagnostic levels:
|
|
172
|
+
|
|
173
|
+
```bash
|
|
174
|
+
lcon qti-to-learnosity --in input.xml --out output.json
|
|
175
|
+
echo $? # 0 = success, 1 = failure
|
|
176
|
+
```
|
|
177
|
+
|
|
178
|
+
Success = no ERROR-level diagnostics. Warnings are acceptable.
|
|
179
|
+
|
|
180
|
+
### Q: Where are diagnostics written?
|
|
181
|
+
|
|
182
|
+
**A:** By default:
|
|
183
|
+
|
|
184
|
+
- When `--out -` (stdout): diagnostics go to stderr
|
|
185
|
+
- When `--out <file>`: diagnostics go to `diagnostics.json`
|
|
186
|
+
|
|
187
|
+
Override with `--diagnostics <stderr|file|both|none>`.
|
|
188
|
+
|
|
189
|
+
### Q: What's the difference between diagnostics levels?
|
|
190
|
+
|
|
191
|
+
| Level | Meaning | Action |
|
|
192
|
+
| ----------- | ----------------------------------- | ----------------------- |
|
|
193
|
+
| **ERROR** | Conversion failed or invalid output | Fix input or report bug |
|
|
194
|
+
| **WARNING** | Potential issue, lossy conversion | Review output carefully |
|
|
195
|
+
| **INFO** | Transformation applied | No action needed |
|
|
196
|
+
|
|
197
|
+
## Supported Interactions
|
|
198
|
+
|
|
199
|
+
### Q: What question types are supported?
|
|
200
|
+
|
|
201
|
+
**A:** The converter supports **11 interaction types** for bidirectional conversion:
|
|
202
|
+
|
|
203
|
+
| QTI Interaction | Learnosity Type |
|
|
204
|
+
| -------------------------- | ----------------------- |
|
|
205
|
+
| associateInteraction | classificaiton |
|
|
206
|
+
| choiceInteraction | mcq |
|
|
207
|
+
| textEntryInteraction | clozetext, shorttext |
|
|
208
|
+
| extendedTextInteraction | longtextV2 |
|
|
209
|
+
| matchInteraction | choicematrix |
|
|
210
|
+
| gapMatchInteraction | clozeassociation |
|
|
211
|
+
| inlineChoiceInteraction | clozedropdown |
|
|
212
|
+
| orderInteraction | orderlist |
|
|
213
|
+
| hotspotInteraction | hotspot |
|
|
214
|
+
| hottextInteraction | tokenhighlight |
|
|
215
|
+
| graphicGapMatchInteraction | imageclozeassociationV2 |
|
|
216
|
+
|
|
217
|
+
See [Supported Interactions](https://learnosity.github.io/lib-qti-converter/#/SUPPORTED_INTERACTIONS) for detailed descriptions and examples.
|
|
218
|
+
|
|
219
|
+
### Q: Can I convert items with multiple questions?
|
|
220
|
+
|
|
221
|
+
**A:** Yes! The converter supports:
|
|
222
|
+
|
|
223
|
+
- **Composite items**: Multiple interactions of the same type (e.g., 3 MCQs in one item)
|
|
224
|
+
- **Mixed interactions**: Different interaction types in one item (e.g., MCQ + essay)
|
|
225
|
+
|
|
226
|
+
These are converted to Learnosity items with multiple questions in the `questions` array.
|
|
227
|
+
|
|
228
|
+
### Q: What happens if I try to convert an unsupported interaction type?
|
|
229
|
+
|
|
230
|
+
**A:** You'll receive a `QTI_UNSUPPORTED_INTERACTION` diagnostic, and that interaction will be skipped. The rest of the item will still convert if it contains supported interactions.
|
|
231
|
+
|
|
232
|
+
## QTI Versions
|
|
233
|
+
|
|
234
|
+
### Q: What QTI versions are supported?
|
|
235
|
+
|
|
236
|
+
**A:** QTI 2.2 is the primary format. QTI 2.1 is available as an opt-in downgrade on output:
|
|
237
|
+
|
|
238
|
+
```bash
|
|
239
|
+
lcon learnosity-to-qti --in item.json --out item.xml --qti-version 2.1
|
|
240
|
+
```
|
|
241
|
+
|
|
242
|
+
### Q: Can I convert QTI 2.1 to Learnosity?
|
|
243
|
+
|
|
244
|
+
**A:** Yes. The converter automatically handles both QTI 2.1 and 2.2 inputs.
|
|
245
|
+
|
|
246
|
+
### Q: What features are lost when downgrading to QTI 2.1?
|
|
247
|
+
|
|
248
|
+
**A:** Features introduced in QTI 2.2 may be omitted or degraded. Check diagnostics for `QTI_VERSION_DOWNGRADE` warnings.
|
|
249
|
+
|
|
250
|
+
## Validation
|
|
251
|
+
|
|
252
|
+
### Q: How do I validate generated QTI XML?
|
|
253
|
+
|
|
254
|
+
**A:** Use the validation script:
|
|
255
|
+
|
|
256
|
+
```bash
|
|
257
|
+
pnpm run validate:qti ./output/qti-items
|
|
258
|
+
```
|
|
259
|
+
|
|
260
|
+
This validates all XML files in the directory using **local XSD schemas** (not remote). The validator automatically detects the file type and uses the appropriate schema:
|
|
261
|
+
|
|
262
|
+
- **QTI items/tests** - Validated against QTI 2.2 schema
|
|
263
|
+
- **Manifest files** (`imsmanifest.xml`) - Validated against IMS Content Packaging schema
|
|
264
|
+
- **LOM metadata files** (`*.lom.xml`) - Validated against IMS Learning Resource Metadata schema
|
|
265
|
+
|
|
266
|
+
Schema URLs are resolved to local files using the XML catalog (`schemas/qti/catalog.xml`).
|
|
267
|
+
|
|
268
|
+
### Q: Why does validation fail but conversion succeeds?
|
|
269
|
+
|
|
270
|
+
**A:** The converter may produce technically valid but schema-non-compliant XML in some edge cases. Check diagnostics for clues and report issues.
|
|
271
|
+
|
|
272
|
+
### Q: Can I use my own XSD schema?
|
|
273
|
+
|
|
274
|
+
**A:** Yes:
|
|
275
|
+
|
|
276
|
+
```bash
|
|
277
|
+
pnpm run validate:qti ./output/qti-items ./path/to/custom.xsd
|
|
278
|
+
```
|
|
279
|
+
|
|
280
|
+
### Q: How can I see which schemas are being used?
|
|
281
|
+
|
|
282
|
+
**A:** Use debug mode:
|
|
283
|
+
|
|
284
|
+
```bash
|
|
285
|
+
pnpm run validate:qti:debug ./output/qti-items
|
|
286
|
+
```
|
|
287
|
+
|
|
288
|
+
This shows schema loading and resolution details.
|
|
289
|
+
|
|
290
|
+
## Configuration
|
|
291
|
+
|
|
292
|
+
### Q: How do I set default options?
|
|
293
|
+
|
|
294
|
+
**A:** Create `lrn-converter.config.json` in your working directory:
|
|
295
|
+
|
|
296
|
+
```json
|
|
297
|
+
{
|
|
298
|
+
"qtiVersion": "2.2",
|
|
299
|
+
"outputFormat": "dir",
|
|
300
|
+
"diagnostics": "both",
|
|
301
|
+
"pretty": true,
|
|
302
|
+
"verbose": false,
|
|
303
|
+
"output": "./output",
|
|
304
|
+
"organisationId": 12345,
|
|
305
|
+
"mediaVault": false,
|
|
306
|
+
"customAssetUrl": "https://my-cdn.example.com/assets"
|
|
307
|
+
}
|
|
308
|
+
```
|
|
309
|
+
|
|
310
|
+
All options are optional. CLI flags override config file values.
|
|
311
|
+
|
|
312
|
+
See [GETTING_STARTED.md](./GETTING_STARTED.md#configuration-file-optional) for detailed documentation of all config options.
|
|
313
|
+
|
|
314
|
+
### Q: Can I disable the config file?
|
|
315
|
+
|
|
316
|
+
**A:** Yes:
|
|
317
|
+
|
|
318
|
+
```bash
|
|
319
|
+
lcon qti-to-learnosity --no-config --in input.xml --out output.json
|
|
320
|
+
```
|
|
321
|
+
|
|
322
|
+
### Q: What config options are available?
|
|
323
|
+
|
|
324
|
+
See [Getting Started](https://learnosity.github.io/lib-qti-converter/#/GETTING_STARTED?id=configuration-file-optional) for the full list.
|
|
325
|
+
|
|
326
|
+
## Testing
|
|
327
|
+
|
|
328
|
+
### Q: How do I run tests?
|
|
329
|
+
|
|
330
|
+
**A:**
|
|
331
|
+
|
|
332
|
+
```bash
|
|
333
|
+
pnpm test
|
|
334
|
+
```
|
|
335
|
+
|
|
336
|
+
This runs all 407 tests across the workspace.
|
|
337
|
+
|
|
338
|
+
### Q: Why are tests failing?
|
|
339
|
+
|
|
340
|
+
**A:** Common causes:
|
|
341
|
+
|
|
342
|
+
- Missing `pnpm run build` - tests run against compiled code in `dist/`
|
|
343
|
+
- Node version mismatch - requires Node >= 22.0.0
|
|
344
|
+
- Changed fixtures paths - verify fixture files exist
|
|
345
|
+
|
|
346
|
+
### Q: How do I run a specific test?
|
|
347
|
+
|
|
348
|
+
**A:**
|
|
349
|
+
|
|
350
|
+
```bash
|
|
351
|
+
cd packages/core
|
|
352
|
+
npx vitest --run test/hotspot.test.ts
|
|
353
|
+
```
|
|
354
|
+
|
|
355
|
+
## Performance
|
|
356
|
+
|
|
357
|
+
### Q: How fast is the conversion?
|
|
358
|
+
|
|
359
|
+
**A:** Performance depends on item complexity and package size. Typical:
|
|
360
|
+
|
|
361
|
+
- Single item: <100ms
|
|
362
|
+
- Package with 1000 items: ~5 seconds
|
|
363
|
+
|
|
364
|
+
### Q: Can I speed up package validation?
|
|
365
|
+
|
|
366
|
+
**A:** Yes, increase parallel jobs:
|
|
367
|
+
|
|
368
|
+
```bash
|
|
369
|
+
pnpm run validate:qti ./output 16 # Use 16 parallel jobs
|
|
370
|
+
```
|
|
371
|
+
|
|
372
|
+
Default is 8 jobs.
|
|
373
|
+
|
|
374
|
+
## Troubleshooting
|
|
375
|
+
|
|
376
|
+
### Q: I get "command not found: lcon"
|
|
377
|
+
|
|
378
|
+
**A:** For end users, install the package globally:
|
|
379
|
+
|
|
380
|
+
```bash
|
|
381
|
+
npm install -g @learnosity/lib-qti-converter
|
|
382
|
+
```
|
|
383
|
+
|
|
384
|
+
For contributors, use the workspace script:
|
|
385
|
+
|
|
386
|
+
```bash
|
|
387
|
+
pnpm run build
|
|
388
|
+
pnpm run lcon -- --help
|
|
389
|
+
```
|
|
390
|
+
|
|
391
|
+
### Q: Tests pass locally but fail in CI
|
|
392
|
+
|
|
393
|
+
**A:** Common issues:
|
|
394
|
+
|
|
395
|
+
- Different Node.js version
|
|
396
|
+
- Missing build step in CI pipeline
|
|
397
|
+
- Case-sensitive filesystem differences
|
|
398
|
+
|
|
399
|
+
### Q: How do I report a bug?
|
|
400
|
+
|
|
401
|
+
**A:** Include:
|
|
402
|
+
|
|
403
|
+
1. Input file (or minimal reproduction)
|
|
404
|
+
2. Command used
|
|
405
|
+
3. Full diagnostic output
|
|
406
|
+
4. Expected vs actual behavior
|
|
407
|
+
5. Node.js and npm versions
|
|
408
|
+
|
|
409
|
+
## Getting Help
|
|
410
|
+
|
|
411
|
+
**Can't find an answer?**
|
|
412
|
+
|
|
413
|
+
1. Check [Examples](https://learnosity.github.io/lib-qti-converter/#/EXAMPLES) for practical examples
|
|
414
|
+
2. See the [package on npm](https://www.npmjs.com/package/@learnosity/lib-qti-converter) for comprehensive documentation
|
|
415
|
+
3. Run with `--verbose` flag for detailed logging
|