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: carry each physical functioning item response into
PARAMCD, PARAM, and AVAL, add a subscale score record
coded PFSCORE holding the mean answered-item response multiplied
by 25 (mean divided by four, times 100), and say in AREASND why
a value is missing.
Input: collected questionnaire responses for the physical
functioning scale, with study, subject, and visit (STUDYID,
USUBJID, VISIT), category (QSCAT), test code and test name
(QSTESTCD, QSTEST), and numeric result (QSSTRESN) on the
zero to four answer scale. An unanswered item is marked not done
(QSSTAT), with the reason (QSREASND) when one was recorded.
Records of other questionnaire scales are left out, so only the
physical functioning records feed the dataset.
Variables:
PARAMCD: the test code (PF01throughPF04) on an item record, orPFSCOREon the added score record.PARAM: the test name on an item record, or the subscale name on the added score record.AVAL: on an item record, the numeric result on the zero to four answer scale, empty when the item was not answered; on the score record, the mean of the answered items at that visit multiplied by 25, empty when fewer than three of the four items were answered.AREASND: on an item record, the reason recorded for an unanswered item, empty otherwise. On a score record without a value, the reason the visit's items record when none was answered and they record one reason between them, andNOT CALCULABLEotherwise; empty on a score record with a value.
Note: every visit with a PF01 item record, answered or not,
carries a score record, so a visit with too few answers to score
keeps an empty score and stays apart from a visit with no records
at all.
Inputs
Under review1 source fileinput/qs.csv
Edit21 rows| STUDYID | USUBJID | VISIT | QSSEQ | QSCAT | QSTESTCD | QSTEST | QSSTRESN | QSSTAT | QSREASND |
|---|---|---|---|---|---|---|---|---|---|
| PILOT7 | BASELINE | 1 | PHYSICAL FUNCTIONING SCALE | PF01 | Trouble with strenuous activity | 2 | — | — | |
| PILOT7 | BASELINE | 2 | PHYSICAL FUNCTIONING SCALE | PF02 | Trouble with a long walk | 0 | — | — | |
| PILOT7 | BASELINE | 3 | PHYSICAL FUNCTIONING SCALE | PF03 | Trouble with a short walk | 2 | — | — | |
| PILOT7 | BASELINE | 4 | PHYSICAL FUNCTIONING SCALE | PF04 | Needs to stay in bed or a chair | 1 | — | — | |
| PILOT7 | WEEK 12 | 5 | PHYSICAL FUNCTIONING SCALE | PF01 | Trouble with strenuous activity | 3 | — | — | |
| PILOT7 | WEEK 12 | 6 | PHYSICAL FUNCTIONING SCALE | PF02 | Trouble with a long walk | 3 | — | — | |
| PILOT7 | WEEK 12 | 7 | PHYSICAL FUNCTIONING SCALE | PF03 | Trouble with a short walk | — | NOT DONE | — | |
| PILOT7 | WEEK 12 | 8 | PHYSICAL FUNCTIONING SCALE | PF04 | Needs to stay in bed or a chair | 3 | — | — | |
| PILOT7 | BASELINE | 1 | PHYSICAL FUNCTIONING SCALE | PF01 | Trouble with strenuous activity | 1 | — | — | |
| PILOT7 | BASELINE | 2 | PHYSICAL FUNCTIONING SCALE | PF02 | Trouble with a long walk | — | NOT DONE | — | |
| PILOT7 | BASELINE | 3 | PHYSICAL FUNCTIONING SCALE | PF03 | Trouble with a short walk | — | NOT DONE | — | |
| PILOT7 | BASELINE | 4 | PHYSICAL FUNCTIONING SCALE | PF04 | Needs to stay in bed or a chair | 2 | — | — | |
| PILOT7 | WEEK 12 | 5 | PHYSICAL FUNCTIONING SCALE | PF01 | Trouble with strenuous activity | — | NOT DONE | PATIENT REFUSAL | |
| PILOT7 | WEEK 12 | 6 | PHYSICAL FUNCTIONING SCALE | PF02 | Trouble with a long walk | — | NOT DONE | PATIENT REFUSAL | |
| PILOT7 | WEEK 12 | 7 | PHYSICAL FUNCTIONING SCALE | PF03 | Trouble with a short walk | — | NOT DONE | PATIENT REFUSAL | |
| PILOT7 | WEEK 12 | 8 | PHYSICAL FUNCTIONING SCALE | PF04 | Needs to stay in bed or a chair | — | NOT DONE | PATIENT REFUSAL | |
| PILOT7 | BASELINE | 1 | PHYSICAL FUNCTIONING SCALE | PF01 | Trouble with strenuous activity | 4 | — | — | |
| PILOT7 | BASELINE | 2 | PHYSICAL FUNCTIONING SCALE | PF02 | Trouble with a long walk | 4 | — | — | |
| PILOT7 | BASELINE | 3 | PHYSICAL FUNCTIONING SCALE | PF03 | Trouble with a short walk | 4 | — | — | |
| PILOT7 | BASELINE | 4 | PHYSICAL FUNCTIONING SCALE | PF04 | Needs to stay in bed or a chair | 4 | — | — | |
| PILOT7 | BASELINE | 5 | EMOTIONAL FUNCTIONING SCALE | EF01 | Feeling tense | 3 | — | — |
Expected output
Under review25 expected rowsexpected/adqs.csv
Edit25 rows| STUDYID | USUBJID | VISIT | PARAMCD | PARAM | AVAL | AREASND |
|---|---|---|---|---|---|---|
| PILOT7 | BASELINE | PF01 | Trouble with strenuous activity | 2 | — | |
| PILOT7 | BASELINE | PF02 | Trouble with a long walk | 0 | — | |
| PILOT7 | BASELINE | PF03 | Trouble with a short walk | 2 | — | |
| PILOT7 | BASELINE | PF04 | Needs to stay in bed or a chair | 1 | — | |
| PILOT7 | WEEK 12 | PF01 | Trouble with strenuous activity | 3 | — | |
| PILOT7 | WEEK 12 | PF02 | Trouble with a long walk | 3 | — | |
| PILOT7 | WEEK 12 | PF03 | Trouble with a short walk | — | — | |
| PILOT7 | WEEK 12 | PF04 | Needs to stay in bed or a chair | 3 | — | |
| PILOT7 | BASELINE | PF01 | Trouble with strenuous activity | 1 | — | |
| PILOT7 | BASELINE | PF02 | Trouble with a long walk | — | — | |
| PILOT7 | BASELINE | PF03 | Trouble with a short walk | — | — | |
| PILOT7 | BASELINE | PF04 | Needs to stay in bed or a chair | 2 | — | |
| PILOT7 | WEEK 12 | PF01 | Trouble with strenuous activity | — | PATIENT REFUSAL | |
| PILOT7 | WEEK 12 | PF02 | Trouble with a long walk | — | PATIENT REFUSAL | |
| PILOT7 | WEEK 12 | PF03 | Trouble with a short walk | — | PATIENT REFUSAL | |
| PILOT7 | WEEK 12 | PF04 | Needs to stay in bed or a chair | — | PATIENT REFUSAL | |
| PILOT7 | BASELINE | PF01 | Trouble with strenuous activity | 4 | — | |
| PILOT7 | BASELINE | PF02 | Trouble with a long walk | 4 | — | |
| PILOT7 | BASELINE | PF03 | Trouble with a short walk | 4 | — | |
| PILOT7 | BASELINE | PF04 | Needs to stay in bed or a chair | 4 | — | |
| PILOT7 | BASELINE | PFSCORE | Physical Functioning Subscale Score | 31.25 | — | |
| PILOT7 | WEEK 12 | PFSCORE | Physical Functioning Subscale Score | 75 | — | |
| PILOT7 | BASELINE | PFSCORE | Physical Functioning Subscale Score | — | NOT CALCULABLE | |
| PILOT7 | WEEK 12 | PFSCORE | Physical Functioning Subscale Score | — | PATIENT REFUSAL | |
| PILOT7 | BASELINE | PFSCORE | Physical Functioning Subscale Score | 100 | — |
Human review and assessment
| Dataset Name | Variable Name | Variable Label | Type | Codelist/Controlled Terms | Core | Computational Method | Origin |
|---|---|---|---|---|---|---|---|
| ADQS | STUDYID | Study Identifier | character | Copy value from QS.STUDYID. | Predecessor | ||
| ADQS | USUBJID | Unique Subject Identifier | character | Copy value from QS.USUBJID. | Predecessor | ||
| ADQS | VISIT | Visit Name | character | Copy value from QS.VISIT. | Predecessor | ||
| ADQS | PARAMCD | Parameter Code | character | PF01, PF02, PF03, PF04, PFSCORE | Set per constructed row; see the Row construction sheet. | Derived | |
| ADQS | PARAM | Parameter | character | Set per constructed row; see the Row construction sheet. | Derived | ||
| ADQS | AVAL | Analysis Value | numeric | If PARAMCD = 'PFSCORE' AND ITEMANS >= 3 then compute 100 * (ITEMSUM / ITEMANS) / 4; If PARAMCD = 'PFSCORE' then "None"; otherwise "ITEMRESN". | Derived | ||
| ADQS | AREASND | Analysis Reason Not Done | character | If PARAMCD = 'PFSCORE' AND ITEMANS >= 3 then "None"; If PARAMCD = 'PFSCORE' AND ITEMANS = 0 AND ITEMRSNN = 1 then "ITEMRSN"; If PARAMCD = 'PFSCORE' then "NOT CALCULABLE"; otherwise "ITEMRSND". | Derived |
| Template | Include when | PARAMCD | PARAM | ITEMRESN | ITEMRSND |
|---|---|---|---|---|---|
| item | QS.QSCAT = 'PHYSICAL FUNCTIONING SCALE' | Copy QS.QSTESTCD | Copy QS.QSTEST | Copy QS.QSSTRESN | Copy QS.QSREASND |
| subscale | QS.QSCAT = 'PHYSICAL FUNCTIONING SCALE' AND QS.QSTESTCD = 'PF01' | Constant "PFSCORE" | Constant "Physical Functioning Subscale Score" | Constant "None" | Constant "None" |
| Variable | Permitted values |
|---|---|
| PARAMCD | PF01, PF02, PF03, PF04, PFSCORE |
| 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-subscale-score/full.md
Edit25 linesFollowing CDISC ADaM standards, use the provided QS dataset to create an ADQS dataset with one record per subject per visit per parameter.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, VISIT, PARAMCD, PARAM, AVAL, AREASND
The item records are the physical functioning records; a record of the emotional functioning scale is not in the output. On an item record, PARAMCD is the item's test code, PF01 through PF04, and PARAM is its test name. AVAL on an item record is the numeric result on the zero to four answer scale, and has no value when the item was not answered. Every visit with a PF01 item record, answered or not, also has a score record, with PARAMCD "PFSCORE" and PARAM "Physical Functioning Subscale Score". AVAL on the score record is the mean of the answered items at that visit multiplied by 25, and has no value when fewer than three of the four items were answered. AVAL is not rounded. AREASND on an item record is the reason recorded for the item not being done, and has no value when none was recorded. On a score record whose AVAL has no value, AREASND is the reason recorded on the visit's items when none of them was answered and they record one reason between them, and "NOT CALCULABLE" otherwise; it has no value on a score record with a value.
Read the source datasets from /app/input and save the completed dataset as /app/output/adqs.csv.
prompts/adam-adqs-subscale-score/conventions.md
Edit13 linesFollowing CDISC ADaM standards, use the provided QS dataset to create an ADQS dataset with one record per subject per visit per parameter.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, VISIT, PARAMCD, PARAM, AVAL, AREASND
AVAL on an item record is the numeric result on the zero to four answer scale. On the score record, PARAMCD is "PFSCORE" and PARAM is "Physical Functioning Subscale Score". AVAL is not rounded. AREASND holds a recorded reason, or is "NOT CALCULABLE", or has no value.
Read the source datasets from /app/input and save the completed dataset as /app/output/adqs.csv.
prompts/adam-adqs-subscale-score/brief.md
Edit8 linesFollowing CDISC ADaM standards, use the provided QS dataset to create an ADQS dataset with one record per subject per visit per parameter.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, VISIT, PARAMCD, PARAM, AVAL, AREASND
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-subscale-score/result.R
Edit72 lines# Reference solution for the yamaa benchmark adam-adqs-subscale-score (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)qs <- read_csv( "/app/input/qs.csv", col_types = cols( QSSEQ = col_integer(), QSSTRESN = col_double(), .default = col_character() ))# Each physical functioning item response, on its zero to four scale.items <- qs |> filter(QSTESTCD %in% c("PF01", "PF02", "PF03", "PF04")) |> mutate( PARAMCD = QSTESTCD, PARAM = QSTEST, AVAL = QSSTRESN, AREASND = QSREASND ) |> select(STUDYID, USUBJID, VISIT, PARAMCD, PARAM, AVAL, AREASND)# One score record per visit with a PF01 item record: the mean of the# answered items on a zero to one hundred scale, with no value when fewer# than three of the four items were answered. A score without a value takes# the items' reason when none was answered, and reads NOT CALCULABLE# otherwise.visits <- items |> filter(PARAMCD %in% "PF01") |> distinct(STUDYID, USUBJID, VISIT)stats <- items |> group_by(STUDYID, USUBJID, VISIT) |> summarise( n_answered = sum(!is.na(AVAL)), mean_answered = mean(AVAL, na.rm = TRUE), n_reasons = n_distinct(AREASND, na.rm = TRUE), reason = first(na.omit(AREASND)), .groups = "drop" ) |> mutate( mean_answered = if_else( n_answered < 3 | is.nan(mean_answered), NA_real_, mean_answered * 25 ), reason = case_when( n_answered >= 3 ~ NA_character_, n_answered == 0 & n_reasons == 1 ~ reason, .default = "NOT CALCULABLE" ) )scores <- visits |> left_join(stats, by = c("STUDYID", "USUBJID", "VISIT")) |> mutate( PARAMCD = "PFSCORE", PARAM = "Physical Functioning Subscale Score", AVAL = mean_answered, AREASND = reason ) |> select(STUDYID, USUBJID, VISIT, PARAMCD, PARAM, AVAL, AREASND)adqs <- bind_rows(items, scores) |> arrange(STUDYID, USUBJID, VISIT, PARAMCD)dir.create("/app/output", showWarnings = FALSE)write_csv(adqs, "/app/output/adqs.csv", na = "")solutions/adam-adqs-subscale-score/result.py
Edit88 lines# Reference solution for the yamaa benchmark adam-adqs-subscale-score (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 csvfrom collections import OrderedDictINPUT_QS = "/app/input/qs.csv"OUTPUT_ADQS = "/app/output/adqs.csv"ITEM_CODES = ("PF01", "PF02", "PF03", "PF04")SCORE_PARAMCD = "PFSCORE"SCORE_PARAM = "Physical Functioning Subscale Score"def fmt(value): if value is None: return "" if value == int(value): return str(int(value)) return repr(value)def main(): with open(INPUT_QS, newline="") as f: rows = list(csv.DictReader(f)) # Item records: the physical functioning records (PF01..PF04). items = [r for r in rows if r["QSTESTCD"] in ITEM_CODES] # Group item records by subject and visit, preserving input order. groups = OrderedDict() for r in items: key = (r["STUDYID"], r["USUBJID"], r["VISIT"]) groups.setdefault(key, []).append(r) out = [] for (studyid, usubjid, visit), recs in groups.items(): answered = [] reasons = set() for r in recs: raw = (r["QSSTRESN"] or "").strip() aval = float(raw) if raw != "" else None if aval is not None: answered.append(aval) reason = (r["QSREASND"] or "").strip() if reason: reasons.add(reason) out.append( [studyid, usubjid, visit, r["QSTESTCD"], r["QSTEST"], fmt(aval), reason] ) # Every visit with a PF01 item record also has a score record. A score # without a value takes the items' reason when none was answered, and # reads NOT CALCULABLE otherwise. if any(r["QSTESTCD"] == "PF01" for r in recs): if len(answered) >= 3: score = sum(answered) / len(answered) * 25 areasnd = "" elif not answered and len(reasons) == 1: score = None areasnd = next(iter(reasons)) else: score = None areasnd = "NOT CALCULABLE" out.append( [ studyid, usubjid, visit, SCORE_PARAMCD, SCORE_PARAM, fmt(score), areasnd, ] ) with open(OUTPUT_ADQS, "w", newline="") as f: writer = csv.writer(f) writer.writerow( ["STUDYID", "USUBJID", "VISIT", "PARAMCD", "PARAM", "AVAL", "AREASND"] ) writer.writerows(out)if __name__ == "__main__": main()solutions/adam-adqs-subscale-score/result.sas
Edit21 lines/* opensas reference solution for the yamaa benchmark adam-adqs-subscale-score. Reads the benchmark inputs and derives the requested output. Execute with the existing opensas runtime: opensas /app/output/result.sas. */data qs; length STUDYID USUBJID VISIT QSCAT QSTESTCD QSTEST QSSTAT QSREASND $1024; infile "/app/input/qs.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. USUBJID : $char1024. VISIT : $char1024. QSSEQ QSCAT : $char1024. QSTESTCD : $char1024. QSTEST : $char1024. QSSTRESN QSSTAT : $char1024. QSREASND : $char1024.;run;proc sql; create table collected as select STUDYID,USUBJID,VISIT,QSTESTCD as PARAMCD,QSTEST as PARAM,QSSTRESN as AVAL,QSREASND as AREASND from qs where QSTESTCD in ('PF01','PF02','PF03','PF04'); create table anchors as select distinct STUDYID,USUBJID,VISIT from collected where PARAMCD='PF01'; create table scores as select a.STUDYID,a.USUBJID,a.VISIT,'PFSCORE' as PARAMCD,'Physical Functioning Subscale Score' as PARAM, case when count(b.AVAL)>=3 then 25*mean(b.AVAL) else . end as AVAL, case when count(b.AVAL)>=3 then ' ' when count(b.AVAL)=0 and count(distinct b.AREASND)=1 then max(b.AREASND) else 'NOT CALCULABLE' end as AREASND length=1024 from anchors as a left join collected as b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID and a.VISIT=b.VISIT group by a.STUDYID,a.USUBJID,a.VISIT;quit;data result; set collected scores; run;proc export data=result(keep=STUDYID USUBJID VISIT PARAMCD PARAM AVAL AREASND) outfile="/app/output/adqs.csv" dbms=csv replace; run;
yamaa