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: reviewedEditUnder review
What this benchmark means
README.md

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

Goal: add the subject's mean result (AVALMEAN) for each laboratory parameter to every collected record.

Input: collected laboratory (LB) records carrying study, subject, sequence number, test code, and the collected numeric result.

Variables:

  • AVAL: the collected numeric result for the record; empty when no usable result was collected.
  • AVALMEAN: the mean of the subject's non-missing AVAL values for the parameter, repeated on every record for that subject and parameter, including a record whose own AVAL is empty; empty, never zero, when the subject has no non-missing AVAL for the parameter.

Note: the mean is taken separately for each test code, so each of a subject's records carries the mean for its own test.

Inputs

Under review
1 source file

input/lb.csv

Edit
7 rows
input/lb.csv
STUDYIDUSUBJIDLBSEQLBTESTCDLBSTRESN
KN1891NEUT3.1
KN1892NEUT2.8
KN1893NEUT3.4
KN1894NEUT—
KN1891NEUT4.0
KN1892NEUT4.2
KN1891NEUT—

Expected output

Under review
7 expected rows

expected/adlb.csv

Edit
7 rows
expected/adlb.csv
STUDYIDUSUBJIDLBSEQPARAMCDAVALAVALMEAN
KN1891NEUT3.13.1
KN1892NEUT2.83.1
KN1893NEUT3.43.1
KN1894NEUT—3.1
KN1891NEUT44.1
KN1892NEUT4.24.1
KN1891NEUT——
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
ADLBSTUDYIDStudy IdentifiercharacterCopy value from LB.STUDYID.Predecessor
ADLBUSUBJIDUnique Subject IdentifiercharacterCopy value from LB.USUBJID.Predecessor
ADLBLBSEQSequence NumbernumericCopy value from LB.LBSEQ.Predecessor
ADLBPARAMCDParameter CodecharacterCopy value from LB.LBTESTCD.Predecessor
ADLBAVALAnalysis ValuenumericCopy value from LB.LBSTRESN.Predecessor
ADLBAVALMEANMean Analysis ValuenumericAggregate MEAN(AVAL) over records grouped by STUDYID, USUBJID, PARAMCD, matching on the shared output keys.Derived
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/adam-adlb-mean/full.md

Edit
16 lines

Following CDISC ADaM standards, use the provided LB dataset to create an ADLB dataset with one record per collected laboratory record.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, LBSEQ, PARAMCD, AVAL, AVALMEAN

PARAMCD is the record's collected test code. AVAL is the collected numeric result for the record, and has no value when no usable result was collected. AVALMEAN is the mean of the subject's non-missing AVAL values for the record's parameter, and the same mean is repeated on every record for that subject and parameter, including a record whose own AVAL has no value. When the subject has no non-missing AVAL for the parameter, AVALMEAN has no value; it is never zero. AVALMEAN is not rounded.

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

prompts/adam-adlb-mean/conventions.md

Edit
10 lines

Following CDISC ADaM standards, use the provided LB dataset to create an ADLB dataset with one record per collected laboratory record.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, LBSEQ, PARAMCD, AVAL, AVALMEAN

AVALMEAN is not rounded.

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

prompts/adam-adlb-mean/brief.md

Edit
8 lines

Following CDISC ADaM standards, use the provided LB dataset to create an ADLB dataset with one record per collected laboratory record.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, LBSEQ, PARAMCD, AVAL, AVALMEAN

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

Edit
33 lines
# Reference solution for the yamaa benchmark adam-adlb-mean (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)lb <- read_csv(  "/app/input/lb.csv",  col_types = cols(    LBSEQ = col_integer(),    LBSTRESN = col_double(),    .default = col_character()  ))# Mean of the subject's collected values for the parameter, repeated on# every record for that subject and parameter.means <- lb |>  filter(!is.na(LBSTRESN)) |>  group_by(STUDYID, USUBJID, LBTESTCD) |>  summarise(AVALMEAN = mean(LBSTRESN), .groups = "drop")adlb <- lb |>  left_join(means, by = c("STUDYID", "USUBJID", "LBTESTCD")) |>  mutate(AVAL = LBSTRESN, PARAMCD = LBTESTCD) |>  arrange(USUBJID, LBSEQ) |>  select(STUDYID, USUBJID, LBSEQ, PARAMCD, AVAL, AVALMEAN)dir.create("/app/output", showWarnings = FALSE)write_csv(adlb, "/app/output/adlb.csv", na = "")

solutions/adam-adlb-mean/result.py

Edit
82 lines
# Reference solution for the yamaa benchmark adam-adlb-mean (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."""Create ADLB from the collected LB dataset.One record per collected laboratory record. AVAL is the collectednumeric result (LBSTRESN); AVALMEAN is the mean of the subject'snon-missing AVAL values for the record's parameter, repeated on everyrecord for that subject and parameter."""import csvfrom decimal import Decimal, InvalidOperationfrom pathlib import PathINPUT_DIR = Path("/app/input")OUTPUT_DIR = Path("/app/output")def parse_number(text):    """Return the Decimal value of a collected result, or None."""    if text is None:        return None    text = text.strip()    if not text:        return None    try:        return Decimal(text)    except InvalidOperation:        return Nonedef format_number(value):    """Format a Decimal without rounding, dropping trailing zeros."""    if value is None:        return ""    text = format(value.normalize(), "f")    return textdef main():    with open(INPUT_DIR / "lb.csv", newline="", encoding="utf-8") as handle:        rows = list(csv.DictReader(handle))    records = []    totals = {}    counts = {}    for row in rows:        aval = parse_number(row.get("LBSTRESN"))        key = (row["USUBJID"], row["LBTESTCD"])        if aval is not None:            totals[key] = totals.get(key, Decimal(0)) + aval            counts[key] = counts.get(key, 0) + 1        records.append((row, aval))    OUTPUT_DIR.mkdir(parents=True, exist_ok=True)    fieldnames = ["STUDYID", "USUBJID", "LBSEQ", "PARAMCD", "AVAL", "AVALMEAN"]    with open(OUTPUT_DIR / "adlb.csv", "w", newline="", encoding="utf-8") as handle:        writer = csv.DictWriter(handle, fieldnames=fieldnames)        writer.writeheader()        for row, aval in records:            key = (row["USUBJID"], row["LBTESTCD"])            mean = None            if counts.get(key):                mean = totals[key] / counts[key]            writer.writerow(                {                    "STUDYID": row["STUDYID"],                    "USUBJID": row["USUBJID"],                    "LBSEQ": row["LBSEQ"],                    "PARAMCD": row["LBTESTCD"],                    "AVAL": format_number(aval),                    "AVALMEAN": format_number(mean),                }            )if __name__ == "__main__":    main()

solutions/adam-adlb-mean/result.sas

Edit
16 lines
/* opensas reference solution for the yamaa benchmark adam-adlb-mean.   Reads the benchmark inputs and derives the requested output.   Execute with the existing opensas runtime: opensas /app/output/result.sas. */data lb;  length STUDYID USUBJID LBTESTCD $1024;  infile "/app/input/lb.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. LBSEQ LBTESTCD : $char1024. LBSTRESN;run;proc sql;  create table result as  select a.*,a.LBTESTCD as PARAMCD,a.LBSTRESN as AVAL,b.AVALMEAN from lb as a left join (select STUDYID,USUBJID,LBTESTCD,mean(LBSTRESN) as AVALMEAN from lb group by STUDYID,USUBJID,LBTESTCD) as b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID and a.LBTESTCD=b.LBTESTCD;quit;proc export data=result(keep=STUDYID USUBJID LBSEQ PARAMCD AVAL AVALMEAN) outfile="/app/output/adlb.csv" dbms=csv replace; run;