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: give every subject in the efficacy population a total score at
each scheduled visit, adding a last observation carried forward (LOCF)
record for each visit missed, with the analysis value (AVAL), the
record-type flag (DTYPE), the collected record it comes from (QSSEQ),
and the efficacy population flag (EFFFL).
Input: one subject-level record per subject carrying the efficacy
population flag, and the SDTM questionnaire (QS) records of a total
score, here the ADAS-Cog total (ACTOT), one per subject and visit,
including records whose score was not done. Each record's visit gives
the analysis visit (AVISIT, numbered AVISITN).
Variables:
AVAL: the collected score on a collected record, and empty when the score was not collected. On a carried-forward record, the score from the closest earlier post-baseline visit that has one for the same subject.DTYPE: empty on a collected record;LOCFon a record added for a missed scheduled visit.QSSEQ: the collected record's own sequence number, and on a carried-forward record the sequence number of the record whose score it carries.EFFFL: the subject's efficacy population flag, repeated on every record.
Note: the protocol schedules Weeks 8, 16, and 24 for every subject in the efficacy population. A scheduled visit is missed when the subject has no collected score there; a collected record whose score is empty stays, and the carried score goes on its own record beside it. Only post-baseline scores are carried, since baseline is the reference a change is measured from, so a missed visit with no earlier post-baseline score gains no record. Subjects outside the efficacy population keep their collected records and gain none. The input carries at most one record per subject per visit.
Inputs
Under review2 source filesinput/adsl.csv
Edit7 rows| STUDYID | USUBJID | EFFFL |
|---|---|---|
| YAMAA-01 | Y | |
| YAMAA-01 | Y | |
| YAMAA-01 | Y | |
| YAMAA-01 | Y | |
| YAMAA-01 | N | |
| YAMAA-01 | Y | |
| YAMAA-01 | Y |
input/qs.csv
Edit16 rows| STUDYID | DOMAIN | USUBJID | QSSEQ | QSTESTCD | QSTEST | QSSTRESN | QSSTAT | VISITNUM | VISIT |
|---|---|---|---|---|---|---|---|---|---|
| YAMAA-01 | QS | 1 | ACTOT | ADAS-Cog Total Score | 22 | — | 0 | Baseline | |
| YAMAA-01 | QS | 2 | ACTOT | ADAS-Cog Total Score | 24 | — | 8 | Week 8 | |
| YAMAA-01 | QS | 3 | ACTOT | ADAS-Cog Total Score | 25 | — | 16 | Week 16 | |
| YAMAA-01 | QS | 4 | ACTOT | ADAS-Cog Total Score | 27 | — | 24 | Week 24 | |
| YAMAA-01 | QS | 1 | ACTOT | ADAS-Cog Total Score | 30 | — | 0 | Baseline | |
| YAMAA-01 | QS | 2 | ACTOT | ADAS-Cog Total Score | 31 | — | 8 | Week 8 | |
| YAMAA-01 | QS | 1 | ACTOT | ADAS-Cog Total Score | 18 | — | 0 | Baseline | |
| YAMAA-01 | QS | 2 | ACTOT | ADAS-Cog Total Score | 20 | — | 8 | Week 8 | |
| YAMAA-01 | QS | 3 | ACTOT | ADAS-Cog Total Score | — | NOT DONE | 16 | Week 16 | |
| YAMAA-01 | QS | 1 | ACTOT | ADAS-Cog Total Score | 15 | — | 16 | Week 16 | |
| YAMAA-01 | QS | 2 | ACTOT | ADAS-Cog Total Score | 17 | — | 24 | Week 24 | |
| YAMAA-01 | QS | 1 | ACTOT | ADAS-Cog Total Score | 26 | — | 0 | Baseline | |
| YAMAA-01 | QS | 2 | ACTOT | ADAS-Cog Total Score | 28 | — | 8 | Week 8 | |
| YAMAA-01 | QS | 1 | ACTOT | ADAS-Cog Total Score | 12 | — | 0 | Baseline | |
| YAMAA-01 | QS | 2 | ACTOT | ADAS-Cog Total Score | 0 | — | 8 | Week 8 | |
| YAMAA-01 | QS | 1 | ACTOT | ADAS-Cog Total Score | 25 | — | 0 | Baseline |
Expected output
Under review22 expected rowsexpected/adqs.csv
Edit22 rows| STUDYID | USUBJID | PARAMCD | AVISIT | AVISITN | AVAL | DTYPE | QSSEQ | EFFFL |
|---|---|---|---|---|---|---|---|---|
| YAMAA-01 | ACTOT | Baseline | 0 | 22 | — | 1 | Y | |
| YAMAA-01 | ACTOT | Week 8 | 8 | 24 | — | 2 | Y | |
| YAMAA-01 | ACTOT | Week 16 | 16 | 25 | — | 3 | Y | |
| YAMAA-01 | ACTOT | Week 24 | 24 | 27 | — | 4 | Y | |
| YAMAA-01 | ACTOT | Baseline | 0 | 30 | — | 1 | Y | |
| YAMAA-01 | ACTOT | Week 8 | 8 | 31 | — | 2 | Y | |
| YAMAA-01 | ACTOT | Week 16 | 16 | 31 | LOCF | 2 | Y | |
| YAMAA-01 | ACTOT | Week 24 | 24 | 31 | LOCF | 2 | Y | |
| YAMAA-01 | ACTOT | Baseline | 0 | 18 | — | 1 | Y | |
| YAMAA-01 | ACTOT | Week 8 | 8 | 20 | — | 2 | Y | |
| YAMAA-01 | ACTOT | Week 16 | 16 | — | — | 3 | Y | |
| YAMAA-01 | ACTOT | Week 16 | 16 | 20 | LOCF | 2 | Y | |
| YAMAA-01 | ACTOT | Week 24 | 24 | 20 | LOCF | 2 | Y | |
| YAMAA-01 | ACTOT | Week 16 | 16 | 15 | — | 1 | Y | |
| YAMAA-01 | ACTOT | Week 24 | 24 | 17 | — | 2 | Y | |
| YAMAA-01 | ACTOT | Baseline | 0 | 26 | — | 1 | N | |
| YAMAA-01 | ACTOT | Week 8 | 8 | 28 | — | 2 | N | |
| YAMAA-01 | ACTOT | Baseline | 0 | 12 | — | 1 | Y | |
| YAMAA-01 | ACTOT | Week 8 | 8 | 0 | — | 2 | Y | |
| YAMAA-01 | ACTOT | Week 16 | 16 | 0 | LOCF | 2 | Y | |
| YAMAA-01 | ACTOT | Week 24 | 24 | 0 | LOCF | 2 | Y | |
| YAMAA-01 | ACTOT | Baseline | 0 | 25 | — | 1 | Y |
Human review and assessment
| Dataset Name | Variable Name | Variable Label | Type | Codelist/Controlled Terms | Core | Computational Method | Origin |
|---|---|---|---|---|---|---|---|
| ADQS | STUDYID | Study Identifier | character | Set per constructed row; see the Row construction sheet. | Derived | ||
| ADQS | USUBJID | Unique Subject Identifier | character | Set per constructed row; see the Row construction sheet. | Derived | ||
| ADQS | PARAMCD | Parameter Code | character | Set per constructed row; see the Row construction sheet. | Derived | ||
| ADQS | AVISIT | Analysis Visit | character | Set per constructed row; see the Row construction sheet. | Derived | ||
| ADQS | AVISITN | Analysis Visit (N) | numeric | Set per constructed row; see the Row construction sheet. | Derived | ||
| ADQS | AVAL | Analysis Value | numeric | Set per constructed row; see the Row construction sheet. | Derived | ||
| ADQS | DTYPE | Derivation Type | character | Set per constructed row; see the Row construction sheet. | Derived | ||
| ADQS | QSSEQ | Sequence Number | numeric | Set per constructed row; see the Row construction sheet. | Derived | ||
| ADQS | EFFFL | Efficacy Population Flag | character | Set per constructed row; see the Row construction sheet. | Derived |
| Template | Include when | STUDYID | USUBJID | PARAMCD | AVISIT | AVISITN | AVAL | DTYPE | QSSEQ | EFFFL |
|---|---|---|---|---|---|---|---|---|---|---|
| collected | Copy QS.STUDYID | Copy QS.USUBJID | Copy QS.QSTESTCD | Copy QS.VISIT | Copy QS.VISITNUM | Copy QS.QSSTRESN | Constant "None" | Copy QS.QSSEQ | Copy ADSL.EFFFL | |
| week_8 | ADSL.EFFFL = 'Y' AND COLLECTED.QSSTRESN IS NULL AND LAST_SCORE.QSSTRESN IS NOT NULL | Copy ADSL.STUDYID | Copy ADSL.USUBJID | Constant "ACTOT" | Constant "Week 8" | Constant "8" | Copy QSSTRESN from the last QS record whose STUDYID equals STUDYID, USUBJID equals USUBJID and QSTESTCD equals PARAMCD, where AVISITN is VISITNUM or more, where QS.VISITNUM > 0 AND QS.QSSTRESN IS NOT NULL, ordered by QS.VISITNUM, and no match yields blank | Constant "LOCF" | Copy QSSEQ from the last QS record whose STUDYID equals STUDYID, USUBJID equals USUBJID and QSTESTCD equals PARAMCD, where AVISITN is VISITNUM or more, where QS.VISITNUM > 0 AND QS.QSSTRESN IS NOT NULL, ordered by QS.VISITNUM, and no match yields blank | Copy ADSL.EFFFL |
| week_16 | ADSL.EFFFL = 'Y' AND COLLECTED.QSSTRESN IS NULL AND LAST_SCORE.QSSTRESN IS NOT NULL | Copy ADSL.STUDYID | Copy ADSL.USUBJID | Constant "ACTOT" | Constant "Week 16" | Constant "16" | Copy QSSTRESN from the last QS record whose STUDYID equals STUDYID, USUBJID equals USUBJID and QSTESTCD equals PARAMCD, where AVISITN is VISITNUM or more, where QS.VISITNUM > 0 AND QS.QSSTRESN IS NOT NULL, ordered by QS.VISITNUM, and no match yields blank | Constant "LOCF" | Copy QSSEQ from the last QS record whose STUDYID equals STUDYID, USUBJID equals USUBJID and QSTESTCD equals PARAMCD, where AVISITN is VISITNUM or more, where QS.VISITNUM > 0 AND QS.QSSTRESN IS NOT NULL, ordered by QS.VISITNUM, and no match yields blank | Copy ADSL.EFFFL |
| week_24 | ADSL.EFFFL = 'Y' AND COLLECTED.QSSTRESN IS NULL AND LAST_SCORE.QSSTRESN IS NOT NULL | Copy ADSL.STUDYID | Copy ADSL.USUBJID | Constant "ACTOT" | Constant "Week 24" | Constant "24" | Copy QSSTRESN from the last QS record whose STUDYID equals STUDYID, USUBJID equals USUBJID and QSTESTCD equals PARAMCD, where AVISITN is VISITNUM or more, where QS.VISITNUM > 0 AND QS.QSSTRESN IS NOT NULL, ordered by QS.VISITNUM, and no match yields blank | Constant "LOCF" | Copy QSSEQ from the last QS record whose STUDYID equals STUDYID, USUBJID equals USUBJID and QSTESTCD equals PARAMCD, where AVISITN is VISITNUM or more, where QS.VISITNUM > 0 AND QS.QSSTRESN IS NOT NULL, ordered by QS.VISITNUM, and no match yields blank | Copy ADSL.EFFFL |
| Version | Date | Author | Description | Reviewer | Sign-off |
|---|---|---|---|---|---|
| 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-adqs-missed-visit-locf/full.md
Edit27 linesFollowing CDISC ADaM standards, use the provided ADSL and QS datasets to create an ADQS dataset with one record per collected QS record and per carried-forward visit.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, PARAMCD, AVISIT, AVISITN, AVAL, DTYPE, QSSEQ, EFFFL
Each QS record is a record of the output, including a record whose QSSTRESN is empty. On a collected record, PARAMCD is QSTESTCD, AVISIT is VISIT, AVISITN is VISITNUM, AVAL is QSSTRESN, and QSSEQ is the record's QSSEQ. The scheduled visits are "Week 8" (AVISITN 8), "Week 16" (AVISITN 16), and "Week 24" (AVISITN 24). A scheduled visit is missed when the subject has no QS record with a QSSTRESN value there. For each scheduled visit missed by a subject whose EFFFL in ADSL is "Y", the output adds a record with PARAMCD "ACTOT", that visit's AVISIT and AVISITN, and DTYPE "LOCF", when the subject has a QSSTRESN value at an earlier visit after baseline (VISITNUM greater than 0). Its AVAL is the QSSTRESN of the closest such earlier visit, and its QSSEQ is the QSSEQ of that record. A baseline score is never carried forward, so a missed visit with no earlier post-baseline score adds no record. A score of zero counts as a score. DTYPE has no value on a collected record. EFFFL is the subject's efficacy population flag from ADSL, repeated on every record. A subject outside the efficacy population keeps the collected records and gains no added record.
Read the source datasets from /app/input and save the completed dataset as /app/output/adqs.csv.
prompts/adam-adqs-missed-visit-locf/conventions.md
Edit12 linesFollowing CDISC ADaM standards, use the provided ADSL and QS datasets to create an ADQS dataset with one record per collected QS record and per carried-forward visit.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, PARAMCD, AVISIT, AVISITN, AVAL, DTYPE, QSSEQ, EFFFL
The scheduled visits are "Week 8" (AVISITN 8), "Week 16" (AVISITN 16), and "Week 24" (AVISITN 24). PARAMCD is "ACTOT". DTYPE is "LOCF" or has no value.
Read the source datasets from /app/input and save the completed dataset as /app/output/adqs.csv.
prompts/adam-adqs-missed-visit-locf/brief.md
Edit9 linesFollowing CDISC ADaM standards, use the provided ADSL and QS datasets to create an ADQS dataset with one record per collected QS record and per carried-forward visit.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, PARAMCD, AVISIT, AVISITN, AVAL, DTYPE, QSSEQ, EFFFL
Read the source datasets from /app/input and save the completed dataset as /app/output/adqs.csv.
R
Edit3 lineslibrary(yamaa)yamaa_spec("spec.yaml")$run()$outputPython
Edit3 linesimport yamaayamaa.spec("spec.yaml").run().outputsolutions/adam-adqs-missed-visit-locf/result.R
Edit77 lines# Reference solution for the yamaa benchmark adam-adqs-missed-visit-locf (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(tidyr)adsl <- read_csv( "/app/input/adsl.csv", col_types = cols(.default = col_character()))qs <- read_csv( "/app/input/qs.csv", col_types = cols( QSSEQ = col_integer(), QSSTRESN = col_double(), VISITNUM = col_integer(), .default = col_character() ))# Every QS record is kept, an empty score included.collected <- qs |> left_join( select(adsl, STUDYID, USUBJID, EFFFL), by = c("STUDYID", "USUBJID") ) |> transmute( STUDYID, USUBJID, PARAMCD = QSTESTCD, AVISIT = VISIT, AVISITN = VISITNUM, AVAL = QSSTRESN, DTYPE = NA_character_, QSSEQ, EFFFL )# Scores by subject and visit; a score of zero counts.scored <- qs |> filter(!is.na(QSSTRESN)) |> select(STUDYID, USUBJID, VISITNUM, QSSTRESN, QSSEQ)scheduled <- tibble( AVISIT = c("Week 8", "Week 16", "Week 24"), AVISITN = c(8L, 16L, 24L))# Each missed scheduled visit of an efficacy subject, carried from the# closest earlier post-baseline score; no such score adds no record.missed <- adsl |> filter(EFFFL %in% "Y") |> select(STUDYID, USUBJID, EFFFL) |> crossing(scheduled) |> anti_join( scored, by = c("STUDYID", "USUBJID", "AVISITN" = "VISITNUM") )carried <- missed |> inner_join( scored, by = c("STUDYID", "USUBJID"), relationship = "many-to-many" ) |> filter(VISITNUM > 0, VISITNUM < AVISITN) |> group_by(STUDYID, USUBJID, AVISITN) |> slice_max(VISITNUM, n = 1, with_ties = FALSE) |> ungroup() |> transmute( STUDYID, USUBJID, PARAMCD = "ACTOT", AVISIT, AVISITN, AVAL = QSSTRESN, DTYPE = "LOCF", QSSEQ, EFFFL )adqs <- bind_rows(collected, carried) |> arrange(USUBJID, AVISITN, !is.na(DTYPE))dir.create("/app/output", showWarnings = FALSE)write_csv(adqs, "/app/output/adqs.csv", na = "")solutions/adam-adqs-missed-visit-locf/result.py
Edit94 lines# Reference solution for the yamaa benchmark adam-adqs-missed-visit-locf (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.import csvINPUT_DIR = "/app/input"OUTPUT_DIR = "/app/output"SCHEDULED = [("Week 8", 8), ("Week 16", 16), ("Week 24", 24)]def main(): with open(f"{INPUT_DIR}/adsl.csv", newline="") as f: adsl = list(csv.DictReader(f)) efffl = {(r["STUDYID"], r["USUBJID"]): r["EFFFL"] for r in adsl} with open(f"{INPUT_DIR}/qs.csv", newline="") as f: qs = list(csv.DictReader(f)) # Every QS record is kept, an empty score included. rows = [] for r in qs: rows.append( { "STUDYID": r["STUDYID"], "USUBJID": r["USUBJID"], "PARAMCD": r["QSTESTCD"], "AVISIT": r["VISIT"], "AVISITN": r["VISITNUM"], "AVAL": r["QSSTRESN"], "DTYPE": "", "QSSEQ": r["QSSEQ"], "EFFFL": efffl.get((r["STUDYID"], r["USUBJID"]), ""), } ) # Scores by subject and visit number. A score of zero counts. scored = {} for r in qs: if r["QSSTRESN"].strip() != "": key = (r["STUDYID"], r["USUBJID"]) scored.setdefault(key, {})[int(r["VISITNUM"])] = r # A carried-forward record for each missed scheduled visit of an # efficacy subject, from the closest earlier post-baseline score. for (studyid, usubjid), flag in efffl.items(): if flag != "Y": continue visits = scored.get((studyid, usubjid), {}) for avisit, avisitn in SCHEDULED: if avisitn in visits: continue earlier = [n for n in visits if 0 < n < avisitn] if not earlier: continue source = visits[max(earlier)] rows.append( { "STUDYID": studyid, "USUBJID": usubjid, "PARAMCD": "ACTOT", "AVISIT": avisit, "AVISITN": str(avisitn), "AVAL": source["QSSTRESN"], "DTYPE": "LOCF", "QSSEQ": source["QSSEQ"], "EFFFL": flag, } ) rows.sort(key=lambda r: (r["USUBJID"], int(r["AVISITN"]), r["DTYPE"])) columns = [ "STUDYID", "USUBJID", "PARAMCD", "AVISIT", "AVISITN", "AVAL", "DTYPE", "QSSEQ", "EFFFL", ] with open(f"{OUTPUT_DIR}/adqs.csv", "w", newline="") as f: writer = csv.DictWriter(f, fieldnames=columns) writer.writeheader() writer.writerows(rows)if __name__ == "__main__": main()solutions/adam-adqs-missed-visit-locf/result.sas
Edit33 lines/* opensas reference solution for the yamaa benchmark adam-adqs-missed-visit-locf. 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 EFFFL $1024; infile "/app/input/adsl.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. EFFFL : $char1024.;run;data qs; length STUDYID DOMAIN USUBJID QSTESTCD QSTEST QSSTAT VISIT $1024; infile "/app/input/qs.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. DOMAIN : $char1024. USUBJID : $char1024. QSSEQ QSTESTCD : $char1024. QSTEST : $char1024. QSSTRESN QSSTAT : $char1024. VISITNUM VISIT : $char1024.;run;proc sql; create table collected as select a.STUDYID,a.USUBJID,a.QSTESTCD as PARAMCD,a.VISIT as AVISIT,a.VISITNUM as AVISITN,a.QSSTRESN as AVAL,'' as DTYPE,a.QSSEQ,b.EFFFL from qs as a left join adsl as b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID; create table scored as select STUDYID,USUBJID,QSTESTCD,VISITNUM,QSSTRESN,QSSEQ from qs where not missing(QSSTRESN);quit;data schedule; length AVISIT PARAMCD $1024; set adsl; if EFFFL='Y'; PARAMCD='ACTOT'; do AVISITN=8,16,24; AVISIT=catx(' ','Week',strip(put(AVISITN,best32.))); output; end; run;proc sql; create table missed as select a.* from schedule as a left join scored as b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID and a.PARAMCD=b.QSTESTCD and a.AVISITN=b.VISITNUM where missing(b.VISITNUM); create table candidates as select a.*,b.QSSTRESN as AVAL,b.QSSEQ,b.VISITNUM as sourcevisit from missed as a inner join scored as b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID and a.PARAMCD=b.QSTESTCD and b.VISITNUM>0 and b.VISITNUM<a.AVISITN;quit;proc sort data=candidates; by STUDYID USUBJID PARAMCD AVISITN descending sourcevisit; run;data carried; length DTYPE $11; set candidates; by STUDYID USUBJID PARAMCD AVISITN; if first.AVISITN; DTYPE='LOCF'; run;data result; length DTYPE $11; set collected carried; run;proc sql; create table final as select STUDYID, USUBJID, PARAMCD, AVISIT, AVISITN, AVAL, DTYPE, QSSEQ, EFFFL from result;quit;proc export data=final outfile="/app/output/adqs.csv" dbms=csv replace; run;
yamaa