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
README.mdPublic entries: Python and R. Passing coverage requires an installed inventory.
Goal: build one record for each subject and scheduled tumor
assessment holding the visit order (AVISITN), the assessment
date (ADT), the summed diameters in millimeters (AVAL), the
counts behind the sum (NMEAS and NTARGET), and the
completeness flag (ANL01FL).
Input: scheduled tumor assessments with visit order and date, tumor measurement records with lesion group, test code, numeric result, and completion status, plus the lesion inventory selected at study entry with lesion group and lesion identifier.
Variables:
AVISITNis the numeric order of the assessment, carried from the scheduled assessment; it orders the assessments of a subject.ADTis the date of the assessment, carried from the scheduled assessment; missing when the assessment has no recorded date.AVALis the sum ofTRSTRESNover the target longest-diameter records at the assessment, those withTRGRPIDofTARGETandTRTESTCDofLDIAM(longest diameter). A record with a missing result contributes nothing, while a zero result (a lesion that disappeared) counts as measured;AVALis missing when the assessment measured no target lesion.NMEASis how many target lesions the assessment measured: the count of non-missingTRSTRESNvalues among those records. It is missing when the assessment has no target longest-diameter records, and 0 when it has records but none carries a result; this separates an assessment that was never performed from one that measured nothing.NTARGETis how many lesions were selected as target lesions at study entry: the count of inventory records withTUGRPIDofTARGET, countingTULNKID; it is the same at every assessment of the subject.ANL01FLisYwhen every target lesion was measured, that is whenNMEASequalsNTARGET; blank otherwise.
Note: lesions outside the target inventory never enter the
sum, and a sum over an incomplete set of target lesions is still
reported; ANL01FL marks the assessments where every target
lesion was measured.
Inputs
Under review3 source filesinput/tr.csv
Edit17 rows| STUDYID | USUBJID | AVISIT | TRSEQ | TRLNKID | TRGRPID | TRTESTCD | TRSTRESN | TRSTAT |
|---|---|---|---|---|---|---|---|---|
| YAMAA-01 | BASELINE | 1 | L1 | TARGET | LDIAM | 40 | — | |
| YAMAA-01 | BASELINE | 2 | L2 | TARGET | LDIAM | 25 | — | |
| YAMAA-01 | BASELINE | 3 | L3 | TARGET | LDIAM | 15 | — | |
| YAMAA-01 | WEEK 8 | 4 | L1 | TARGET | LDIAM | 30 | — | |
| YAMAA-01 | WEEK 8 | 5 | L2 | TARGET | LDIAM | 20 | — | |
| YAMAA-01 | WEEK 8 | 6 | L3 | TARGET | LDIAM | — | NOT DONE | |
| YAMAA-01 | BASELINE | 1 | L1 | TARGET | LDIAM | 22 | — | |
| YAMAA-01 | BASELINE | 2 | L2 | TARGET | LDIAM | 18 | — | |
| YAMAA-01 | WEEK 8 | 3 | L1 | TARGET | LDIAM | 12 | — | |
| YAMAA-01 | WEEK 8 | 4 | L2 | TARGET | LDIAM | 10 | — | |
| YAMAA-01 | BASELINE | 1 | L1 | TARGET | LDIAM | 50 | — | |
| YAMAA-01 | BASELINE | 2 | L2 | NON-TARGET | LDIAM | 14 | — | |
| YAMAA-01 | WEEK 8 | 3 | L1 | TARGET | LDIAM | 45 | — | |
| YAMAA-01 | BASELINE | 1 | L1 | TARGET | LDIAM | — | NOT DONE | |
| YAMAA-01 | BASELINE | 2 | L2 | TARGET | LDIAM | — | NOT DONE | |
| YAMAA-01 | WEEK 8 | 3 | L1 | TARGET | LDIAM | 0 | — | |
| YAMAA-01 | WEEK 8 | 4 | L2 | TARGET | LDIAM | 30 | — |
input/trvisit.csv
Edit9 rows| STUDYID | USUBJID | AVISIT | AVISITN | ADT |
|---|---|---|---|---|
| YAMAA-01 | BASELINE | 0 | 2025-01-05 | |
| YAMAA-01 | WEEK 8 | 8 | 2025-03-02 | |
| YAMAA-01 | WEEK 16 | 16 | 2025-04-27 | |
| YAMAA-01 | BASELINE | 0 | 2025-01-12 | |
| YAMAA-01 | WEEK 8 | 8 | 2025-03-09 | |
| YAMAA-01 | BASELINE | 0 | 2025-01-19 | |
| YAMAA-01 | WEEK 8 | 8 | — | |
| YAMAA-01 | BASELINE | 0 | 2025-02-03 | |
| YAMAA-01 | WEEK 8 | 8 | 2025-03-30 |
input/tu.csv
Edit9 rows| STUDYID | USUBJID | TULNKID | TUGRPID |
|---|---|---|---|
| YAMAA-01 | L1 | TARGET | |
| YAMAA-01 | L2 | TARGET | |
| YAMAA-01 | L3 | TARGET | |
| YAMAA-01 | L1 | TARGET | |
| YAMAA-01 | L2 | TARGET | |
| YAMAA-01 | L1 | TARGET | |
| YAMAA-01 | L2 | NON-TARGET | |
| YAMAA-01 | L1 | TARGET | |
| YAMAA-01 | L2 | TARGET |
Expected output
Under review9 expected rowsexpected/adtr.csv
Edit9 rows| STUDYID | USUBJID | AVISIT | AVISITN | ADT | PARAMCD | PARAM | AVAL | NMEAS | NTARGET | ANL01FL |
|---|---|---|---|---|---|---|---|---|---|---|
| YAMAA-01 | BASELINE | 0 | 2025-01-05 | SDIAM | Sum of Target Lesion Diameters (mm) | 80 | 3 | 3 | Y | |
| YAMAA-01 | WEEK 8 | 8 | 2025-03-02 | SDIAM | Sum of Target Lesion Diameters (mm) | 50 | 2 | 3 | — | |
| YAMAA-01 | WEEK 16 | 16 | 2025-04-27 | SDIAM | Sum of Target Lesion Diameters (mm) | — | — | 3 | — | |
| YAMAA-01 | BASELINE | 0 | 2025-01-12 | SDIAM | Sum of Target Lesion Diameters (mm) | 40 | 2 | 2 | Y | |
| YAMAA-01 | WEEK 8 | 8 | 2025-03-09 | SDIAM | Sum of Target Lesion Diameters (mm) | 22 | 2 | 2 | Y | |
| YAMAA-01 | BASELINE | 0 | 2025-01-19 | SDIAM | Sum of Target Lesion Diameters (mm) | 50 | 1 | 1 | Y | |
| YAMAA-01 | WEEK 8 | 8 | — | SDIAM | Sum of Target Lesion Diameters (mm) | 45 | 1 | 1 | Y | |
| YAMAA-01 | BASELINE | 0 | 2025-02-03 | SDIAM | Sum of Target Lesion Diameters (mm) | — | 0 | 2 | — | |
| YAMAA-01 | WEEK 8 | 8 | 2025-03-30 | SDIAM | Sum of Target Lesion Diameters (mm) | 30 | 2 | 2 | Y |
Human review and assessment
| Dataset Name | Variable Name | Variable Label | Type | Codelist/Controlled Terms | Core | Computational Method | Origin |
|---|---|---|---|---|---|---|---|
| ADTR | STUDYID | Study Identifier | character | Copy value from TRVISIT.STUDYID. | Predecessor | ||
| ADTR | USUBJID | Unique Subject Identifier | character | Copy value from TRVISIT.USUBJID. | Predecessor | ||
| ADTR | AVISIT | Analysis Visit | character | Copy value from TRVISIT.AVISIT. | Predecessor | ||
| ADTR | AVISITN | Analysis Visit (N) | numeric | Copy value from TRVISIT.AVISITN. | Predecessor | ||
| ADTR | ADT | Analysis Date | numeric | ISO 8601 | Copy value from TRVISIT.ADT. | Predecessor | |
| ADTR | PARAMCD | Parameter Code | character | Set constant value "SDIAM". | Assigned | ||
| ADTR | PARAM | Parameter | character | Set constant value "Sum of Target Lesion Diameters (mm)". | Assigned | ||
| ADTR | AVAL | Analysis Value | numeric | Aggregate SUM(TR.TRSTRESN) over records matching on the shared output keys, where TR.TRGRPID = 'TARGET' AND TR.TRTESTCD = 'LDIAM'. | Derived | ||
| ADTR | NMEAS | Number of Measured Target Lesions | numeric | Aggregate COUNT(TR.TRSTRESN) over records matching on the shared output keys, where TR.TRGRPID = 'TARGET' AND TR.TRTESTCD = 'LDIAM'. | Derived | ||
| ADTR | NTARGET | Number of Target Lesions | numeric | Aggregate COUNT(TU.TULNKID) over records matching on the shared output keys, where TU.TUGRPID = 'TARGET'. | Derived | ||
| ADTR | ANL01FL | Analysis Record Flag 01 | character | Y | "Y" when NMEAS = NTARGET; blank otherwise. | Derived |
| Variable | Permitted values |
|---|---|
| ANL01FL | Y |
| Version | Date | Author | Description | Reviewer | Sign-off |
|---|---|---|---|---|---|
| 1.7 | 2026-10-20 | yamaa docs build | Read 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.6 | 2026-10-17 | yamaa docs build | Describe collected date parts written as ISO 8601 date text and times of day counted in seconds since midnight | ||
| 1.5 | 2026-10-17 | yamaa docs build | Name 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.4 | 2026-10-15 | yamaa docs build | State datetime precision codes through the hour and minute, and complete only the time parts a collected datetime lacks | ||
| 1.3 | 2026-09-29 | yamaa docs build | Show study codelist names, external dictionaries, and ISO 8601 formats in variable rows; list the document's codelist values and metadata | ||
| 1.2 | 2026-09-29 | yamaa docs build | Classify ADaM copies from a declared input as Predecessor and recodes as Derived, and SDTM recodes of locally derived columns as Derived | ||
| 1.1 | 2026-09-29 | yamaa docs build | Resolve lookups into the donor record they select, and give every derivation shape a plain-language rule instead of its raw YAML | ||
| 1.0 | yamaa docs build | Initial generation from spec.yaml |
prompts/adam-adtr-sum/full.md
Edit24 linesFollowing CDISC ADaM standards, use the provided TR, TRVISIT, and TU datasets to create an ADTR dataset with one record per subject and scheduled tumor assessment.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, AVISIT, AVISITN, ADT, PARAMCD, PARAM, AVAL, NMEAS, NTARGET, ANL01FL
PARAMCD is "SDIAM" and PARAM is "Sum of Target Lesion Diameters (mm)" on every record. AVAL is the sum of TRSTRESN over the target longest-diameter records at the assessment, those with TRGRPID of "TARGET" and TRTESTCD of "LDIAM". A record with a missing result contributes nothing to the sum, while a zero result counts as measured; AVAL has no value when the assessment measured no target lesion. NMEAS is the count of non-missing TRSTRESN values among those records. NMEAS has no value when the assessment has no target longest-diameter records, and is 0 when it has such records but none of them carries a result. NTARGET is the count of the subject's lesion inventory records with TUGRPID of "TARGET", the lesions selected as target lesions at study entry, and is the same at every assessment of the subject. ANL01FL is "Y" when NMEAS equals NTARGET, and has no value otherwise. A sum over an incomplete set of target lesions is still reported.
Read the source datasets from /app/input and save the completed dataset as /app/output/adtr.csv.
prompts/adam-adtr-sum/conventions.md
Edit13 linesFollowing CDISC ADaM standards, use the provided TR, TRVISIT, and TU datasets to create an ADTR dataset with one record per subject and scheduled tumor assessment.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, AVISIT, AVISITN, ADT, PARAMCD, PARAM, AVAL, NMEAS, NTARGET, ANL01FL
PARAMCD is "SDIAM" and PARAM is "Sum of Target Lesion Diameters (mm)" on every record. ANL01FL is "Y" or has no value.
Read the source datasets from /app/input and save the completed dataset as /app/output/adtr.csv.
prompts/adam-adtr-sum/brief.md
Edit10 linesFollowing CDISC ADaM standards, use the provided TR, TRVISIT, and TU datasets to create an ADTR dataset with one record per subject and scheduled tumor assessment.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, AVISIT, AVISITN, ADT, PARAMCD, PARAM, AVAL, NMEAS, NTARGET, ANL01FL
Read the source datasets from /app/input and save the completed dataset as /app/output/adtr.csv.
R
Edit3 lineslibrary(yamaa)yamaa_spec("spec.yaml")$run()$outputPython
Edit3 linesimport yamaayamaa.spec("spec.yaml").run().outputsolutions/adam-adtr-sum/result.R
Edit57 lines# Reference solution for the yamaa benchmark adam-adtr-sum (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)trvisit <- read_csv( "/app/input/trvisit.csv", col_types = cols(AVISITN = col_integer(), ADT = col_date(), .default = col_character()))tr <- read_csv( "/app/input/tr.csv", col_types = cols(TRSTRESN = col_double(), .default = col_character()))tu <- read_csv( "/app/input/tu.csv", col_types = cols(.default = col_character()))# Lesions selected as target at study entry: the same count at every# assessment of the subject.ntarget <- tu |> filter(TUGRPID == "TARGET") |> count(STUDYID, USUBJID, name = "NTARGET")# Target longest diameters at each assessment. A record with no result# contributes nothing, while a zero counts as measured.agg <- tr |> filter(TRGRPID == "TARGET", TRTESTCD == "LDIAM") |> group_by(STUDYID, USUBJID, AVISIT) |> summarise( AVAL_sum = sum(TRSTRESN, na.rm = TRUE), NMEAS = sum(!is.na(TRSTRESN)), .groups = "drop" ) |> mutate(AVAL_sum = if_else(NMEAS == 0L, NA_real_, AVAL_sum))adtr <- trvisit |> left_join(agg, by = c("STUDYID", "USUBJID", "AVISIT")) |> left_join(ntarget, by = c("STUDYID", "USUBJID")) |> mutate( AVAL = AVAL_sum, PARAMCD = "SDIAM", PARAM = "Sum of Target Lesion Diameters (mm)", ANL01FL = if_else(!is.na(NMEAS) & !is.na(NTARGET) & NMEAS == NTARGET, "Y", NA_character_) ) |> select( STUDYID, USUBJID, AVISIT, AVISITN, ADT, PARAMCD, PARAM, AVAL, NMEAS, NTARGET, ANL01FL ) |> arrange(USUBJID, AVISITN)dir.create("/app/output", showWarnings = FALSE)write_csv(adtr, "/app/output/adtr.csv", na = "")solutions/adam-adtr-sum/result.py
Edit118 lines# Reference solution for the yamaa benchmark adam-adtr-sum (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."""Build ADTR: one record per subject and scheduled tumor assessment.Reads TR, TRVISIT and TU from /app/input and writes the ADaM ADTRdataset (sum of target lesion diameters) to /app/output/adtr.csv."""import polars as plINPUT_DIR = "/app/input"OUTPUT_PATH = "/app/output/adtr.csv"PARAMCD = "SDIAM"PARAM = "Sum of Target Lesion Diameters (mm)"def main() -> None: tr = pl.read_csv(f"{INPUT_DIR}/tr.csv", infer_schema=False) trvisit = pl.read_csv(f"{INPUT_DIR}/trvisit.csv", infer_schema=False) tu = pl.read_csv(f"{INPUT_DIR}/tu.csv", infer_schema=False) # Target longest-diameter records only. target = tr.filter( (pl.col("TRGRPID") == "TARGET") & (pl.col("TRTESTCD") == "LDIAM") ).with_columns(pl.col("TRSTRESN").cast(pl.Float64, strict=False)) # Per subject and assessment: how many such records exist, how many # carry a result, and the sum of the measured diameters. AVAL stays # missing when nothing was measured; NMEAS stays missing when the # assessment has no target longest-diameter records at all. if target.height: measured = target.group_by(["STUDYID", "USUBJID", "AVISIT"]).agg( pl.len().alias("_NREC"), pl.col("TRSTRESN").count().alias("NMEAS"), pl.col("TRSTRESN").sum().alias("_SUM"), ) else: measured = pl.DataFrame( schema={ "STUDYID": pl.String, "USUBJID": pl.String, "AVISIT": pl.String, "_NREC": pl.UInt32, "NMEAS": pl.UInt32, "_SUM": pl.Float64, } ) measured = measured.with_columns( pl.when(pl.col("NMEAS") > 0) .then(pl.col("_SUM")) .otherwise(None) .alias("AVAL"), pl.when(pl.col("_NREC") > 0) .then(pl.col("NMEAS")) .otherwise(None) .cast(pl.Int64) .alias("NMEAS"), ).drop(["_NREC", "_SUM"]) # Number of target lesions in the subject's lesion inventory; the # same at every assessment of the subject. ntarget = ( tu.filter(pl.col("TUGRPID") == "TARGET") .group_by(["STUDYID", "USUBJID"]) .agg(pl.len().cast(pl.Int64).alias("NTARGET")) ) adtr = ( trvisit.join( measured, on=["STUDYID", "USUBJID", "AVISIT"], how="left" ) .join(ntarget, on=["STUDYID", "USUBJID"], how="left") .with_columns( pl.col("NTARGET").fill_null(0), pl.col("AVISITN").cast(pl.Int64, strict=False), pl.lit(PARAMCD).alias("PARAMCD"), pl.lit(PARAM).alias("PARAM"), pl.when( pl.col("NMEAS").is_not_null() & (pl.col("NMEAS") == pl.col("NTARGET")) ) .then(pl.lit("Y")) .otherwise(None) .alias("ANL01FL"), ) .sort(["USUBJID", "AVISITN"]) .select( [ "STUDYID", "USUBJID", "AVISIT", "AVISITN", "ADT", "PARAMCD", "PARAM", "AVAL", "NMEAS", "NTARGET", "ANL01FL", ] ) ) # Write whole-number sums without a decimal part. aval = adtr["AVAL"].drop_nulls() if aval.len() and (aval == aval.cast(pl.Int64)).all(): adtr = adtr.with_columns(pl.col("AVAL").cast(pl.Int64)) adtr.write_csv(OUTPUT_PATH)if __name__ == "__main__": main()solutions/adam-adtr-sum/result.sas
Edit38 lines/* opensas reference solution for the yamaa benchmark adam-adtr-sum. Reads the benchmark inputs and derives the requested output. Execute with the existing opensas runtime: opensas /app/output/result.sas. */data tr; length STUDYID USUBJID AVISIT TRLNKID TRGRPID TRTESTCD TRSTAT $1024; infile "/app/input/tr.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. AVISIT : $char1024. TRSEQ TRLNKID : $char1024. TRGRPID : $char1024. TRTESTCD : $char1024. TRSTRESN TRSTAT : $char1024.;run;data trvisit; length STUDYID USUBJID AVISIT ADT $1024; infile "/app/input/trvisit.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. AVISIT : $char1024. AVISITN ADT : $char1024.;run;data tu; length STUDYID USUBJID TULNKID TUGRPID $1024; infile "/app/input/tu.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. TULNKID : $char1024. TUGRPID : $char1024.;run;proc sql; create table inventory as select STUDYID,USUBJID,count(*) as NTARGET from tu where TUGRPID='TARGET' group by STUDYID,USUBJID; create table measures as select a.* from tr as a inner join tu as b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID and a.TRLNKID=b.TULNKID where a.TRGRPID='TARGET' and a.TRTESTCD='LDIAM' and b.TUGRPID='TARGET'; create table totals as select STUDYID,USUBJID,AVISIT,sum(TRSTRESN) as AVAL,count(TRSTRESN) as NMEAS from measures group by STUDYID,USUBJID,AVISIT; create table combined as select a.*,b.AVAL,b.NMEAS,c.NTARGET from trvisit as a left join totals as b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID and a.AVISIT=b.AVISIT left join inventory as c on a.STUDYID=c.STUDYID and a.USUBJID=c.USUBJID;quit;data result; length PARAMCD $8 PARAM $40 ANL01FL $1; set combined; PARAMCD='SDIAM'; PARAM='Sum of Target Lesion Diameters (mm)'; if not missing(NMEAS) and not missing(NTARGET) and NMEAS=NTARGET then ANL01FL='Y';run;proc sql; create table final as select STUDYID, USUBJID, AVISIT, AVISITN, ADT, PARAMCD, PARAM, AVAL, NMEAS, NTARGET, ANL01FL from result;quit;proc export data=final outfile="/app/output/adtr.csv" dbms=csv replace; run;
yamaa