Repository navigation
[QTI] Allow API endpoint to handle AssessmentItem.raw_data to store QTI data #5999
Description
❌ This issue is not open for contribution. Visit Contributing guidelines to learn about the contributing process and how to find suitable issues.
Overview
Store and round-trip the editor's authored QTI XML on AssessmentItem (type='QTI', full item XML in raw_data) through the save, sync, and internal API paths without altering it.
Complexity: Medium
Target branch: unstable
Context
AssessmentItem(contentcuration/contentcuration/models.py) holdstype,question,answers,hints,raw_data.typechoices are migration-defined (0152,0154).- The endpoint already exists:
AssessmentItemViewSet+AssessmentItemSerializer(viewsets/assessmentitem.py), registered in the sync API (viewsets/sync/base.py). This task extends them — not a new endpoint. Type validation already exists (Add validation for the "type" of AssessmentItem objects #4877). - Legacy items use structured
question/answers;raw_datatoday carries raw Perseus JSON forperseus_question. - For
QTIitems the full item XML lives inraw_data;question/answersare unused, and the serializer's answers/hints coercion must be bypassed. - Nested-resource extraction today is markdown-only:
AssessmentItemSerializer.set_files+get_filenames_from_assessment(viewsets/assessmentitem.py) scanquestion/answers/hintsforand create/claimFilerows (presetEXERCISE_IMAGE). QTI items carry references in XML attributes, so that scan finds nothing. - Sync is field-level last-write-wins over the single
raw_datastring. - Saves process asynchronously; validation errors return through the sync error channel, not synchronously.
The Change
- Accept
QTIas a validAssessmentItem.typeeverywhere the backend enumerates or validates types. - Persist and return
raw_dataverbatim for QTI items through save and sync. - Apply no markdown/answer transformation to QTI items.
- Extract referenced files from the QTI
raw_dataXML — checksums fromsrc,srcset,href, anddataattributes — and create/claim/deleteFilerows through the existingset_filesflow. - Validate
raw_dataagainst the QTI schema ([QTI] QTI 3.0 schema XML validation utilities #6005) during async sync processing; reject invalid items.
Acceptance Criteria
-
QTIis an acceptedAssessmentItem.typeacross model, validation, and serializers - A QTI item's
raw_dataround-trips byte-for-byte through save and sync - No markdown/answer transformation is applied to
type='QTI'items - Files referenced in a QTI item's
raw_data(viasrc/srcset/href/data) are linked asFilerows through the existing claim/create/delete flow - Invalid QTI is rejected on save and surfaced to the client
- Legacy item types save and sync unchanged
- Tests cover create/update/read and file extraction for a QTI item via the sync API, asserting verbatim round-trip
References
AI usage
Architecture decided with the maintainer across an iterative session: blanket
QTItype with the item XML inraw_data; XSD-authoritative validation across all sources; a legacy→QTI global migration with an API-layer dual-read; ricecooker upload delegating to the AssessmentItem serializer; and a Perseus custom-interaction contract confirmed against the QTI 3.0 specification. Claude mapped the existing publish/validation/ricecooker code, proposed the breakdown, and drafted each issue; the maintainer steered every decision and reviewed throughout.

Activity
rtibblesbot commentedon Jul 3, 2026
Watching for resolution on behalf of #6002.
rtibblesbot commentedon Jul 3, 2026
Plan: Store and round-trip the editor's authored QTI XML on
AssessmentItem(type='QTI', full item XML inraw_data) through the save and sync API paths without altering it, extracting referenced files and validating the XML against the QTI 3.0 schema.QTIas anAssessmentItem.typeand makeraw_dataround-trip byte-for-byteanswers/hintsJSON-shape validation whentype == "QTI"raw_datavia the sync error channelsrc/srcset/href/datachecksums fromraw_dataand wire intoset_files@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly
How was this generated?
feat: round-trip QTI AssessmentItem raw_data through save and sync
rtibblesbot commentedon Jul 3, 2026
The bot has been waiting for a response for 2 hour(s). It will resume automatically when someone replies.