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: flag each exposure administration whose dose was reduced from the previous administration, adding DOSREDFL (Dose Reduced Flag).

Input: exposure (EX) records carrying a sequence number (EXSEQ), treatment start date/time (EXSTDTM), and collected dose (EXDOSE).

Variables:

  • DOSREDFL is Y when the current dose is lower than the previous dose for the same subject; empty otherwise, for the first record and whenever the current or the previous dose is zero or missing.

Note: the comparison runs in chronological treatment-start order within each subject, breaking timestamp ties by sequence number. The previous dose is always the administration just before, never an earlier nonzero dose, so a pause in dosing (a zero dose) is not flagged and neither is the administration after it.

Inputs

Under review
1 source file

input/ex.csv

Edit
13 rows
input/ex.csv
STUDYIDUSUBJIDEXSEQEXSTDTMEXDOSE
YAMAA-0112024-01-08T08:00200.0
YAMAA-0122024-01-15T08:00200.0
YAMAA-0132024-01-22T08:00150.0
YAMAA-0142024-01-29T08:000.0
YAMAA-0152024-02-05T08:00150.0
YAMAA-0162024-02-12T08:00—
YAMAA-0172024-02-19T08:00100.0
YAMAA-0182024-02-26T08:0080.0
YAMAA-0112024-01-10T08:00250.0
YAMAA-0112024-01-09T08:00200.0
YAMAA-0122024-01-09T08:00120.0
YAMAA-0112024-01-11T08:000.0
YAMAA-0122024-01-18T08:00100.0

Expected output

Under review
13 expected rows

expected/adex.csv

Edit
13 rows
expected/adex.csv
STUDYIDUSUBJIDEXSEQEXSTDTMEXDOSEDOSREDFL
YAMAA-0112024-01-08T08:00:00200—
YAMAA-0122024-01-15T08:00:00200—
YAMAA-0132024-01-22T08:00:00150Y
YAMAA-0142024-01-29T08:00:000—
YAMAA-0152024-02-05T08:00:00150—
YAMAA-0162024-02-12T08:00:00——
YAMAA-0172024-02-19T08:00:00100—
YAMAA-0182024-02-26T08:00:0080Y
YAMAA-0112024-01-10T08:00:00250—
YAMAA-0112024-01-09T08:00:00200—
YAMAA-0122024-01-09T08:00:00120Y
YAMAA-0112024-01-11T08:00:000—
YAMAA-0122024-01-18T08:00:00100—
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
ADEXSTUDYIDStudy IdentifiercharacterCopy value from EX.STUDYID.Predecessor
ADEXUSUBJIDUnique Subject IdentifiercharacterCopy value from EX.USUBJID.Predecessor
ADEXEXSEQSequence NumbernumericCopy value from EX.EXSEQ.Predecessor
ADEXEXSTDTMStart Date/Time of TreatmentnumericISO 8601Copy value from EX.EXSTDTM.Predecessor
ADEXEXDOSEDosenumericCopy value from EX.EXDOSE.Predecessor
ADEXDOSREDFLDose Reduced Flagcharacter"Y" when EXDOSE > 0 AND EXDOSE < PREVDOSE; blank otherwise.Derived
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-adex-dose-reduction/full.md

Edit
16 lines

Following CDISC ADaM standards, use the provided EX dataset to create an ADEX dataset with one record per exposure administration.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, EXSEQ, EXSTDTM, EXDOSE, DOSREDFL

DOSREDFL is Y when the current dose is lower than the previous dose for the same subject, and has no value otherwise: for the first record, and whenever the current or the previous dose is zero or missing. Compare in chronological treatment-start order within each subject, breaking timestamp ties by sequence number. The previous dose is always the administration just before, never an earlier nonzero dose, so a pause in dosing is not flagged and neither is the administration after it.

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

prompts/adam-adex-dose-reduction/conventions.md

Edit
10 lines

Following CDISC ADaM standards, use the provided EX dataset to create an ADEX dataset with one record per exposure administration.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, EXSEQ, EXSTDTM, EXDOSE, DOSREDFL

DOSREDFL is Y or has no value.

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

prompts/adam-adex-dose-reduction/brief.md

Edit
8 lines

Following CDISC ADaM standards, use the provided EX dataset to create an ADEX dataset with one record per exposure administration.

The output dataset should contain the following columns in this order: STUDYID, USUBJID, EXSEQ, EXSTDTM, EXDOSE, DOSREDFL

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

yamaa code

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

run.R

Edit
4 lines
library(yamaa)adex <- yamaa_domain("spec.yaml")$outputadex

run.py

Edit
4 lines
import yamaaadex = yamaa.yamaa_domain("spec.yaml").outputadex

Solution without yamaa

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

solutions/adam-adex-dose-reduction/result.R

Edit
42 lines
# Reference solution for the yamaa benchmark adam-adex-dose-reduction (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)ex <- read_csv(  "/app/input/ex.csv",  col_types = cols(EXSEQ = col_integer(), .default = col_character()))adex <- ex |>  mutate(    EXSTDTM = if_else(      !is.na(EXSTDTM) & nchar(EXSTDTM) == 16L, paste0(EXSTDTM, ":00"), EXSTDTM    ),    EXDOSE = suppressWarnings(as.numeric(EXDOSE))  ) |>  # Chronological treatment-start order within each subject, breaking  # timestamp ties by sequence number.  arrange(USUBJID, EXSTDTM, EXSEQ) |>  group_by(USUBJID) |>  mutate(    PREVDOSE = lag(EXDOSE),    # Y when the current dose is lower than the previous one; no value for    # the first record and whenever either dose is zero or missing. The    # previous dose is always the administration just before.    DOSREDFL = if_else(      !is.na(EXDOSE) & EXDOSE != 0 & !is.na(PREVDOSE) & PREVDOSE != 0 &        EXDOSE < PREVDOSE,      "Y",      NA_character_    )  ) |>  ungroup() |>  select(STUDYID, USUBJID, EXSEQ, EXSTDTM, EXDOSE, DOSREDFL)dir.create("/app/output", showWarnings = FALSE)write_csv(adex, "/app/output/adex.csv", na = "")

solutions/adam-adex-dose-reduction/result.py

Edit
44 lines
# Reference solution for the yamaa benchmark adam-adex-dose-reduction (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 plex = pl.read_csv("/app/input/ex.csv", infer_schema=False).with_columns(    pl.col("EXSEQ").cast(pl.Int64))adex = (    ex.with_columns(        EXSTDTM=pl.when(pl.col("EXSTDTM").str.len_chars() == 16)        .then(pl.col("EXSTDTM") + ":00")        .otherwise(pl.col("EXSTDTM")),        EXDOSE=pl.col("EXDOSE").cast(pl.Float64, strict=False),    )    # Chronological treatment-start order within each subject, breaking    # timestamp ties by sequence number. ISO datetimes sort as text.    .sort(["USUBJID", "EXSTDTM", "EXSEQ"])    .with_columns(PREVDOSE=pl.col("EXDOSE").shift(1).over("USUBJID"))    # Y when the current dose is lower than the previous one; no value for    # the first record and whenever either dose is zero or missing. The    # previous dose is always the administration just before.    .with_columns(        DOSREDFL=pl.when(            pl.col("EXDOSE").is_not_null()            & (pl.col("EXDOSE") != 0)            & pl.col("PREVDOSE").is_not_null()            & (pl.col("PREVDOSE") != 0)            & (pl.col("EXDOSE") < pl.col("PREVDOSE"))        )        .then(pl.lit("Y"))        .otherwise(None)    )    .select("STUDYID", "USUBJID", "EXSEQ", "EXSTDTM", "EXDOSE", "DOSREDFL"))Path("/app/output").mkdir(exist_ok=True)adex.write_csv("/app/output/adex.csv")

solutions/adam-adex-dose-reduction/result.sas

Edit
24 lines
/* opensas reference solution for the yamaa benchmark adam-adex-dose-reduction.   Reads the benchmark inputs and derives the requested output.   Execute with the existing opensas runtime: opensas /app/output/result.sas. */data ex;  length STUDYID USUBJID EXSTDTM $1024;  infile "/app/input/ex.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. EXSEQ EXSTDTM : $char1024. EXDOSE;run;proc sort data=ex out=ordered; by STUDYID USUBJID EXSTDTM EXSEQ; run;data result;  length DOSREDFL $1;  retain previous;  set ordered; by STUDYID USUBJID;  if first.USUBJID then previous=.;  if EXDOSE>0 and previous>0 and EXDOSE<previous then DOSREDFL='Y';  previous=EXDOSE;run;proc sql;  create table final as select STUDYID, USUBJID, EXSEQ, EXSTDTM, EXDOSE, DOSREDFL from result;quit;proc export data=final outfile="/app/output/adex.csv" dbms=csv replace; run;