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: produce pharmacokinetic concentration (PC) records, retaining reported results and turning the vendor's nominal sample times into numeric hours (PCTPTNUM).

Input: a bioanalytical laboratory's electronic transfer, with sample identifiers, subject identifiers, nominal time labels, analyte, reported plasma concentration, units and actual collection date and time.

Variables:

  • PCSEQ numbers samples within each subject by actual collection time, then sample identifier; PCREFID retains that identifier.
  • PCTESTCD and PCTEST identify the measured drug, ZX201 and ZX-201.
  • PCORRES and PCSTRESC retain the reported result as text, including BLQ for below the limit of quantification.
  • PCORRESU and PCSTRESU retain the supplied unit independently of the result. They are empty when no unit is supplied; no unit conversion is applied.
  • PCSTRESN holds numeric results and is empty for BLQ; no limit-based numeric replacement is made.
  • PCSPEC is PLASMA, and PCDTC retains the actual collection time.
  • PCTPT retains the vendor's nominal label. PCTPTNUM is zero for PRE, the number before H for planned post-dose samples, and empty for UNSCHED.

Note: planned hours come from the nominal label, regardless of the actual collection time. An unrecognized label stops the run.

Inputs

Under review
1 source file

input/lab_transfer.csv

Edit
5 rows
input/lab_transfer.csv
ProtocolSubjectSampleNominalAnalyteResultUnitCollected
PK201PK201-001S001PREZX-201BLQng/mL2026-03-02T07:55:00
PK201PK201-001S0020.5HZX-20110.5ng/mL2026-03-02T08:31:00
PK201PK201-001S0032HZX-2016.25ng/mL2026-03-02T10:03:00
PK201PK201-001S004UNSCHEDZX-2014ng/mL2026-03-02T11:17:00
PK201PK201-002S00524HZX-2010.75ng/mL2026-03-03T08:06:00

Expected output

Under review
5 expected rows

expected/pc.csv

Edit
5 rows
expected/pc.csv
DOMAINSTUDYIDUSUBJIDPCSEQPCREFIDPCTESTCDPCTESTPCORRESPCORRESUPCSTRESCPCSTRESNPCSTRESUPCSPECPCDTCPCTPTPCTPTNUM
PCPK2011S001ZX201ZX-201BLQng/mLBLQ—ng/mLPLASMA2026-03-02T07:55:00PRE0
PCPK2012S002ZX201ZX-20110.5ng/mL10.510.5ng/mLPLASMA2026-03-02T08:31:000.5H0.5
PCPK2013S003ZX201ZX-2016.25ng/mL6.256.25ng/mLPLASMA2026-03-02T10:03:002H2
PCPK2014S004ZX201ZX-2014ng/mL44ng/mLPLASMA2026-03-02T11:17:00UNSCHED—
PCPK2011S005ZX201ZX-2010.75ng/mL0.750.75ng/mLPLASMA2026-03-03T08:06:0024H24
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

Variable NameVariable LabelTypeLengthControlled Terms or FormatOriginCoreConversion DefinitionVariable TypeVariable OrderComments for Define
DOMAINDomain AbbreviationCharAssignedSet constant value "PC".SDTM1
STUDYIDStudy IdentifierCharCollectedCopy value from LAB.Protocol.SDTM2
USUBJIDUnique Subject IdentifierCharCollectedCopy value from LAB.Subject.SDTM3
PCREFIDReference IDCharCollectedCopy value from LAB.Sample.SDTM4
PCTESTCDPK Concentration Test Short NameCharCollectedRecode LAB.Analyte: "ZX-201" → "ZX201"; missing values stay missing; unlisted values are errors.SDTM5
PCTESTPK Concentration Test NameCharCollectedCopy value from LAB.Analyte.SDTM6
PCORRESResult or Finding in Original UnitsCharCollectedCopy value from LAB.Result.SDTM7
PCORRESUOriginal UnitsCharCollectedCopy value from LAB.Unit.SDTM8
PCSTRESCCharacter Result/Finding in Std FormatCharDerivedCopy value from PCORRES.SDTM9
PCSTRESNNumeric Result/Finding in Standard UnitsNumDerivedIf PCORRES = 'BLQ' then "None"; otherwise "PCORRES".SDTM10
PCSTRESUStandard UnitsCharDerivedCopy value from PCORRESU.SDTM11
PCSPECSpecimen Material TypeCharAssignedSet constant value "PLASMA".SDTM12
PCDTCDate/Time of Specimen CollectionCharISO 8601CollectedCopy value from LAB.Collected.SDTM13
PCTPTPlanned Time Point NameCharCollectedCopy value from LAB.Nominal.SDTM14
PCTPTNUMPlanned Time Point NumberNumDerivedIf PCTPT = 'PRE' then "0"; If PCTPT = 'UNSCHED' then "None"; otherwise extract capture group 1 matching ^([0-9]+(?:\.[0-9]+)?)H$ from PCTPT.SDTM15
PCSEQSequence NumberNumDerivedRow number within each group of LAB.Protocol, LAB.Subject, ordered by LAB.Collected then LAB.Sample.SDTM16
VersionDateAuthorDescriptionReviewerSign-off
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/sdtm-pc-pk-concentrations/full.md

Edit
23 lines

Following CDISC SDTM standards, use the provided LAB_TRANSFER dataset to create a PC dataset with one record per sample.

The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, PCSEQ, PCREFID, PCTESTCD, PCTEST, PCORRES, PCORRESU, PCSTRESC, PCSTRESN, PCSTRESU, PCSPEC, PCDTC, PCTPT, PCTPTNUM

DOMAIN is "PC". STUDYID and USUBJID are the Protocol and Subject identifiers as supplied, respectively. PCSEQ numbers samples from 1 within each study and subject by ascending actual collection datetime, then ascending Sample identifier (PCREFID). PCTESTCD is "ZX201", PCTEST is "ZX-201", and PCSPEC is "PLASMA". PCORRES and PCSTRESC hold the reported concentration text unchanged, including "BLQ" and the numeric text with its supplied decimal places. PCORRESU and PCSTRESU both hold the supplied unit independently of the reported result, including for "BLQ", with no unit conversion. PCSTRESN holds the numeric reported concentration without rounding and has no value for "BLQ"; no limit-based numeric replacement is made. PCTPTNUM is the planned time in hours represented by the vendor's nominal label in PCTPT: 0 for "PRE", the numeric value before "H" for planned post-dose labels, and no value for "UNSCHED", regardless of the actual collection time.

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

prompts/sdtm-pc-pk-concentrations/conventions.md

Edit
14 lines

Following CDISC SDTM standards, use the provided LAB_TRANSFER dataset to create a PC dataset with one record per sample.

The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, PCSEQ, PCREFID, PCTESTCD, PCTEST, PCORRES, PCORRESU, PCSTRESC, PCSTRESN, PCSTRESU, PCSPEC, PCDTC, PCTPT, PCTPTNUM

DOMAIN is "PC". PCTESTCD is "ZX201", PCTEST is "ZX-201", and PCSPEC is "PLASMA". PCORRES and PCSTRESC include "BLQ" and numeric text with its supplied decimal places. PCSTRESN is given without rounding. PCTPT includes "PRE", "UNSCHED", and planned post-dose labels with the numeric value before "H".

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

prompts/sdtm-pc-pk-concentrations/brief.md

Edit
9 lines

Following CDISC SDTM standards, use the provided LAB_TRANSFER dataset to create a PC dataset with one record per sample.

The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, PCSEQ, PCREFID, PCTESTCD, PCTEST, PCORRES, PCORRESU, PCSTRESC, PCSTRESN, PCSTRESU, PCSPEC, PCDTC, PCTPT, PCTPTNUM

Read the source datasets from /app/input and save the completed dataset as /app/output/pc.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/sdtm-pc-pk-concentrations/result.R

Edit
32 lines
lab <- read.csv("/app/input/lab_transfer.csv", colClasses = "character", check.names = FALSE,                stringsAsFactors = FALSE, na.strings = NULL)collection_time <- as.POSIXct(lab$Collected, format = "%Y-%m-%dT%H:%M:%OS", tz = "UTC")lab <- lab[order(lab$Protocol, lab$Subject, collection_time, lab$Sample), , drop = FALSE]seq_group <- interaction(lab$Protocol, lab$Subject, drop = TRUE)pcseq <- ave(seq_len(nrow(lab)), seq_group, FUN = seq_along)planned_hours <- rep(NA_real_, nrow(lab))planned_hours[lab$Nominal == "PRE"] <- 0postdose <- grepl("^[0-9]+(\\.[0-9]+)?H$", lab$Nominal)planned_hours[postdose] <- as.numeric(sub("H$", "", lab$Nominal[postdose]))pc <- data.frame(  DOMAIN = "PC",  STUDYID = lab$Protocol,  USUBJID = lab$Subject,  PCSEQ = as.integer(pcseq),  PCREFID = lab$Sample,  PCTESTCD = "ZX201",  PCTEST = "ZX-201",  PCORRES = lab$Result,  PCORRESU = lab$Unit,  PCSTRESC = lab$Result,  PCSTRESN = suppressWarnings(as.numeric(lab$Result)),  PCSTRESU = lab$Unit,  PCSPEC = "PLASMA",  PCDTC = lab$Collected,  PCTPT = lab$Nominal,  PCTPTNUM = planned_hours,  stringsAsFactors = FALSE,  check.names = FALSE)stopifnot(nrow(pc) == nrow(lab), identical(pc$PCORRES, pc$PCSTRESC), identical(pc$PCORRESU, pc$PCSTRESU))write.csv(pc, "/app/output/pc.csv", row.names = FALSE, na = "")

solutions/sdtm-pc-pk-concentrations/result.py

Edit
51 lines
from pathlib import Pathimport pandas as pddef main():    source = pd.read_csv(        "/app/input/lab_transfer.csv", dtype=str, keep_default_na=False    )    source["_collection_time"] = pd.to_datetime(        source["Collected"], errors="raise", utc=True    )    source = source.sort_values(        ["Protocol", "Subject", "_collection_time", "Sample"], kind="stable"    )    result = pd.DataFrame(index=source.index)    result["DOMAIN"] = "PC"    result["STUDYID"] = source["Protocol"]    result["USUBJID"] = source["Subject"]    result["PCSEQ"] = source.groupby(["Protocol", "Subject"], sort=False).cumcount() + 1    result["PCREFID"] = source["Sample"]    result["PCTESTCD"] = "ZX201"    result["PCTEST"] = "ZX-201"    result["PCORRES"] = source["Result"]    result["PCORRESU"] = source["Unit"]    result["PCSTRESC"] = source["Result"]    # Preserve the reported numeric precision in the CSV, with BLQ left empty.    result["PCSTRESN"] = source["Result"].where(source["Result"].ne("BLQ"), "")    result["PCSTRESU"] = source["Unit"]    result["PCSPEC"] = "PLASMA"    result["PCDTC"] = source["Collected"]    result["PCTPT"] = source["Nominal"]    def planned_hours(label):        if label == "PRE":            return "0"        if label == "UNSCHED":            return ""        if label.endswith("H"):            hours = label[:-1]            float(hours)            return hours        raise ValueError(f"Unexpected nominal label: {label}")    result["PCTPTNUM"] = source["Nominal"].map(planned_hours)    Path("/app/output").mkdir(exist_ok=True)    result.to_csv("/app/output/pc.csv", index=False)if __name__ == "__main__":    main()

solutions/sdtm-pc-pk-concentrations/result.sas

Edit
42 lines
proc import datafile='/app/input/lab_transfer.csv' out=lab_transfer dbms=csv replace;  guessingrows=max;run;proc sort data=lab_transfer out=lab_sorted;  by Protocol Subject Collected Sample;run;data pc;  length DOMAIN $2 STUDYID $200 USUBJID $200 PCSEQ 8 PCREFID $200         PCTESTCD $8 PCTEST $40 PCORRES $200 PCORRESU $40         PCSTRESC $200 PCSTRESN 8 PCSTRESU $40 PCSPEC $40         PCDTC $40 PCTPT $40 PCTPTNUM 8;  set lab_sorted;  by Protocol Subject;  retain PCSEQ;  if first.Subject then PCSEQ=0;  PCSEQ=PCSEQ+1;  DOMAIN='PC';  STUDYID=Protocol;  USUBJID=Subject;  PCREFID=Sample;  PCTESTCD='ZX201';  PCTEST='ZX-201';  PCORRES=Result;  PCORRESU=Unit;  PCSTRESC=PCORRES;  PCSTRESN=.;  if Result ne 'BLQ' then PCSTRESN=input(Result,best32.);  PCSTRESU=PCORRESU;  PCSPEC='PLASMA';  PCDTC=Collected;  PCTPT=Nominal;  PCTPTNUM=.;  if Nominal='PRE' then PCTPTNUM=0;  else if Nominal ne 'UNSCHED' then PCTPTNUM=input(compress(Nominal,'H'),best32.);  keep DOMAIN STUDYID USUBJID PCSEQ PCREFID PCTESTCD PCTEST PCORRES PCORRESU       PCSTRESC PCSTRESN PCSTRESU PCSPEC PCDTC PCTPT PCTPTNUM;run;proc export data=pc outfile='/app/output/pc.csv' dbms=csv replace;run;