As a clinical trial statistician or programmer, answer three short questions in Your review: the task, the inputs and outputs, and the AI-assisted review. Agreeing with all three approves this benchmark; disagreeing with any needs a comment. Propose a fix with the Edit button on any source file, or add it to your comments.
We suggest spending no more than 5 minutes on a review. The other tabs beside Your review are background for assessment, not under review.
Summary
README.mdPublic entries: Python and R. Passing coverage requires an installed inventory.
Goal: derive the full analysis set flag FASFL from the
safety flag SAFFL and the intent-to-treat flag ITTFL, plus
the dates those flags read, first exposure date TRTSDT and
randomization date RANDDT, and the collected age AGE with its
age group AGEGR1.
Input: one demographic record per subject carrying age and the randomization date, and exposure records carrying the exposure start date.
Variables:
FASFLholdsYonly when bothSAFFLandITTFLholdY, andNotherwise, marking subjects who were randomized and started treatment.SAFFLholdsYwhen the subject has a first exposure date, andNotherwise, marking subjects who started treatment.ITTFLholdsYwhen the subject was randomized, andNotherwise, marking subjects in the intent-to-treat population.TRTSDTholds the earliest dated exposure start for the subject, and stays empty when no exposure record carries a date.RANDDTholds the collected randomization date, and stays empty when the subject was not randomized.AGEGR1holds<65whenAGEis below 65 and>=65when it is 65 or above; a subject with no age stops the run.
Note: the dates are settled before the flags that read them: the safety and intent-to-treat flags come from their dates, and the full analysis set flag comes from both flags.
Inputs
Under review2 source filesinput/dm.csv
Edit7 rows| STUDYID | USUBJID | AGE | RANDDT |
|---|---|---|---|
| YAMAA-01 | 34 | 2025-01-05 | |
| YAMAA-01 | 65 | 2025-02-05 | |
| YAMAA-01 | 52 | — | |
| YAMAA-01 | 65 | 2025-02-20 | |
| YAMAA-01 | 41 | — | |
| YAMAA-01 | 88 | 2025-03-01 | |
| YAMAA-01 | 29 | 2025-04-01 |
input/ex.csv
Edit7 rows| STUDYID | USUBJID | EXSEQ | EXSTDTC |
|---|---|---|---|
| YAMAA-01 | 1 | 2025-01-08 | |
| YAMAA-01 | 2 | 2025-01-15 | |
| YAMAA-01 | 3 | — | |
| YAMAA-01 | 1 | 2025-02-08 | |
| YAMAA-01 | 1 | 2025-02-28 | |
| YAMAA-01 | 1 | 2025-03-05 | |
| YAMAA-01 | 1 | — |
Expected output
Under review7 expected rowsexpected/adsl.csv
Edit7 rows| FASFL | SAFFL | ITTFL | TRTSDT | RANDDT | AGEGR1 | STUDYID | USUBJID | AGE |
|---|---|---|---|---|---|---|---|---|
| Y | Y | Y | 2025-01-08 | 2025-01-05 | <65 | YAMAA-01 | 34 | |
| Y | Y | Y | 2025-02-08 | 2025-02-05 | >=65 | YAMAA-01 | 65 | |
| N | N | N | — | — | <65 | YAMAA-01 | 52 | |
| N | N | Y | — | 2025-02-20 | >=65 | YAMAA-01 | 65 | |
| N | Y | N | 2025-02-28 | — | <65 | YAMAA-01 | 41 | |
| Y | Y | Y | 2025-03-05 | 2025-03-01 | >=65 | YAMAA-01 | 88 | |
| N | N | Y | — | 2025-04-01 | <65 | YAMAA-01 | 29 |
Human review and assessment
| Dataset Name | Variable Name | Variable Label | Type | Codelist/Controlled Terms | Core | Computational Method | Origin |
|---|---|---|---|---|---|---|---|
| ADSL | TRTSDT | Date of First Exposure to Treatment | numeric | ISO 8601 | Aggregate MIN(EX.EXSTDTC) over records matching on the shared output keys. | Derived | |
| ADSL | SAFFL | Safety Population Flag | character | "Y" when TRTSDT IS NOT NULL; "N" otherwise; "N" when the condition is unknown. | Derived | ||
| ADSL | RANDDT | Randomization Date | numeric | ISO 8601 | Copy value from DM.RANDDT. | Predecessor | |
| ADSL | ITTFL | Intent-to-Treat Population Flag | character | "Y" when RANDFL = 'Y'; "N" otherwise; "N" when the condition is unknown. | Derived | ||
| ADSL | FASFL | Full Analysis Set Population Flag | character | "Y" when SAFFL = 'Y' AND ITTFL = 'Y'; "N" otherwise; "N" when the condition is unknown. | Derived | ||
| ADSL | STUDYID | Study Identifier | character | Copy value from DM.STUDYID. | Predecessor | ||
| ADSL | USUBJID | Unique Subject Identifier | character | Copy value from DM.USUBJID. | Predecessor | ||
| ADSL | AGE | Age | numeric | Copy value from DM.AGE. | Predecessor | ||
| ADSL | AGEGR1 | Pooled Age Group 1 | character | Band AGE at 65 into "<65" and ">=65", intervals closed on the left. | Derived |
| Version | Date | Author | Description | Reviewer | Sign-off |
|---|---|---|---|---|---|
| 1.8 | 2026-11-19 | yamaa docs build | State open and closed range endpoints, including bounds of zero | ||
| 1.7 | 2026-10-20 | yamaa docs build | Read a specification in the 1.0 surface as its 0.5 counterpart; state that missing values stay missing where a mapping declares no missing handler, and leave out a declared missing answer that restates a handler's default | ||
| 1.6 | 2026-10-17 | yamaa docs build | Describe collected date parts written as ISO 8601 date text and times of day counted in seconds since midnight | ||
| 1.5 | 2026-10-17 | yamaa docs build | Name collected precision in words instead of letter codes; state imputation fallbacks, minimum source precision, bounds ignored outside the collected period, and invalid text with no handler as an error; describe date and datetime shifts, imputation flag codes, and partial text giving no date part | ||
| 1.4 | 2026-10-15 | yamaa docs build | State datetime precision codes through the hour and minute, and complete only the time parts a collected datetime lacks | ||
| 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-adsl-flag-chain/full.md
Edit17 linesFollowing CDISC ADaM standards, use the provided DM and EX datasets to create an ADSL dataset with one record per subject.
The output dataset should contain the following columns in this order: FASFL, SAFFL, ITTFL, TRTSDT, RANDDT, AGEGR1, STUDYID, USUBJID, AGE
TRTSDT is the subject's earliest dated exposure start, and has no value when no exposure record for the subject carries a date. SAFFL is "Y" when the subject has a first exposure date and "N" otherwise. RANDDT is the randomization date collected for the subject, and has no value when the subject was not randomized. ITTFL is "Y" when the subject was randomized and "N" otherwise. FASFL is "Y" only when SAFFL and ITTFL are both "Y", and "N" otherwise. AGEGR1 is "<65" when AGE is below 65 and ">=65" when AGE is 65 or above.
Read the source datasets from /app/input and save the completed dataset as /app/output/adsl.csv.
prompts/adam-adsl-flag-chain/conventions.md
Edit12 linesFollowing CDISC ADaM standards, use the provided DM and EX datasets to create an ADSL dataset with one record per subject.
The output dataset should contain the following columns in this order: FASFL, SAFFL, ITTFL, TRTSDT, RANDDT, AGEGR1, STUDYID, USUBJID, AGE
SAFFL is "Y" or "N". ITTFL is "Y" or "N". FASFL is "Y" only when SAFFL and ITTFL are both "Y", and "N" otherwise. AGEGR1 is "<65" when AGE is below 65 and ">=65" when AGE is 65 or above.
Read the source datasets from /app/input and save the completed dataset as /app/output/adsl.csv.
prompts/adam-adsl-flag-chain/brief.md
Edit8 linesFollowing CDISC ADaM standards, use the provided DM and EX datasets to create an ADSL dataset with one record per subject.
The output dataset should contain the following columns in this order: FASFL, SAFFL, ITTFL, TRTSDT, RANDDT, AGEGR1, STUDYID, USUBJID, AGE
Read the source datasets from /app/input and save the completed dataset as /app/output/adsl.csv.
R
Edit3 lineslibrary(yamaa)yamaa_spec("spec.yaml")$run()$outputPython
Edit3 linesimport yamaayamaa.spec("spec.yaml").run().outputsolutions/adam-adsl-flag-chain/result.R
Edit40 lines# Reference solution for the yamaa benchmark adam-adsl-flag-chain (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)dm <- read_csv( "/app/input/dm.csv", col_types = cols(AGE = col_integer(), RANDDT = col_date(), .default = col_character()))ex <- read_csv( "/app/input/ex.csv", col_types = cols(EXSEQ = col_integer(), EXSTDTC = col_date(), .default = col_character()))first_exposure <- ex |> group_by(STUDYID, USUBJID) |> summarise( TRTSDT = if (all(is.na(EXSTDTC))) as.Date(NA) else min(EXSTDTC, na.rm = TRUE), .groups = "drop" )adsl <- dm |> left_join(first_exposure, by = c("STUDYID", "USUBJID")) |> mutate( SAFFL = if_else(!is.na(TRTSDT), "Y", "N"), RANDFL = if_else(!is.na(RANDDT), "Y", "N"), ITTFL = if_else(RANDFL == "Y", "Y", "N"), FASFL = if_else(SAFFL == "Y" & ITTFL == "Y", "Y", "N"), AGEGR1 = if_else(AGE < 65, "<65", ">=65") ) |> select( FASFL, SAFFL, ITTFL, TRTSDT, RANDDT, AGEGR1, STUDYID, USUBJID, AGE )dir.create("/app/output", showWarnings = FALSE)write_csv(adsl, "/app/output/adsl.csv", na = "")solutions/adam-adsl-flag-chain/result.py
Edit63 lines# Reference solution for the yamaa benchmark adam-adsl-flag-chain (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 pldm = pl.read_csv("/app/input/dm.csv", infer_schema=False).with_columns( pl.col("RANDDT").str.to_date(strict=False), pl.col("AGE").cast(pl.Int64, strict=False),)ex = pl.read_csv("/app/input/ex.csv", infer_schema=False).with_columns( pl.col("EXSTDTC").str.to_date(strict=False),)first_exposure = ex.group_by(["STUDYID", "USUBJID"]).agg( TRTSDT=pl.col("EXSTDTC").min())adsl = ( dm.join(first_exposure, on=["STUDYID", "USUBJID"], how="left", maintain_order="left") .with_columns( SAFFL=pl.when(pl.col("TRTSDT").is_not_null()) .then(pl.lit("Y")) .otherwise(pl.lit("N")), RANDFL=pl.when(pl.col("RANDDT").is_not_null()) .then(pl.lit("Y")) .otherwise(pl.lit("N")), ) .with_columns( ITTFL=pl.when(pl.col("RANDFL") == "Y") .then(pl.lit("Y")) .otherwise(pl.lit("N")), ) .with_columns( FASFL=pl.when((pl.col("SAFFL") == "Y") & (pl.col("ITTFL") == "Y")) .then(pl.lit("Y")) .otherwise(pl.lit("N")), AGEGR1=pl.when(pl.col("AGE") < 65) .then(pl.lit("<65")) .when(pl.col("AGE") >= 65) .then(pl.lit(">=65")) .otherwise(None), ))adsl = adsl.select( "FASFL", "SAFFL", "ITTFL", "TRTSDT", "RANDDT", "AGEGR1", "STUDYID", "USUBJID", "AGE",)Path("/app/output").mkdir(exist_ok=True)adsl.write_csv("/app/output/adsl.csv")solutions/adam-adsl-flag-chain/result.sas
Edit36 lines/* opensas reference solution for the yamaa benchmark adam-adsl-flag-chain. Reads the benchmark inputs and derives the requested output. Execute with the existing opensas runtime: opensas /app/output/result.sas. */data dm; length STUDYID USUBJID RANDDT $1024; infile "/app/input/dm.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. AGE RANDDT : $char1024.;run;data ex; length STUDYID USUBJID EXSTDTC $1024; infile "/app/input/ex.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. EXSEQ EXSTDTC : $char1024.;run;proc sql; create table firstex as select STUDYID,USUBJID,min(EXSTDTC) as TRTSDT from ex where not missing(EXSTDTC) group by STUDYID,USUBJID; create table joined as select a.*,b.TRTSDT from dm as a left join firstex as b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID;quit;data result; length FASFL SAFFL ITTFL $1 AGEGR1 $4; set joined; SAFFL='N'; ITTFL='N'; FASFL='N'; if not missing(TRTSDT) then SAFFL='Y'; if not missing(RANDDT) then ITTFL='Y'; if SAFFL='Y' and ITTFL='Y' then FASFL='Y'; if not missing(AGE) then do; if AGE<65 then AGEGR1='<65'; else AGEGR1='>=65'; end;run;proc sql; create table final as select FASFL, SAFFL, ITTFL, TRTSDT, RANDDT, AGEGR1, STUDYID, USUBJID, AGE from result;quit;proc export data=final outfile="/app/output/adsl.csv" dbms=csv replace; run;
yamaa