You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
{{ message }}
Repository navigation
[QTI] Allow API endpoint to handle AssessmentItem.raw_data to store QTI data #5999
❌ 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) holds type, question, answers, hints, raw_data. type choices 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_data today carries raw Perseus JSON for perseus_question.
For QTI items the full item XML lives in raw_data; question/answers are 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) scan question/answers/hints for  and create/claim File rows (preset EXERCISE_IMAGE). QTI items carry references in XML attributes, so that scan finds nothing.
Sync is field-level last-write-wins over the single raw_data string.
Saves process asynchronously; validation errors return through the sync error channel, not synchronously.
The Change
Accept QTI as a valid AssessmentItem.type everywhere the backend enumerates or validates types.
Persist and return raw_data verbatim for QTI items through save and sync.
Apply no markdown/answer transformation to QTI items.
Extract referenced files from the QTI raw_data XML — checksums from src, srcset, href, and data attributes — and create/claim/delete File rows through the existing set_files flow.
Architecture decided with the maintainer across an iterative session: blanket QTI type with the item XML in raw_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.
Plan: Store and round-trip the editor's authored QTI XML on AssessmentItem (type='QTI', full item XML in raw_data) through the save and sync API paths without altering it, extracting referenced files and validating the XML against the QTI 3.0 schema.
Add QTI as an AssessmentItem.type and make raw_data round-trip byte-for-byte
Skip answers/hints JSON-shape validation when type == "QTI"
Reject invalid QTI raw_data via the sync error channel
Extract src/srcset/href/data checksums from raw_data and wire into set_files
Full create → update → read round-trip test, file removal on update, and full-suite regression check
@rtibblesbot's comments are generated by an LLM, and should be evaluated accordingly
How was this generated?
Implemented code following the pre-approved plan using test-driven development (red-green-refactor)
Ran the project's full test suite and linter before committing
For UI changes: captured live screenshots to verify rendering
For backend changes: verified with example API/CLI output
❌ 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 inraw_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).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).question/answers;raw_datatoday carries raw Perseus JSON forperseus_question.QTIitems the full item XML lives inraw_data;question/answersare unused, and the serializer's answers/hints coercion must be bypassed.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.raw_datastring.The Change
QTIas a validAssessmentItem.typeeverywhere the backend enumerates or validates types.raw_dataverbatim for QTI items through save and sync.raw_dataXML — checksums fromsrc,srcset,href, anddataattributes — and create/claim/deleteFilerows through the existingset_filesflow.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 serializersraw_dataround-trips byte-for-byte through save and synctype='QTI'itemsraw_data(viasrc/srcset/href/data) are linked asFilerows through the existing claim/create/delete flowReferences
AI usage