Review ask

As a clinical trial statistician or programmer, challenge anything in this benchmark: describe a problem in Comments, or propose a fix with the Edit button on any source file.

  1. Task: Would a real study need this derivation, specified this way? Does it follow CDISC SDTM: variable names, controlled terms, record structure? Flag any rule that is ambiguous or that a sponsor would handle differently.
  2. Inputs: Do they look like data collected in a real trial, and do they include the situations you would expect to meet in one?
  3. Expected output: Would independent QC programming reproduce every value from these inputs and rules?

The other tabs beside Comments are background for assessment, not under review.

Summary

Lifecycle: reviewedEditUnder review
What this benchmark means
README.md

Goal: build one record per skin compartment a subject has for the test code (IL13), carrying LBTESTCD, LBTEST, LBSPEC, LBLOC, LBORRES, LBORRESU, LBSTRESN, and LBSTAT.

Input: one row per subject carrying cohort, lesional result, non-lesional result, and unit.

Variables:

  • LBTESTCD is IL13 on every record.
  • LBTEST is Interleukin 13 on every record.
  • LBSPEC is SKIN on every record.
  • LBLOC is LESIONAL on the lesional record and NON-LESIONAL on the non-lesional record; the lesional record is built only when a cohort is recorded and is not NONAD, while every subject gets the non-lesional record.
  • LBORRES is the collected result as reported, taken from the lesional result on lesional records and from the non-lesional result on non-lesional records; blank when the expected sample was not analysed.
  • LBORRESU is the collected unit, taken on every record, including records whose result is blank.
  • LBSTRESN is the numeric form of the reported result; missing when the reported result is blank. A result that is not a number stops the run.
  • LBSTAT is NOT DONE when the reported result is blank; blank otherwise.

Note: a blank result with NOT DONE means the compartment exists but its sample was not analysed, while a missing lesional record means the subject has no lesional compartment.

Inputs

Under review
1 source file

input/bx_raw.csv

Edit
3 rows
input/bx_raw.csv
STUDYIDUSUBJIDCOHORTLESRESNLESRESRESU
CATHAD4.21.1pg/mL
CATHPSORIASIS—0.9pg/mL
CATHNONAD—0.8pg/mL

Expected output

Under review
5 expected rows

expected/lb.csv

Edit
5 rows
expected/lb.csv
DOMAINSTUDYIDUSUBJIDLBSEQLBTESTCDLBTESTLBSPECLBLOCLBORRESLBORRESULBSTRESNLBSTAT
LBCATH1IL13Interleukin 13SKINLESIONAL4.2pg/mL4.2—
LBCATH1IL13Interleukin 13SKINLESIONAL—pg/mL—NOT DONE
LBCATH2IL13Interleukin 13SKINNON-LESIONAL1.1pg/mL1.1—
LBCATH2IL13Interleukin 13SKINNON-LESIONAL0.9pg/mL0.9—
LBCATH1IL13Interleukin 13SKINNON-LESIONAL0.8pg/mL0.8—
Shaded columns are derived— = missing value

Comments and assessment materials

Comments

Signed in with GitHub; saved in repository 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 "LB".SDTM1
STUDYIDStudy IdentifierCharCollectedCopy value from BX_RAW.STUDYID.SDTM2
USUBJIDUnique Subject IdentifierCharCollectedCopy value from BX_RAW.USUBJID.SDTM3
LBTESTCDLab Test or Examination Short NameCharAssignedSet constant value "IL13".SDTM4
LBTESTLab Test or Examination NameCharAssignedSet constant value "Interleukin 13".SDTM5
LBSPECSpecimen Material TypeCharAssignedSet constant value "SKIN".SDTM6
LBLOCLocation Used for MeasurementCharDerivedSet per constructed row; see the Row construction sheet.SDTM7
LBSEQSequence NumberNumDerivedRow number within each group of STUDYID, USUBJID, ordered by LBLOC then LBTESTCD.SDTM8
LBORRESResult or Finding in Original UnitsCharDerivedSet per constructed row; see the Row construction sheet.SDTM9
LBORRESUOriginal UnitsCharCollectedCopy value from BX_RAW.RESU.SDTM10
LBSTRESNNumeric Result/Finding in Standard UnitsNumDerivedCopy value from LBORRES.SDTM11
LBSTATCompletion StatusCharNOT DONEDerivedIf LBORRES IS NULL then "NOT DONE"; otherwise blank.SDTM12
TemplateInclude whenLBLOCLBORRES
lesionalBX_RAW.COHORT <> 'NONAD'Constant "LESIONAL"Copy BX_RAW.LESRES
non_lesionalConstant "NON-LESIONAL"Copy BX_RAW.NLESRES
VariablePermitted values
LBSTATNOT DONE
VersionDateAuthorDescriptionReviewerSign-off
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-lb-compartments/full.md

Edit
27 lines

Following CDISC SDTM standards, use the provided BX_RAW dataset to create an LB dataset with one record per skin compartment a subject has.

The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, LBSEQ, LBTESTCD, LBTEST, LBSPEC, LBLOC, LBORRES, LBORRESU, LBSTRESN, LBSTAT

LBTESTCD is IL13, LBTEST is Interleukin 13, and LBSPEC is SKIN on every record. LBSEQ numbers each subject's records with the lesional record first. LBLOC is LESIONAL on the lesional record and NON-LESIONAL on the non-lesional record; the lesional record is built only when a cohort is recorded and is not NONAD, while every subject gets the non-lesional record.

LBORRES is the collected result from the matching compartment, and has no value when the expected sample was not analysed. LBORRESU is the collected unit on every record, including records with no result. LBSTRESN is the numeric form of the reported result, and has no value when the reported result is blank. LBSTAT is NOT DONE when the reported result is blank, and has no value otherwise.

A blank result with NOT DONE means the compartment exists but its sample was not analysed, while a missing lesional record means the subject has no lesional compartment.

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

prompts/sdtm-lb-compartments/conventions.md

Edit
15 lines

Following CDISC SDTM standards, use the provided BX_RAW dataset to create an LB dataset with one record per skin compartment a subject has.

The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, LBSEQ, LBTESTCD, LBTEST, LBSPEC, LBLOC, LBORRES, LBORRESU, LBSTRESN, LBSTAT

LBTESTCD is IL13, LBTEST is Interleukin 13, and LBSPEC is SKIN on every record. LBLOC is LESIONAL on the lesional record and NON-LESIONAL on the non-lesional record.

LBSTAT is NOT DONE or has no value.

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

prompts/sdtm-lb-compartments/brief.md

Edit
9 lines

Following CDISC SDTM standards, use the provided BX_RAW dataset to create an LB dataset with one record per skin compartment a subject has.

The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, LBSEQ, LBTESTCD, LBTEST, LBSPEC, LBLOC, LBORRES, LBORRESU, LBSTRESN, LBSTAT

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

yamaa code

Runs the yamaa specification; its result must match the expected output

run.R

Edit
4 lines
library(yamaa)lb <- yamaa_domain("spec.yaml")$outputlb

run.py

Edit
4 lines
import yamaalb = yamaa.yamaa_domain("spec.yaml").outputlb

Solution without yamaa

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

solutions/sdtm-lb-compartments/result.R

Edit
50 lines
# Reference solution for the yamaa benchmark sdtm-lb-compartments (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.library(dplyr, warn.conflicts = FALSE)library(readr)library(purrr)bx <- read_csv(  "/app/input/bx_raw.csv",  col_types = cols(.default = col_character()))make_records <- function(study, subj, cohort, les, nles, unit) {  locs <- list()  if (!is.na(cohort) && cohort != "" && cohort != "NONAD") {    locs <- append(locs, list(list(loc = "LESIONAL", res = les)))  }  locs <- append(locs, list(list(loc = "NON-LESIONAL", res = nles)))  imap(locs, function(entry, i) {    res <- entry$res    if (is.na(res) || res == "") res <- NA_character_    num <- suppressWarnings(as.numeric(res))    tibble(      DOMAIN = "LB",      STUDYID = study,      USUBJID = subj,      LBSEQ = as.integer(i),      LBTESTCD = "IL13",      LBTEST = "Interleukin 13",      LBSPEC = "SKIN",      LBLOC = entry$loc,      LBORRES = res,      LBORRESU = unit,      LBSTRESN = num,      LBSTAT = if_else(is.na(res), "NOT DONE", NA_character_)    )  }) |> bind_rows()}lb <- pmap_dfr(  list(bx$STUDYID, bx$USUBJID, bx$COHORT, bx$LESRES, bx$NLESRES, bx$RESU),  make_records) |>  arrange(STUDYID, USUBJID, LBSEQ)dir.create("/app/output", showWarnings = FALSE)write_csv(lb, "/app/output/lb.csv", na = "")

solutions/sdtm-lb-compartments/result.py

Edit
63 lines
# Reference solution for the yamaa benchmark sdtm-lb-compartments (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.from pathlib import Pathimport polars as plbx = pl.read_csv("/app/input/bx_raw.csv", infer_schema=False)rows = []for r in bx.to_dicts():    study, subj = r["STUDYID"], r["USUBJID"]    cohort, les, nles, unit = r["COHORT"], r["LESRES"], r["NLESRES"], r["RESU"]    records = []    if cohort is not None and cohort != "" and cohort != "NONAD":        records.append(("LESIONAL", les))    records.append(("NON-LESIONAL", nles))    for i, (loc, res) in enumerate(records, start=1):        res_text = res if res not in (None, "") else None        try:            resn = float(res_text) if res_text is not None else None        except ValueError:            resn = None        rows.append(            {                "DOMAIN": "LB",                "STUDYID": study,                "USUBJID": subj,                "LBSEQ": i,                "LBTESTCD": "IL13",                "LBTEST": "Interleukin 13",                "LBSPEC": "SKIN",                "LBLOC": loc,                "LBORRES": res_text,                "LBORRESU": unit,                "LBSTRESN": resn,                "LBSTAT": "NOT DONE" if res_text is None else None,            }        )lb = pl.DataFrame(    rows,    schema={        "DOMAIN": pl.String,        "STUDYID": pl.String,        "USUBJID": pl.String,        "LBSEQ": pl.Int64,        "LBTESTCD": pl.String,        "LBTEST": pl.String,        "LBSPEC": pl.String,        "LBLOC": pl.String,        "LBORRES": pl.String,        "LBORRESU": pl.String,        "LBSTRESN": pl.Float64,        "LBSTAT": pl.String,    },).sort(["STUDYID", "USUBJID", "LBSEQ"])Path("/app/output").mkdir(parents=True, exist_ok=True)lb.write_csv("/app/output/lb.csv")

solutions/sdtm-lb-compartments/result.sas

Edit
23 lines
/* opensas reference solution for the yamaa benchmark sdtm-lb-compartments.   Reads the benchmark inputs and derives the requested output.   Execute with the existing opensas runtime: opensas /app/output/result.sas. */data bx_raw;  length STUDYID USUBJID COHORT LESRES NLESRES RESU $1024;  infile "/app/input/bx_raw.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. COHORT : $char1024. LESRES : $char1024. NLESRES : $char1024. RESU : $char1024.;run;data prepared; set bx_raw; length DOMAIN $2 LBTESTCD LBTEST LBSPEC LBLOC LBORRES LBORRESU LBSTAT $1024; DOMAIN='LB'; LBTESTCD='IL13'; LBTEST='Interleukin 13'; LBSPEC='SKIN'; LBORRESU=RESU;if not missing(COHORT) and COHORT ne 'NONAD' then do; LBLOC='LESIONAL'; LBORRES=LESRES; LBSTRESN=input(LESRES,?? best32.); LBSTAT=''; if missing(LESRES) then LBSTAT='NOT DONE'; LOCORD=1; output; end;LBLOC='NON-LESIONAL'; LBORRES=NLESRES; LBSTRESN=input(NLESRES,?? best32.); LBSTAT=''; if missing(NLESRES) then LBSTAT='NOT DONE'; LOCORD=2; output; run;proc sort data=prepared; by STUDYID USUBJID LOCORD; run;data result; set prepared; by STUDYID USUBJID; retain LBSEQ;  if first.USUBJID then LBSEQ=0;  LBSEQ+1;run;proc sql;  create table final as select DOMAIN, STUDYID, USUBJID, LBSEQ, LBTESTCD, LBTEST, LBSPEC, LBLOC, LBORRES, LBORRESU, LBSTRESN, LBSTAT from result;quit;proc export data=final outfile="/app/output/lb.csv" dbms=csv replace; run;