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: keep each subject's investigator comments in CMNT and
whether any was collected in CMNTFL.
Input: demographics (DM) rows listing the subjects, plus SDTM
comments (CO) records, one per comment, carrying the comment text
(COVAL), its continuation (COVAL1) and the comment's sequence
number (COSEQ). A comment longer than the 200 characters a transport
file allows continues in COVAL1, split between words.
Variables:
CMNTis the subject's comments exactly as the investigator recorded them: a comma inside a comment, quotation marks around a subject's own words, and a line break in the middle of a comment all reach the result unchanged. A comment split acrossCOVALandCOVAL1is joined back with one space; an emptyCOVAL1, quoted or not, adds nothing. A subject's comments are joined inCOSEQorder, separated by a semicolon and a space. It is absent when the subject has no comment.CMNTFLisYwhen the subject has a comment andNwhen none was collected.
Inputs
Under review2 source filesinput/co.csv
Edit6 rows| STUDYID | DOMAIN | RDOMAIN | USUBJID | COSEQ | COVAL | COVAL1 | COEVAL | CODTC |
|---|---|---|---|---|---|---|---|---|
| YAMAA-01 | CO | — | 1 | Dose reduced, per protocol | — | INVESTIGATOR | 2025-02-03 | |
| YAMAA-01 | CO | — | 1 | Subject said "felt fine" | — | INVESTIGATOR | 2025-02-10 | |
| YAMAA-01 | CO | — | 1 | Visit missed rescheduled | — | INVESTIGATOR | 2025-02-17 | |
| YAMAA-01 | CO | — | 1 | Subject reported mild dizziness after each morning dose in weeks 2 to 4. The investigator reviewed all concomitant medications and found no interaction. The dose was not changed and the subject agreed | to keep a daily symptom diary until the next visit. | INVESTIGATOR | 2025-03-03 | |
| YAMAA-01 | CO | — | 2 | Visit 4 done by phone | — | INVESTIGATOR | 2025-04-07 | |
| YAMAA-01 | CO | — | 1 | Subject moved to another city | — | INVESTIGATOR | 2025-03-10 |
input/dm.csv
Edit6 rows| STUDYID | USUBJID |
|---|---|
| YAMAA-01 | |
| YAMAA-01 | |
| YAMAA-01 | |
| YAMAA-01 | |
| YAMAA-01 | |
| YAMAA-01 |
Expected output
Under review6 expected rowsexpected/adsl.csv
Edit6 rows| STUDYID | USUBJID | CMNT | CMNTFL |
|---|---|---|---|
| YAMAA-01 | Dose reduced, per protocol | Y | |
| YAMAA-01 | Subject said "felt fine" | Y | |
| YAMAA-01 | Visit missed rescheduled | Y | |
| YAMAA-01 | — | N | |
| YAMAA-01 | Subject reported mild dizziness after each morning dose in weeks 2 to 4. The investigator reviewed all concomitant medications and found no interaction. The dose was not changed and the subject agreed to keep a daily symptom diary until the next visit. | Y | |
| YAMAA-01 | Subject moved to another city; Visit 4 done by phone | Y |
Human review and assessment
| Dataset Name | Variable Name | Variable Label | Type | Codelist/Controlled Terms | Core | Computational Method | Origin |
|---|---|---|---|---|---|---|---|
| ADSL | STUDYID | Study Identifier | character | Copy value from DM.STUDYID. | Predecessor | ||
| ADSL | USUBJID | Unique Subject Identifier | character | Copy value from DM.USUBJID. | Predecessor | ||
| ADSL | CMNT | Investigator Comment | character | Aggregate STR_JOIN(COTEXT) over records matching on the shared output keys, with COTEXT as if CO.COVAL1 IS NULL then "CO.COVAL"; otherwise fill the template "{CO.COVAL} {CO.COVAL1}". | Derived | ||
| ADSL | CMNTFL | Comment Collected Flag | character | If CMNT IS NULL then "N"; otherwise "Y". | 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-investigator-comment/full.md
Edit20 linesFollowing CDISC ADaM standards, use the provided CO and DM datasets to create an ADSL dataset with one record per subject.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, CMNT, CMNTFL
Each CO record is one investigator comment. COVAL holds the comment, and a comment longer than 200 characters continues in COVAL1, split between words, so the comment is COVAL followed by one space and COVAL1. A COVAL1 that is empty, quoted or not, adds nothing. CMNT is the subject's comments exactly as the investigator recorded them: a comma inside a comment, quotation marks around a subject's own words, and a line break in the middle of a comment all reach the result unchanged. When a subject has several comments, CMNT joins them in COSEQ order, separated by a semicolon and a space ("; "). CMNT has no value when the subject has no CO record. CMNTFL is "Y" when the subject has a comment and "N" when none was collected.
Read the source datasets from /app/input and save the completed dataset as /app/output/adsl.csv.
prompts/adam-adsl-investigator-comment/conventions.md
Edit13 linesFollowing CDISC ADaM standards, use the provided CO and DM datasets to create an ADSL dataset with one record per subject.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, CMNT, CMNTFL
A comment split across COVAL and COVAL1 joins back with one space, and a subject's comments join in COSEQ order, separated by a semicolon and a space ("; "). CMNT keeps commas, quotation marks and line breaks unchanged, or has no value. CMNTFL is "Y" or "N".
Read the source datasets from /app/input and save the completed dataset as /app/output/adsl.csv.
prompts/adam-adsl-investigator-comment/brief.md
Edit8 linesFollowing CDISC ADaM standards, use the provided CO and DM datasets to create an ADSL dataset with one record per subject.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, CMNT, CMNTFL
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-investigator-comment/result.R
Edit38 lines# Reference solution for the yamaa benchmark adam-adsl-investigator-comment (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(.default = col_character()), na = "")co <- read_csv( "/app/input/co.csv", col_types = cols(COSEQ = col_integer(), .default = col_character()), na = "", trim_ws = FALSE)# Each comment is COVAL, then COVAL1 after one space when it continues# there; a subject's comments join in COSEQ order with "; ".comments <- co |> mutate(TEXT = if_else(is.na(COVAL1) | COVAL1 == "", COVAL, paste(COVAL, COVAL1))) |> arrange(USUBJID, COSEQ) |> group_by(USUBJID) |> summarise(CMNT = paste(TEXT, collapse = "; "), .groups = "drop")adsl <- dm |> left_join(comments, by = "USUBJID") |> mutate(CMNTFL = if_else(is.na(CMNT), "N", "Y")) |> select(STUDYID, USUBJID, CMNT, CMNTFL) |> arrange(USUBJID)dir.create("/app/output", showWarnings = FALSE)write_csv(adsl, "/app/output/adsl.csv", na = "")solutions/adam-adsl-investigator-comment/result.py
Edit63 lines# Reference solution for the yamaa benchmark adam-adsl-investigator-comment (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."""Create ADSL (one record per subject) from DM and CO.Each CO record is one comment: COVAL, then COVAL1 after one space whenthe comment continues there. CMNT joins a subject's comments in COSEQorder with "; "; CMNTFL is "Y" when the subject has a comment and "N"when none was collected."""import csvimport osINPUT_DIR = "/app/input"OUTPUT_DIR = "/app/output"FIELDNAMES = ["STUDYID", "USUBJID", "CMNT", "CMNTFL"]def read(name): with open(os.path.join(INPUT_DIR, name), newline="", encoding="utf-8") as handle: return list(csv.DictReader(handle))def main(): dm_rows = read("dm.csv") comments = {} for row in sorted(read("co.csv"), key=lambda r: int(r["COSEQ"])): text = row["COVAL"] if row["COVAL1"]: text += " " + row["COVAL1"] comments.setdefault(row["USUBJID"], []).append(text) adsl_rows = [] for row in dm_rows: texts = comments.get(row["USUBJID"], []) adsl_rows.append( { "STUDYID": row["STUDYID"], "USUBJID": row["USUBJID"], "CMNT": "; ".join(texts), "CMNTFL": "Y" if texts else "N", } ) os.makedirs(OUTPUT_DIR, exist_ok=True) with open( os.path.join(OUTPUT_DIR, "adsl.csv"), "w", newline="", encoding="utf-8", ) as handle: writer = csv.DictWriter(handle, fieldnames=FIELDNAMES) writer.writeheader() writer.writerows(adsl_rows)if __name__ == "__main__": main()solutions/adam-adsl-investigator-comment/result.sas
Edit132 lines/* opensas reference solution for the yamaa benchmark adam-adsl-investigator-comment. 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 $40; infile "/app/input/dm.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char40. USUBJID : $char40.;run;/* Read CO line by line and split the fields here: a quoted comment can hold commas, doubled quotation marks, and line breaks, so each field's length is counted as it is read. An empty field, quoted or not, has length zero. */data co; infile "/app/input/co.csv" firstobs=2 truncover lrecl=32767; length USUBJID $40 COVAL COVAL1 FIELD $400 CH $1; retain USUBJID COVAL COVAL1 FIELD "" COSEQ VALLEN VAL1LEN FLEN NFIELD INQUOTE 0; keep USUBJID COSEQ COVAL COVAL1 VALLEN VAL1LEN; input; if lengthn(_infile_) = 0 and not INQUOTE then delete; RECLEN = lengthc(_infile_); do I = 1 to RECLEN; CH = substr(_infile_, I, 1); if INQUOTE and CH = '"' then do; /* A doubled quotation mark inside quotes is one mark of the value. */ if I < RECLEN and substr(_infile_, I + 1, 1) = '"' then do; link addchar; I + 1; end; else INQUOTE = 0; end; else if not INQUOTE and CH = '"' then INQUOTE = 1; else if not INQUOTE and CH = "," then link endfield; else link addchar; end; /* A line break inside quotes is part of the comment; anywhere else it ends the record. */ if INQUOTE then do; CH = '0A'x; link addchar; end; else do; link endfield; output; call missing(USUBJID, COVAL, COVAL1); COSEQ = .; VALLEN = 0; VAL1LEN = 0; NFIELD = 0; end; return;/* Append one character, a space included, to the field being read. */addchar: if FLEN = 0 then FIELD = CH; else FIELD = substr(FIELD, 1, FLEN) || CH; FLEN + 1; return;/* Store the field just read under its column. */endfield: NFIELD + 1; if NFIELD = 4 then USUBJID = FIELD; else if NFIELD = 5 then COSEQ = input(FIELD, best32.); else if NFIELD = 6 then do; COVAL = FIELD; VALLEN = FLEN; end; else if NFIELD = 7 then do; COVAL1 = FIELD; VAL1LEN = FLEN; end; FIELD = ""; FLEN = 0; return;run;/* Each comment is COVAL, then COVAL1 after one space when it continues there; a subject's comments join in COSEQ order with "; ". */proc sort data=co; by USUBJID COSEQ; run;data comments; set co; by USUBJID; length TEXT $1000 CMNT $2000; retain CMNT "" CMNTLEN 0; keep USUBJID CMNT CMNTLEN; TEXT = substr(COVAL, 1, VALLEN); TLEN = VALLEN; if VAL1LEN > 0 then do; TEXT = substr(COVAL, 1, VALLEN) || " " || substr(COVAL1, 1, VAL1LEN); TLEN = VALLEN + 1 + VAL1LEN; end; if first.USUBJID then do; CMNT = TEXT; CMNTLEN = TLEN; end; else do; CMNT = substr(CMNT, 1, CMNTLEN) || "; " || substr(TEXT, 1, TLEN); CMNTLEN = CMNTLEN + 2 + TLEN; end; if last.USUBJID then output;run;proc sql; create table adsl as select d.STUDYID, d.USUBJID, case when c.CMNTLEN > 0 then c.CMNT else "" end as CMNT length=2000, case when c.CMNTLEN > 0 then "Y" else "N" end as CMNTFL length=1, coalesce(c.CMNTLEN, 0) as CMNTLEN from dm as d left join comments as c on d.USUBJID = c.USUBJID order by d.STUDYID, d.USUBJID;quit;/* Write the file directly: the comment quoted, with its quotation marks doubled, at its recorded length. */data _null_; set adsl; file "/app/output/adsl.csv"; length QUOTED $4000 OUTLINE $4200; if _n_ = 1 then put "STUDYID,USUBJID,CMNT,CMNTFL"; if CMNTLEN = 0 then OUTLINE = trim(STUDYID) || "," || trim(USUBJID) || ",," || CMNTFL; else do; QUOTED = tranwrd(CMNT, '"', '""'); QLEN = CMNTLEN + countc(CMNT, '"'); OUTLINE = trim(STUDYID) || "," || trim(USUBJID) || ',"' || substr(QUOTED, 1, QLEN) || '",' || CMNTFL; end; put OUTLINE;run;
yamaa