StitchEDC is an advanced, automated clinical metadata compiler designed to ingest unstructured trial protocols or clinical state structures and output fully compliant CDISC ODM v1.3.2 XML study setups.
By mapping raw protocol constraints into a formal 21-Definition Canonical Schema, StitchEDC bridges the gap between study protocols and production-ready electronic Data Capture (EDC) environments, providing real-time verification of study logic before database locking.
At the heart of StitchEDC lies a strict JSON-Schema abstraction (canonical_study.schema.json) that model compilers and translation scripts must resolve to. This schema covers 21 distinct structural definitions grouped across three critical layers:
ββββββββββββββββββββββββββββββββββββββββββββββββ
β PROTOCOL & METRICS LAYER β
β 1. Protocol Identity 2. Descriptors (MAMS)β
β 3. Estimands 4. Eligibility (I/E)β
β 5. Clinical Endpoints 6. DOOR Scales β
ββββββββββββββββββββββββ¬ββββββββββββββββββββββββ
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββ
β TRIAL DESIGN LAYER β
β 7. Stages 8. Treatment Arms β
β 9. Analysis Gates 10. Stratum Factors β
ββββββββββββββββββββββββ¬ββββββββββββββββββββββββ
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββ
β DATA COLLECTION LAYER β
β 11. Calendar Epochs 12. Timeline Visits β
β 13. CRF Templates 14. Item Layout Groupsβ
β 15. Form Items/Fields 16. Codelists / Decodesβ
β 17. VisitΓForm Matrix β
ββββββββββββββββββββββββ¬ββββββββββββββββββββββββ
βΌ
ββββββββββββββββββββββββββββββββββββββββββββββββ
β LOGICAL RULES ENGINE β
β 18. Edit Checks (Cross) 19. Derivations β
β 20. Access Control Roles21. Change Audit/Provβ
ββββββββββββββββββββββββββββββββββββββββββββββββ
protocol_identity: Captures primary keys includingprotocol_id, standard phase designations (I/Ib/II/IIa/IIb/III/IV), therapeutic area, study sponsor, andtarget_enrollment.design_descriptors: Binds architectural flags such as Multi-Arm Multi-Stage (MAMS), blinding style (open-label,double-blind,triple-blind), non-inferiority margins, and adaptive seamless transitions.estimands: Formalizes the precise scientific question on the trial by pairing target subject population, intervention strategy, clinical endpoints, and rules for intercurrent event resolution.structured_eligibility: Deconstructs inclusion and exclusion criteria into database-executable flags map-wired directly back to screening item variables.endpoint: Maps primary, secondary, and exploratory protocol endpoints.door_ranking: Specifically isolates multi-state complex matrices, formulating Desirability of Outcome Ranking (DOOR) hierarchies.
stage: Defines sequential adaptive trials segments governed by specific gates.arm: Represents study treatment pathways linked directly to corresponding study stages.analysis_gate: Declares trial interim analysis criteria (e.g., sample-size triggers, DSMB futility limits, or O'Brien-Fleming efficacy alpha-boundaries).stratification: Maps key randomization balancing indicators (e.g., diagnostic sub-strata, clinical site IDs) mapped to active target variables.
epoch: Demarcates the clinical trial schedule (e.g., screening cycle, active intervention period, recovery, long-term safety follow-up).event: Outlines physical clinic visits or remote monitoring checkpoints.form: Represents individual Case Report Forms (CRF) or clinical domains.item_group: Structural layout partitions (tabular matrices, continuous forms) inside individual CRFs.field: Fully resolved database metadata items containing strict CDISC data types (Date,Integer,Float,Text,Boolean,Coded) and target units.code_list: Translation dictionaries carrying internal software transaction values (code) paired with human-readable language strings (decode).visit_form_link: Connects visits (event_id) to CRFs (form_id), generating the logical study collection calendar grid.
edit_check: Declares diagnostic and semantic validation formulas (including cross-form or time-offset dependencies) to prevent input errors on paperless sites.derivation: Governs calculated database endpoints (e.g., BMI, Mean Arterial Pressure, Creatinine Clearance) so secondary fields are auto-populated.role: Implements Role-Based Access Control permissions mapping investigator, monitor, CRA, and auditor workflows.provenance: An integrated review audit block attached to every schema definition block tracking generation model confidence metrics, reviewer overrides, timestamps, and validation stamps.
Standard XML schemas only check basic syntax (like tag structures). To prevent database errors in production, StitchEDC integrates a robust semantic rules validator (validate_schema.py & schemaChecker.ts) that screens for five critical clinical failure modes:
- The Gaps: Programmers declare a coded field (e.g., Sex, Race, Toxicity Grade) but fail to configure option values, leaving the CRF dropdown empty.
- The Check: Parses database schemas, flag and blocks any
code_listthat has zero list members ("items"is empty), or contains any option with a nullcodeor empty descriptiondecode.
- The Gaps: Code lists are defined in the database but are completely disconnected from any item field or domain space. This causes code drift, bloating the study metadata.
- The Check: Aggregates all references in the database. Generates code-list usage warnings for clinical programmers to prune unreferenced dictionaries.
- The Gaps: Arm pathways are defined but have no stage associations, or calendar visit events have invalid references to timeline segments (Epochs). This leads to unassigned subjects or untracked clinical data.
- The Check: Ensures every designated
armmaps to at least one active studystage, verifies all interimanalysis_gatesreference active definitions, and guarantees scheduledeventsare bounded by realepochs.
- The Gaps: Fields reference undefined CRFs, visit matrices link to deleted visit dates, or inclusion/exclusion rules link to deleted questions.
-
The Check: Performs full relational integrity diagnostics on the schema graph. It flags any reference where:
$$\text{Target OID} \notin {\text{Declared Primary Identifiers}}$$ This includes checking fields mapping to missing layout groups, cross-form derivations referencing missing fields, and eligibility rules referencing non-existent data points.
- The Gaps: Desirability of Outcome Ranking (DOOR) scales are configured incorrectly (e.g., skipping ranks, duplicate numbers, or non-sequential ranges).
-
The Check: Programmatically validates that DOOR scale rankings are unique, sequential, and start exactly at
$1$ ($1, 2, 3, \ldots, N$ ). Any non-contiguous or missing numbers are flagged as severe database configuration errors.
StitchEDC contains a standalone, server-compatible Python script (validate_schema.py) to validate your study setup. You can run it on your CI/CD pipelines, build scripts, or terminals:
python3 validate_schema.py path_to_your_study_design.json=======================================================
StitchEDC Clinical Trial Ingest Validator Diagnostics Report
=======================================================
Clinical Fields Audited: 18
CRF Forms Scanned: 8
Outcome Endpoints Map: 2
Total Errors Found: 0
Total Warnings Flagged: 1
=======================================================
π’ NO CRITICAL COMPILATION SCHEMA ERRORS DISCOVERED. VALID STITCHEDC INGEST STUDY.
β οΈ ARCHITECTURAL DESIGN WARNINGS FLAGGED:
- [Orphaned Code List] Code list 'CL_LB_CSF_LACTATE' exists but is never referenced.
For advanced clinical research data groups, comparing protocol setups across multiple trials is a major bottleneck. StitchEDC resolves this by treating the entire 21-definition clinical domain space as a topological property graph.
The standalone Python tool export_clinical_graph.py parses a study setup and outputs a comprehensive Neo4j Cypher script ready to build transaction-safe indexes and multi-edge connected clinical nodes.
- Protocol Backbone:
(:Protocol) -[:HAS_ARM]-> (:Arm)and(:Protocol) -[:CONDUCTED_AT]-> (:Site) - Clinical Timeline:
(:Protocol) -[:HAS_VISIT]-> (:Visit) - Data-Dictionary Layout:
(:Visit)-[:COLLECTS {mandatory: boolean}]-> (:Form) -[:CONTAINS_FIELD]-> (:Field) -[:USES_CODELIST]-> (:CodeList) - Rigor and Quality Control:
(:Field) -[:VALIDATED_BY]-> (:EditCheck)
python3 export_clinical_graph.py path_to_your_study_design.json study_graph.cypherData scientists and trial designers can run highly specialized Cypher questions instantly in the Neo4j browser:
- Investigator Cognitive Burden: Look for overloaded clinic visits by counting total field entries expected at each physical visit checkpoint.
MATCH (v:Visit)-[:COLLECTS]->(f:Form)-[:CONTAINS_FIELD]->(fi:Field) RETURN v.name AS Visit, count(fi) AS TotalFields, count(DISTINCT f) AS FormsCount ORDER BY TotalFields DESC;
- Clinical Logic dependencies audit: Trace multi-form validation formulas and dependencies to map validation rules to specific clinical domains.
MATCH (f:Form)-[:CONTAINS_FIELD]->(fi:Field)-[:VALIDATED_BY]->(ec:EditCheck) RETURN f.cdisc_domain AS Domain, fi.name AS TargetField, ec.rule AS RuleExpression ORDER BY Domain;
The exported StitchEDC_ODM_Setup.xml is fully compliant with the CDISC ODM XML Version 1.3.2 schema, allowing clinical database designers to import the generated files directly into standard EDCs (like Viedoc, Rave, or OpenClinica).
CreationDateTime: Auto-generated timestamping conform to ISO 8601 formatting.FileOID/StudyOID: Formats structured strings incorporating protocol identifiers and cryptographic epoch values.XmlEscape: Safe encoding rules applied across all protocol titles, labels, edit check error messages, and descriptions to ensure stable file handling.- Custom Metadata Block: Appends stratification elements, treatment arms, and edit-check equations as structured auxiliary comments, streamlining database setups.
Developed for Global Clinical Data Managers and Research Coordinators by StitchEDC Studio.