Appearance
ADR-2476: Synchronous CDISC ODM v1.3.2 and USDM v4 Protocol Draft Import and Self-Service Study Registration
- Status: Accepted
- Date: 2026-11-20
- Authors: @fderuiter
- Deciders: @fderuiter
- Requirements: PRD-SYS-001 (signed reason for change and per-tenant audit trail), kernel spec K007, K-PROT-1, K-PROJ-1
1. Context & Problem Statement
ADR-2472 established ProtocolDesign as the typed content of a ProtocolVersion, and ADR-2473 introduced UsdmDesignImporter in packages/ddf to parse CDISC USDM 4 JSON in memory. However, three gaps prevented study designers from onboarding studies or importing external study structures in the web workspace:
- No CDISC ODM v1.3.2 XML or bundled CDISC Library eCRF importer: Sponsors migrating studies from CDISC ODM-XML v1.3.2 systems or assembling drafts from the 36 bundled CDISC Library eCRF templates (
docs/CDISC/Library/Data_Collection/eCRFs) had no parser to translate<FormDef>,<ItemGroupRef>/<ItemGroupDef>, and<ItemRef>/<ItemDef>definitions intoProtocolDesignwhile preserving form names, item prompts, display order, mandatory flags, and import notes. - No persisted Kernel HTTP routes for study creation or synchronous draft import:
apps/designerruns outside Core without PostgreSQL persistence (ServiceTopology), whileCadence.Kernel.Apiexposed read-only protocol routes without endpoints to list visible tenant studies, register a study (RegisterStudy), or synchronously import an ODM/USDM definition into aDraftProtocolVersion(CreateProtocolDraft,ReviseProtocolDraft,ForkProtocolVersion). - Unrouted
/ecrfupload client and missing study directory UI:StudyCanvasView.vuerequired typing a study code from memory (with aCAD-101placeholder mismatching the seededCADENCE-101demo study), andDesignerSchemaPanel.vue/useSchemaIngestion.jsposted uploads to an unrouted/api/v1/designer/ingestion/uploadpath that triggered HTTP 404 errors andwindow.alertdialogs.
2. Decision Drivers & Constraints
- Kernel Governance & Auditability (PRD-SYS-001, ADR-2449, ADR-2452): Every study registration and protocol draft import must execute through
IKernelCommandSenderwith study design authorization (study.register,protocol.draft,protocol.revise_draft,protocol.amend), a gateway-signedX-Change-Reason, andIdempotency-Keyreplay safety. Imported definitions must always enterDraftstatus and require formal review and electronic attestation before site activation. - Standards Boundary (K-PROJ-1):
packages/kernel/srcmust remain free of CDISC ODM/USDM parsing details and domain variable names; standards translation belongs inpackages/ddfbehind a pure kernel port (IProtocolDesignImporter). - Payload & XML Security: Synchronous HTTP uploads must reject payloads exceeding 10 MB (
10,485,760bytes) and prohibit XML DTD / external entity declarations (DtdProcessing.Prohibit,XmlResolver = null). - Lossless Fidelity & Readable Import Notes: Item prompts (
CollectionItem.Prompt), display order, mandatory flags, unmapped terminology bindings, and optional vendor attributes/extensions must be preserved on the draft summary (ProtocolDesign.ImportNotes) without requiring a database schema migration.
3. Options Considered
Option 1: Synchronous Import via IProtocolDesignImporter on the Kernel API Host (Selected)
- Overview: Define
IProtocolDesignImporterandIStudyDirectoryinCadence.Kernel.Abstractions; implementOdmDesignImporter,CdiscLibraryTemplateCatalog(covering all 36 bundled CDISC Library eCRF files), andProtocolDesignImporterServiceinCadence.Ddf; expose tenant-visible study/organization directory,POST /api/v1/kernel/studies,GET /api/v1/kernel/protocol-templates,GET /api/v1/kernel/protocol-versions/{versionRef}/design-summary, andPOST /api/v1/kernel/studies/{studyRef}/protocol-importsonCadence.Kernel.Api; and wire bothStudyCanvasView.vue/ProtocolImportPanel.vueandDesignerSchemaPanel.vue/useSchemaIngestion.jsto the kernel endpoints with inline banners and zerowindow.alertcalls. - Pros:
- ✅ Uses the kernel's transactional command pipeline, per-tenant audit chain, capability checks, and
Idempotency-Keyguarantees directly. - ✅ Preserves K-PROJ-1 layering (
Cadence.Kernel.Apidepends only onCadence.Kernel.Abstractions;apps/kernel-apicomposesCadence.Ddf). - ✅ Eliminates unrouted
/api/v1/designer/ingestion/upload404s and supports one-step study creation + ODM v1.3.2 / USDM v4 import.
- ✅ Uses the kernel's transactional command pipeline, per-tenant audit chain, capability checks, and
- Cons:
- ❌ Caps synchronous HTTP uploads at 10 MB rather than streaming multi-hundred-megabyte archives asynchronously.
Option 2: Route Uploads Through apps/designer with Cross-Service Calls to Kernel
- Overview: Add ODM parsing and multipart upload endpoints to
apps/designerand forward translated designs over internal HTTP toapps/kernel-api. - Pros:
- ✅ Keeps
Cadence.Ddfout ofapps/kernel-api.
- ✅ Keeps
- Cons:
- ❌ Splits study registration, concept resolution, and draft creation across two network hops without a single transactional or idempotent boundary, and requires new gateway routing and designer-to-kernel service credentials.
4. Decision Outcome
- Chosen Option: Option 1
- Justification: Executing synchronous ODM v1.3.2 XML, USDM v4 JSON, and bundled CDISC Library eCRF template imports on the kernel API host behind
IProtocolDesignImporterkeeps standards parsing isolated inCadence.Ddfwhile guaranteeing transactionalDraftcreation, signedX-Change-Reasonauditing, and deterministicIdempotency-Keyreplay.
5. Consequences & Trade-offs
- Positive Impact: Study designers can browse visible studies (including
CADENCE-101), register new studies, and import ODM v1.3.2 XML, USDM v4 JSON, or any of the 36 bundled CDISC Library eCRF templates in one flow with inline validation feedback and readable import notes. - Negative Impact / Technical Debt: Payloads larger than 10 MB are rejected with HTTP
413 Payload Too Largeon the synchronous import route. - Mitigation Strategy: Both client file pickers and server endpoints enforce the 10 MB ceiling with actionable RFC 9457
ProblemDetailsmessages, andProtocolDesignDocumentstores optionalPromptandImportNoteswithJsonIgnoreCondition.WhenWritingNullso existing protocol content hashes remain unchanged.
6. Implementation & Verification
- Affected Packages / Services:
packages/kernel/src/Cadence.Kernel.Abstractions,packages/kernel/src/Cadence.Kernel.Persistence,packages/kernel/src/Cadence.Kernel.Api,packages/ddf,apps/kernel-api,apps/web. - Verification Plan: Validated by
OdmDesignImporterTests(all 36 bundled CDISC Library eCRF files, DTD/XXE blocking, 10 MB limit, vendor/terminology import notes),KernelStudyImportEndpointsTests(visibility filtering, permissions, signedX-Change-Reason,Idempotency-Keyreplay,Draft-only status),Cadence.ArchitectureTests(StandardsBoundaryTests,KernelLayeringTests), and Vitest specs (StudyCanvasImport.spec.js,EcrfSchemaImport.spec.js).