xAPI and cmi5 Event Model
Status: in-progress
Intent
Section titled “Intent”Define how internal domain events map to xAPI statements and cmi5-compatible flows.
Design Direction
Section titled “Design Direction”- Internal transactional model remains canonical
- xAPI statements are generated from domain events and lifecycle transitions
- cmi5-specific launch/session constraints are layered on top of xAPI generation
- The upstream ADL LRS Conformance Test Suite is a hard gate for the public LRS surface, so route order and normalization rules should be implemented in slices that let the relevant batteries pass early.
Actor Mapping
Section titled “Actor Mapping”- Actor maps to a stable Emergent-controlled
accountIFI, notmbox. account.homePageis the Emergent-controlled identity namespace for the deployment.account.nameis the stable internal person identifier, not a mutable username or email address.- Person display metadata is optional and should remain lossy-safe; it must not be required for identity matching.
- Teacher previews, admin imports, and service-driven statements use separate authority mapping from actor mapping.
Activity IRI Strategy
Section titled “Activity IRI Strategy”- Material assignment activity:
https://emergent.app/xapi/activities/material-assignment/{assignmentId} - Material version activity:
https://emergent.app/xapi/activities/material-version/{courseMaterialVersionId} - Learning unit activity:
https://emergent.app/xapi/activities/learning-unit/{learningUnitId} - Competency node activity:
https://emergent.app/xapi/activities/competency-node/{competencyNodeId} - Qualification activity:
https://emergent.app/xapi/activities/qualification/{qualificationDefinitionId}
Rules:
- The assignment activity is the primary object for learner playback and progress statements.
- The material-version activity is used in context when statement provenance needs to survive reassignment.
- Activity IRIs are owned by Emergent and should resolve to human-readable metadata over time.
- H5P runtime-local ids must never appear as the canonical xAPI activity id.
Verb and Object Mapping Baseline
Section titled “Verb and Object Mapping Baseline”| Internal event | xAPI verb (illustrative) | xAPI object |
|---|---|---|
| unit viewed | experienced |
learning unit activity |
| attempt started | initialized |
assessment activity |
| attempt submitted | completed |
assessment activity |
| score finalized | scored or profile-specific verb |
assessment attempt result projection |
| feedback issued | profile-specific feedback verb | feedback activity linked to attempt |
| competency demonstrated | profile-specific competency verb | competency node activity |
| competency state changed | profile-specific progression verb | competency-state activity |
| qualification granted | earned |
qualification activity |
Verb profiles should be versioned and documented.
H5P Event Mapping
Section titled “H5P Event Mapping”| Runtime event | xAPI verb | xAPI object | Notes |
|---|---|---|---|
| launch issued | https://w3id.org/xapi/adl/verbs/launched |
material assignment activity | Emitted by platform boundary, not by Lumi directly |
| player initialized | http://adlnet.gov/expapi/verbs/initialized |
material assignment activity | Registration is required |
| content experienced | http://adlnet.gov/expapi/verbs/experienced |
material assignment activity | Used for lightweight interaction start |
| question answered | http://adlnet.gov/expapi/verbs/answered |
interaction activity or parent | Use interaction metadata when available |
| progress checkpoint recorded | https://emergent.app/xapi/verbs/progressed |
material assignment activity | Emergent-owned profile verb |
| content completed | http://adlnet.gov/expapi/verbs/completed |
material assignment activity | Completion is not equivalent to success |
| score finalized | https://w3id.org/xapi/adl/verbs/scored |
material assignment activity | Include scaled/raw/min/max when known |
| teacher preview launched | https://emergent.app/xapi/verbs/previewed |
material assignment activity | Must not write learner progress projections |
Registration and Authority Mapping
Section titled “Registration and Authority Mapping”- Registration is per launch lineage, not per person or per raw H5P package.
- A new registration is issued when the platform creates a new launch session.
- Authority is derived from the authenticated LRS credential used on ingest.
- Actor and authority may differ, especially for platform-imported or teacher-preview statements.
- Statement ids should be deterministic when emitted from platform domain events and may be generated by the LRS for accepted runtime events that arrive without ids.
Result and Context Mapping
Section titled “Result and Context Mapping”result should include:
- Completion and success indicators where applicable
- Score details including scaled/raw/min/max where meaningful
- Duration when session semantics apply
- Response payloads only when the interaction type supports them and the privacy posture allows them
context should include:
- Offering or container context identifiers
- Assignment lineage identifiers
- Material version identifiers
- Competency framework/version and competency-node identifiers where applicable
- Platform extension context required for traceability
Recommended context layout:
context.registration: launch-session registration UUIDcontext.contextActivities.parent: assignment activitycontext.contextActivities.grouping: offering activitycontext.contextActivities.category: Emergent verb-profile or product-profile activities when neededcontext.contextAgents: teacher or reviewer relationships where the relationship matters to the statementcontext.contextGroups: cohort or group relationships only when they materially change meaningcontext.extensions:https://emergent.app/xapi/extensions/offering-idhttps://emergent.app/xapi/extensions/learning-unit-idhttps://emergent.app/xapi/extensions/course-material-version-idhttps://emergent.app/xapi/extensions/launch-session-idhttps://emergent.app/xapi/extensions/runtime-provider
cmi5 Considerations
Section titled “cmi5 Considerations”For cmi5-compatible flows:
- Respect launch/session boundaries in event generation
- Support AU (assignable unit) progression semantics
- Ensure move-on criteria can be evaluated from generated statement stream
Current launch-boundary limits:
- Assignment-level cmi5 AU metadata now comes from
course_material_assignment.cmi5_au_metadata_payloadand feedsmoveOn,masteryScore,launchParameters,entitlementKey, and publisher grouping activity when populated. - Assignment AU metadata is populated at import (derived from the version manifest) and maintained in bulk via the admin backfill (
POST .../cmi5-au-metadata/backfill); there is no per-assignment update endpoint. - Workflow auth also exposes
POST /workflow/course-material-assignments/cmi5-au-metadata/backfillto populate empty assignment AU metadata in bulk from derivable version manifests for the caller’s accessible organizations. - The backfill request accepts
dryRunplus optionalorganizationIdscope, and the admin console dashboard now uses that path as the first concrete admin caller for previewing or applying manifest-derived AU metadata. - Launch resolution falls back to
course_material_version.source_manifest_payloadwhen assignment AU metadata is empty. The normalized import shape iscmi5AuMetadataorcmi5.auMetadata, with directcmi5and root-object fallback for the same AU fields. - H5P launch handlers still accept
/runtime/assignments/{assignmentId}/launchinside the service, but the Kubernetes gateway deployment publishes that surface through the Supabase-compatible/functions/v1/runtime/assignments/{assignmentId}/launchpath. The LMS-launched statement records the public launch URL in the cmi5launchURLcontext extension. LMS.LaunchDatanow includes a realreturnURLwhen the matching portal public URL is configured. Learner launches return to/classes/{offeringId}; preview launches return to the configured portal root.- If neither assignment metadata nor a derivable source manifest is present, launches still fall back to spec-safe defaults and omit optional cmi5 values.
Idempotency and Ordering
Section titled “Idempotency and Ordering”xAPI generation pipeline requirements:
- Deterministic statement identifiers or idempotency keys
- Stable ordering for transitions of the same attempt/session
- Retry-safe emission to LRS targets
Initial implementation rules:
- Platform-originated statements should use deterministic ids derived from the event identity.
- Runtime-originated statements that arrive without ids may be assigned ids by the LRS, but ordering must still preserve launch-session chronology.
- Projection updates must be idempotent by
statement.id. - Teacher preview traffic must be distinguishable from learner progress traffic at the statement level.
Implementation Anchors
Section titled “Implementation Anchors”- Domain events and contract types:
packages/domain - Event persistence or outbox support:
packages/dbandapps/api - Local/offline event capture and replay markers:
packages/offline-data
Conformance Gate
Section titled “Conformance Gate”- Treat the IEEE xAPI 2.0 documentation as the normative protocol source and the upstream ADL LRS Conformance Test Suite as the executable compatibility oracle.
- Add the conformance harness early and keep it expected-red until the corresponding LRS slice exists; do not wait for the full H5P flow before exercising it.
- Basic-auth compatibility must stay first-wave because the upstream suite currently exercises Basic auth directly.
- MIT-licensed upstream helpers are eligible for direct TypeScript adaptation when they reduce ambiguity or spec risk, provided the required license notice is preserved for copied or derived material.
Remaining Decisions
Section titled “Remaining Decisions”- Final Emergent-owned verb IRIs for progress and preview flows
- Whether interaction-level child activities should be minted eagerly or lazily
- Partitioning strategy for high-volume statement retrieval in large cohorts