Automated TLF on Posit Connect: Scheduled Reports That Hold Up to an Audit

Reading time:
time
min
By:
Marek Latala
November 26, 2026

The tables, listings, and figures are the part of a study a regulator actually reads. Everything upstream (the transfers, the standardization, the analysis datasets) exists to produce a few hundred RTF files that go into the clinical study report. In most organizations the last mile still runs on someone's laptop: a programmer opens the project, runs the script, checks the output looks right, and copies it into the submission folder.

That works until an inspector asks a question the laptop can't answer. Which version of the data produced this table? Which package versions were loaded when it ran? Who could have changed the output between generation and submission, and did they? The honest answer, more often than it should be, is a reconstruction from memory, email threads, and file timestamps.

What biometrics produces, and where it breaks

For anyone who’s not familiar with a biometrics team’s day-to-day work: TLF is tables, listings, and figures (you'll also see TFL, same deliverables, different word order), and the three are not interchangeable. A table is aggregated summary statistics. A listing is record-level data, one row per observation. A figure is a plot. Use them precisely - statisticians notice when you don't.

They come from CDISC data: raw data standardized into SDTM, transformed into analysis-ready ADaM, then TLFs generated from ADaM with traceability back to the source. The statistical analysis plan (SAP) governs every analysis, and the table shells (the empty layouts, fixed before database lock) mean no one can shape the analysis to the result. High-importance outputs are checked by independent double programming: a second programmer reproduces the output and the two are reconciled until they match.

None of that is the problem. The runtime around it is. The manual loop drifts in ways nobody notices until it matters. The environment is whatever was installed that day, unpinned. The data version is implicit in a shared path. The output is copied into Word by hand and checked by eye, and the audit trail is a file timestamp and whatever the programmer wrote in the log.

How automated TLF generation works on Connect

The fix is to stop treating report generation as an interactive act and treat it as published, scheduled content with a pinned environment. Here's how it runs on the platform we've built for one of our clients.

TLF programs are developed in Workbench, in the isolated per-session pods from one of the previous posts. When a program is ready, it's published to Posit Connect as a rendered report, an R Markdown or Quarto document, together with its source. This matters: on Connect, only content published with its source code can be scheduled. Interactive Shiny apps can't, because they render on demand. A TLF report is exactly the rendered, non-interactive content the scheduler is built for.

We publish it git-backed. The report's code and a committed manifest.json live in a Git repository, and Connect deploys from the repo, creating a new bundle on each update. That's deliberate. The exact code that generated an output is a reviewed, versioned commit rather than a file someone pushed from their IDE, and change control for the report is the change control you already run in Git.

Scheduling is deliberately constrained. Connect doesn't expose raw cron. It offers a fixed set of interval patterns anchored to a date and time, and for parameterized R Markdown each parameter combination is a saved "variant" with its own rendering history, which maps cleanly onto per-study reports off one code base. One catch worth knowing: only the default variant updates automatically on a schedule.

Execution runs off-host on Kubernetes through the Posit Launcher, so each render is a container job, not a process on a shared server. Connect runs content under a service account rather than as the viewer, which is the right model for unattended generation: the report's identity, scoped to the study's data, reads the inputs and writes the output. The rendered RTF and PDF land immutably in our object-locked storage layer, with an audit bundle that records how the run happened.

Reproducibility: pinning the whole run

"Reproducible" gets used loosely. For a regulated output it means one thing: rebuild the environment from committed references and get the same result years later, without the original machine. That takes three independent pins, because no single tool covers the whole stack.

The container image, pinned by digest, fixes the operating system, the system libraries, the compiler toolchain, the BLAS and LAPACK implementations, and the R binary itself. Tags are mutable, a publisher can repoint :latest or even :4.4.1, so we pin by the immutable sha256 digest. That's the layer renv can't reach.

The package repository comes next, frozen by date. Posit Package Manager (PPM, formerly RStudio Package Manager) serves date-based snapshots: point the repo URL at a past date and you install packages exactly as they were then. That keeps renv::restore() working long after a plain CRAN install would fail on an archived binary. In our build PPM is restricted to CRAN, Bioconductor, and PyPI, with GitHub packages verified separately.

Then renv.lock, committed with the code, records the R version and every package's version, source, and hash. What it doesn't do is install R itself or capture the OS and system libraries, which is why the image digest sits underneath it. Posit's own docs are blunt that renv "is not a panacea for reproducibility."

Together, three pins (a digest-pinned image, a date-frozen PPM snapshot, and a committed renv.lock) make a run reproducible by construction. On Connect the render-time image is chosen through the content's manifest, which is another reason we publish via manifest rather than push-button from the IDE: push-button can't select an execution image, so the disciplined path is also the one that gives you the pin. Its digest, the renv.lock, and the PPM snapshot date all land in the audit bundle in the storage layer next to the output.

One caveat up front: no regulation names any of these tools. Part 11, Annex 11, and GAMP 5 don't require renv, PPM date freezing, or digest pinning. This is an engineering pattern that satisfies the intent of those rules, not a checkbox any of them define.

How it maps to 21 CFR Part 11

If you work with a GxP pharma environment, you know that every choice above traces to a requirement. Part 11, the rule governing electronic records and electronic signatures, doesn't itself say you must keep a report. The duty to keep the record comes from the predicate rule. Part 11 governs how that record has to be trustworthy:

  • Validation and detecting altered records (11.10(a)). The environment is pinned and the code is a reviewed commit, so a changed output can be discerned against its recorded inputs.
  • Accurate copies and protected retrieval (11.10(b), (c)). Outputs go to the storage layer under S3 Object Lock, retained for the period the predicate rule sets (seven years in our configuration) and encrypted with a dedicated KMS key.
  • Audit trails (11.10(e)). Three independent trails, none depending on anyone documenting by hand: Connect emits structured audit events for content actions, CloudTrail captures S3 data events at the object level, and Workbench session logs capture the analysis environment. Asked what produced a figure, the render history gives the image and code bundle, the audit bundle gives the package versions, and the S3 trail shows which data files were read.
  • Change control (11.10(k)). Report code and its manifest are versioned in Git. The documentation of a change is its commit and pull request.

Access control follows the component classification. The Posit platform is a commercial off-the-shelf product, typically GAMP 5 Category 3 (Category 4 to the extent it's meaningfully configured), qualified on its configuration and supplier assessment rather than rebuilt internally. The custom TLF code on top is Category 5, the tier that carries the full traceability and QC burden. Decision-support views for regulated use get per-view acceptance and role scoping, not a blanket "anyone with a login." A QC record, created from a template when the study folder is set up and appended on each deliverable, is pushed alongside the outputs.

Be precise about which document requires what, because auditors are. Audit-trail review as a recurring obligation, for one, comes from EU Annex 11 and FDA data-integrity guidance, not the literal text of Part 11.

What an auditor actually asks

All of this provides a valuable return the moment someone with a checklist sits across the table. The hard questions are rarely whether a control exists. They're whether you can show it without preparation, and they land on the seams: the report someone ran manually "just this once," the environment that drifted between two runs, the output in the submission whose exact code version no one can point to. The failure mode is almost never a missing control. It's a control that depends on someone remembering to apply it.

If you keep the build generation this way, the predictable questions answer themselves. Prove that this table came from this dataset and this code: the render history. Prove the environment was controlled: the image digest, renv.lock, and snapshot date. Show who could have changed the output and whether they did: Object Lock plus the Connect audit events. This is the same argument we made for session isolation. The assurance is architectural. It doesn't depend on anyone following a process under deadline pressure.

The other half of the work is upstream, in requirements. Biometrics teams ask for speed and flexibility - “enable me to run my script and give me the table.” Compliance needs constraint and evidence - “prove the script, the data, and the environment.” Reconciling those two is most of the design. The mistake we've seen, and made, is treating reproducibility as something you bolt on at the end. It's a property you either build into the runtime or spend the rest of the project retrofitting.

Tradeoffs worth knowing about

This pattern isn't free, and it isn't right for everything.

Connect's scheduler is a scheduler, not a workflow engine. It runs content on an interval. It doesn't model dependencies between steps. If your generation is a multi-stage pipeline where a listing waits on an analysis dataset that waits on a lock, you want an orchestrator driving the sequence, with Connect as the place the final outputs live and get scheduled.

The pinning discipline has to be enforced, because nothing stops a publisher from shipping an unpinned report. Since push-button publishing can't pin an image, the manifest path is the only one that yields a controlled environment, and teams have to adopt it deliberately rather than fall into it.

Qualifying a commercial product is a boundary, not a free pass. You validate the configuration, not the vendor's internals, which is correct and cheaper, but it puts real weight on the supplier assessment and on keeping your own configuration under control.

Explore Possibilities

Share Your Data Goals with Us

From advanced analytics to platform development and pharma consulting, we craft solutions tailored to your needs.