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: one record per subject flagging any reported dose adjustment (DOSADJFL).

Input: subject list plus exposure (EX) records carrying the reason for a dose adjustment (EXADJ), exposure as collected (EC) records carrying the same reason (ECADJ), and findings-about (FA) records carrying a test code (FATESTCD), the object of the finding (FAOBJ), and its result (FASTRESC).

Variables:

  • DOSADJFL holds Y when any source holds a qualifying record: a filled EXADJ value, a filled ECADJ value, or a findings-about row with FATESTCD of OCCUR, FAOBJ of DOSE ADJUSTMENT, and FASTRESC of Y. A pre-specified (PRESP) or non-dose-adjustment finding does not qualify. It holds N when the subject has at least one record in any of the three sources but no qualifying record. It stays empty when the subject is absent from all three sources.

Note: a record belongs to a subject only when both the study and subject identifiers match, and a source record for a subject not in the subject list adds no record.

Inputs

Under review
4 source files

input/adsl.csv

Edit
10 rows
input/adsl.csv
STUDYIDUSUBJID
AB42
AB42
AB42
AB42
AB42
AB42
AB42
AB42
AB42
AB43

input/ec.csv

Edit
3 rows
input/ec.csv
STUDYIDUSUBJIDECADJ
AB42DOSE REDUCED
AB42—
AB42—

input/ex.csv

Edit
7 rows
input/ex.csv
STUDYIDUSUBJIDEXADJ
AB42DOSE REDUCED
AB42—
AB42—
AB42—
AB42DOSE REDUCED
AB42—
AB42DOSE REDUCED

input/fa.csv

Edit
4 rows
input/fa.csv
STUDYIDUSUBJIDFATESTCDFAOBJFASTRESC
AB42OCCURDOSE ADJUSTMENTY
AB42OCCURDOSE ADJUSTMENTN
AB42OCCUROTHER ASSESSMENTY
AB42PRESPDOSE ADJUSTMENTY

Expected output

Under review
10 expected rows

expected/adsl.csv

Edit
10 rows
expected/adsl.csv
STUDYIDUSUBJIDDOSADJFL
AB42Y
AB42N
AB42Y
AB42—
AB42Y
AB42N
AB42Y
AB42N
AB42N
AB43—
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
ADSLSTUDYIDStudy IdentifiercharacterCopy value from ADSL_RAW.STUDYID.Predecessor
ADSLUSUBJIDUnique Subject IdentifiercharacterCopy value from ADSL_RAW.USUBJID.Predecessor
ADSLDOSADJFLDose Adjustment FlagcharacterY, NIf EX_ADJ_CNT > 0 OR EC_ADJ_CNT > 0 OR FA_ADJ_CNT > 0 then "Y"; If EX_ANY_CNT > 0 OR EC_ANY_CNT > 0 OR FA_ANY_CNT > 0 then "N"; otherwise blank.Derived
VariablePermitted values
DOSADJFLY, N
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-adsl-dose-adjustment/full.md

Edit
21 lines

Following CDISC ADaM standards, use the provided ADSL_RAW, EX, EC, and FA datasets to create an ADSL dataset with one record per subject.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, DOSADJFL

DOSADJFL is Y when any source reports an adjustment: a filled EXADJ value, a filled ECADJ value, or a findings-about row with test code OCCUR, object DOSE ADJUSTMENT, and result Y. A PRESP test code, or a row about anything but dose adjustment, does not qualify.

DOSADJFL is N when the subject has at least one record in any of the three sources but no qualifying record. It has no value when the subject is absent from all three sources.

A source record counts for a subject only when both identifiers match, and a source record for a subject outside the subject list adds no record.

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

prompts/adam-adsl-dose-adjustment/conventions.md

Edit
10 lines

Following CDISC ADaM standards, use the provided ADSL_RAW, EX, EC, and FA datasets to create an ADSL dataset with one record per subject.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, DOSADJFL

DOSADJFL is Y, N, or has no value.

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

prompts/adam-adsl-dose-adjustment/brief.md

Edit
8 lines

Following CDISC ADaM standards, use the provided ADSL_RAW, EX, EC, and FA datasets to create an ADSL dataset with one record per subject.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, DOSADJFL

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

yamaa code

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

run.R

Edit
4 lines
library(yamaa)adsl <- yamaa_domain("spec.yaml")$outputadsl

run.py

Edit
4 lines
import yamaaadsl = yamaa.yamaa_domain("spec.yaml").outputadsl

Solution without yamaa

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

solutions/adam-adsl-dose-adjustment/result.R

Edit
63 lines
# Reference solution for the yamaa benchmark adam-adsl-dose-adjustment (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(stringr)base <- read_csv(  "/app/input/adsl.csv",  col_types = cols(.default = col_character()))ex <- read_csv(  "/app/input/ex.csv",  col_types = cols(.default = col_character()))ec <- read_csv(  "/app/input/ec.csv",  col_types = cols(.default = col_character()))fa <- read_csv(  "/app/input/fa.csv",  col_types = cols(.default = col_character()))# A record reports an adjustment with a filled value; findings-about rows# qualify only for dose adjustment occurrences with a Y result.ex_adj <- ex |>  filter(!is.na(EXADJ), str_trim(EXADJ) != "") |>  distinct(STUDYID, USUBJID) |>  mutate(.ex_adj = TRUE)ec_adj <- ec |>  filter(!is.na(ECADJ), str_trim(ECADJ) != "") |>  distinct(STUDYID, USUBJID) |>  mutate(.ec_adj = TRUE)fa_adj <- fa |>  filter(FATESTCD %in% "OCCUR", FAOBJ %in% "DOSE ADJUSTMENT", FASTRESC %in% "Y") |>  distinct(STUDYID, USUBJID) |>  mutate(.fa_adj = TRUE)ex_any <- ex |> distinct(STUDYID, USUBJID) |> mutate(.ex_any = TRUE)ec_any <- ec |> distinct(STUDYID, USUBJID) |> mutate(.ec_any = TRUE)fa_any <- fa |> distinct(STUDYID, USUBJID) |> mutate(.fa_any = TRUE)adsl <- base |>  left_join(ex_adj, by = c("STUDYID", "USUBJID")) |>  left_join(ec_adj, by = c("STUDYID", "USUBJID")) |>  left_join(fa_adj, by = c("STUDYID", "USUBJID")) |>  left_join(ex_any, by = c("STUDYID", "USUBJID")) |>  left_join(ec_any, by = c("STUDYID", "USUBJID")) |>  left_join(fa_any, by = c("STUDYID", "USUBJID")) |>  mutate(    DOSADJFL = case_when(      .ex_adj %in% TRUE | .ec_adj %in% TRUE | .fa_adj %in% TRUE ~ "Y",      .ex_any %in% TRUE | .ec_any %in% TRUE | .fa_any %in% TRUE ~ "N"    )  ) |>  select(STUDYID, USUBJID, DOSADJFL)dir.create("/app/output", showWarnings = FALSE)write_csv(adsl, "/app/output/adsl.csv", na = "")

solutions/adam-adsl-dose-adjustment/result.py

Edit
75 lines
# Reference solution for the yamaa benchmark adam-adsl-dose-adjustment (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 plbase = pl.read_csv("/app/input/adsl.csv", infer_schema=False)ex = pl.read_csv("/app/input/ex.csv", infer_schema=False)ec = pl.read_csv("/app/input/ec.csv", infer_schema=False)fa = pl.read_csv("/app/input/fa.csv", infer_schema=False)keys = ["STUDYID", "USUBJID"]def adjusted(sub: pl.DataFrame, column: str) -> pl.DataFrame:    return (        sub.filter(pl.col(column).fill_null("").str.strip_chars() != "")        .select(keys)        .unique()        .with_columns(pl.lit(True).alias(f"__adj_{column}"))    )def any_records(sub: pl.DataFrame, tag: str) -> pl.DataFrame:    return (        sub.select(keys).unique().with_columns(pl.lit(True).alias(f"__any_{tag}"))    )ex_adj = adjusted(ex, "EXADJ")ec_adj = adjusted(ec, "ECADJ")fa_adj = (    fa.filter(        (pl.col("FATESTCD") == "OCCUR")        & (pl.col("FAOBJ") == "DOSE ADJUSTMENT")        & (pl.col("FASTRESC") == "Y")    )    .select(keys)    .unique()    .with_columns(pl.lit(True).alias("__adj_FA")))ex_any = any_records(ex, "EX")ec_any = any_records(ec, "EC")fa_any = any_records(fa, "FA")adsl = (    base.join(ex_adj, on=keys, how="left", maintain_order="left")    .join(ec_adj, on=keys, how="left", maintain_order="left")    .join(fa_adj, on=keys, how="left", maintain_order="left")    .join(ex_any, on=keys, how="left", maintain_order="left")    .join(ec_any, on=keys, how="left", maintain_order="left")    .join(fa_any, on=keys, how="left", maintain_order="left")    .with_columns(        DOSADJFL=pl.when(            (pl.col("__adj_EXADJ") == True)            | (pl.col("__adj_ECADJ") == True)            | (pl.col("__adj_FA") == True)        )        .then(pl.lit("Y"))        .when(            (pl.col("__any_EX") == True)            | (pl.col("__any_EC") == True)            | (pl.col("__any_FA") == True)        )        .then(pl.lit("N"))        .otherwise(None)    )    .select("STUDYID", "USUBJID", "DOSADJFL"))Path("/app/output").mkdir(exist_ok=True)adsl.write_csv("/app/output/adsl.csv")

solutions/adam-adsl-dose-adjustment/result.sas

Edit
41 lines
/* opensas reference solution for the yamaa benchmark adam-adsl-dose-adjustment.   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 $1024;  infile "/app/input/adsl.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024.;run;data ec;  length STUDYID USUBJID ECADJ $1024;  infile "/app/input/ec.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. ECADJ : $char1024.;run;data ex;  length STUDYID USUBJID EXADJ $1024;  infile "/app/input/ex.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. EXADJ : $char1024.;run;data fa;  length STUDYID USUBJID FATESTCD FAOBJ FASTRESC $1024;  infile "/app/input/fa.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. FATESTCD : $char1024. FAOBJ : $char1024. FASTRESC : $char1024.;run;proc sql;  create table evidence as  select STUDYID,USUBJID,case when not missing(EXADJ) then 1 else 0 end as adjusted from ex  union all select STUDYID,USUBJID,case when not missing(ECADJ) then 1 else 0 end from ec  union all select STUDYID,USUBJID,case when FATESTCD='OCCUR' and FAOBJ='DOSE ADJUSTMENT' and FASTRESC='Y' then 1 else 0 end from fa;  create table flags as select STUDYID,USUBJID,max(adjusted) as adjusted,count(*) as records from evidence group by STUDYID,USUBJID;  create table result as select a.*, case when b.adjusted=1 then 'Y' when b.records>0 then 'N' else '' end as DOSADJFL from adsl as a left join flags as b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID;quit;proc sql;  create table final as select STUDYID, USUBJID, DOSADJFL from result;quit;proc export data=final outfile="/app/output/adsl.csv" dbms=csv replace; run;