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: build one record per skin compartment a subject has for
the test code (IL13), carrying LBTESTCD, LBTEST, LBSPEC,
LBLOC, LBORRES, LBORRESU, LBSTRESN, and LBSTAT.
Input: one row per subject carrying cohort, lesional result, non-lesional result, and unit.
Variables:
LBTESTCDisIL13on every record.LBTESTisInterleukin 13on every record.LBSPECisSKINon every record.LBLOCisLESIONALon the lesional record andNON-LESIONALon the non-lesional record; the lesional record is built only when a cohort is recorded and is notNONAD, while every subject gets the non-lesional record.LBORRESis the collected result as reported, taken from the lesional result on lesional records and from the non-lesional result on non-lesional records; blank when the expected sample was not analysed.LBORRESUis the collected unit, taken on every record, including records whose result is blank.LBSTRESNis the numeric form of the reported result; missing when the reported result is blank. A result that is not a number stops the run.LBSTATisNOT DONEwhen the reported result is blank; blank otherwise.
Note: a blank result with NOT DONE means the compartment
exists but its sample was not analysed, while a missing lesional
record means the subject has no lesional compartment.
Inputs
Under review1 source fileinput/bx_raw.csv
Edit3 rows| STUDYID | USUBJID | COHORT | LESRES | NLESRES | RESU |
|---|---|---|---|---|---|
| CATH | AD | 4.2 | 1.1 | pg/mL | |
| CATH | PSORIASIS | — | 0.9 | pg/mL | |
| CATH | NONAD | — | 0.8 | pg/mL |
Expected output
Under review5 expected rowsexpected/lb.csv
Edit5 rows| DOMAIN | STUDYID | USUBJID | LBSEQ | LBTESTCD | LBTEST | LBSPEC | LBLOC | LBORRES | LBORRESU | LBSTRESN | LBSTAT |
|---|---|---|---|---|---|---|---|---|---|---|---|
| LB | CATH | 1 | IL13 | Interleukin 13 | SKIN | LESIONAL | 4.2 | pg/mL | 4.2 | — | |
| LB | CATH | 1 | IL13 | Interleukin 13 | SKIN | LESIONAL | — | pg/mL | — | NOT DONE | |
| LB | CATH | 2 | IL13 | Interleukin 13 | SKIN | NON-LESIONAL | 1.1 | pg/mL | 1.1 | — | |
| LB | CATH | 2 | IL13 | Interleukin 13 | SKIN | NON-LESIONAL | 0.9 | pg/mL | 0.9 | — | |
| LB | CATH | 1 | IL13 | Interleukin 13 | SKIN | NON-LESIONAL | 0.8 | pg/mL | 0.8 | — |
Human review and assessment
| Variable Name | Variable Label | Type | Length | Controlled Terms or Format | Origin | Core | Conversion Definition | Variable Type | Variable Order | Comments for Define |
|---|---|---|---|---|---|---|---|---|---|---|
| DOMAIN | Domain Abbreviation | Char | Assigned | Set constant value "LB". | SDTM | 1 | ||||
| STUDYID | Study Identifier | Char | Collected | Copy value from BX_RAW.STUDYID. | SDTM | 2 | ||||
| USUBJID | Unique Subject Identifier | Char | Collected | Copy value from BX_RAW.USUBJID. | SDTM | 3 | ||||
| LBTESTCD | Lab Test or Examination Short Name | Char | Assigned | Set constant value "IL13". | SDTM | 4 | ||||
| LBTEST | Lab Test or Examination Name | Char | Assigned | Set constant value "Interleukin 13". | SDTM | 5 | ||||
| LBSPEC | Specimen Material Type | Char | Assigned | Set constant value "SKIN". | SDTM | 6 | ||||
| LBLOC | Location Used for Measurement | Char | Derived | Set per constructed row; see the Row construction sheet. | SDTM | 7 | ||||
| LBSEQ | Sequence Number | Num | Derived | Row number within each group of STUDYID, USUBJID, ordered by LBLOC then LBTESTCD. | SDTM | 8 | ||||
| LBORRES | Result or Finding in Original Units | Char | Derived | Set per constructed row; see the Row construction sheet. | SDTM | 9 | ||||
| LBORRESU | Original Units | Char | Collected | Copy value from BX_RAW.RESU. | SDTM | 10 | ||||
| LBSTRESN | Numeric Result/Finding in Standard Units | Num | Derived | Copy value from LBORRES. | SDTM | 11 | ||||
| LBSTAT | Completion Status | Char | NOT DONE | Derived | If LBORRES IS NULL then "NOT DONE"; otherwise blank. | SDTM | 12 |
| Template | Include when | LBLOC | LBORRES |
|---|---|---|---|
| lesional | BX_RAW.COHORT <> 'NONAD' | Constant "LESIONAL" | Copy BX_RAW.LESRES |
| non_lesional | Constant "NON-LESIONAL" | Copy BX_RAW.NLESRES |
| Variable | Permitted values |
|---|---|
| LBSTAT | NOT DONE |
| 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/sdtm-lb-compartments/full.md
Edit25 linesFollowing CDISC SDTM standards, use the provided BX_RAW dataset to create an LB dataset with one record per skin compartment per subject.
The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, LBSEQ, LBTESTCD, LBTEST, LBSPEC, LBLOC, LBORRES, LBORRESU, LBSTRESN, LBSTAT
DOMAIN is "LB" on every record. LBTESTCD is "IL13" and LBTEST is "Interleukin 13" on every record. LBSPEC is "SKIN" on every record. Every subject has a non-lesional record, and a subject has a lesional record as well when a cohort is recorded for the subject and the cohort is not "NONAD". LBLOC is "LESIONAL" on the lesional record and "NON-LESIONAL" on the non-lesional record. LBORRES is the subject's lesional result on the lesional record and the subject's non-lesional result on the non-lesional record, as reported; it has no value when the compartment's sample was not analysed. LBORRESU is the collected unit on every record, including a record whose result has no value. LBSTRESN is the numeric form of the reported result, and has no value when the reported result has no value. LBSTAT is "NOT DONE" when the reported result has no value, and has no value otherwise. LBSEQ numbers a subject's records from 1, the lesional record before the non-lesional record.
Read the source datasets from /app/input and save the completed dataset as /app/output/lb.csv.
prompts/sdtm-lb-compartments/conventions.md
Edit14 linesFollowing CDISC SDTM standards, use the provided BX_RAW dataset to create an LB dataset with one record per skin compartment per subject.
The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, LBSEQ, LBTESTCD, LBTEST, LBSPEC, LBLOC, LBORRES, LBORRESU, LBSTRESN, LBSTAT
DOMAIN is "LB" on every record. LBTESTCD is "IL13" and LBTEST is "Interleukin 13" on every record. LBSPEC is "SKIN" on every record. LBLOC is "LESIONAL" or "NON-LESIONAL". LBSTAT is "NOT DONE" or has no value.
Read the source datasets from /app/input and save the completed dataset as /app/output/lb.csv.
prompts/sdtm-lb-compartments/brief.md
Edit9 linesFollowing CDISC SDTM standards, use the provided BX_RAW dataset to create an LB dataset with one record per skin compartment per subject.
The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, LBSEQ, LBTESTCD, LBTEST, LBSPEC, LBLOC, LBORRES, LBORRESU, LBSTRESN, LBSTAT
Read the source datasets from /app/input and save the completed dataset as /app/output/lb.csv.
R
Edit3 lineslibrary(yamaa)yamaa_spec("spec.yaml")$run()$outputPython
Edit3 linesimport yamaayamaa.spec("spec.yaml").run().outputsolutions/sdtm-lb-compartments/result.R
Edit50 lines# Reference solution for the yamaa benchmark sdtm-lb-compartments (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(purrr)bx <- read_csv( "/app/input/bx_raw.csv", col_types = cols(.default = col_character()))make_records <- function(study, subj, cohort, les, nles, unit) { locs <- list() if (!is.na(cohort) && cohort != "" && cohort != "NONAD") { locs <- append(locs, list(list(loc = "LESIONAL", res = les))) } locs <- append(locs, list(list(loc = "NON-LESIONAL", res = nles))) imap(locs, function(entry, i) { res <- entry$res if (is.na(res) || res == "") res <- NA_character_ num <- suppressWarnings(as.numeric(res)) tibble( DOMAIN = "LB", STUDYID = study, USUBJID = subj, LBSEQ = as.integer(i), LBTESTCD = "IL13", LBTEST = "Interleukin 13", LBSPEC = "SKIN", LBLOC = entry$loc, LBORRES = res, LBORRESU = unit, LBSTRESN = num, LBSTAT = if_else(is.na(res), "NOT DONE", NA_character_) ) }) |> bind_rows()}lb <- pmap_dfr( list(bx$STUDYID, bx$USUBJID, bx$COHORT, bx$LESRES, bx$NLESRES, bx$RESU), make_records) |> arrange(STUDYID, USUBJID, LBSEQ)dir.create("/app/output", showWarnings = FALSE)write_csv(lb, "/app/output/lb.csv", na = "")solutions/sdtm-lb-compartments/result.py
Edit90 lines# Reference solution for the yamaa benchmark sdtm-lb-compartments (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."""Build the SDTM LB dataset (Interleukin 13, skin compartments) from BX_RAW.One record per skin compartment per subject: every subject gets anon-lesional record, and a subject also gets a lesional record when acohort is recorded for the subject and the cohort is not "NONAD".Within a subject the lesional record is sequenced before thenon-lesional record."""import csvINPUT_CSV = "/app/input/bx_raw.csv"OUTPUT_CSV = "/app/output/lb.csv"COLUMNS = [ "DOMAIN", "STUDYID", "USUBJID", "LBSEQ", "LBTESTCD", "LBTEST", "LBSPEC", "LBLOC", "LBORRES", "LBORRESU", "LBSTRESN", "LBSTAT",]def make_record(subject, seq, location, result, unit): """Assemble one LB record for a single compartment.""" result = (result or "").strip() if result: numeric = float(result) status = "" else: numeric = "" status = "NOT DONE" return { "DOMAIN": "LB", "STUDYID": subject["STUDYID"], "USUBJID": subject["USUBJID"], "LBSEQ": seq, "LBTESTCD": "IL13", "LBTEST": "Interleukin 13", "LBSPEC": "SKIN", "LBLOC": location, "LBORRES": result, "LBORRESU": unit, "LBSTRESN": numeric, "LBSTAT": status, }def main(): with open(INPUT_CSV, newline="") as handle: subjects = list(csv.DictReader(handle)) records = [] for subject in subjects: unit = (subject.get("RESU") or "").strip() cohort = (subject.get("COHORT") or "").strip() seq = 0 # Lesional record first, when a cohort is recorded and is not NONAD. if cohort and cohort != "NONAD": seq += 1 records.append( make_record(subject, seq, "LESIONAL", subject.get("LESRES"), unit) ) # Every subject has a non-lesional record. seq += 1 records.append( make_record(subject, seq, "NON-LESIONAL", subject.get("NLESRES"), unit) ) with open(OUTPUT_CSV, "w", newline="") as handle: writer = csv.DictWriter(handle, fieldnames=COLUMNS) writer.writeheader() writer.writerows(records)if __name__ == "__main__": main()solutions/sdtm-lb-compartments/result.sas
Edit23 lines/* opensas reference solution for the yamaa benchmark sdtm-lb-compartments. Reads the benchmark inputs and derives the requested output. Execute with the existing opensas runtime: opensas /app/output/result.sas. */data bx_raw; length STUDYID USUBJID COHORT LESRES NLESRES RESU $1024; infile "/app/input/bx_raw.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. COHORT : $char1024. LESRES : $char1024. NLESRES : $char1024. RESU : $char1024.;run;data prepared; set bx_raw; length DOMAIN $2 LBTESTCD LBTEST LBSPEC LBLOC LBORRES LBORRESU LBSTAT $1024; DOMAIN='LB'; LBTESTCD='IL13'; LBTEST='Interleukin 13'; LBSPEC='SKIN'; LBORRESU=RESU;if not missing(COHORT) and COHORT ne 'NONAD' then do; LBLOC='LESIONAL'; LBORRES=LESRES; LBSTRESN=input(LESRES,?? best32.); LBSTAT=''; if missing(LESRES) then LBSTAT='NOT DONE'; LOCORD=1; output; end;LBLOC='NON-LESIONAL'; LBORRES=NLESRES; LBSTRESN=input(NLESRES,?? best32.); LBSTAT=''; if missing(NLESRES) then LBSTAT='NOT DONE'; LOCORD=2; output; run;proc sort data=prepared; by STUDYID USUBJID LOCORD; run;data result; set prepared; by STUDYID USUBJID; retain LBSEQ; if first.USUBJID then LBSEQ=0; LBSEQ+1;run;proc sql; create table final as select DOMAIN, STUDYID, USUBJID, LBSEQ, LBTESTCD, LBTEST, LBSPEC, LBLOC, LBORRES, LBORRESU, LBSTRESN, LBSTAT from result;quit;proc export data=final outfile="/app/output/lb.csv" dbms=csv replace; run;
yamaa