An R interface that turns a plain-text table shell into production-ready SAS and R code. It parses the shell, retrieves similar validated patterns from a curated CDISC corpus, and generates matching code β then exports CDISC ARS v1.0 metadata for full traceability.
Shell parsing
Raw shell text β structured spec (TLF type, population, statistics, columns)
Dual generation
Production SAS + admiral/cards/clinify R from the same shell
Multi-scenario
Run up to 6 scenarios at once (SAF vs ITT, SAS vs R)
ARS export
CDISC ARS v1.0 JSON, compatible with siera::readARS()
ca_parse_shell()
Parse shell text into a structured spec
ca_generate_sas()
Generate production SAS code
ca_generate_r()
Generate admiral + cards R code
ca_run_scenario()
Run multiple QC scenarios
ca_export_ars()
Export CDISC ARS v1.0 JSON
ca_search()
Semantic search of shells/programs
# Shell β validated SAS + R in three lines
library(clinassist)
spec <- ca_parse_shell("Table 14.1.1 Demographics β Safety Population")
sas <- ca_generate_sas(spec) # production SAS
r <- ca_generate_r(spec) # admiral + cards
ars <- ca_export_ars(spec) # CDISC ARS v1.0 JSON
π§¬ardflowlive demo Β· MIT
ARS-driven TLF automation in pure R
Takes a CDISC Analysis Results Standard (ARS) specification and produces a complete TLF: an Analysis Results Dataset, an FDA-style RTF, a Dataset-JSON ARD, and an HTML preview β all from one spec, with full specβresult lineage for audit.
spec.R β compute.R
Read ARS metadata, derive the analysis results
render.R β output.R
RTF (r2rtf) + Dataset-JSON + HTML from one ARD
trace.R
Audit log linking every result cell to its spec
validate.R
Conformance checks against the ARS standard
# One ARS spec β RTF + Dataset-JSON + HTML, fully traceable
library(ardflow)
spec <- read_ars("demographics.json")
ard <- compute(spec, data = adsl) # Analysis Results Datasetrender(ard, format = "rtf") # FDA-style RTFrender(ard, format = "datasetjson") # CDISC Dataset-JSON ARD
trace <- get_trace(ard) # spec β result lineage
Edit the ARS spec β run the real ardflow pipeline β get ARD + RTF + trace
This runs actual R (dplyr + r2rtf) on the server against a synthetic ADSL dataset. Edit the CDISC ARS analysis spec below and click Run β ardflow computes the Analysis Results Dataset, renders a real submission RTF, and emits the specβresult trace. Change a method or grouping variable and watch the output change live.
π Synthetic ADSL data (10 subjects, 3 arms) Β· no real patients Β· runs live R 4.5 + r2rtf on the server
What problem do these packages solve?
Clinical programming has historically meant writing every TLF by hand in SAS, then independently re-programming it for QC β slow, repetitive, and error-prone. The industry is also shifting toward R and the CDISC Analysis Results Standard (ARS), but most teams lack tooling to bridge SAS, R, and ARS in one workflow.
These two packages close that gap: clinassist generates validated SAS+R code from a shell, and ardflow turns a machine-readable ARS spec into a complete, traceable TLF. Together they turn "write it twice, check it manually" into "specify once, generate everywhere, prove it matches."
Architecture
π
Shell / ARS Spec
Plain shell text or CDISC ARS JSON
π
RAG / Compute
Retrieve patterns or derive results
βοΈ
Generate
SAS + R code, or RTF + Dataset-JSON
β
Trace / Validate
ARS export + full lineage for audit
How they fit the pharmaverse
clinassist
Built on httr2 + jsonlite. Generates code that uses admiral (ADaM derivations), cards (Analysis Results Datasets), and clinify (TLF rendering). ARS exports are compatible with siera::readARS(), so output drops straight into ARS-based pipelines.
ardflow
Pure-R package using r2rtf for submission RTF and the datasetjson standard for CDISC Dataset-JSON. Each module β spec, compute, render, output, trace, validate β is independently testable, mirroring how a regulated pipeline is built and verified.
Compliance & data
All examples and demos use synthetic, CDISC-aligned data β no proprietary content, no real patients, no study identifiers. The RAG corpus is built from generic CDISC-standard patterns. GDPR/HIPAA-safe by design.
Why this matters for a Clinical Data & Insights team
Cuts TLF development + QC time by generating both production and validation code from one spec
De-risks the SASβR transition with a single interface producing both languages
Native CDISC ARS support positions the team for the standard regulators are moving toward
Full traceability (spec β result) makes every output audit-ready
Packaged, tested, documented R β the way a tool-development function should ship internal software