The hardware and bandwidth for this mirror is donated by METANET, the Webhosting and Full Service-Cloud Provider.
If you wish to report a bug, or if you are interested in having us mirror your free-software or open-source project, please feel free to contact us at mirror[@]metanet.ch.

Hy’s Law Implementation

Introduction

During the drug development process, clinical trials are often required to assess for the potential that the experimental drug can cause severe liver injury, known as a drug induced liver injury (DILI). There are multiple criteria that need to be evaluated to determine and classify a DILI “Event”. Hy’s Law, a common rule of thumb for a DILI Event , is usually comprised of three parts:

Required Packages

The examples of this vignette require the following packages.

library(admiral)
library(dplyr, warn.conflicts = FALSE)

Programming Workflow

Read in Data

We assume that an ADLB dataset is available 1.

First we read in the ADLB parameters required for the Hy’s Law parameters:

data(admiral_adlb)
adlb <- admiral_adlb %>%
  filter(PARAMCD %in% c("AST", "ALT", "BILI") & is.na(DTYPE))
STUDYID DOMAIN USUBJID LBSEQ LBTESTCD LBTEST LBCAT LBORRES LBORRESU LBORNRLO LBORNRHI LBSTRESC LBSTRESN LBSTRESU LBSTNRLO LBSTNRHI LBNRIND LBBLFL VISITNUM VISIT VISITDY LBDTC LBDY TRTSDT TRTEDT TRT01A TRT01P ADT ADY PARAMCD PARAM PARAMN PARCAT1 AVAL AVALC ANRLO ANRHI DTYPE AVISIT AVISITN ONTRTFL ANRIND BASETYPE ABLFL BASE BASEC BNRIND CHG PCHG ATOXDSCL ATOXDSCH ATOXGRL ATOXGRH ATOXGR BTOXGRL BTOXGRH BTOXGR R2BASE R2ANRLO R2ANRHI SHIFT1 SHIFT2 ANL01FL LVOTFL TRTP TRTA ASEQ SUBJID RFSTDTC RFENDTC RFXSTDTC RFXENDTC RFICDTC RFPENDTC DTHDTC DTHFL SITEID AGE AGEU SEX RACE ETHNIC ARMCD ARM ACTARMCD ACTARM COUNTRY DMDTC DMDY TRTSDTM TRTSTMF TRTEDTM TRTETMF TRTDURD SCRFDT EOSDT EOSSTT FRVDT RANDDT DTHDT DTHADY LDDTHELD LSTALVDT AGEGR1 SAFFL RACEGR1 REGION1 LDDTHGR1 DTH30FL DTHA30FL DTHB30FL
CDISCPILOT01 LB 01-701-1015 3 ALT Alanine Aminotransferase CHEMISTRY 27 U/L 6 34 27 27 U/L 6 34 NORMAL Y 1 SCREENING 1 -7 2013-12-26T14:45 -7 2014-01-02 2014-07-02 Placebo Placebo 2013-12-26 -7 ALT Alanine Aminotransferase (U/L) 3 CHEMISTRY 27 27 6 34 NA Baseline 0 NA NORMAL LAST Y 27 27 NORMAL 0 0.000000 NA Alanine aminotransferase increased NA 0 0 NA 0 0 1.0000000 4.500000 0.7941176 NORMAL to NORMAL 0 to 0 NA NA Placebo Placebo 27 1015 2014-01-02 2014-07-02 2014-01-02 2014-07-02 NA 2014-07-02T11:45 NA NA 701 63 YEARS F WHITE HISPANIC OR LATINO Pbo Placebo Pbo Placebo USA 2013-12-26 -7 2014-01-02 H 2014-07-02 23:59:59 H 182 NA 2014-07-02 COMPLETED NA 2014-01-02 NA NA NA 2014-07-02 18-64 Y White NA NA NA NA NA
CDISCPILOT01 LB 01-701-1015 41 ALT Alanine Aminotransferase CHEMISTRY 41 U/L 6 34 41 41 U/L 6 34 HIGH NA 4 WEEK 2 14 2014-01-16T13:17 15 2014-01-02 2014-07-02 Placebo Placebo 2014-01-16 15 ALT Alanine Aminotransferase (U/L) 3 CHEMISTRY 41 41 6 34 NA Week 2 4 Y HIGH LAST NA 27 27 NORMAL 14 51.851852 NA Alanine aminotransferase increased NA 1 1 NA 0 0 1.5185185 6.833333 1.2058824 NORMAL to HIGH 0 to 1 Y NA Placebo Placebo 28 1015 2014-01-02 2014-07-02 2014-01-02 2014-07-02 NA 2014-07-02T11:45 NA NA 701 63 YEARS F WHITE HISPANIC OR LATINO Pbo Placebo Pbo Placebo USA 2013-12-26 -7 2014-01-02 H 2014-07-02 23:59:59 H 182 NA 2014-07-02 COMPLETED NA 2014-01-02 NA NA NA 2014-07-02 18-64 Y White NA NA NA NA NA
CDISCPILOT01 LB 01-701-1015 76 ALT Alanine Aminotransferase CHEMISTRY 18 U/L 6 34 18 18 U/L 6 34 NORMAL NA 5 WEEK 4 28 2014-01-30T08:50 29 2014-01-02 2014-07-02 Placebo Placebo 2014-01-30 29 ALT Alanine Aminotransferase (U/L) 3 CHEMISTRY 18 18 6 34 NA Week 4 5 Y NORMAL LAST NA 27 27 NORMAL -9 -33.333333 NA Alanine aminotransferase increased NA 0 0 NA 0 0 0.6666667 3.000000 0.5294118 NORMAL to NORMAL 0 to 0 Y NA Placebo Placebo 30 1015 2014-01-02 2014-07-02 2014-01-02 2014-07-02 NA 2014-07-02T11:45 NA NA 701 63 YEARS F WHITE HISPANIC OR LATINO Pbo Placebo Pbo Placebo USA 2013-12-26 -7 2014-01-02 H 2014-07-02 23:59:59 H 182 NA 2014-07-02 COMPLETED NA 2014-01-02 NA NA NA 2014-07-02 18-64 Y White NA NA NA NA NA
CDISCPILOT01 LB 01-701-1015 106 ALT Alanine Aminotransferase CHEMISTRY 26 U/L 6 34 26 26 U/L 6 34 NORMAL NA 7 WEEK 6 42 2014-02-12T12:56 42 2014-01-02 2014-07-02 Placebo Placebo 2014-02-12 42 ALT Alanine Aminotransferase (U/L) 3 CHEMISTRY 26 26 6 34 NA Week 6 7 Y NORMAL LAST NA 27 27 NORMAL -1 -3.703704 NA Alanine aminotransferase increased NA 0 0 NA 0 0 0.9629630 4.333333 0.7647059 NORMAL to NORMAL 0 to 0 Y NA Placebo Placebo 31 1015 2014-01-02 2014-07-02 2014-01-02 2014-07-02 NA 2014-07-02T11:45 NA NA 701 63 YEARS F WHITE HISPANIC OR LATINO Pbo Placebo Pbo Placebo USA 2013-12-26 -7 2014-01-02 H 2014-07-02 23:59:59 H 182 NA 2014-07-02 COMPLETED NA 2014-01-02 NA NA NA 2014-07-02 18-64 Y White NA NA NA NA NA
CDISCPILOT01 LB 01-701-1015 136 ALT Alanine Aminotransferase CHEMISTRY 22 U/L 6 34 22 22 U/L 6 34 NORMAL NA 8 WEEK 8 56 2014-03-05T12:25 63 2014-01-02 2014-07-02 Placebo Placebo 2014-03-05 63 ALT Alanine Aminotransferase (U/L) 3 CHEMISTRY 22 22 6 34 NA Week 8 8 Y NORMAL LAST NA 27 27 NORMAL -5 -18.518518 NA Alanine aminotransferase increased NA 0 0 NA 0 0 0.8148148 3.666667 0.6470588 NORMAL to NORMAL 0 to 0 Y NA Placebo Placebo 32 1015 2014-01-02 2014-07-02 2014-01-02 2014-07-02 NA 2014-07-02T11:45 NA NA 701 63 YEARS F WHITE HISPANIC OR LATINO Pbo Placebo Pbo Placebo USA 2013-12-26 -7 2014-01-02 H 2014-07-02 23:59:59 H 182 NA 2014-07-02 COMPLETED NA 2014-01-02 NA NA NA 2014-07-02 18-64 Y White NA NA NA NA NA
CDISCPILOT01 LB 01-701-1015 166 ALT Alanine Aminotransferase CHEMISTRY 27 U/L 6 34 27 27 U/L 6 34 NORMAL NA 9 WEEK 12 84 2014-03-26T15:15 84 2014-01-02 2014-07-02 Placebo Placebo 2014-03-26 84 ALT Alanine Aminotransferase (U/L) 3 CHEMISTRY 27 27 6 34 NA Week 12 9 Y NORMAL LAST NA 27 27 NORMAL 0 0.000000 NA Alanine aminotransferase increased NA 0 0 NA 0 0 1.0000000 4.500000 0.7941176 NORMAL to NORMAL 0 to 0 Y NA Placebo Placebo 33 1015 2014-01-02 2014-07-02 2014-01-02 2014-07-02 NA 2014-07-02T11:45 NA NA 701 63 YEARS F WHITE HISPANIC OR LATINO Pbo Placebo Pbo Placebo USA 2013-12-26 -7 2014-01-02 H 2014-07-02 23:59:59 H 182 NA 2014-07-02 COMPLETED NA 2014-01-02 NA NA NA 2014-07-02 18-64 Y White NA NA NA NA NA

Flagging Elevated Values (CRITy, CRITyFL)

A standard convention of ADLBHY datasets, are various CRITy and CRITyFL columns to describe the conditions necessary to reach that particular criterion of Hy’s Law and the actual flag itself to indicate whether or not the condition was reached.

Using mutate(), call_derivation() and derive_var_merged_exist_flag(), we can create these columns that indicate the the 3-fold or greater than upper limit of normal of ALT/AST and the 2-fold or greater than upper limit of normal of BILI.

To increase visibility and for simplicity, we will retain only columns that are relevant to a Hy’s Law analysis for now.

adlb_annotated <- adlb %>%
  mutate(
    CRIT1 = case_when(
      PARAMCD == "AST" ~ "AST >=3xULN",
      PARAMCD == "ALT" ~ "ALT >=3xULN",
      PARAMCD == "BILI" ~ "BILI >=2xULN"
    ),
    CRIT1FL = if_else(
      (AVAL / ANRHI >= 3 & PARAMCD %in% c("AST", "ALT")) |
        (AVAL / ANRHI >= 2 & PARAMCD == "BILI"),
      "Y",
      NA_character_
    )
  ) %>%
  select(STUDYID, USUBJID, TRT01A, PARAMCD, LBSEQ, ADT, AVISIT, ADY, AVAL, ANRHI, CRIT1, CRIT1FL)
STUDYID USUBJID TRT01A PARAMCD LBSEQ ADT AVISIT ADY AVAL ANRHI CRIT1 CRIT1FL
CDISCPILOT01 01-701-1015 Placebo ALT 3 2013-12-26 Baseline -7 27 34 ALT >=3xULN NA
CDISCPILOT01 01-701-1015 Placebo ALT 41 2014-01-16 Week 2 15 41 34 ALT >=3xULN NA
CDISCPILOT01 01-701-1015 Placebo ALT 76 2014-01-30 Week 4 29 18 34 ALT >=3xULN NA
CDISCPILOT01 01-701-1015 Placebo ALT 106 2014-02-12 Week 6 42 26 34 ALT >=3xULN NA
CDISCPILOT01 01-701-1015 Placebo ALT 136 2014-03-05 Week 8 63 22 34 ALT >=3xULN NA
CDISCPILOT01 01-701-1015 Placebo ALT 166 2014-03-26 Week 12 84 27 34 ALT >=3xULN NA
CDISCPILOT01 01-701-1015 Placebo ALT 201 2014-05-07 Week 16 126 17 34 ALT >=3xULN NA
CDISCPILOT01 01-701-1015 Placebo ALT 231 2014-05-21 Week 20 140 21 34 ALT >=3xULN NA
CDISCPILOT01 01-701-1015 Placebo ALT 261 2014-06-18 Week 24 168 23 34 ALT >=3xULN NA
CDISCPILOT01 01-701-1015 Placebo ALT 296 2014-07-02 Week 26 182 23 34 ALT >=3xULN NA

Subsetting by LBTESTCD and Joining by Potential Events

If an elevated ALT/AST event reaches the threshold for Hy’s Law, we need to search for any elevated BILI events within a certain time-window, usually up to 14 days after the elevated ALT/AST event (this window may vary by organization). By,

  1. Splitting our dataset into its ALT/AST and BILI subsets, respectively, and
  2. Joining these two datasets using derive_vars_joined() while using the filter_join argument to only join together the relevant flagged BILI records that have a corresponding flagged ALT/AST record (prior up to 14 days but may vary for trial/organization) that would indicate a potential Hy’s Law event,

the resulting dataset is helpful for deriving additional parameters. The dataset may also prove useful for a listing where you have to display the two lab-records in one row to showcase the potential event.

altast_records <- adlb_annotated %>%
  filter(PARAMCD %in% c("AST", "ALT"))

bili_records <- adlb_annotated %>%
  filter(PARAMCD %in% c("BILI"))

hylaw_records <- derive_vars_joined(
  dataset = altast_records,
  dataset_add = bili_records,
  by_vars = exprs(STUDYID, USUBJID),
  order = exprs(ADY),
  join_type = "all",
  filter_join = 0 <= ADT.join - ADT & ADT.join - ADT <= 14 & CRIT1FL == "Y" & CRIT1FL.join == "Y",
  new_vars = exprs(BILI_DT = ADT, BILI_CRITFL = CRIT1FL),
  mode = "first"
)
STUDYID USUBJID TRT01A PARAMCD LBSEQ ADT AVISIT ADY AVAL ANRHI CRIT1 CRIT1FL BILI_DT BILI_CRITFL
CDISCPILOT01 01-705-1186 Placebo ALT 40 2014-01-23 Week 2 16 104 32 ALT >=3xULN Y 2014-01-23 Y
CDISCPILOT01 01-705-1186 Placebo ALT 127 2014-01-29 Week 4 22 107 32 ALT >=3xULN Y 2014-01-29 Y
CDISCPILOT01 01-705-1186 Placebo AST 41 2014-01-23 Week 2 16 118 34 AST >=3xULN Y 2014-01-23 Y
CDISCPILOT01 01-705-1186 Placebo AST 77 2014-01-26 Unscheduled 4.1 19 115 34 AST >=3xULN Y 2014-01-26 Y
CDISCPILOT01 01-705-1186 Placebo AST 128 2014-01-29 Week 4 22 135 34 AST >=3xULN Y 2014-01-29 Y
CDISCPILOT01 01-705-1186 Placebo AST 113 2014-02-01 Unscheduled 4.2 25 114 34 AST >=3xULN Y 2014-02-01 Y
CDISCPILOT01 01-705-1292 Xanomeline Low Dose AST 180 2014-02-07 Week 12 117 125 34 AST >=3xULN Y NA NA
CDISCPILOT01 01-705-1310 Xanomeline High Dose ALT 135 2013-12-26 Week 8 55 129 32 ALT >=3xULN Y NA NA
CDISCPILOT01 01-705-1310 Xanomeline High Dose AST 136 2013-12-26 Week 8 55 114 34 AST >=3xULN Y NA NA
CDISCPILOT01 01-708-1286 Placebo ALT 207 2014-02-23 Week 24 167 124 32 ALT >=3xULN Y NA NA

How to Create New Parameters and Rows

Using derive_param_exist_flag() you can create a variety of parameters for your final dataset with AVAL = 1/0 for your specific Hy’s Law analysis. Below is an example of how to indicate a potential Hy’s Law event, with PARAMCD set as "HYSLAW" and PARAM set to "ALT/AST >= 3xULN and BILI >= 2xULN" for each patient using the flags from the prior dataset. This method allows for flexibility as well, if parameters for each visit was desired, you would add AVISIT and ADT to the select() and by_vars lines as denoted from the following code.

Additional modifications can be made such as:

hylaw_records_pts_visits <- hylaw_records %>%
  select(STUDYID, USUBJID, TRT01A) %>% # add AVISIT, ADT for by visit
  distinct()

hylaw_records_fls <- hylaw_records %>%
  select(STUDYID, USUBJID, TRT01A, CRIT1FL, BILI_CRITFL) %>% # add AVISIT, ADT for by visit
  distinct()

hylaw_params <- derive_param_exist_flag(
  dataset_ref = hylaw_records_pts_visits,
  dataset_add = hylaw_records_fls,
  condition = CRIT1FL == "Y" & BILI_CRITFL == "Y",
  false_value = "N",
  missing_value = "N",
  by_vars = exprs(STUDYID, USUBJID, TRT01A), # add AVISIT, ADT for by visit
  set_values_to = exprs(
    PARAMCD = "HYSLAW",
    PARAM = "ALT/AST >= 3xULN and BILI >= 2xULN",
    AVAL = yn_to_numeric(AVALC)
  )
)
STUDYID USUBJID TRT01A AVALC PARAMCD PARAM AVAL
CDISCPILOT01 01-705-1186 Placebo Y HYSLAW ALT/AST >= 3xULN and BILI >= 2xULN 1
CDISCPILOT01 01-701-1015 Placebo N HYSLAW ALT/AST >= 3xULN and BILI >= 2xULN 0
CDISCPILOT01 01-701-1023 Placebo N HYSLAW ALT/AST >= 3xULN and BILI >= 2xULN 0
CDISCPILOT01 01-701-1028 Xanomeline High Dose N HYSLAW ALT/AST >= 3xULN and BILI >= 2xULN 0
CDISCPILOT01 01-701-1033 Xanomeline Low Dose N HYSLAW ALT/AST >= 3xULN and BILI >= 2xULN 0
CDISCPILOT01 01-701-1034 Xanomeline High Dose N HYSLAW ALT/AST >= 3xULN and BILI >= 2xULN 0
CDISCPILOT01 01-701-1047 Placebo N HYSLAW ALT/AST >= 3xULN and BILI >= 2xULN 0
CDISCPILOT01 01-701-1097 Xanomeline Low Dose N HYSLAW ALT/AST >= 3xULN and BILI >= 2xULN 0
CDISCPILOT01 01-705-1292 Xanomeline Low Dose N HYSLAW ALT/AST >= 3xULN and BILI >= 2xULN 0
CDISCPILOT01 01-705-1310 Xanomeline High Dose N HYSLAW ALT/AST >= 3xULN and BILI >= 2xULN 0

The last step would be binding these rows back to whatever previous dataset is appropriate based on your data specifications, in this case, it would be best suited to bind back to our adlb_annotated object.

Conclusion

adlbhy <- adlb_annotated %>%
  bind_rows(hylaw_params)
STUDYID USUBJID TRT01A PARAMCD LBSEQ ADT AVISIT ADY AVAL ANRHI CRIT1 CRIT1FL AVALC PARAM
CDISCPILOT01 01-701-1015 Placebo ALT 3 2013-12-26 Baseline -7 27 34 ALT >=3xULN NA NA NA
CDISCPILOT01 01-701-1015 Placebo ALT 41 2014-01-16 Week 2 15 41 34 ALT >=3xULN NA NA NA
CDISCPILOT01 01-701-1015 Placebo ALT 76 2014-01-30 Week 4 29 18 34 ALT >=3xULN NA NA NA
CDISCPILOT01 01-701-1015 Placebo ALT 106 2014-02-12 Week 6 42 26 34 ALT >=3xULN NA NA NA
CDISCPILOT01 01-701-1015 Placebo ALT 136 2014-03-05 Week 8 63 22 34 ALT >=3xULN NA NA NA
CDISCPILOT01 01-701-1015 Placebo ALT 166 2014-03-26 Week 12 84 27 34 ALT >=3xULN NA NA NA
CDISCPILOT01 01-701-1015 Placebo ALT 201 2014-05-07 Week 16 126 17 34 ALT >=3xULN NA NA NA
CDISCPILOT01 01-701-1015 Placebo ALT 231 2014-05-21 Week 20 140 21 34 ALT >=3xULN NA NA NA
CDISCPILOT01 01-701-1015 Placebo ALT 261 2014-06-18 Week 24 168 23 34 ALT >=3xULN NA NA NA
CDISCPILOT01 01-701-1015 Placebo ALT 296 2014-07-02 Week 26 182 23 34 ALT >=3xULN NA NA NA

Here we demonstrated what is the base-case that may be asked of as a trial programmer. The reality is that Hy’s Law and assessing potential DILI events can get rather complex quite quickly. Differences in assessment across organizations and specific trials might require modifications, which may include:

We hope by demonstrating the flexibility of admiral functions and using a general workflow to create the necessary parameters for an ADLBHY, that creating this final dataset becomes simplified and easily scalable. Ideally, this is ready for your organization’s standard macros or previous code for TLFs and outputs as well. This is our first attempt at breaking down and summarizing this topic. We welcome feedback and ideas to improve this guide!

Example Script

ADaM Sourcing Command
ADLBHY use_ad_template("ADLBHY")

  1. In the walk through below we will use the ADLB dataset created from the call use_ad_template("adlb"). Due to the size of the dataset, we only included the following USUBJIDs:

    • 01-701-1015, 01-701-1023, 01-701-1028, 01-701-1033, 01-701-1034, 01-701-1047, 01-701-1097, 01-705-1186, 01-705-1292, 01-705-1310, 01-708-1286.
    ↩︎

These binaries (installable software) and packages are in development.
They may not be fully stable and should be used with caution. We make no claims about them.