>_ pyclin

Open source · Apache-2.0 · Python

A complete FDA submission package, built in Python.

pyclin takes clinical study data from raw collection through SDTM, ADaM, TLFs, Define-XML and an XPT v5 eCTD Module 5 package in one reproducible, specification-driven run. Numbers match SAS by default, and tests prove it.

pip install pyclin · first release (v0.1.0) in preparation

study-01 · terminal
Illustration of the planned pyclin build command on a synthetic study.

Python's defaults don't match SAS. pyclin's do.

Teams moving to Python stall on small numeric differences, and every company rebuilds the same global macros privately. pyclin matches SAS by default and documents and tests every intentional difference.

CalculationPython defaultSAS / CDISC conventionpyclin
Rounding 2.5 to an integer2round() rounds half to even3ROUND, half away from zero3
Standard deviation of 1, 2, 3, 41.118numpy uses population SD1.291n − 1 divisor1.291
First quartile of 1, 2, 3, 41.75pandas linear interpolation1.5PCTLDEF=51.5
Study day, one day before the reference date0date − reference + 1−1no day 0−1

The goal: double-programmed outputs agree to the last decimal, on 100% of reference cells.

One run, from collected data to Module 5

Existing public pilots start from pre-built SDTM. pyclin covers the full chain in a single language, and the build fails on any unexplained conformance finding.

  1. Configure

    A study file names the inputs, specs and outputs.

  2. SDTM

    Raw data mapped and conformed to the SDTM spec.

  3. ADaM

    Derived from SDTM and conformed to the ADaM spec.

  4. TLFs

    RTF outputs with plain-text twins for QC.

  5. Package

    XPT, define.xml, programs and checksums in m5.

  6. Check

    Conformance via CDISC CORE before release.

Four layers, one specification

Every layer reads the same metadata specification, so datasets, define.xml and documentation can't drift apart.

Interfacehow you run it

  • pyclin build CLI
  • Python API
  • study config YAML

Submissionwhat you send

  • pyclin.xpt XPT v5, IBM float, 5 GB split
  • pyclin.define Define-XML 2.1
  • pyclin.package eCTD m5, SHA-256
  • pyclin.checks CORE

Analysiswhat you derive

  • pyclin.sdtm
  • pyclin.adam
  • pyclin.tlf RTF + text
  • pyclin.compare like PROC COMPARE

Foundationwhat everything trusts

  • pyclin.spec
  • pyclin.dates ISO 8601, study day
  • pyclin.stats SAS parity
  • pyclin.fmt precision, n (%)

In

Raw or CDASH data, metadata specs in CSV or Excel, controlled terminology, and a study config.

Out

SDTM and ADaM .xpt files, define.xml with an HTML preview, RTF TLFs, programs as .txt, and QC and conformance reports.

Roadmap

Each phase ships before the next begins. The flagship goal is the first public, Python-built test submission reviewed through an FDA pilot channel.

Q1 2027
Core pipelineSDTM, ADaM, four TLFs, define.xml and XPT on a synthetic study.
Q2 2027
CDISCPILOT01 parityReproduce the R Consortium Pilot 3 ADaM datasets and TLF results with zero numeric differences.
Q3 2027
Validation packageReviewer's guides, container image, and a public dry run by independent industry reviewers.
Q4 2027
Pilot submissionThrough a PHUSE or R Consortium partnership.

Design principles

  • The spec is the contract

    Code never hard-codes labels, lengths or order.

  • SAS parity by default

    Every intentional difference is documented and tested.

  • Deterministic output

    Identical inputs produce byte-identical files.

  • Small, composable functions

    Building blocks instead of monolithic study programs.

  • Reuse open tools

    CORE, rtflite and pkglite rather than rebuilding them.

  • Validation in every release

    Changelog, test report and a requirements-to-tests traceability matrix.

Part of an open toolkit

  • clinfolio ↗

    Storage and large-scale processing. pyclin reads and writes clinfolio datasets.

  • Synthebo

    Synthetic studies with known truth for end-to-end tests.

  • rwd2sdtm

    Uses pyclin for XPT and define.xml output of real-world data.

  • DeltaBench ↗

    Scores AI-generated specs and programs against pyclin reference outputs.

Help build it

pyclin is an independent project, built on personal time with public or synthetic data only. It's looking for its first collaborators before v1.0.

Out of scope by design: replacing CDISC CORE, bundling licensed dictionaries such as MedDRA or WHODrug, and EDC or trial management.

  • Co-maintainersPython developers comfortable with pandas and packaging.
  • Biostatistics reviewerTo review ANCOVA, time-to-event and exact CI methods.
  • SAS parity testerTo produce reference outputs and confirm cell-level matches.