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: prepare the pharmacokinetic (PK) concentrations of a population
PK dataset that are below the limit of quantification for two ways of
handling them: as censored at the limit (the M3 method: CENS, DV,
MDV), and as half the limit for the first one after a quantified result
(the M6 method: DVM6, MDVM6), with the limit itself (ALLOQ).
Input: exposure (EX) records, one per administration, with the dose
(EXDOSE) and its date/time (EXSTDTC), and PK concentration (PC)
records of one analyte, one per sample, with the collection date/time
(PCDTC), the limit of quantification (PCLLOQ) and the result. A
quantified result has its number in PCSTRESN; a result below the limit
has none and is reported as text starting with < (PCSTRESC). An
administration gives a dose record, and a sample gives a concentration
record unless it was not done (PCSTAT).
Variables:
ASEQ: the record's number within the subject, in the order ofADTM, a sample before a dose at the same date/time.ADTM: the date/time of the administration or of the sample.EVID: 1 for a dose record and 0 for a concentration record.AMT: the dose given; empty on a concentration record.ALLOQ: the limit of quantification of the sample; empty on a dose record.CENS: 1 for a result below the limit; 0 for a quantified result and on a dose record.DV: the quantified result, or the limit for a result below it; empty on a dose record.MDV: 1 whenDVis empty and 0 otherwise.DVM6: the quantified result; for a result below the limit, half the limit when the subject's sample before it was quantified, and empty when that sample was also below the limit or when there is no sample before it. Empty on a dose record.MDVM6: 1 whenDVM6is empty and 0 otherwise.
Note: the sample before a result is the subject's latest earlier concentration record, whatever doses were given in between; a sample that was not done is no record, so it does not separate a result below the limit from the quantified result before it.
Inputs
Under review2 source filesinput/ex.csv
Edit4 rows| STUDYID | USUBJID | EXSEQ | EXTRT | EXDOSE | EXDOSU | EXSTDTC |
|---|---|---|---|---|---|---|
| YAMAA-01 | 1 | DRUG X | 100 | mg | 2025-03-10T08:00 | |
| YAMAA-01 | 1 | DRUG X | 100 | mg | 2025-03-10T09:00 | |
| YAMAA-01 | 2 | DRUG X | 100 | mg | 2025-03-11T09:00 | |
| YAMAA-01 | 1 | DRUG X | 50 | mg | 2025-03-12T08:30 |
input/pc.csv
Edit13 rows| STUDYID | USUBJID | PCSEQ | PCTESTCD | PCSTRESC | PCSTRESN | PCSTRESU | PCSTAT | PCLLOQ | PCTPT | PCDTC |
|---|---|---|---|---|---|---|---|---|---|---|
| YAMAA-01 | 1 | DRGX | <1.00 | — | ng/mL | — | 1 | Pre-dose | 2025-03-10T07:45 | |
| YAMAA-01 | 2 | DRGX | 6.42 | 6.42 | ng/mL | — | 1 | 1 h | 2025-03-10T09:00 | |
| YAMAA-01 | 3 | DRGX | 2.05 | 2.05 | ng/mL | — | 1 | 4 h | 2025-03-10T12:00 | |
| YAMAA-01 | 4 | DRGX | <1.00 | — | ng/mL | — | 1 | 12 h | 2025-03-10T20:00 | |
| YAMAA-01 | 5 | DRGX | <1.00 | — | ng/mL | — | 1 | 24 h | 2025-03-11T08:00 | |
| YAMAA-01 | 1 | DRGX | 3.90 | 3.9 | ng/mL | — | 0.5 | 2 h | 2025-03-10T11:00 | |
| YAMAA-01 | 2 | DRGX | <0.50 | — | ng/mL | — | 0.5 | Pre-dose | 2025-03-11T09:00 | |
| YAMAA-01 | 3 | DRGX | 4.18 | 4.18 | ng/mL | — | 0.5 | 2 h | 2025-03-11T11:00 | |
| YAMAA-01 | 4 | DRGX | — | — | — | NOT DONE | — | 12 h | 2025-03-11T21:00 | |
| YAMAA-01 | 5 | DRGX | <0.50 | — | ng/mL | — | 0.5 | 24 h | 2025-03-12T09:00 | |
| YAMAA-01 | 6 | DRGX | <0.50 | — | ng/mL | — | 0.5 | 48 h | 2025-03-13T09:00 | |
| YAMAA-01 | 1 | DRGX | <1.00 | — | ng/mL | — | 1 | 1 h | 2025-03-12T09:30 | |
| YAMAA-01 | 2 | DRGX | <1.00 | — | ng/mL | — | 1 | 2 h | 2025-03-12T10:30 |
Expected output
Under review16 expected rowsexpected/adppk.csv
Edit16 rows| STUDYID | USUBJID | ASEQ | ADTM | EVID | AMT | ALLOQ | CENS | DV | MDV | DVM6 | MDVM6 |
|---|---|---|---|---|---|---|---|---|---|---|---|
| YAMAA-01 | 1 | 2025-03-10T07:45:00 | 0 | — | 1 | 1 | 1 | 0 | — | 1 | |
| YAMAA-01 | 2 | 2025-03-10T08:00:00 | 1 | 100 | — | 0 | — | 1 | — | 1 | |
| YAMAA-01 | 3 | 2025-03-10T09:00:00 | 0 | — | 1 | 0 | 6.42 | 0 | 6.42 | 0 | |
| YAMAA-01 | 4 | 2025-03-10T12:00:00 | 0 | — | 1 | 0 | 2.05 | 0 | 2.05 | 0 | |
| YAMAA-01 | 5 | 2025-03-10T20:00:00 | 0 | — | 1 | 1 | 1 | 0 | 0.5 | 0 | |
| YAMAA-01 | 6 | 2025-03-11T08:00:00 | 0 | — | 1 | 1 | 1 | 0 | — | 1 | |
| YAMAA-01 | 1 | 2025-03-10T09:00:00 | 1 | 100 | — | 0 | — | 1 | — | 1 | |
| YAMAA-01 | 2 | 2025-03-10T11:00:00 | 0 | — | 0.5 | 0 | 3.9 | 0 | 3.9 | 0 | |
| YAMAA-01 | 3 | 2025-03-11T09:00:00 | 0 | — | 0.5 | 1 | 0.5 | 0 | 0.25 | 0 | |
| YAMAA-01 | 4 | 2025-03-11T09:00:00 | 1 | 100 | — | 0 | — | 1 | — | 1 | |
| YAMAA-01 | 5 | 2025-03-11T11:00:00 | 0 | — | 0.5 | 0 | 4.18 | 0 | 4.18 | 0 | |
| YAMAA-01 | 6 | 2025-03-12T09:00:00 | 0 | — | 0.5 | 1 | 0.5 | 0 | 0.25 | 0 | |
| YAMAA-01 | 7 | 2025-03-13T09:00:00 | 0 | — | 0.5 | 1 | 0.5 | 0 | — | 1 | |
| YAMAA-01 | 1 | 2025-03-12T08:30:00 | 1 | 50 | — | 0 | — | 1 | — | 1 | |
| YAMAA-01 | 2 | 2025-03-12T09:30:00 | 0 | — | 1 | 1 | 1 | 0 | — | 1 | |
| YAMAA-01 | 3 | 2025-03-12T10:30:00 | 0 | — | 1 | 1 | 1 | 0 | — | 1 |
Human review and assessment
| Dataset Name | Variable Name | Variable Label | Type | Codelist/Controlled Terms | Core | Computational Method | Origin |
|---|---|---|---|---|---|---|---|
| ADPPK | STUDYID | Study Identifier | character | Set per constructed row; see the Row construction sheet. | Derived | ||
| ADPPK | USUBJID | Unique Subject Identifier | character | Set per constructed row; see the Row construction sheet. | Derived | ||
| ADPPK | ADTM | Analysis Date/Time | numeric | ISO 8601 | Set per constructed row; see the Row construction sheet. | Derived | |
| ADPPK | EVID | Event ID | numeric | 0, 1 | Set per constructed row; see the Row construction sheet. | Derived | |
| ADPPK | AMT | Actual Amount of Dose Received | numeric | Set per constructed row; see the Row construction sheet. | Derived | ||
| ADPPK | ALLOQ | Analysis Lower Limit of Quantitation | numeric | Set per constructed row; see the Row construction sheet. | Derived | ||
| ADPPK | CENS | Censoring Indicator | numeric | 0, 1 | Set per constructed row; see the Row construction sheet. | Derived | |
| ADPPK | DV | Dependent Variable Result | numeric | Set per constructed row; see the Row construction sheet. | Derived | ||
| ADPPK | MDV | Missing Dependent Variable Result | numeric | If DV IS NULL then "1"; otherwise "0". | Derived | ||
| ADPPK | DVM6 | Dependent Variable Result, M6 Method | numeric | If EVID = 0 AND CENS = 0 then "DV"; If EVID = 0 AND CENS = 1 AND PREVCENS = 0 then compute ALLOQ / 2; otherwise blank. | Derived | ||
| ADPPK | MDVM6 | Missing Dependent Variable Result, M6 Method | numeric | If DVM6 IS NULL then "1"; otherwise "0". | Derived | ||
| ADPPK | ASEQ | Analysis Sequence Number | numeric | Row number within each group of STUDYID, USUBJID, ordered by ADTM then EVID. | Derived |
| Template | Include when | STUDYID | USUBJID | ADTM | EVID | AMT | ALLOQ | CENS | DV |
|---|---|---|---|---|---|---|---|---|---|
| dose | Copy EX.STUDYID | Copy EX.USUBJID | Copy EX.EXSTDTC | Constant "1" | Copy EX.EXDOSE | Constant "None" | Constant "0" | Constant "None" | |
| concentration | PC.PCSTAT IS NULL | Copy PC.STUDYID | Copy PC.USUBJID | Copy PC.PCDTC | Constant "0" | Constant "None" | Copy PC.PCLLOQ | If PC.PCSTRESC LIKE '<%' then "1"; otherwise "0" | If CENS = 1 then "ALLOQ"; otherwise "PC.PCSTRESN" |
| Variable | Permitted values |
|---|---|
| EVID | 0, 1 |
| CENS | 0, 1 |
| 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-adppk-blq-methods/full.md
Edit37 linesFollowing CDISC ADaM standards, use the provided EX and PC datasets to create an ADPPK dataset with one record per subject per administration (a dose record) or sample that was done (a concentration record).
The output dataset should contain the following columns in this order: STUDYID, USUBJID, ASEQ, ADTM, EVID, AMT, ALLOQ, CENS, DV, MDV, DVM6, MDVM6
A PC sample with PCSTAT "NOT DONE" was not done and gives no record. A quantified result has its number in PCSTRESN; a result below the limit of quantification has none, and its PCSTRESC starts with "<".
- ASEQ numbers the subject's records from 1 in the order of ADTM, with a sample before a dose at the same date/time.
- ADTM is EXSTDTC on a dose record and PCDTC on a concentration record, written as YYYY-MM-DDThh:mm:ss with its seconds.
- EVID is 1 on a dose record and 0 on a concentration record.
- AMT is EXDOSE on a dose record and has no value on a concentration record.
- ALLOQ is PCLLOQ on a concentration record and has no value on a dose record.
- CENS is 1 for a result below the limit, and 0 for a quantified result and on a dose record.
- DV is the quantified result, or ALLOQ for a result below the limit; it has no value on a dose record.
- MDV is 1 when DV has no value and 0 otherwise.
- DVM6 is the quantified result. For a result below the limit it is half of ALLOQ, not rounded, when the subject's sample before it was quantified; it has no value when that sample was also below the limit or when the subject has no sample before it. DVM6 has no value on a dose record.
- MDVM6 is 1 when DVM6 has no value and 0 otherwise.
The sample before a result is the subject's latest earlier concentration record, whatever doses were given in between. A sample that was not done does not separate a result below the limit from the quantified result before it.
Read the source datasets from /app/input and save the completed dataset as /app/output/adppk.csv.
prompts/adam-adppk-blq-methods/conventions.md
Edit15 linesFollowing CDISC ADaM standards, use the provided EX and PC datasets to create an ADPPK dataset with one record per subject per administration (a dose record) or sample that was done (a concentration record).
The output dataset should contain the following columns in this order: STUDYID, USUBJID, ASEQ, ADTM, EVID, AMT, ALLOQ, CENS, DV, MDV, DVM6, MDVM6
ADTM is written as YYYY-MM-DDThh:mm:ss with its seconds. EVID is 1 on a dose record and 0 on a concentration record. CENS is 1 for a result below the limit of quantification, and 0 for a quantified result and on a dose record. MDV is 1 when DV has no value and 0 otherwise, and MDVM6 is 1 when DVM6 has no value and 0 otherwise. DVM6 is not rounded.
Read the source datasets from /app/input and save the completed dataset as /app/output/adppk.csv.
prompts/adam-adppk-blq-methods/brief.md
Edit9 linesFollowing CDISC ADaM standards, use the provided EX and PC datasets to create an ADPPK dataset with one record per subject per administration (a dose record) or sample that was done (a concentration record).
The output dataset should contain the following columns in this order: STUDYID, USUBJID, ASEQ, ADTM, EVID, AMT, ALLOQ, CENS, DV, MDV, DVM6, MDVM6
Read the source datasets from /app/input and save the completed dataset as /app/output/adppk.csv.
R
Edit3 lineslibrary(yamaa)yamaa_spec("spec.yaml")$run()$outputPython
Edit3 linesimport yamaayamaa.spec("spec.yaml").run().outputsolutions/adam-adppk-blq-methods/result.R
Edit77 lines# Reference solution for the yamaa benchmark adam-adppk-blq-methods (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.suppressPackageStartupMessages({ library(dplyr) library(readr) library(stringr)})ex <- read_csv("/app/input/ex.csv", col_types = cols(.default = col_character()))pc <- read_csv("/app/input/pc.csv", col_types = cols(.default = col_character()))with_seconds <- function(x) { x <- str_trim(x) case_when( str_detect(x, "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}$") ~ str_c(x, ":00"), str_detect(x, "^[0-9]{4}-[0-9]{2}-[0-9]{2}T[0-9]{2}:[0-9]{2}:[0-9]{2}") ~ str_sub(x, 1, 19), TRUE ~ x )}doses <- ex %>% transmute( STUDYID, USUBJID, ADTM = with_seconds(EXSTDTC), EVID = 1L, AMT = as.numeric(EXDOSE), ALLOQ = NA_real_, CENS = 0L, DV = NA_real_, DVM6 = NA_real_, SRCSEQ = as.numeric(EXSEQ) )samples <- pc %>% filter(is.na(PCSTAT) | str_to_upper(str_trim(PCSTAT)) != "NOT DONE") %>% mutate( ADTM = with_seconds(PCDTC), RESN = as.numeric(PCSTRESN), ALLOQ = as.numeric(PCLLOQ), BLQ = is.na(RESN) & !is.na(PCSTRESC) & str_starts(str_trim(PCSTRESC), fixed("<")), SRCSEQ = as.numeric(PCSEQ) ) %>% arrange(USUBJID, ADTM, SRCSEQ) %>% group_by(USUBJID) %>% mutate(PREVQUANT = lag(!BLQ & !is.na(RESN), default = FALSE)) %>% ungroup() %>% transmute( STUDYID, USUBJID, ADTM, EVID = 0L, AMT = NA_real_, ALLOQ, CENS = if_else(BLQ, 1L, 0L), DV = if_else(BLQ, ALLOQ, RESN), DVM6 = case_when( !BLQ ~ RESN, PREVQUANT ~ ALLOQ / 2, TRUE ~ NA_real_ ), SRCSEQ )adppk <- bind_rows(samples, doses) %>% arrange(USUBJID, ADTM, EVID, SRCSEQ) %>% group_by(USUBJID) %>% mutate(ASEQ = row_number()) %>% ungroup() %>% mutate( MDV = if_else(is.na(DV), 1L, 0L), MDVM6 = if_else(is.na(DVM6), 1L, 0L) ) %>% select(STUDYID, USUBJID, ASEQ, ADTM, EVID, AMT, ALLOQ, CENS, DV, MDV, DVM6, MDVM6)write_csv(adppk, "/app/output/adppk.csv", na = "")solutions/adam-adppk-blq-methods/result.py
Edit90 lines# Reference solution for the yamaa benchmark adam-adppk-blq-methods (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 numpy as npimport pandas as pdCOLUMNS = [ "STUDYID", "USUBJID", "ASEQ", "ADTM", "EVID", "AMT", "ALLOQ", "CENS", "DV", "MDV", "DVM6", "MDVM6",]def with_seconds(value): text = str(value).strip() if "T" not in text: return text + "T00:00:00" date, time = text.split("T", 1) parts = time.split(":") while len(parts) < 3: parts.append("00") return date + "T" + ":".join(parts)def number(value): if pd.isna(value): return "" value = float(value) if value == int(value): return str(int(value)) return repr(value)ex = pd.read_csv("/app/input/ex.csv", dtype=str, keep_default_na=False)pc = pd.read_csv("/app/input/pc.csv", dtype=str, keep_default_na=False)dose = pd.DataFrame({ "STUDYID": ex["STUDYID"], "USUBJID": ex["USUBJID"], "ADTM": ex["EXSTDTC"].map(with_seconds), "EVID": 1, "AMT": pd.to_numeric(ex["EXDOSE"], errors="coerce"), "ALLOQ": np.nan, "CENS": 0, "DV": np.nan, "DVM6": np.nan, "SRCSEQ": pd.to_numeric(ex["EXSEQ"], errors="coerce"),})pc = pc[pc["PCSTAT"].str.strip().str.upper() != "NOT DONE"].copy()pc["ADTM"] = pc["PCDTC"].map(with_seconds)pc["SRCSEQ"] = pd.to_numeric(pc["PCSEQ"], errors="coerce")pc["RESULT"] = pd.to_numeric(pc["PCSTRESN"], errors="coerce")pc["ALLOQ"] = pd.to_numeric(pc["PCLLOQ"], errors="coerce")pc["BLQ"] = pc["RESULT"].isna() & pc["PCSTRESC"].str.strip().str.startswith("<")pc = pc.sort_values(["USUBJID", "ADTM", "SRCSEQ"], kind="stable").reset_index(drop=True)quantified = pc["RESULT"].notna()previous_quantified = quantified.groupby(pc["USUBJID"]).shift(1)previous_quantified = previous_quantified.where(previous_quantified.notna(), False).astype(bool)conc = pd.DataFrame({ "STUDYID": pc["STUDYID"], "USUBJID": pc["USUBJID"], "ADTM": pc["ADTM"], "EVID": 0, "AMT": np.nan, "ALLOQ": pc["ALLOQ"], "CENS": pc["BLQ"].astype(int), "DV": pc["RESULT"].where(~pc["BLQ"], pc["ALLOQ"]), "DVM6": pc["RESULT"].where( ~(pc["BLQ"] & previous_quantified), pc["ALLOQ"] / 2 ), "SRCSEQ": pc["SRCSEQ"],})adppk = pd.concat([conc, dose], ignore_index=True)adppk = adppk.sort_values( ["USUBJID", "ADTM", "EVID", "SRCSEQ"], kind="stable").reset_index(drop=True)adppk["ASEQ"] = adppk.groupby("USUBJID").cumcount() + 1adppk["MDV"] = adppk["DV"].isna().astype(int)adppk["MDVM6"] = adppk["DVM6"].isna().astype(int)for column in ["AMT", "ALLOQ", "DV", "DVM6"]: adppk[column] = adppk[column].map(number)adppk[COLUMNS].to_csv("/app/output/adppk.csv", index=False, lineterminator="\n")solutions/adam-adppk-blq-methods/result.sas
Edit84 lines/* opensas reference solution for the yamaa benchmark adam-adppk-blq-methods. Reads the benchmark inputs and derives the requested output. Execute with the existing opensas runtime: opensas /app/output/result.sas. */proc import datafile="/app/input/ex.csv" out=ex dbms=csv replace; getnames=yes; guessingrows=max;run;proc import datafile="/app/input/pc.csv" out=pc dbms=csv replace; getnames=yes; guessingrows=max;run;data dose; length STUDYID $20 USUBJID $40 ADTM $19; set ex(keep=STUDYID USUBJID EXDOSE EXSTDTC); ADTM = strip(EXSTDTC); if length(ADTM) = 16 then ADTM = cats(ADTM, ":00"); EVID = 1; AMT = EXDOSE; ALLOQ = .; BLQ = 0; RESN = .; keep STUDYID USUBJID ADTM EVID AMT ALLOQ BLQ RESN;run;data conc; length STUDYID $20 USUBJID $40 ADTM $19; set pc(keep=STUDYID USUBJID PCSTRESC PCSTRESN PCSTAT PCLLOQ PCDTC); if upcase(strip(PCSTAT)) = "NOT DONE" then delete; ADTM = strip(PCDTC); if length(ADTM) = 16 then ADTM = cats(ADTM, ":00"); EVID = 0; AMT = .; ALLOQ = PCLLOQ; BLQ = 0; if missing(PCSTRESN) and substr(strip(PCSTRESC), 1, 1) = "<" then BLQ = 1; RESN = PCSTRESN; keep STUDYID USUBJID ADTM EVID AMT ALLOQ BLQ RESN;run;data all; set conc dose;run;proc sort data=all; by STUDYID USUBJID ADTM EVID;run;data adppk; retain STUDYID USUBJID ASEQ ADTM EVID AMT ALLOQ CENS DV MDV DVM6 MDVM6; set all; by STUDYID USUBJID; retain PREVQ; if first.USUBJID then do; ASEQ = 0; PREVQ = 0; end; ASEQ + 1; CENS = 0; DV = .; DVM6 = .; if EVID = 0 then do; if BLQ = 1 then do; CENS = 1; DV = ALLOQ; if PREVQ = 1 then DVM6 = ALLOQ / 2; PREVQ = 0; end; else do; DV = RESN; DVM6 = RESN; if not missing(RESN) then PREVQ = 1; else PREVQ = 0; end; end; MDV = missing(DV); MDVM6 = missing(DVM6); keep STUDYID USUBJID ASEQ ADTM EVID AMT ALLOQ CENS DV MDV DVM6 MDVM6;run;proc export data=adppk outfile="/app/output/adppk.csv" dbms=csv replace;run;
yamaa