Review ask

As a clinical trial statistician or programmer, answer three short questions in Your review: the task, the inputs and outputs, and the AI-assisted review. Agreeing with all three approves this benchmark; disagreeing with any needs a comment. Propose a fix with the Edit button on any source file, or add it to your comments.

We suggest spending no more than 5 minutes on a review. The other tabs beside Your review are background for assessment, not under review.

Summary

Lifecycle: draftEditUnder review
What this benchmark means
README.md

Public entries: Python and R. Passing coverage requires an installed inventory.

Goal: put a subject's dose administrations and pharmacokinetic (PK) concentration samples in one dataset, one record per event in time order, as a population PK model reads them: the event type (EVID), the compartment (CMT), the dose amount (AMT), the concentration (DV), whether a record has no concentration (MDV), a subject number (ID) and the record's place in the subject's sequence (ASEQ).

Input: exposure (EX) records, one per administration, with the dose (EXDOSE) and its date/time (EXSTDTC), and PK concentration (PC) records, one per sample and analyte, with the numeric result (PCSTRESN, empty when the result is below the limit of quantification), the completion status (PCSTAT) and the collection date/time (PCDTC).

Variables:

  • ID: the subject's number among the subjects in the dataset, counted from 1 in the order of USUBJID, with no number skipped.
  • ASEQ: the record's number within the subject, from 1 in the order of ADTM. At one date/time a sample comes before a dose, since it was drawn before the dose was given, and samples follow their CMT.
  • ADTM: the date/time of the administration or of the sample.
  • EVID: 1 for a dose record and 0 for a concentration record.
  • CMT: 1 for a dose, the compartment the drug is given into; 2 for a concentration of the parent drug (DRGX) and 3 for one of its metabolite (MET1).
  • PARAMCD: DOSE for a dose record and the analyte for a concentration record.
  • AMT: the dose given; empty on a concentration record.
  • DV: the concentration; empty on a dose record and for a result below the limit of quantification.
  • MDV: 1 when DV is empty and 0 otherwise.

Note: an administration with a dose of zero is no event and gives no record, a sample that was not done gives none, and a subject with no administration of an amount, such as a placebo subject, has no records at all.

Inputs

Under review
2 source files

input/ex.csv

Edit
6 rows
input/ex.csv
STUDYIDUSUBJIDEXSEQEXTRTEXDOSEEXDOSUEXSTDTC
YAMAA-011DRUG X100mg2025-03-10T08:00
YAMAA-012DRUG X100mg2025-03-11T08:00
YAMAA-011DRUG X50mg2025-03-10T09:00
YAMAA-011DRUG X100mg2025-03-12T08:30
YAMAA-012DRUG X0mg2025-03-13T08:30
YAMAA-011PLACEBO0mg2025-03-10T08:15

input/pc.csv

Edit
11 rows
input/pc.csv
STUDYIDUSUBJIDPCSEQPCTESTCDPCSTRESCPCSTRESNPCSTRESUPCSTATPCTPTPCDTC
YAMAA-011DRGX<1.00—ng/mL—Pre-dose2025-03-10T07:40
YAMAA-012MET1<0.50—ng/mL—Pre-dose2025-03-10T07:40
YAMAA-013DRGX4.694.69ng/mL—1 h2025-03-10T09:00
YAMAA-014MET11.211.21ng/mL—1 h2025-03-10T09:00
YAMAA-015DRGX1.151.15ng/mL—24 h2025-03-11T08:00
YAMAA-016MET10.900.9ng/mL—24 h2025-03-11T08:00
YAMAA-011DRGX2.782.78ng/mL—2 h2025-03-10T11:00
YAMAA-012DRGX———NOT DONE4 h2025-03-10T13:00
YAMAA-011DRGX4.524.52ng/mL—1 h2025-03-12T09:30
YAMAA-011DRGX<1.00—ng/mL—Pre-dose2025-03-10T08:00
YAMAA-012DRGX<1.00—ng/mL—1 h2025-03-10T09:15

Expected output

Under review
12 expected rows

expected/adppk.csv

Edit
12 rows
expected/adppk.csv
STUDYIDUSUBJIDIDASEQADTMEVIDCMTPARAMCDAMTDVMDV
YAMAA-01112025-03-10T07:40:0002DRGX——1
YAMAA-01122025-03-10T07:40:0003MET1——1
YAMAA-01132025-03-10T08:00:0011DOSE100—1
YAMAA-01142025-03-10T09:00:0002DRGX—4.690
YAMAA-01152025-03-10T09:00:0003MET1—1.210
YAMAA-01162025-03-11T08:00:0002DRGX—1.150
YAMAA-01172025-03-11T08:00:0003MET1—0.90
YAMAA-01182025-03-11T08:00:0011DOSE100—1
YAMAA-01212025-03-10T09:00:0011DOSE50—1
YAMAA-01222025-03-10T11:00:0002DRGX—2.780
YAMAA-01312025-03-12T08:30:0011DOSE100—1
YAMAA-01322025-03-12T09:30:0002DRGX—4.520
Shaded columns are derived— = missing value

Human review and assessment

Your review

3 questions and your comments · View benchmark discussions

Mapping spec

Generated from the benchmark YAML; do not edit by hand

Dataset NameVariable NameVariable LabelTypeCodelist/Controlled TermsCoreComputational MethodOrigin
ADPPKSTUDYIDStudy IdentifiercharacterSet per constructed row; see the Row construction sheet.Derived
ADPPKUSUBJIDUnique Subject IdentifiercharacterSet per constructed row; see the Row construction sheet.Derived
ADPPKADTMAnalysis Date/TimenumericISO 8601Set per constructed row; see the Row construction sheet.Derived
ADPPKEVIDEvent IDnumeric0, 1Set per constructed row; see the Row construction sheet.Derived
ADPPKCMTCompartmentnumeric1, 2, 3Set per constructed row; see the Row construction sheet.Derived
ADPPKPARAMCDParameter CodecharacterSet per constructed row; see the Row construction sheet.Derived
ADPPKAMTActual Amount of Dose ReceivednumericSet per constructed row; see the Row construction sheet.Derived
ADPPKDVDependent Variable ResultnumericSet per constructed row; see the Row construction sheet.Derived
ADPPKMDVMissing Dependent Variable ResultnumericIf DV IS NULL then "1"; otherwise "0".Derived
ADPPKIDSubject Identifier for the AnalysisnumericRank rows from 1 ordered by STUDYID then USUBJID; ties share a number and the next distinct value follows without a gap.Derived
ADPPKASEQAnalysis Sequence NumbernumericRow number within each group of STUDYID, USUBJID, ordered by ADTM then EVID then CMT.Derived
TemplateInclude whenSTUDYIDUSUBJIDADTMEVIDCMTPARAMCDAMTDV
doseEX.EXDOSE > 0Copy EX.STUDYIDCopy EX.USUBJIDCopy EX.EXSTDTCConstant "1"Constant "1"Constant "DOSE"Copy EX.EXDOSEConstant "None"
observationPC.PCSTAT IS NULL AND DOSED.EXSEQ IS NOT NULLCopy PC.STUDYIDCopy PC.USUBJIDCopy PC.PCDTCConstant "0"Recode PC.PCTESTCD: "DRGX" → "2", "MET1" → "3"; missing values stay missing; unlisted values are errorsCopy PC.PCTESTCDConstant "None"Copy PC.PCSTRESN
VariablePermitted values
EVID0, 1
CMT1, 2, 3
VersionDateAuthorDescriptionReviewerSign-off
1.82026-11-19yamaa docs buildState open and closed range endpoints, including bounds of zero
1.72026-10-20yamaa docs buildRead a specification in the 1.0 surface as its 0.5 counterpart; state that missing values stay missing where a mapping declares no missing handler, and leave out a declared missing answer that restates a handler's default
1.62026-10-17yamaa docs buildDescribe collected date parts written as ISO 8601 date text and times of day counted in seconds since midnight
1.52026-10-17yamaa docs buildName collected precision in words instead of letter codes; state imputation fallbacks, minimum source precision, bounds ignored outside the collected period, and invalid text with no handler as an error; describe date and datetime shifts, imputation flag codes, and partial text giving no date part
1.42026-10-15yamaa docs buildState datetime precision codes through the hour and minute, and complete only the time parts a collected datetime lacks
1.32026-09-29yamaa docs buildShow study codelist names, external dictionaries, and ISO 8601 formats in variable rows; list the document's codelist values and metadata
1.22026-09-29yamaa docs buildClassify ADaM copies from a declared input as Predecessor and recodes as Derived, and SDTM recodes of locally derived columns as Derived
1.12026-09-29yamaa docs buildResolve lookups into the donor record they select, and give every derivation shape a plain-language rule instead of its raw YAML
1.0yamaa docs buildInitial generation from spec.yaml

Agent prompt

The request an agent receives with the input files; each tier states no more than the one above

prompts/adam-adppk-event-records/full.md

Edit
39 lines

Following CDISC ADaM standards, use the provided EX and PC datasets to create an ADPPK dataset with one record per event of a subject: a dose administration, or a PK concentration sample of one analyte.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, ID, ASEQ, ADTM, EVID, CMT, PARAMCD, AMT, DV, MDV

The dataset holds the events as a population PK model reads them: a dose record for each EX record and a concentration record for each PC record, with these exceptions.

  • An administration with a dose of zero is no event and gives no record.
  • A sample that was not done (PCSTAT is "NOT DONE") gives no record.
  • A subject with no administration of a dose above zero, such as a placebo subject, has no records at all, concentration records included.
  • Every other PC record gives a concentration record, a sample drawn before the subject's first dose and a result below the limit of quantification included.

The columns hold:

  • ID is the subject's number among the subjects in the output dataset, counted from 1 in the order of USUBJID, with no number skipped.
  • ASEQ is the record's number within the subject, from 1 in the order of ADTM. At one date/time a concentration record comes before a dose record, and concentration records follow their CMT.
  • ADTM is the date/time of the administration (EXSTDTC) or of the sample (PCDTC), written as YYYY-MM-DDThh:mm:ss with the seconds always shown.
  • EVID is 1 for a dose record and 0 for a concentration record.
  • CMT is 1 for a dose record, and for a concentration record 2 when PCTESTCD is "DRGX", the parent drug, and 3 when it is "MET1", its metabolite.
  • PARAMCD is "DOSE" for a dose record and PCTESTCD for a concentration record.
  • AMT is the dose given (EXDOSE) and has no value on a concentration record.
  • DV is the concentration (PCSTRESN), not rounded, and has no value on a dose record or for a result below the limit of quantification.
  • MDV is 1 when DV has no value, on every dose record too, and 0 otherwise.

Read the source datasets from /app/input and save the completed dataset as /app/output/adppk.csv.

prompts/adam-adppk-event-records/conventions.md

Edit
18 lines

Following CDISC ADaM standards, use the provided EX and PC datasets to create an ADPPK dataset with one record per event of a subject: a dose administration, or a PK concentration sample of one analyte.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, ID, ASEQ, ADTM, EVID, CMT, PARAMCD, AMT, DV, MDV

ID is the subject's number among the subjects in the output dataset, counted from 1 in the order of USUBJID, with no number skipped. ADTM is written as YYYY-MM-DDThh:mm:ss with the seconds always shown. EVID is 1 for a dose record and 0 for a concentration record. CMT is 1 for a dose record, and for a concentration record 2 when PCTESTCD is "DRGX", the parent drug, and 3 when it is "MET1", its metabolite. PARAMCD is "DOSE" for a dose record and PCTESTCD for a concentration record. DV is not rounded. MDV is 1 when DV has no value and 0 otherwise.

Read the source datasets from /app/input and save the completed dataset as /app/output/adppk.csv.

prompts/adam-adppk-event-records/brief.md

Edit
9 lines

Following CDISC ADaM standards, use the provided EX and PC datasets to create an ADPPK dataset with one record per event of a subject: a dose administration, or a PK concentration sample of one analyte.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, ID, ASEQ, ADTM, EVID, CMT, PARAMCD, AMT, DV, MDV

Read the source datasets from /app/input and save the completed dataset as /app/output/adppk.csv.

yamaa code

Public calls generated from benchmark.yaml; results must match the expected output

R

Edit
3 lines
library(yamaa)yamaa_spec("spec.yaml")$run()$output

Python

Edit
3 lines
import yamaayamaa.spec("spec.yaml").run().output

Solution without yamaa

Written from the full prompt and the inputs alone; CI checks it reproduces the expected output

solutions/adam-adppk-event-records/result.R

Edit
62 lines
# Reference solution for the yamaa benchmark adam-adppk-event-records (R track).## Written from the benchmark's full prompt and its inputs alone, as an agent# would write it. Harbor's oracle agent runs it to check that the prompt can# be solved and that the grader scores a correct answer 1.suppressPackageStartupMessages({  library(dplyr)  library(readr)  library(stringr)})ex <- read_csv("/app/input/ex.csv", col_types = cols(.default = col_character()), na = c("", "NA"))pc <- read_csv("/app/input/pc.csv", col_types = cols(.default = col_character()), na = c("", "NA"))full_dtm <- function(x) {  x <- str_trim(x)  d <- "[0-9]{4}-[0-9]{2}-[0-9]{2}"  case_when(    is.na(x) ~ NA_character_,    str_detect(x, paste0("^", d, "$")) ~ paste0(x, "T00:00:00"),    str_detect(x, paste0("^", d, "T[0-9]{2}$")) ~ paste0(x, ":00:00"),    str_detect(x, paste0("^", d, "T[0-9]{2}:[0-9]{2}$")) ~ paste0(x, ":00"),    TRUE ~ str_sub(x, 1, 19)  )}doses <- ex %>%  mutate(AMT = as.numeric(EXDOSE)) %>%  filter(!is.na(AMT), AMT > 0) %>%  transmute(    STUDYID, USUBJID,    ADTM = full_dtm(EXSTDTC),    EVID = 1L, CMT = 1L, PARAMCD = "DOSE",    AMT, DV = NA_real_,    SRCSEQ = as.numeric(EXSEQ)  )concs <- pc %>%  filter(is.na(PCSTAT) | str_to_upper(str_trim(PCSTAT)) != "NOT DONE") %>%  semi_join(doses, by = "USUBJID") %>%  transmute(    STUDYID, USUBJID,    ADTM = full_dtm(PCDTC),    EVID = 0L,    CMT = case_when(PCTESTCD == "DRGX" ~ 2L, PCTESTCD == "MET1" ~ 3L, TRUE ~ NA_integer_),    PARAMCD = PCTESTCD,    AMT = NA_real_,    DV = if_else(!is.na(PCSTRESC) & str_detect(PCSTRESC, "^ *<"), NA_real_, as.numeric(PCSTRESN)),    SRCSEQ = as.numeric(PCSEQ)  )adppk <- bind_rows(doses, concs) %>%  mutate(MDV = if_else(is.na(DV), 1L, 0L)) %>%  arrange(USUBJID, ADTM, EVID, CMT, SRCSEQ) %>%  mutate(ID = dense_rank(USUBJID)) %>%  group_by(USUBJID) %>%  mutate(ASEQ = row_number()) %>%  ungroup() %>%  select(STUDYID, USUBJID, ID, ASEQ, ADTM, EVID, CMT, PARAMCD, AMT, DV, MDV)write_csv(adppk, "/app/output/adppk.csv", na = "")

solutions/adam-adppk-event-records/result.py

Edit
60 lines
# Reference solution for the yamaa benchmark adam-adppk-event-records (Python track).## Written from the benchmark's full prompt and its inputs alone, as an agent# would write it. Harbor's oracle agent runs it to check that the prompt can# be solved and that the grader scores a correct answer 1.import pandas as pdCOLUMNS = ["STUDYID", "USUBJID", "ID", "ASEQ", "ADTM", "EVID", "CMT", "PARAMCD", "AMT", "DV", "MDV"]CMT = {"DRGX": 2, "MET1": 3}def read(name):    frame = pd.read_csv(f"/app/input/{name}.csv", dtype=str, keep_default_na=False)    return frame.apply(lambda column: column.str.strip())def adtm(values):    return pd.to_datetime(values, format="ISO8601").dt.strftime("%Y-%m-%dT%H:%M:%S")ex = read("ex")ex = ex[pd.to_numeric(ex["EXDOSE"], errors="coerce") > 0]dose = pd.DataFrame(    {        "STUDYID": ex["STUDYID"],        "USUBJID": ex["USUBJID"],        "ADTM": adtm(ex["EXSTDTC"]),        "EVID": 1,        "CMT": 1,        "PARAMCD": "DOSE",        "AMT": ex["EXDOSE"],        "DV": "",        "SEQ": pd.to_numeric(ex["EXSEQ"], errors="coerce"),    })pc = read("pc")pc = pc[(pc["PCSTAT"].str.upper() != "NOT DONE") & pc["USUBJID"].isin(dose["USUBJID"])]conc = pd.DataFrame(    {        "STUDYID": pc["STUDYID"],        "USUBJID": pc["USUBJID"],        "ADTM": adtm(pc["PCDTC"]),        "EVID": 0,        "CMT": pc["PCTESTCD"].map(CMT).astype("Int64"),        "PARAMCD": pc["PCTESTCD"],        "AMT": "",        "DV": pc["PCSTRESN"],        "SEQ": pd.to_numeric(pc["PCSEQ"], errors="coerce"),    })adppk = pd.concat([dose, conc], ignore_index=True)adppk["CMT"] = adppk["CMT"].astype("Int64")adppk["MDV"] = (adppk["DV"] == "").astype(int)adppk = adppk.sort_values(["USUBJID", "ADTM", "EVID", "CMT", "SEQ"], kind="stable").reset_index(drop=True)adppk["ID"] = adppk.groupby("USUBJID", sort=True).ngroup() + 1adppk["ASEQ"] = adppk.groupby("USUBJID").cumcount() + 1adppk[COLUMNS].to_csv("/app/output/adppk.csv", index=False)

solutions/adam-adppk-event-records/result.sas

Edit
86 lines
/* opensas reference solution for the yamaa benchmark adam-adppk-event-records.   Reads the benchmark inputs and derives the requested output.   Execute with the existing opensas runtime: opensas /app/output/result.sas. */options missing='';data ex;  infile '/app/input/ex.csv' dsd dlm=',' firstobs=2 truncover;  length STUDYID $40 USUBJID $40 EXSEQ 8 EXTRT $40 EXDOSE 8 EXDOSU $20 EXSTDTC $25;  input STUDYID $ USUBJID $ EXSEQ EXTRT $ EXDOSE EXDOSU $ EXSTDTC $;run;data pc;  infile '/app/input/pc.csv' dsd dlm=',' firstobs=2 truncover;  length STUDYID $40 USUBJID $40 PCSEQ 8 PCTESTCD $8 PCSTRESC $20 PCSTRESN 8         PCSTRESU $20 PCSTAT $20 PCTPT $40 PCDTC $25;  input STUDYID $ USUBJID $ PCSEQ PCTESTCD $ PCSTRESC $ PCSTRESN PCSTRESU $ PCSTAT $ PCTPT $ PCDTC $;run;data dose;  set ex;  where EXDOSE > 0;  length ADTM $19 PARAMCD $8;  ADTM = strip(compress(EXSTDTC, "0D"x));  if length(ADTM) = 16 then ADTM = cats(ADTM, ':00');  else if length(ADTM) = 13 then ADTM = cats(ADTM, ':00:00');  else if length(ADTM) = 10 then ADTM = cats(ADTM, 'T00:00:00');  EVID = 1;  CMT = 1;  PARAMCD = 'DOSE';  AMT = EXDOSE;  DV = .;  MDV = 1;  keep STUDYID USUBJID ADTM EVID CMT PARAMCD AMT DV MDV;run;proc sort data=dose(keep=USUBJID) out=dosed nodupkey;  by USUBJID;run;proc sort data=pc out=pcs;  by USUBJID;run;data conc;  merge pcs(in=inpc) dosed(in=indose);  by USUBJID;  if inpc and indose;  if upcase(strip(PCSTAT)) = 'NOT DONE' then delete;  length ADTM $19 PARAMCD $8;  ADTM = strip(compress(PCDTC, "0D"x));  if length(ADTM) = 16 then ADTM = cats(ADTM, ':00');  else if length(ADTM) = 13 then ADTM = cats(ADTM, ':00:00');  else if length(ADTM) = 10 then ADTM = cats(ADTM, 'T00:00:00');  EVID = 0;  if PCTESTCD = 'DRGX' then CMT = 2;  else if PCTESTCD = 'MET1' then CMT = 3;  PARAMCD = PCTESTCD;  AMT = .;  DV = PCSTRESN;  if missing(DV) then MDV = 1;  else MDV = 0;  keep STUDYID USUBJID ADTM EVID CMT PARAMCD AMT DV MDV;run;data events;  set dose conc;run;proc sort data=events;  by USUBJID ADTM EVID CMT;run;data adppk;  retain STUDYID USUBJID ID ASEQ ADTM EVID CMT PARAMCD AMT DV MDV;  set events;  by USUBJID;  if first.USUBJID then do;    ID + 1;    ASEQ = 0;  end;  ASEQ + 1;run;proc export data=adppk outfile='/app/output/adppk.csv' dbms=csv replace;run;