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 ADaM: 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: carry each investigator-scored overall response assessment into the analysis dataset as one record under the OVR (Overall Response by Investigator) parameter, adding the completed date (ADT), the study day (ADY), the response rank (AVAL), and the per-date flag (ANL01FL).

Input: one record per collected response assessment carrying the test code RSTESTCD, the evaluator RSEVAL, the assessment date RSDTC, and the result RSSTRESC, plus the treatment start TRTSDT from the subject-level dataset. Only assessments the investigator (INVESTIGATOR) scored as overall response (OVRLRESP) leave a record; a target-lesion assessment (TRGRESP) and an independent assessor (INDEPENDENT ASSESSOR) assessment leave none.

Variables:

  • RSSEQ numbers the assessment within the subject; PARAMCD and PARAM carry the fixed parameter code and description.
  • RSDTC carries the collected assessment date as it was recorded.
  • ADT is the completed analysis date. A fully collected date is used as it stands; a year and month without a day complete to the first of the month, and a year alone to 1 January. An assessment with no readable date stops the run.
  • ADY is the study day of the assessment, counting the treatment start as day one.
  • AVALC is the collected response: complete response (CR), partial response (PR), stable disease (SD), neither complete response nor progressive disease (NON-CR/NON-PD), progressive disease (PD), or not evaluable (NE).
  • AVAL ranks the response from best to worst as 1 (CR), 2 (PR), 3 (SD), 4 (NON-CR/NON-PD), 5 (PD), or 6 (NE).
  • ANL01FL is Y for one record at each assessment date: the worst (largest AVAL) response that day, with the lowest RSSEQ breaking ties when a day carries the same worst response twice. It is empty otherwise.

Note: a completed date counts exactly as a collected one in every comparison that follows, so grouping by date and measuring from the treatment start never depend on how much of the date was collected. An assessment dated exactly on the treatment start lands on study day one.

Inputs

Under review
2 source files

input/adsl.csv

Edit
8 rows
input/adsl.csv
STUDYIDUSUBJIDTRTSDT
YAMAA-012025-01-06
YAMAA-012025-01-13
YAMAA-012025-01-20
YAMAA-012025-01-27
YAMAA-012025-02-03
YAMAA-012025-01-01
YAMAA-012025-01-06
YAMAA-012025-01-13

input/rs.csv

Edit
18 rows
input/rs.csv
STUDYIDUSUBJIDRSSEQRSTESTCDRSEVALRSDTCRSSTRESC
YAMAA-011OVRLRESPINVESTIGATOR2025-02-03PR
YAMAA-012OVRLRESPINVESTIGATOR2025-03-17CR
YAMAA-013OVRLRESPINVESTIGATOR2025-04-28PD
YAMAA-011OVRLRESPINVESTIGATOR2025-02-10SD
YAMAA-012OVRLRESPINVESTIGATOR2025-02-10PD
YAMAA-013OVRLRESPINVESTIGATOR2025-03-24NE
YAMAA-011OVRLRESPINVESTIGATOR2025-03NON-CR/NON-PD
YAMAA-011OVRLRESPINVESTIGATOR2025-02-17SD
YAMAA-012OVRLRESPINVESTIGATOR2025-02-17SD
YAMAA-011TRGRESPINVESTIGATOR2025-05-05PR
YAMAA-012OVRLRESPINDEPENDENT ASSESSOR2025-05-05PR
YAMAA-013OVRLRESPINVESTIGATOR2025-05-05CR
YAMAA-011OVRLRESPINVESTIGATOR2025PR
YAMAA-011OVRLRESPINVESTIGATOR2025-01-06CR
YAMAA-011OVRLRESPINVESTIGATOR2025-02-10SD
YAMAA-012OVRLRESPINVESTIGATOR2025-02-10PD
YAMAA-013OVRLRESPINVESTIGATOR2025-02-10NE
YAMAA-014OVRLRESPINVESTIGATOR2025-02-10NE

Expected output

Under review
16 expected rows

expected/adrs.csv

Edit
16 rows
expected/adrs.csv
STUDYIDUSUBJIDRSSEQPARAMCDPARAMRSDTCADTADYAVALCAVALANL01FL
YAMAA-011OVROverall Response by Investigator2025-02-032025-02-0329PR2Y
YAMAA-012OVROverall Response by Investigator2025-03-172025-03-1771CR1Y
YAMAA-013OVROverall Response by Investigator2025-04-282025-04-28113PD5Y
YAMAA-011OVROverall Response by Investigator2025-02-102025-02-1029SD3—
YAMAA-012OVROverall Response by Investigator2025-02-102025-02-1029PD5Y
YAMAA-013OVROverall Response by Investigator2025-03-242025-03-2471NE6Y
YAMAA-011OVROverall Response by Investigator2025-032025-03-0141NON-CR/NON-PD4Y
YAMAA-011OVROverall Response by Investigator2025-02-172025-02-1722SD3Y
YAMAA-012OVROverall Response by Investigator2025-02-172025-02-1722SD3—
YAMAA-013OVROverall Response by Investigator2025-05-052025-05-0592CR1Y
YAMAA-011OVROverall Response by Investigator20252025-01-011PR2Y
YAMAA-011OVROverall Response by Investigator2025-01-062025-01-061CR1Y
YAMAA-011OVROverall Response by Investigator2025-02-102025-02-1029SD3—
YAMAA-012OVROverall Response by Investigator2025-02-102025-02-1029PD5—
YAMAA-013OVROverall Response by Investigator2025-02-102025-02-1029NE6Y
YAMAA-014OVROverall Response by Investigator2025-02-102025-02-1029NE6—
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

Dataset NameVariable NameVariable LabelTypeCodelist/Controlled TermsCoreComputational MethodOrigin
ADRSSTUDYIDStudy IdentifiercharacterCopy value from RS.STUDYID.Predecessor
ADRSUSUBJIDUnique Subject IdentifiercharacterCopy value from RS.USUBJID.Predecessor
ADRSRSSEQSequence NumbernumericCopy value from RS.RSSEQ.Predecessor
ADRSPARAMCDParameter CodecharacterSet constant value "OVR".Assigned
ADRSPARAMParametercharacterSet constant value "Overall Response by Investigator".Assigned
ADRSRSDTCDate/Time of AssessmentcharacterCopy value from RS.RSDTC.Predecessor
ADRSADTAnalysis DatenumericISO 8601Impute incomplete date from RSDTC, defaulting month=1, day=1; missing or invalid input yields null.Derived
ADRSAVALCAnalysis Value (C)characterCR, PR, SD, NON-CR/NON-PD, PD, NECopy value from RS.RSSTRESC.Predecessor
ADRSAVALAnalysis ValuenumericRecode AVALC: "CR" → "1", "PR" → "2", "SD" → "3", "NON-CR/NON-PD" → "4", "PD" → "5", "NE" → "6"; missing or unlisted values are errors.Derived
ADRSADYAnalysis Relative DaynumericCDISC study day of ADT against TRTSDT as day 1; there is no day zero.Derived
ADRSANL01FLAnalysis Record Flag 01characterY"Y" when WORSTORD = 1; blank otherwise.Derived
VariablePermitted values
AVALCCR, PR, SD, NON-CR/NON-PD, PD, NE
ANL01FLY
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/adam-adrs-response-records/full.md

Edit
34 lines

Following CDISC ADaM standards, use the provided RS and ADSL datasets to create an ADRS dataset with one record per investigator overall response assessment.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, RSSEQ, PARAMCD, PARAM, RSDTC, ADT, ADY, AVALC, AVAL, ANL01FL

Only assessments the investigator scored as overall response leave a record; a target-lesion assessment and an independent assessor assessment leave none. Use PARAMCD "OVR" and PARAM "Overall Response by Investigator".

RSDTC is the collected assessment date as recorded. ADT is the completed analysis date: a fully collected date is used as it stands, a year and month without a day complete to the first of the month, and a year alone to 1 January. A completed date counts exactly as a collected one in every comparison that follows. ADY is the study day of the assessment, counting the treatment start as day one, so an assessment dated exactly on the treatment start lands on day one.

AVALC is the collected response: complete response (CR), partial response (PR), stable disease (SD), neither complete response nor progressive disease (NON-CR/NON-PD), progressive disease (PD), or not evaluable (NE). AVAL ranks the response from best to worst as 1 (CR), 2 (PR), 3 (SD), 4 (NON-CR/NON-PD), 5 (PD), or 6 (NE).

ANL01FL is Y for one record at each assessment date: the worst (largest AVAL) response that day, with the lowest RSSEQ breaking ties when a day carries the same worst response twice. It has no value otherwise.

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

prompts/adam-adrs-response-records/conventions.md

Edit
19 lines

Following CDISC ADaM standards, use the provided RS and ADSL datasets to create an ADRS dataset with one record per investigator overall response assessment.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, RSSEQ, PARAMCD, PARAM, RSDTC, ADT, ADY, AVALC, AVAL, ANL01FL

Use PARAMCD "OVR" and PARAM "Overall Response by Investigator".

AVALC is complete response (CR), partial response (PR), stable disease (SD), neither complete response nor progressive disease (NON-CR/NON-PD), progressive disease (PD), or not evaluable (NE). AVAL ranks the response from best to worst as 1 (CR), 2 (PR), 3 (SD), 4 (NON-CR/NON-PD), 5 (PD), or 6 (NE).

ANL01FL is Y or has no value.

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

prompts/adam-adrs-response-records/brief.md

Edit
10 lines

Following CDISC ADaM standards, use the provided RS and ADSL datasets to create an ADRS dataset with one record per investigator overall response assessment.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, RSSEQ, PARAMCD, PARAM, RSDTC, ADT, ADY, AVALC, AVAL, ANL01FL

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

yamaa code

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

run.R

Edit
4 lines
library(yamaa)adrs <- yamaa_domain("spec.yaml")$outputadrs

run.py

Edit
4 lines
import yamaaadrs = yamaa.yamaa_domain("spec.yaml").outputadrs

Solution without yamaa

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

solutions/adam-adrs-response-records/result.R

Edit
71 lines
# Reference solution for the yamaa benchmark adam-adrs-response-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.library(dplyr, warn.conflicts = FALSE)library(lubridate)library(readr)library(stringr)adsl <- read_csv(  "/app/input/adsl.csv",  col_types = cols(TRTSDT = col_date(), .default = col_character()))rs <- read_csv(  "/app/input/rs.csv",  col_types = cols(RSSEQ = col_integer(), .default = col_character()))# Only investigator overall response assessments leave a record.base <- rs |>  filter(RSTESTCD %in% "OVRLRESP", RSEVAL %in% "INVESTIGATOR") |>  left_join(select(adsl, USUBJID, TRTSDT), by = "USUBJID") |>  mutate(    PARAMCD = "OVR",    PARAM = "Overall Response by Investigator",    RSDTC = RSDTC,    ADT = case_when(      str_detect(RSDTC, "^[0-9]{4}-[0-9]{2}-[0-9]{2}$") ~ suppressWarnings(ymd(RSDTC, quiet = TRUE)),      str_detect(RSDTC, "^[0-9]{4}-[0-9]{2}$") ~ suppressWarnings(ymd(paste0(RSDTC, "-01"), quiet = TRUE)),      str_detect(RSDTC, "^[0-9]{4}$") ~ suppressWarnings(ymd(paste0(RSDTC, "-01-01"), quiet = TRUE)),      .default = as.Date(NA)    ),    ADY = case_when(      is.na(ADT) | is.na(TRTSDT) ~ NA_integer_,      ADT >= TRTSDT ~ as.integer(ADT - TRTSDT) + 1L,      .default = as.integer(ADT - TRTSDT)    ),    AVALC = RSSTRESC,    AVAL = case_when(      AVALC == "CR" ~ 1L,      AVALC == "PR" ~ 2L,      AVALC == "SD" ~ 3L,      AVALC == "NON-CR/NON-PD" ~ 4L,      AVALC == "PD" ~ 5L,      AVALC == "NE" ~ 6L    )  )# One flagged record at each assessment date: the worst response that day,# with the lowest sequence number breaking ties.flagged <- base |>  group_by(STUDYID, USUBJID, ADT) |>  arrange(desc(AVAL), RSSEQ, .by_group = TRUE) |>  mutate(    rank = row_number(),    ANL01FL = if_else(rank == 1L, "Y", NA_character_)  ) |>  ungroup() |>  select(-rank)adrs <- flagged |>  select(    STUDYID, USUBJID, RSSEQ, PARAMCD, PARAM, RSDTC, ADT, ADY,    AVALC, AVAL, ANL01FL  ) |>  arrange(USUBJID, ADT, RSSEQ)dir.create("/app/output", showWarnings = FALSE)write_csv(adrs, "/app/output/adrs.csv", na = "")

solutions/adam-adrs-response-records/result.py

Edit
83 lines
# Reference solution for the yamaa benchmark adam-adrs-response-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.from pathlib import Pathimport polars as pladsl = pl.read_csv("/app/input/adsl.csv", infer_schema=False).with_columns(    pl.col("TRTSDT").str.to_date())rs = pl.read_csv("/app/input/rs.csv", infer_schema=False).with_columns(    pl.col("RSSEQ").cast(pl.Int64))# Only investigator overall response assessments leave a record.base = rs.filter(    (pl.col("RSTESTCD") == "OVRLRESP") & (pl.col("RSEVAL") == "INVESTIGATOR")).join(adsl.select("USUBJID", "TRTSDT"), on="USUBJID", how="left")full = pl.col("RSDTC").str.contains(r"^\d{4}-\d{2}-\d{2}$")year_month = pl.col("RSDTC").str.contains(r"^\d{4}-\d{2}$")year_only = pl.col("RSDTC").str.contains(r"^\d{4}$")# A completed date counts exactly as a collected one in every comparison.adt = (    pl.when(full)    .then(pl.col("RSDTC").str.to_date(strict=False))    .when(year_month)    .then((pl.col("RSDTC") + "-01").str.to_date(strict=False))    .when(year_only)    .then((pl.col("RSDTC") + "-01-01").str.to_date(strict=False)))ady = (    pl.when(pl.col("ADT").is_null() | pl.col("TRTSDT").is_null())    .then(None)    .when(pl.col("ADT") >= pl.col("TRTSDT"))    .then((pl.col("ADT") - pl.col("TRTSDT")).dt.total_days() + 1)    .otherwise((pl.col("ADT") - pl.col("TRTSDT")).dt.total_days()))derived = (    base.with_columns(        PARAMCD=pl.lit("OVR"),        PARAM=pl.lit("Overall Response by Investigator"),        ADT=adt,    )    .with_columns(        ADY=ady.cast(pl.Int64),        AVALC=pl.col("RSSTRESC"),        AVAL=pl.col("RSSTRESC").replace_strict(            {"CR": 1, "PR": 2, "SD": 3, "NON-CR/NON-PD": 4, "PD": 5, "NE": 6},            default=None,            return_dtype=pl.Int64,        ),    ))# One flagged record at each assessment date: the worst response that day,# with the lowest sequence number breaking ties.ranked = derived.sort(    ["STUDYID", "USUBJID", "ADT", "AVAL", "RSSEQ"],    descending=[False, False, False, True, False],).with_columns(    rank=pl.col("RSSEQ").cum_count().over(["STUDYID", "USUBJID", "ADT"]))adrs = (    ranked.with_columns(        ANL01FL=pl.when(pl.col("rank") == 1).then(pl.lit("Y")).otherwise(None)    )    .select(        "STUDYID", "USUBJID", "RSSEQ", "PARAMCD", "PARAM", "RSDTC",        "ADT", "ADY", "AVALC", "AVAL", "ANL01FL",    )    .sort(["USUBJID", "ADT", "RSSEQ"]))Path("/app/output").mkdir(exist_ok=True)adrs.write_csv("/app/output/adrs.csv")

solutions/adam-adrs-response-records/result.sas

Edit
35 lines
/* opensas reference solution for the yamaa benchmark adam-adrs-response-records.   Reads the benchmark inputs and derives the requested output.   Execute with the existing opensas runtime: opensas /app/output/result.sas. */data adsl;  length STUDYID USUBJID TRTSDT $1024;  infile "/app/input/adsl.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. TRTSDT : $char1024.;run;data rs;  length STUDYID USUBJID RSTESTCD RSEVAL RSDTC RSSTRESC $1024;  infile "/app/input/rs.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. RSSEQ RSTESTCD : $char1024. RSEVAL : $char1024. RSDTC : $char1024. RSSTRESC : $char1024.;run;proc sql; create table joined as select a.*,b.TRTSDT from rs as a left join adsl as b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID where a.RSTESTCD='OVRLRESP' and a.RSEVAL='INVESTIGATOR'; quit;data assessments;  length PARAMCD $8 PARAM $40 ADT $10 AVALC $16;  set joined; PARAMCD='OVR'; PARAM='Overall Response by Investigator';  ADT=RSDTC;  if lengthn(RSDTC)=7 then ADT=cats(RSDTC,'-01');  if lengthn(RSDTC)=4 then ADT=cats(RSDTC,'-01-01');  if not missing(ADT) and not missing(TRTSDT) then do;    ADY=input(ADT,yymmdd10.)-input(TRTSDT,yymmdd10.); if ADY>=0 then ADY=ADY+1;  end;  AVALC=RSSTRESC; select(AVALC); when('CR') AVAL=1; when('PR') AVAL=2; when('SD') AVAL=3; when('NON-CR/NON-PD') AVAL=4; when('PD') AVAL=5; when('NE') AVAL=6; otherwise AVAL=.; end;run;proc sort data=assessments; by STUDYID USUBJID ADT descending AVAL RSSEQ; run;data result; length ANL01FL $1; set assessments; by STUDYID USUBJID ADT; if first.ADT then ANL01FL='Y'; run;proc sql;  create table final as select STUDYID, USUBJID, RSSEQ, PARAMCD, PARAM, RSDTC, ADT, ADY, AVALC, AVAL, ANL01FL from result;quit;proc export data=final outfile="/app/output/adrs.csv" dbms=csv replace; run;