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.
- 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.
- Inputs: Do they look like data collected in a real trial, and do they include the situations you would expect to meet in one?
- 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
README.mdGoal: 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:
RSSEQnumbers the assessment within the subject;PARAMCDandPARAMcarry the fixed parameter code and description.RSDTCcarries the collected assessment date as it was recorded.ADTis 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.ADYis the study day of the assessment, counting the treatment start as day one.AVALCis 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).AVALranks the response from best to worst as1(CR),2(PR),3(SD),4(NON-CR/NON-PD),5(PD), or6(NE).ANL01FLisYfor one record at each assessment date: the worst (largestAVAL) response that day, with the lowestRSSEQbreaking 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 review2 source filesinput/adsl.csv
Edit8 rows| STUDYID | USUBJID | TRTSDT |
|---|---|---|
| YAMAA-01 | 2025-01-06 | |
| YAMAA-01 | 2025-01-13 | |
| YAMAA-01 | 2025-01-20 | |
| YAMAA-01 | 2025-01-27 | |
| YAMAA-01 | 2025-02-03 | |
| YAMAA-01 | 2025-01-01 | |
| YAMAA-01 | 2025-01-06 | |
| YAMAA-01 | 2025-01-13 |
input/rs.csv
Edit18 rows| STUDYID | USUBJID | RSSEQ | RSTESTCD | RSEVAL | RSDTC | RSSTRESC |
|---|---|---|---|---|---|---|
| YAMAA-01 | 1 | OVRLRESP | INVESTIGATOR | 2025-02-03 | PR | |
| YAMAA-01 | 2 | OVRLRESP | INVESTIGATOR | 2025-03-17 | CR | |
| YAMAA-01 | 3 | OVRLRESP | INVESTIGATOR | 2025-04-28 | PD | |
| YAMAA-01 | 1 | OVRLRESP | INVESTIGATOR | 2025-02-10 | SD | |
| YAMAA-01 | 2 | OVRLRESP | INVESTIGATOR | 2025-02-10 | PD | |
| YAMAA-01 | 3 | OVRLRESP | INVESTIGATOR | 2025-03-24 | NE | |
| YAMAA-01 | 1 | OVRLRESP | INVESTIGATOR | 2025-03 | NON-CR/NON-PD | |
| YAMAA-01 | 1 | OVRLRESP | INVESTIGATOR | 2025-02-17 | SD | |
| YAMAA-01 | 2 | OVRLRESP | INVESTIGATOR | 2025-02-17 | SD | |
| YAMAA-01 | 1 | TRGRESP | INVESTIGATOR | 2025-05-05 | PR | |
| YAMAA-01 | 2 | OVRLRESP | INDEPENDENT ASSESSOR | 2025-05-05 | PR | |
| YAMAA-01 | 3 | OVRLRESP | INVESTIGATOR | 2025-05-05 | CR | |
| YAMAA-01 | 1 | OVRLRESP | INVESTIGATOR | 2025 | PR | |
| YAMAA-01 | 1 | OVRLRESP | INVESTIGATOR | 2025-01-06 | CR | |
| YAMAA-01 | 1 | OVRLRESP | INVESTIGATOR | 2025-02-10 | SD | |
| YAMAA-01 | 2 | OVRLRESP | INVESTIGATOR | 2025-02-10 | PD | |
| YAMAA-01 | 3 | OVRLRESP | INVESTIGATOR | 2025-02-10 | NE | |
| YAMAA-01 | 4 | OVRLRESP | INVESTIGATOR | 2025-02-10 | NE |
Expected output
Under review16 expected rowsexpected/adrs.csv
Edit16 rows| STUDYID | USUBJID | RSSEQ | PARAMCD | PARAM | RSDTC | ADT | ADY | AVALC | AVAL | ANL01FL |
|---|---|---|---|---|---|---|---|---|---|---|
| YAMAA-01 | 1 | OVR | Overall Response by Investigator | 2025-02-03 | 2025-02-03 | 29 | PR | 2 | Y | |
| YAMAA-01 | 2 | OVR | Overall Response by Investigator | 2025-03-17 | 2025-03-17 | 71 | CR | 1 | Y | |
| YAMAA-01 | 3 | OVR | Overall Response by Investigator | 2025-04-28 | 2025-04-28 | 113 | PD | 5 | Y | |
| YAMAA-01 | 1 | OVR | Overall Response by Investigator | 2025-02-10 | 2025-02-10 | 29 | SD | 3 | — | |
| YAMAA-01 | 2 | OVR | Overall Response by Investigator | 2025-02-10 | 2025-02-10 | 29 | PD | 5 | Y | |
| YAMAA-01 | 3 | OVR | Overall Response by Investigator | 2025-03-24 | 2025-03-24 | 71 | NE | 6 | Y | |
| YAMAA-01 | 1 | OVR | Overall Response by Investigator | 2025-03 | 2025-03-01 | 41 | NON-CR/NON-PD | 4 | Y | |
| YAMAA-01 | 1 | OVR | Overall Response by Investigator | 2025-02-17 | 2025-02-17 | 22 | SD | 3 | Y | |
| YAMAA-01 | 2 | OVR | Overall Response by Investigator | 2025-02-17 | 2025-02-17 | 22 | SD | 3 | — | |
| YAMAA-01 | 3 | OVR | Overall Response by Investigator | 2025-05-05 | 2025-05-05 | 92 | CR | 1 | Y | |
| YAMAA-01 | 1 | OVR | Overall Response by Investigator | 2025 | 2025-01-01 | 1 | PR | 2 | Y | |
| YAMAA-01 | 1 | OVR | Overall Response by Investigator | 2025-01-06 | 2025-01-06 | 1 | CR | 1 | Y | |
| YAMAA-01 | 1 | OVR | Overall Response by Investigator | 2025-02-10 | 2025-02-10 | 29 | SD | 3 | — | |
| YAMAA-01 | 2 | OVR | Overall Response by Investigator | 2025-02-10 | 2025-02-10 | 29 | PD | 5 | — | |
| YAMAA-01 | 3 | OVR | Overall Response by Investigator | 2025-02-10 | 2025-02-10 | 29 | NE | 6 | Y | |
| YAMAA-01 | 4 | OVR | Overall Response by Investigator | 2025-02-10 | 2025-02-10 | 29 | NE | 6 | — |
Comments and assessment materials
| Dataset Name | Variable Name | Variable Label | Type | Codelist/Controlled Terms | Core | Computational Method | Origin |
|---|---|---|---|---|---|---|---|
| ADRS | STUDYID | Study Identifier | character | Copy value from RS.STUDYID. | Predecessor | ||
| ADRS | USUBJID | Unique Subject Identifier | character | Copy value from RS.USUBJID. | Predecessor | ||
| ADRS | RSSEQ | Sequence Number | numeric | Copy value from RS.RSSEQ. | Predecessor | ||
| ADRS | PARAMCD | Parameter Code | character | Set constant value "OVR". | Assigned | ||
| ADRS | PARAM | Parameter | character | Set constant value "Overall Response by Investigator". | Assigned | ||
| ADRS | RSDTC | Date/Time of Assessment | character | Copy value from RS.RSDTC. | Predecessor | ||
| ADRS | ADT | Analysis Date | numeric | ISO 8601 | Impute incomplete date from RSDTC, defaulting month=1, day=1; missing or invalid input yields null. | Derived | |
| ADRS | AVALC | Analysis Value (C) | character | CR, PR, SD, NON-CR/NON-PD, PD, NE | Copy value from RS.RSSTRESC. | Predecessor | |
| ADRS | AVAL | Analysis Value | numeric | Recode AVALC: "CR" → "1", "PR" → "2", "SD" → "3", "NON-CR/NON-PD" → "4", "PD" → "5", "NE" → "6"; missing or unlisted values are errors. | Derived | ||
| ADRS | ADY | Analysis Relative Day | numeric | CDISC study day of ADT against TRTSDT as day 1; there is no day zero. | Derived | ||
| ADRS | ANL01FL | Analysis Record Flag 01 | character | Y | "Y" when WORSTORD = 1; blank otherwise. | Derived |
| Variable | Permitted values |
|---|---|
| AVALC | CR, PR, SD, NON-CR/NON-PD, PD, NE |
| ANL01FL | Y |
| Version | Date | Author | Description | Reviewer | Sign-off |
|---|---|---|---|---|---|
| 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-adrs-response-records/full.md
Edit34 linesFollowing 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
Edit19 linesFollowing 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
Edit10 linesFollowing 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.
run.R
Edit4 lineslibrary(yamaa)adrs <- yamaa_domain("spec.yaml")$outputadrsrun.py
Edit4 linesimport yamaaadrs = yamaa.yamaa_domain("spec.yaml").outputadrssolutions/adam-adrs-response-records/result.R
Edit71 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
Edit83 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
Edit35 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;
yamaa
Comments
Signed in with GitHub; saved in repository Discussions