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 subjects who completed the study, adding COMPLFL and carrying TRTSDT through.

Input: subject-level records carrying first treatment date (TRTSDT) when treated, plus disposition records carrying a category (DSCAT), standardized outcome (DSDECOD), collection date (DSDTC), and epoch (EPOCH).

Variables:

  • COMPLFL: Y when the subject has a disposition event in the study (FOLLOW-UP) epoch with standardized outcome COMPLETED; N otherwise. A subject whose records carry only other outcomes, such as ADVERSE EVENT, and a subject with no disposition record at all, are both N. A subject with two such completion records stops the run rather than being flagged.

Note: the flag answers whether an end-of-study completion record exists, not whether its collection date was filled in or how an earlier period ended, so a subject who completed treatment but discontinued the study is N.

Inputs

Under review
2 source files

input/adsl_raw.csv

Edit
8 rows
input/adsl_raw.csv
STUDYIDUSUBJIDTRTSDT
YAMAA-012024-01-15
YAMAA-012024-01-20
YAMAA-012024-02-02
YAMAA-012024-02-05
YAMAA-01—
YAMAA-012024-02-12
YAMAA-012024-02-18
YAMAA-012024-03-01

input/ds.csv

Edit
9 rows
input/ds.csv
STUDYIDUSUBJIDDSSEQDSCATDSDECODDSDTCEPOCH
YAMAA-011PROTOCOL MILESTONERANDOMIZED2024-01-12SCREENING
YAMAA-012DISPOSITION EVENTCOMPLETED2024-02-10TREATMENT
YAMAA-013DISPOSITION EVENTDISCONTINUED2024-03-01FOLLOW-UP
YAMAA-011DISPOSITION EVENTCOMPLETED—FOLLOW-UP
YAMAA-011DISPOSITION EVENTADVERSE EVENT2024-02-20TREATMENT
YAMAA-011DISPOSITION EVENTADVERSE EVENT2024-01-05FOLLOW-UP
YAMAA-011DISPOSITION EVENTCOMPLETED2024-03-10FOLLOW-UP
YAMAA-011PROTOCOL MILESTONESCREEN FAILURE2024-01-08SCREENING
YAMAA-011DISPOSITION EVENTCOMPLETED2024-04-01FOLLOW-UP

Expected output

Under review
8 expected rows

expected/adsl.csv

Edit
8 rows
expected/adsl.csv
STUDYIDUSUBJIDTRTSDTCOMPLFL
YAMAA-012024-01-15N
YAMAA-012024-01-20Y
YAMAA-012024-02-02N
YAMAA-012024-02-05N
YAMAA-01—N
YAMAA-012024-02-12Y
YAMAA-012024-02-18N
YAMAA-012024-03-01Y
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
ADSLTRTSDTDate of First Exposure to TreatmentnumericISO 8601Copy value from ADSL_RAW.TRTSDT.Predecessor
ADSLCOMPLFLCompleters Population FlagcharacterY, N"Y" when COMPREC IS NOT NULL; "N" otherwise; "N" when the condition is unknown.Derived
VariablePermitted values
COMPLFLY, 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-completion-flag/full.md

Edit
18 lines

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

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

COMPLFL is Y when the subject has a disposition event in the study (FOLLOW-UP) epoch with standardized outcome COMPLETED; N otherwise. A subject whose records carry only other outcomes, such as ADVERSE EVENT, and a subject with no disposition record at all, are both N.

The flag answers whether an end-of-study completion record exists, not whether its collection date was filled in or how an earlier period ended, so a subject who completed treatment but discontinued the study is N.

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

prompts/adam-adsl-completion-flag/conventions.md

Edit
10 lines

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

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

COMPLFL is Y or N.

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

prompts/adam-adsl-completion-flag/brief.md

Edit
8 lines

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

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

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-completion-flag/result.R

Edit
34 lines
# Reference solution for the yamaa benchmark adam-adsl-completion-flag (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)adsl_raw <- read_csv(  "/app/input/adsl_raw.csv",  col_types = cols(TRTSDT = col_date(), .default = col_character()))ds <- read_csv(  "/app/input/ds.csv",  col_types = cols(.default = col_character()))completed <- ds |>  filter(    DSCAT %in% "DISPOSITION EVENT",    EPOCH %in% "FOLLOW-UP",    DSDECOD %in% "COMPLETED"  ) |>  distinct(STUDYID, USUBJID) |>  mutate(.completed = "Y")adsl <- adsl_raw |>  left_join(completed, by = c("STUDYID", "USUBJID")) |>  mutate(COMPLFL = if_else(!is.na(.completed), "Y", "N")) |>  select(STUDYID, USUBJID, TRTSDT, COMPLFL)dir.create("/app/output", showWarnings = FALSE)write_csv(adsl, "/app/output/adsl.csv", na = "")

solutions/adam-adsl-completion-flag/result.py

Edit
36 lines
# Reference solution for the yamaa benchmark adam-adsl-completion-flag (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_raw = pl.read_csv("/app/input/adsl_raw.csv", infer_schema=False)ds = pl.read_csv("/app/input/ds.csv", infer_schema=False)completed = (    ds.filter(        (pl.col("DSCAT") == "DISPOSITION EVENT")        & (pl.col("EPOCH") == "FOLLOW-UP")        & (pl.col("DSDECOD") == "COMPLETED")    )    .select("STUDYID", "USUBJID")    .unique()    .with_columns(__completed=pl.lit("Y")))adsl = (    adsl_raw.join(completed, on=["STUDYID", "USUBJID"], how="left", maintain_order="left")    .with_columns(        COMPLFL=pl.when(pl.col("__completed") == "Y")        .then(pl.lit("Y"))        .otherwise(pl.lit("N"))    )    .select("STUDYID", "USUBJID", "TRTSDT", "COMPLFL"))Path("/app/output").mkdir(parents=True, exist_ok=True)adsl.write_csv("/app/output/adsl.csv")

solutions/adam-adsl-completion-flag/result.sas

Edit
23 lines
/* opensas reference solution for the yamaa benchmark adam-adsl-completion-flag.   Reads the benchmark inputs and derives the requested output.   Execute with the existing opensas runtime: opensas /app/output/result.sas. */data adsl_raw;  length STUDYID USUBJID TRTSDT $1024;  infile "/app/input/adsl_raw.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. TRTSDT : $char1024.;run;data ds;  length STUDYID USUBJID DSCAT DSDECOD DSDTC EPOCH $1024;  infile "/app/input/ds.csv" dsd dlm="," firstobs=2 truncover lrecl=32767;  input STUDYID : $char1024. USUBJID : $char1024. DSSEQ DSCAT : $char1024. DSDECOD : $char1024. DSDTC : $char1024. EPOCH : $char1024.;run;proc sql;create table completed as select distinct STUDYID,USUBJID from ds where EPOCH='FOLLOW-UP' and DSDECOD='COMPLETED';create table result as select a.*,case when not missing(b.USUBJID) then 'Y' else 'N' end as COMPLFL from adsl_raw a left join completed b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID; quit;proc sql;  create table final as select STUDYID, USUBJID, TRTSDT, COMPLFL from result;quit;proc export data=final outfile="/app/output/adsl.csv" dbms=csv replace; run;