tm.hyslaw

R-CMD-check pkgdown

Teal modules and reusable builders for exploratory Hy’s Law monitoring from CDISC ADaM-style ADSL + ADLB.

This is a review aid, not a submission TFL. It does not implement alternative-cause exclusion (pre-existing liver disease, obstruction, alcohol). Admiral ADLBHY derives ADaM flags; dv.edish and hep-explorer are interactive eDISH apps on other stacks. This package sits in between: table/plot builders with no Shiny, plus optional teal modules.

Peak eDISH maxima are not the same as biochemical potential Hy’s Law. The scatter uses on-treatment peaks that need not occur on the same day. Red open circles mark concurrent-window cases (optional ALP exclusion). Study-specific ADDILI is not an input; the package documents the ADLB algorithm instead.

Design rule

Layer What it answers Default
Peak eDISH On-treatment max ALT or AST / ULN vs max BILI / ULN (may be different days) Lines at 3x and 2x ULN; operator >=
mDISH Same peaks divided by baseline Same 3x / 2x cuts on the baseline scale
Cholestatic screen Peak ALP / ULN vs peak BILI / ULN Lines at 2x and 2x ULN
Concurrent Hy’s Law BILI meeting the bilirubin cut on or after ALT/AST meeting the AT cut window_days = 14 (admiral vignette)
ALP exclusion Concurrent cases with ALP meeting the ALP cut in the same window On; set exclude_alp = FALSE to turn off
Threshold operator >= (package default) vs > (FDA 2009 / many CSR shells) compare = ">="

Peak eDISH can look like Hy’s Law when the two peaks are weeks apart. Concurrent-window classification is the monitoring rule. window_days = 7 or 30 can match a SAP. Missing ALP is not imputed.

Install and run

# from the package root
pkgload::load_all()
shiny::runApp("app.R")

Or call the builders without Shiny:

library(tm.hyslaw)

data <- make_synthetic_hyslaw_data()
classified <- classify_hyslaw(data$ADSL, data$ADLB)
build_hyslaw_table(classified = classified)
build_liver_elevation_table(classified = classified)
plot_edish(classified = classified)
plot_edish(classified = classified, which = "mdish")
plot_edish(classified = classified, which = "cholestatic")
hyslaw_listing(classified = classified)

Teal column selectors

tm_g_edish() and tm_t_hyslaw() choose the treatment column and the population flag with teal.picks::variables() on ADSL. Both selectors are a single column (multiple = FALSE). Defaults are TRT01A and SAFFL. The control shows each column’s label from the data.

population_value stays "Y" and is not a selector. Window, threshold operator, plot type, color, facet, and the checkboxes are unchanged.

A named character vector can still be passed as group_vars or population_choices. That form warns and is converted to teal.picks::variables(choices, selected).

What is calculated

Always (subject-level):

The default summary table has two sections: four peak-quadrant counts (ST&F-style maximal abnormalities) and biochemical concurrent counts. build_liver_elevation_table() adds nested 3/5/10/20x and 1.5/2x elevations plus the combination row split by ALP. The listing adds R-ratio; symptoms and alternative causes are not in ADLB and are not filled.

Data dependencies

Dataset Required Recommended
ADSL USUBJID, arm/group (e.g. TRT01A) SAFFL, ITTFL
ADLB USUBJID, PARAMCD, AVAL, ULN (ANRHI or Pilot A1HI) ADT / ADY, ONTRTFL, ABLFL, ALP or ALKPH

PARAMCD values: ALT, AST, BILI, and ALP (ALKPH is accepted). Study-specific ADDILI is not required.

Demo / test data

Unit tests use synthetic ADLB so all four quadrants and the peak-vs-window distinction are guaranteed. Alzheimer / Xanomeline public studies rarely contain true Hy’s Law cases.

Public ADaM is for integration tests and the demo app only (exploratory; attribute to the data owner; not a submission TFL):

  1. pharmaverseadam adsl + adlb (demo preferred)
  2. CDISC Pilot 01 adsl.xpt + adlbc.xpt via source("data-raw/process_data.R") (gitignored XPTs)
  3. random.cdisc.data when available as a Suggests fallback in other packages; this demo prefers synthetic if public data are missing

pharmaverseadam::adlbhy can be compared as an admiral-derived HYSLAW parameter. Counts are not required to match this package.

Development quality gates

This repository is set up for the standard R package release loop:

devtools::document()
testthat::test_local()
devtools::check(error_on = "never")
pkgdown::build_site()

GitHub Actions runs R CMD check on Ubuntu with the current release of R for pushes to main and for pull requests into main. Suggested packages on CRAN are installed, so a missing Suggests dependency fails the check. A separate pkgdown workflow builds the reference site on pushes to main and on manual dispatch, then publishes it to the gh-pages branch. After the first successful run, set GitHub Pages to deploy from the gh-pages branch root (https://ygma-bitc.github.io/tm.hyslaw/). .lintr is for local use. Coverage is intentionally not a release gate for this early package.

mirror server hosted at Truenetwork, Russian Federation.