Teal module and reusable table builder for Time to Next Intervention (TTNI) and related time-to-event endpoints.
TTNI is a time-to-event efficacy endpoint (time to next anticancer intervention), distinct from safety incidence endpoints (such as TEAE/OSEI).
| Detected arms | KM counts / quartiles / landmarks | HR, 95% CI, log-rank p |
|---|---|---|
| 1 arm | Yes | No |
| 2 arms | Yes | Yes, vs ref_arm |
| 3+ arms | Yes, Total column by default | No |
Forcing compute_hr = TRUE on a multi-arm data set is
ignored with a warning.
# from the package root
pkgload::load_all()
shiny::runApp("app.R")Or call the builder without Shiny:
library(tm.ttni)
two <- make_synthetic_ttni_data("two_arm")
build_ttni_table(two$ADSL, two$ADTTE, ref_arm = "Placebo")
multi <- make_synthetic_ttni_data("multi_arm")
build_ttni_table(multi$ADSL, multi$ADTTE) # no HRAlways:
ttni_surv_time_choices()): descriptive
Mean (SD) of AVAL, plus
tern::surv_time() statistics. Median and 95% CI are one row
(median_ci_3d); quartiles and range print as
Q1, Q3 and Min, Max.The interactive table does not print method
footnotes by default. Callers may still pass
footnotes = default_ttni_footnotes() to
build_ttni_table() when a TFL-style footer is required.
| Topic | Definition |
|---|---|
| Mean (SD) | Descriptive mean and standard deviation of
AVAL in the analysis set (includes censored times). This is
not a Kaplan-Meier mean. |
| Kaplan-Meier | Product-limit estimates. Median and 95% CI
use tern median_ci_3d on one row. Confidence intervals use
the log-log method unless conf_type is changed.
Non-estimable values are shown as NE. |
| Follow-up time | Reverse Kaplan-Meier estimates. |
| Landmark rates | Kaplan-Meier event-free percentages at the selected months. |
| Time unit | AVAL stored in days is
converted to months (/ 30.4375) when AVALU is
DAYS. |
| Hazard ratio / 95% CI | Unstratified Cox model (Efron ties); two-arm designs only. |
| p-value | Unstratified log-rank test; two-arm designs only. |
Min, Max {1} /
{2} |
Observed range of AVAL. tern
annotations mark a bound that is a censored observation. |
Two-arm only:
Not implemented (group-sequential / SAP-specific):
| Dataset | Required | Recommended |
|---|---|---|
| ADSL | USUBJID, arm/group
(e.g. TRT01A) |
SAFFL, ITTFL,
SEX, RACE, COUNTRY |
| ADTTE | USUBJID,
PARAMCD, AVAL, CNSR |
PARAM, AVALU,
EVNTDESC |
AVAL stored in days is converted to months
(/ 30.4375) when AVALU is DAYS.
CDISC Pilot ADTTE has no AVALU; the demo
loader treats those values as days.
Layer 1 Arm design detect_arm_design()
Layer 2 Data adapters standardize_adsl() / standardize_adtte()
Layer 3 Data prep prep_ttni_data() # empty result is not an error
Layer 4 Table builder build_ttni_table(prepped = ...)
Layer 5 UI / Server teal.picks PARAMCD, group, population; shinyvalidate, Show R Code
Layer 6 Entry point tm_t_ttni() → teal::module()
PARAMCD, the treatment / group column, and the population flag are
teal.picks selectors. PARAMCD uses values() on
a fixed PARAMCD column (default TTNI). Group
and population use variables() with
multiple = FALSE on adsl_name (defaults
TRT01A, and SAFFL / ITTFL). The
reference arm, landmarks, Total, follow-up, and statistic checkboxes
stay ordinary Shiny inputs. Legacy choices_selected
(PARAMCD) and character column vectors (group and population) are still
accepted and signal a deprecation warning.
tm_t_ttni(
cat = teal.picks::picks(
teal.picks::datasets("ADTTE", "ADTTE"),
teal.picks::variables("PARAMCD", "PARAMCD", multiple = FALSE, fixed = TRUE),
teal.picks::values(c("TTNI", "OS"), "TTNI", multiple = FALSE)
),
group_vars = teal.picks::picks(
teal.picks::datasets("ADSL", "ADSL"),
teal.picks::variables(c("TRT01A", "SEX"), "TRT01A", multiple = FALSE)
),
population_var = teal.picks::picks(
teal.picks::datasets("ADSL", "ADSL"),
teal.picks::variables(c("SAFFL", "ITTFL"), "SAFFL", multiple = FALSE)
)
)The server returns table, prepped_data,
no_data, and source_code.
The example app resolves data in this order:
ADSL / ADTTEdata-raw/
(adsl.xpt, adtte.xpt)random.cdisc.data (radsl /
radtte) when availablemake_synthetic_ttni_data()Download the public CDISC Pilot files (do not commit them):
source("data-raw/process_data.R")The demo’s HR-off example is the public CDISC Pilot
three-arm study (PARAMCD = TTDE; Placebo / Xanomeline High
Dose / Xanomeline Low Dose). Study-specific dose-level labels are not
hardcoded; generic arms are used. The module shows KM summaries without
HR on that three-arm table.
These files are CDISC clinical test data. Attribute them to cdisc-org/sdtm-adam-pilot-project and do not redistribute them for a fee.
build_ttni_table() is the reusable engine. It can be
called directly in standalone scripts, reporting pipelines, or other
Shiny applications without requiring the full teal framework.