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 every pharmacokinetic (PK) parameter record and add, for each
maximum concentration (CMAX) and area under the curve (AUCLST, AUCIFO)
record, its dose-normalized parameter (CMAXD, AUCLSTD, AUCIFOD): the
value divided by the dose, in milligrams, of the administration the profile
follows.
Input: PK parameters (PP), one record per parameter per concentration profile, each profile identified by its reference date and time; exposure (EX), one record per administration with its start date and time, dose and dose unit.
Variables:
PARAMCD: the PP parameter code, orCMAXD,AUCLSTDorAUCIFODon an added record.PARAM: the PP parameter name, or the controlled name of the added parameter (Max Conc Norm by Dose,AUC to Last Nonzero Conc Norm by Dose,AUC Infinity Obs Norm by Dose), without a unit.AVAL: the PP result in standard units, empty when the parameter was not calculated; on an added record, that result divided by the dose of the one administration that starts at the profile's reference time, a dose in micrograms counting as a thousandth of a milligram. Not rounded.AVALU: the PP standard unit; on an added record, that unit per mg (ng/mL/mg,h*ng/mL/mg).
Note: a twice-daily day divides by one administration's dose, not the day's total. No dose-normalized record is added for any other parameter (time of maximum concentration, half-life), for a parameter that has no value, or for a profile whose reference time has no dosing record or a zero dose. Two dosing records with one start, a dose unit other than mg or ug, a negative dose, or an input that already holds a dose-normalized code stops the run.
Inputs
Under review2 source filesinput/ex.csv
Edit7 rows| STUDYID | DOMAIN | USUBJID | EXSEQ | EXTRT | EXDOSE | EXDOSU | EXDOSFRM | EXDOSFRQ | EXROUTE | EXSTDTC | EXENDTC |
|---|---|---|---|---|---|---|---|---|---|---|---|
| YAMAA-01 | EX | 1 | DRUG A | 10 | mg | TABLET | ONCE | ORAL | 2026-03-02T08:00 | 2026-03-02T08:00 | |
| YAMAA-01 | EX | 2 | DRUG A | 40 | mg | TABLET | ONCE | ORAL | 2026-03-09T08:00 | 2026-03-09T08:00 | |
| YAMAA-01 | EX | 1 | DRUG A | 25 | mg | TABLET | BID | ORAL | 2026-03-02T08:00 | 2026-03-02T08:00 | |
| YAMAA-01 | EX | 2 | DRUG A | 25 | mg | TABLET | BID | ORAL | 2026-03-02T20:00 | 2026-03-02T20:00 | |
| YAMAA-01 | EX | 1 | DRUG A | 500 | ug | TABLET | ONCE | ORAL | 2026-03-02T08:00 | 2026-03-02T08:00 | |
| YAMAA-01 | EX | 1 | DRUG A | 50 | mg | TABLET | ONCE | ORAL | 2026-03-02T08:00 | 2026-03-02T08:00 | |
| YAMAA-01 | EX | 1 | DRUG A | 100 | mg | TABLET | ONCE | ORAL | 2026-03-02T08:00 | 2026-03-02T08:00 |
input/pp.csv
Edit20 rows| STUDYID | DOMAIN | USUBJID | PPSEQ | PPTESTCD | PPTEST | PPCAT | PPORRES | PPORRESU | PPSTRESC | PPSTRESN | PPSTRESU | PPSTAT | PPREASND | PPSPEC | VISITNUM | VISIT | PPRFTDTC |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| YAMAA-01 | PP | 1 | CMAX | Max Conc | DRUG A | 120 | ng/mL | 120 | 120 | ng/mL | — | — | PLASMA | 1 | DAY 1 | 2026-03-02T08:00 | |
| YAMAA-01 | PP | 2 | TMAX | Time of CMAX Observation | DRUG A | 1.5 | h | 1.5 | 1.5 | h | — | — | PLASMA | 1 | DAY 1 | 2026-03-02T08:00 | |
| YAMAA-01 | PP | 3 | AUCLST | AUC to Last Nonzero Conc | DRUG A | 960 | h*ng/mL | 960 | 960 | h*ng/mL | — | — | PLASMA | 1 | DAY 1 | 2026-03-02T08:00 | |
| YAMAA-01 | PP | 4 | AUCIFO | AUC Infinity Obs | DRUG A | 1000 | h*ng/mL | 1000 | 1000 | h*ng/mL | — | — | PLASMA | 1 | DAY 1 | 2026-03-02T08:00 | |
| YAMAA-01 | PP | 5 | CMAX | Max Conc | DRUG A | 500 | ng/mL | 500 | 500 | ng/mL | — | — | PLASMA | 8 | DAY 8 | 2026-03-09T08:00 | |
| YAMAA-01 | PP | 6 | AUCLST | AUC to Last Nonzero Conc | DRUG A | 4200 | h*ng/mL | 4200 | 4200 | h*ng/mL | — | — | PLASMA | 8 | DAY 8 | 2026-03-09T08:00 | |
| YAMAA-01 | PP | 1 | CMAX | Max Conc | DRUG A | 310 | ng/mL | 310 | 310 | ng/mL | — | — | PLASMA | 1 | DAY 1 | 2026-03-02T08:00 | |
| YAMAA-01 | PP | 2 | TMAX | Time of CMAX Observation | DRUG A | 2 | h | 2 | 2 | h | — | — | PLASMA | 1 | DAY 1 | 2026-03-02T08:00 | |
| YAMAA-01 | PP | 3 | AUCLST | AUC to Last Nonzero Conc | DRUG A | 2480 | h*ng/mL | 2480 | 2480 | h*ng/mL | — | — | PLASMA | 1 | DAY 1 | 2026-03-02T08:00 | |
| YAMAA-01 | PP | 1 | CMAX | Max Conc | DRUG A | 6.2 | ng/mL | 6.2 | 6.2 | ng/mL | — | — | PLASMA | 1 | DAY 1 | 2026-03-02T08:00 | |
| YAMAA-01 | PP | 2 | AUCLST | AUC to Last Nonzero Conc | DRUG A | 48.5 | h*ng/mL | 48.5 | 48.5 | h*ng/mL | — | — | PLASMA | 1 | DAY 1 | 2026-03-02T08:00 | |
| YAMAA-01 | PP | 3 | AUCIFO | AUC Infinity Obs | DRUG A | 51 | h*ng/mL | 51 | 51 | h*ng/mL | — | — | PLASMA | 1 | DAY 1 | 2026-03-02T08:00 | |
| YAMAA-01 | PP | 4 | LAMZHL | Half-Life Lambda z | DRUG A | 6.5 | h | 6.5 | 6.5 | h | — | — | PLASMA | 1 | DAY 1 | 2026-03-02T08:00 | |
| YAMAA-01 | PP | 1 | CMAX | Max Conc | DRUG A | 610 | ng/mL | 610 | 610 | ng/mL | — | — | PLASMA | 1 | DAY 1 | 2026-03-02T08:00 | |
| YAMAA-01 | PP | 2 | AUCLST | AUC to Last Nonzero Conc | DRUG A | 4900 | h*ng/mL | 4900 | 4900 | h*ng/mL | — | — | PLASMA | 1 | DAY 1 | 2026-03-02T08:00 | |
| YAMAA-01 | PP | 3 | CMAX | Max Conc | DRUG A | 640 | ng/mL | 640 | 640 | ng/mL | — | — | PLASMA | 8 | DAY 8 | 2026-03-09T08:00 | |
| YAMAA-01 | PP | 4 | AUCLST | AUC to Last Nonzero Conc | DRUG A | 5150 | h*ng/mL | 5150 | 5150 | h*ng/mL | — | — | PLASMA | 8 | DAY 8 | 2026-03-09T08:00 | |
| YAMAA-01 | PP | 1 | CMAX | Max Conc | DRUG A | 1250 | ng/mL | 1250 | 1250 | ng/mL | — | — | PLASMA | 1 | DAY 1 | 2026-03-02T08:00 | |
| YAMAA-01 | PP | 2 | AUCLST | AUC to Last Nonzero Conc | DRUG A | 9900 | h*ng/mL | 9900 | 9900 | h*ng/mL | — | — | PLASMA | 1 | DAY 1 | 2026-03-02T08:00 | |
| YAMAA-01 | PP | 3 | AUCIFO | AUC Infinity Obs | DRUG A | — | — | — | — | — | NOT DONE | INSUFFICIENT DATA | PLASMA | 1 | DAY 1 | 2026-03-02T08:00 |
Expected output
Under review34 expected rowsexpected/adpp.csv
Edit34 rows| STUDYID | USUBJID | VISIT | PARAMCD | PARAM | AVAL | AVALU |
|---|---|---|---|---|---|---|
| YAMAA-01 | DAY 1 | CMAX | Max Conc | 120 | ng/mL | |
| YAMAA-01 | DAY 1 | TMAX | Time of CMAX Observation | 1.5 | h | |
| YAMAA-01 | DAY 1 | AUCLST | AUC to Last Nonzero Conc | 960 | h*ng/mL | |
| YAMAA-01 | DAY 1 | AUCIFO | AUC Infinity Obs | 1000 | h*ng/mL | |
| YAMAA-01 | DAY 8 | CMAX | Max Conc | 500 | ng/mL | |
| YAMAA-01 | DAY 8 | AUCLST | AUC to Last Nonzero Conc | 4200 | h*ng/mL | |
| YAMAA-01 | DAY 1 | CMAX | Max Conc | 310 | ng/mL | |
| YAMAA-01 | DAY 1 | TMAX | Time of CMAX Observation | 2 | h | |
| YAMAA-01 | DAY 1 | AUCLST | AUC to Last Nonzero Conc | 2480 | h*ng/mL | |
| YAMAA-01 | DAY 1 | CMAX | Max Conc | 6.2 | ng/mL | |
| YAMAA-01 | DAY 1 | AUCLST | AUC to Last Nonzero Conc | 48.5 | h*ng/mL | |
| YAMAA-01 | DAY 1 | AUCIFO | AUC Infinity Obs | 51 | h*ng/mL | |
| YAMAA-01 | DAY 1 | LAMZHL | Half-Life Lambda z | 6.5 | h | |
| YAMAA-01 | DAY 1 | CMAX | Max Conc | 610 | ng/mL | |
| YAMAA-01 | DAY 1 | AUCLST | AUC to Last Nonzero Conc | 4900 | h*ng/mL | |
| YAMAA-01 | DAY 8 | CMAX | Max Conc | 640 | ng/mL | |
| YAMAA-01 | DAY 8 | AUCLST | AUC to Last Nonzero Conc | 5150 | h*ng/mL | |
| YAMAA-01 | DAY 1 | CMAX | Max Conc | 1250 | ng/mL | |
| YAMAA-01 | DAY 1 | AUCLST | AUC to Last Nonzero Conc | 9900 | h*ng/mL | |
| YAMAA-01 | DAY 1 | AUCIFO | AUC Infinity Obs | — | — | |
| YAMAA-01 | DAY 1 | CMAXD | Max Conc Norm by Dose | 12 | ng/mL/mg | |
| YAMAA-01 | DAY 1 | AUCLSTD | AUC to Last Nonzero Conc Norm by Dose | 96 | h*ng/mL/mg | |
| YAMAA-01 | DAY 1 | AUCIFOD | AUC Infinity Obs Norm by Dose | 100 | h*ng/mL/mg | |
| YAMAA-01 | DAY 8 | CMAXD | Max Conc Norm by Dose | 12.5 | ng/mL/mg | |
| YAMAA-01 | DAY 8 | AUCLSTD | AUC to Last Nonzero Conc Norm by Dose | 105 | h*ng/mL/mg | |
| YAMAA-01 | DAY 1 | CMAXD | Max Conc Norm by Dose | 12.4 | ng/mL/mg | |
| YAMAA-01 | DAY 1 | AUCLSTD | AUC to Last Nonzero Conc Norm by Dose | 99.2 | h*ng/mL/mg | |
| YAMAA-01 | DAY 1 | CMAXD | Max Conc Norm by Dose | 12.4 | ng/mL/mg | |
| YAMAA-01 | DAY 1 | AUCLSTD | AUC to Last Nonzero Conc Norm by Dose | 97 | h*ng/mL/mg | |
| YAMAA-01 | DAY 1 | AUCIFOD | AUC Infinity Obs Norm by Dose | 102 | h*ng/mL/mg | |
| YAMAA-01 | DAY 1 | CMAXD | Max Conc Norm by Dose | 12.2 | ng/mL/mg | |
| YAMAA-01 | DAY 1 | AUCLSTD | AUC to Last Nonzero Conc Norm by Dose | 98 | h*ng/mL/mg | |
| YAMAA-01 | DAY 1 | CMAXD | Max Conc Norm by Dose | 12.5 | ng/mL/mg | |
| YAMAA-01 | DAY 1 | AUCLSTD | AUC to Last Nonzero Conc Norm by Dose | 99 | h*ng/mL/mg |
Human review and assessment
| Dataset Name | Variable Name | Variable Label | Type | Codelist/Controlled Terms | Core | Computational Method | Origin |
|---|---|---|---|---|---|---|---|
| ADPP | STUDYID | Study Identifier | character | Copy value from PP.STUDYID. | Predecessor | ||
| ADPP | USUBJID | Unique Subject Identifier | character | Copy value from PP.USUBJID. | Predecessor | ||
| ADPP | VISIT | Visit Name | character | Copy value from PP.VISIT. | Predecessor | ||
| ADPP | PARAMCD | Parameter Code | character | Set per constructed row; see the Row construction sheet. | Derived | ||
| ADPP | PARAM | Parameter | character | Set per constructed row; see the Row construction sheet. | Derived | ||
| ADPP | AVAL | Analysis Value | numeric | Set per constructed row; see the Row construction sheet. | Derived | ||
| ADPP | AVALU | Analysis Value Unit | character | Set per constructed row; see the Row construction sheet. | Derived |
| Template | Include when | PARAMCD | PARAM | DOSE_MG | AVAL | AVALU |
|---|---|---|---|---|---|---|
| collected | Copy PP.PPTESTCD | Copy PP.PPTEST | Constant "None" | Copy PP.PPSTRESN | Copy PP.PPSTRESU | |
| dose_normalized | PARAMCD IS NOT NULL AND AVAL IS NOT NULL | Recode PP.PPTESTCD: "CMAX" → "CMAXD", "AUCLST" → "AUCLSTD", "AUCIFO" → "AUCIFOD"; missing or unlisted values stay missing | Recode PP.PPTESTCD: "CMAX" → "Max Conc Norm by Dose", "AUCLST" → "AUC to Last Nonzero Conc Norm by Dose", "AUCIFO" → "AUC Infinity Obs Norm by Dose"; missing or unlisted values stay missing | Copy DOSE_MG from the EX record whose STUDYID equals PP.STUDYID, USUBJID equals PP.USUBJID and EXSTDTC equals PP.PPRFTDTC, where DOSE_MG is derived as compute EXDOSE / MGDIV, and no match yields "0" | Compute PP.PPSTRESN / NULLIF(DOSE_MG, 0) | Fill the template "{PP.PPSTRESU}/mg"; a missing field → blank |
| 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-adpp-dose-normalized/full.md
Edit31 linesFollowing CDISC ADaM standards, use the provided EX and PP datasets to create an ADPP dataset with one record per subject, parameter, and visit.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, VISIT, PARAMCD, PARAM, AVAL, AVALU
- Every collected record is in the output, and a dose-normalized record is added for each CMAX, AUCLST, and AUCIFO record.
- PARAMCD on an added record is CMAXD for a CMAX record, AUCLSTD for an AUCLST record, and AUCIFOD for an AUCIFO record.
- PARAM on an added record is "Max Conc Norm by Dose" for CMAXD, "AUC to Last Nonzero Conc Norm by Dose" for AUCLSTD, and "AUC Infinity Obs Norm by Dose" for AUCIFOD.
- AVAL is the result in standard units and has no value when the parameter was not calculated.
- AVAL on an added record is that result divided by the dose, in milligrams, of the one administration of the same subject that starts at the profile's reference time.
- A dose in micrograms counts as a thousandth of a milligram.
- A twice-daily day divides by one administration's dose, not the day's total.
- AVALU is the standard unit on a collected record and that unit per mg on an added record, "ng/mL/mg" for a CMAXD record and "h*ng/mL/mg" for an AUCLSTD or AUCIFOD record.
- AVAL on an added record is not rounded.
- No dose-normalized record is added for any other parameter, for a parameter that has no value, or for a profile whose reference time has no administration or whose administration's dose is zero.
Read the source datasets from /app/input and save the completed dataset as /app/output/adpp.csv.
prompts/adam-adpp-dose-normalized/conventions.md
Edit13 linesFollowing CDISC ADaM standards, use the provided EX and PP datasets to create an ADPP dataset with one record per subject, parameter, and visit.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, VISIT, PARAMCD, PARAM, AVAL, AVALU
PARAMCD is CMAXD for a CMAX record, AUCLSTD for an AUCLST record, and AUCIFOD for an AUCIFO record. PARAM is "Max Conc Norm by Dose" for CMAXD, "AUC to Last Nonzero Conc Norm by Dose" for AUCLSTD, and "AUC Infinity Obs Norm by Dose" for AUCIFOD. AVAL on an added record is not rounded.
Read the source datasets from /app/input and save the completed dataset as /app/output/adpp.csv.
prompts/adam-adpp-dose-normalized/brief.md
Edit8 linesFollowing CDISC ADaM standards, use the provided EX and PP datasets to create an ADPP dataset with one record per subject, parameter, and visit.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, VISIT, PARAMCD, PARAM, AVAL, AVALU
Read the source datasets from /app/input and save the completed dataset as /app/output/adpp.csv.
R
Edit3 lineslibrary(yamaa)yamaa_spec("spec.yaml")$run()$outputPython
Edit3 linesimport yamaayamaa.spec("spec.yaml").run().outputsolutions/adam-adpp-dose-normalized/result.R
Edit64 lines# Reference solution for the yamaa benchmark adam-adpp-dose-normalized (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)pp <- read_csv( "/app/input/pp.csv", col_types = cols(PPSTRESN = col_double(), .default = col_character()))ex <- read_csv( "/app/input/ex.csv", col_types = cols(EXDOSE = col_double(), .default = col_character()))# The three exposure parameters that get a dose-normalized record.normalized <- tibble( PPTESTCD = c("CMAX", "AUCLST", "AUCIFO"), NEWCD = c("CMAXD", "AUCLSTD", "AUCIFOD"), NEWPARAM = c( "Max Conc Norm by Dose", "AUC to Last Nonzero Conc Norm by Dose", "AUC Infinity Obs Norm by Dose" ))mg_per_unit <- tibble(EXDOSU = c("mg", "ug"), MGDIV = c(1, 1000))# Every PP record as collected.kept <- pp |> transmute( STUDYID, USUBJID, VISIT, PARAMCD = PPTESTCD, PARAM = PPTEST, AVAL = PPSTRESN, AVALU = PPSTRESU )# The one administration that starts at each profile's reference time, its# dose in mg (a dose in ug is a thousandth of a mg).dose <- ex |> left_join(mg_per_unit, by = "EXDOSU") |> transmute(STUDYID, USUBJID, PPRFTDTC = EXSTDTC, DOSEMG = EXDOSE / MGDIV)added <- pp |> inner_join(normalized, by = "PPTESTCD") |> filter(!is.na(PPSTRESN)) |> inner_join(dose, by = c("STUDYID", "USUBJID", "PPRFTDTC")) |> filter(!is.na(DOSEMG), DOSEMG != 0) |> transmute( STUDYID, USUBJID, VISIT, PARAMCD = NEWCD, PARAM = NEWPARAM, AVAL = PPSTRESN / DOSEMG, AVALU = paste0(PPSTRESU, "/mg") )adpp <- bind_rows(kept, added) |> select(STUDYID, USUBJID, VISIT, PARAMCD, PARAM, AVAL, AVALU)dir.create("/app/output", showWarnings = FALSE)write_csv(adpp, "/app/output/adpp.csv", na = "")solutions/adam-adpp-dose-normalized/result.py
Edit86 lines# Reference solution for the yamaa benchmark adam-adpp-dose-normalized (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 ADPP from EX and PP: collected PK parameters plus dose-normalizedrecords for CMAX, AUCLST, and AUCIFO, normalized by the dose (mg) of thesubject's administration starting at the profile's reference time."""import csvimport osINPUT = "/app/input"OUTPUT = "/app/output"NORMALIZED = { "CMAX": ("CMAXD", "Max Conc Norm by Dose", "ng/mL/mg"), "AUCLST": ("AUCLSTD", "AUC to Last Nonzero Conc Norm by Dose", "h*ng/mL/mg"), "AUCIFO": ("AUCIFOD", "AUC Infinity Obs Norm by Dose", "h*ng/mL/mg"),}COLUMNS = ["STUDYID", "USUBJID", "VISIT", "PARAMCD", "PARAM", "AVAL", "AVALU"]def read_csv(name): with open(os.path.join(INPUT, name), newline="") as f: return list(csv.DictReader(f))def dose_mg(ex_row): dose = float(ex_row["EXDOSE"]) unit = ex_row["EXDOSU"].strip() if unit == "mg": return dose if unit in ("ug", "\u00b5g", "mcg"): return dose / 1000.0 return dosedef main(): ex = read_csv("ex.csv") pp = read_csv("pp.csv") # One administration per subject per start time. dose_by_key = {} for row in ex: dose_by_key[(row["USUBJID"], row["EXSTDTC"])] = dose_mg(row) out = [] for rec in pp: base = { "STUDYID": rec["STUDYID"], "USUBJID": rec["USUBJID"], "VISIT": rec["VISIT"], "PARAMCD": rec["PPTESTCD"], "PARAM": rec["PPTEST"], "AVAL": rec["PPSTRESN"], "AVALU": rec["PPSTRESU"], } out.append(base) spec = NORMALIZED.get(rec["PPTESTCD"]) if spec is None or rec["PPSTRESN"] == "": continue dose = dose_by_key.get((rec["USUBJID"], rec["PPRFTDTC"])) if dose is None or dose == 0: continue paramcd, param, avalu = spec aval = float(rec["PPSTRESN"]) / dose added = dict(base) added["PARAMCD"] = paramcd added["PARAM"] = param added["AVAL"] = repr(aval) added["AVALU"] = avalu out.append(added) os.makedirs(OUTPUT, exist_ok=True) with open(os.path.join(OUTPUT, "adpp.csv"), "w", newline="") as f: writer = csv.DictWriter(f, fieldnames=COLUMNS) writer.writeheader() writer.writerows(out)if __name__ == "__main__": main()solutions/adam-adpp-dose-normalized/result.sas
Edit63 lines/* opensas reference solution for the yamaa benchmark adam-adpp-dose-normalized. Reads the benchmark inputs and derives the requested output. Execute with the existing opensas runtime: opensas /app/output/result.sas. */data pp; length STUDYID DOMAIN USUBJID PPSEQ PPTESTCD PPTEST PPCAT PPORRES PPORRESU PPSTRESC PPSTRESU PPSTAT PPREASND PPSPEC VISITNUM VISIT PPRFTDTC $1024; infile "/app/input/pp.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. DOMAIN : $char1024. USUBJID : $char1024. PPSEQ : $char1024. PPTESTCD : $char1024. PPTEST : $char1024. PPCAT : $char1024. PPORRES : $char1024. PPORRESU : $char1024. PPSTRESC : $char1024. PPSTRESN PPSTRESU : $char1024. PPSTAT : $char1024. PPREASND : $char1024. PPSPEC : $char1024. VISITNUM : $char1024. VISIT : $char1024. PPRFTDTC : $char1024.;run;data ex; length STUDYID DOMAIN USUBJID EXSEQ EXTRT EXDOSU EXDOSFRM EXDOSFRQ EXROUTE EXSTDTC EXENDTC $1024; infile "/app/input/ex.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char1024. DOMAIN : $char1024. USUBJID : $char1024. EXSEQ : $char1024. EXTRT : $char1024. EXDOSE EXDOSU : $char1024. EXDOSFRM : $char1024. EXDOSFRQ : $char1024. EXROUTE : $char1024. EXSTDTC : $char1024. EXENDTC : $char1024.;run;/* Every PP record as collected. */data kept; length STUDYID USUBJID VISIT PARAMCD PARAM AVALU $1024; set pp; PARAMCD=PPTESTCD; PARAM=PPTEST; AVAL=PPSTRESN; AVALU=PPSTRESU; keep STUDYID USUBJID VISIT PARAMCD PARAM AVAL AVALU;run;/* The dose in mg of each administration; a dose in ug is a thousandth of a mg. */data dose; length PPRFTDTC $1024; set ex; if EXDOSU='mg' then DOSEMG=EXDOSE; else if EXDOSU='ug' then DOSEMG=EXDOSE/1000; PPRFTDTC=EXSTDTC; keep STUDYID USUBJID PPRFTDTC DOSEMG;run;/* The maximum concentration and area under the curve records that have a value. */data exposure; length NEWCD NEWPARAM $1024; set pp; if PPTESTCD='CMAX' then do; NEWCD='CMAXD'; NEWPARAM='Max Conc Norm by Dose'; end; else if PPTESTCD='AUCLST' then do; NEWCD='AUCLSTD'; NEWPARAM='AUC to Last Nonzero Conc Norm by Dose'; end; else if PPTESTCD='AUCIFO' then do; NEWCD='AUCIFOD'; NEWPARAM='AUC Infinity Obs Norm by Dose'; end; if NEWCD ne '' and not missing(PPSTRESN);run;/* The administration that starts at the profile's reference time. */proc sql; create table matched as select a.*, b.DOSEMG from exposure as a inner join dose as b on a.STUDYID=b.STUDYID and a.USUBJID=b.USUBJID and a.PPRFTDTC=b.PPRFTDTC;quit;data added; length STUDYID USUBJID VISIT PARAMCD PARAM AVALU $1024; set matched; if not missing(DOSEMG) and DOSEMG ne 0; PARAMCD=NEWCD; PARAM=NEWPARAM; AVAL=PPSTRESN/DOSEMG; AVALU=cats(PPSTRESU, '/mg'); keep STUDYID USUBJID VISIT PARAMCD PARAM AVAL AVALU;run;data result; set kept added; run;proc sql; create table final as select STUDYID, USUBJID, VISIT, PARAMCD, PARAM, AVAL, AVALU from result;quit;proc export data=final outfile="/app/output/adpp.csv" dbms=csv replace; run;
yamaa