Keyboard shortcuts

Press or to navigate between chapters

Press S or / to search in the book

Press ? to show this help

Press Esc to hide this help

Architecture Overview

Trial Submission Studio is built as a modular Rust workspace with 10 specialized crates.

Design Philosophy

Core Principles

  1. Separation of Concerns - Each crate has a single responsibility
  2. Deterministic Output - Reproducible results for regulatory compliance
  3. Offline Operation - All standards embedded, no network dependencies
  4. Type Safety - Rust’s type system prevents data errors

Key Design Decisions

  • Pure Functions - Mapping and validation logic is side-effect free
  • Embedded Standards - CDISC data bundled in binary
  • No External APIs - Works without internet connection
  • Auditable - Clear data lineage and transformations

Workspace Structure

trial-submission-studio/
├── Cargo.toml              # Workspace configuration
├── crates/
│   ├── tss-gui/            # Desktop application
│   ├── xport/              # XPT file I/O
│   ├── tss-validate/       # CDISC validation
│   ├── tss-map/            # Column mapping
│   ├── tss-normalization/      # Data transformations
│   ├── tss-ingest/         # CSV loading
│   ├── tss-output/         # Multi-format export
│   ├── tss-standards/      # CDISC standards loader
│   ├── tss-model/          # Core types + Polars utilities
│   └── tss-updater/        # App update mechanism
├── standards/              # Embedded CDISC data
├── mockdata/               # Test datasets
└── docs/                   # This documentation

Crate Dependency Graph

flowchart TD
    subgraph Application
        GUI[tss-gui]
    end

    subgraph Processing
        MAP[tss-map]
        OUTPUT[tss-output]
        INGEST[tss-ingest]
        TRANSFORM[tss-normalization]
    end

    subgraph Validation
        VALIDATE[tss-validate]
    end

    subgraph I/O
        XPT[xport]
    end

    subgraph Core
        STANDARDS[tss-standards]
        MODEL[tss-model]
    end

    subgraph Utility
        UPDATER[tss-updater]
    end

    GUI --> MAP
    GUI --> OUTPUT
    GUI --> INGEST
    GUI --> UPDATER
    MAP --> VALIDATE
    MAP --> STANDARDS
    OUTPUT --> XPT
    OUTPUT --> STANDARDS
    INGEST --> STANDARDS
    VALIDATE --> STANDARDS
    STANDARDS --> MODEL
    style GUI fill: #4a90d9, color: #fff
    style STANDARDS fill: #50c878, color: #fff
    style MODEL fill: #f5a623, color: #fff

Crate Responsibilities

CratePurposeKey Dependencies
tss-guiDesktop applicationegui, eframe
xportXPT file I/Obyteorder, encoding_rs
tss-validateCDISC validationtss-standards
tss-mapFuzzy column mappingrapidfuzz
tss-normalizationData transformationspolars
tss-ingestCSV loadingcsv, polars
tss-outputMulti-format exportquick-xml
tss-standardsCDISC standards loaderserde, serde_json
tss-modelCore types + Polars utilitieschrono, polars
tss-updaterApp updatesreqwest

Data Flow

Import → Transform → Export

flowchart LR
    subgraph Input
        CSV[CSV File]
    end

    subgraph Processing
        INGEST[Ingest]
        MAP[Map & Transform]
        VALIDATE[Validate]
    end

    subgraph Output
        XPT[XPT File]
        XML[Dataset-XML]
        DEFINE[Define-XML]
    end

    CSV --> INGEST
    INGEST --> MAP
    MAP --> VALIDATE
    VALIDATE --> XPT
    VALIDATE --> XML
    VALIDATE --> DEFINE
    VALIDATE -.->|errors| MAP
    style CSV fill: #e8f4f8, stroke: #333
    style XPT fill: #d4edda, stroke: #333
    style XML fill: #d4edda, stroke: #333
    style DEFINE fill: #d4edda, stroke: #333

Standards Integration

flowchart TB
    subgraph "Embedded CDISC Data"
        SDTM[SDTM-IG 3.4]
        CT[Controlled Terminology]
        DOMAINS[Domain Definitions]
    end

    STANDARDS[tss-standards]
    SDTM --> STANDARDS
    CT --> STANDARDS
    DOMAINS --> STANDARDS
    STANDARDS --> MAP[tss-map]
    STANDARDS --> VALIDATE[tss-validate]
    STANDARDS --> OUTPUT[tss-output]
    style STANDARDS fill: #50c878, color: #fff

Key Technologies

Core Stack

ComponentTechnology
LanguageRust 1.92+
GUI Frameworkegui/eframe
Data ProcessingPolars
SerializationSerde
TestingInsta, Proptest

External Crates

PurposeCrate
Fuzzy matchingrapidfuzz
XML processingquick-xml
XPT handlingCustom (xport)
Loggingtracing
HTTP clientreqwest

Embedded Data

Standards Directory

standards/
├── sdtm/
│   └── ig/v3.4/
│       ├── Datasets.csv         # Domain definitions
│       ├── Variables.csv        # Variable metadata
│       ├── metadata.toml        # Version info
│       └── chapters/            # IG chapter documentation
├── adam/
│   └── ig/v1.3/
│       ├── DataStructures.csv   # ADaM structures
│       ├── Variables.csv        # Variable metadata
│       └── metadata.toml
├── send/
│   └── ig/v3.1.1/
│       ├── Datasets.csv         # SEND domains
│       ├── Variables.csv        # Variable metadata
│       └── metadata.toml
├── terminology/
│   ├── 2024-03-29/              # CT release date
│   │   ├── SDTM_CT_*.csv
│   │   ├── SEND_CT_*.csv
│   │   └── ADaM_CT_*.csv
│   ├── 2025-03-28/
│   └── 2025-09-26/              # Latest CT
├── validation/
│   ├── sdtm/Rules.csv           # SDTM validation rules
│   ├── adam/Rules.csv           # ADaM validation rules
│   └── send/Rules.csv           # SEND validation rules
└── xsl/
    ├── define2-0-0.xsl          # Define-XML stylesheets
    └── define2-1.xsl

Testing Strategy

Test Types

TypePurposeCrates
UnitFunction-levelAll
IntegrationCross-cratetss-gui
SnapshotOutput stabilityxport, tss-output
PropertyEdge casestss-map, tss-validate

Test Data

Mock datasets in mockdata/ for:

  • Various domain types
  • Edge cases
  • Validation testing

Next Steps