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 pharmacokinetic (PK) parameter of a two-period
bioequivalence crossover into ADPP with the period's pre-dose
concentration (PRECONC), that concentration as a percentage of the
period's maximum concentration (PREPCMAX), and the analysis flag
(ANL01FL) that leaves a period with carry-over out of the
bioequivalence analysis.
Input: PK parameters (PP) with their numeric result (PPSTRESN)
and the reference dose time of their period (PPRFTDTC), and PK
concentrations (PC) with planned time point (PCTPT), standard result
(PCSTRESC, PCSTRESN), status and the reference dose time
(PCRFTDTC).
Variables:
VISITNUMandVISITname the dosing period the parameter belongs to, as PP gives them.AVALis the parameter's numeric result in standard units.PRECONCis the concentration of the period's pre-dose sample: the PC record planned atPREDOSEwhose reference dose time is the parameter's. A result below the lower limit of quantitation counts as 0. Empty when the period has no pre-dose sample, or the sample was not done; no other sample stands in for it.PREPCMAXisPRECONCas a percentage of the same subject's maximum concentration (Cmax) in the same period, not rounded; empty whenPRECONCis.ANL01FLis empty on every parameter of a period whosePREPCMAXis greater than 5, andYon every other record, including a period whosePREPCMAXis empty. Exactly 5 percent stays in.
Note: every period is checked, the first one included, and the
period is the unit left out: the subject's other period keeps Y, and
every record stays in the dataset. The pre-dose result, the percentage
and the flag repeat on every parameter of the period.
Inputs
Under review2 source filesinput/pc.csv
Edit15 rows| STUDYID | DOMAIN | USUBJID | PCSEQ | PCTESTCD | PCTEST | PCORRES | PCORRESU | PCSTRESC | PCSTRESN | PCSTRESU | PCSTAT | PCLLOQ | VISITNUM | VISIT | PCDTC | PCTPT | PCTPTNUM | PCRFTDTC |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| YAMAA-01 | PC | 1 | DRUGX | Drug X | <0.5 | ng/mL | <0.5 | — | ng/mL | — | 0.5 | 1 | PERIOD 1 | 2025-03-03T07:45 | PREDOSE | 0 | 2025-03-03T08:00 | |
| YAMAA-01 | PC | 2 | DRUGX | Drug X | 1 | ng/mL | 1 | 1 | ng/mL | — | 0.5 | 2 | PERIOD 2 | 2025-03-10T07:45 | PREDOSE | 0 | 2025-03-10T08:00 | |
| YAMAA-01 | PC | 3 | DRUGX | Drug X | 60 | ng/mL | 60 | 60 | ng/mL | — | 0.5 | 2 | PERIOD 2 | 2025-03-10T09:00 | 1H | 1 | 2025-03-10T08:00 | |
| YAMAA-01 | PC | 1 | DRUGX | Drug X | <0.5 | ng/mL | <0.5 | — | ng/mL | — | 0.5 | 1 | PERIOD 1 | 2025-03-03T07:45 | PREDOSE | 0 | 2025-03-03T08:00 | |
| YAMAA-01 | PC | 2 | DRUGX | Drug X | 7 | ng/mL | 7 | 7 | ng/mL | — | 0.5 | 2 | PERIOD 2 | 2025-03-10T07:45 | PREDOSE | 0 | 2025-03-10T08:00 | |
| YAMAA-01 | PC | 1 | DRUGX | Drug X | <0.5 | ng/mL | <0.5 | — | ng/mL | — | 0.5 | 1 | PERIOD 1 | 2025-03-03T07:45 | PREDOSE | 0 | 2025-03-03T08:00 | |
| YAMAA-01 | PC | 2 | DRUGX | Drug X | 3 | ng/mL | 3 | 3 | ng/mL | — | 0.5 | 2 | PERIOD 2 | 2025-03-10T07:45 | PREDOSE | 0 | 2025-03-10T08:00 | |
| YAMAA-01 | PC | 1 | DRUGX | Drug X | <0.5 | ng/mL | <0.5 | — | ng/mL | — | 0.5 | 1 | PERIOD 1 | 2025-03-03T07:45 | PREDOSE | 0 | 2025-03-03T08:00 | |
| YAMAA-01 | PC | 2 | DRUGX | Drug X | 2 | ng/mL | 2 | 2 | ng/mL | — | 0.5 | 2 | PERIOD 2 | 2025-03-10T07:45 | PREDOSE | 0 | 2025-03-10T08:00 | |
| YAMAA-01 | PC | 1 | DRUGX | Drug X | 6 | ng/mL | 6 | 6 | ng/mL | — | 0.5 | 1 | PERIOD 1 | 2025-03-03T07:45 | PREDOSE | 0 | 2025-03-03T08:00 | |
| YAMAA-01 | PC | 2 | DRUGX | Drug X | <0.5 | ng/mL | <0.5 | — | ng/mL | — | 0.5 | 2 | PERIOD 2 | 2025-03-10T07:45 | PREDOSE | 0 | 2025-03-10T08:00 | |
| YAMAA-01 | PC | 1 | DRUGX | Drug X | <0.5 | ng/mL | <0.5 | — | ng/mL | — | 0.5 | 1 | PERIOD 1 | 2025-03-03T07:45 | PREDOSE | 0 | 2025-03-03T08:00 | |
| YAMAA-01 | PC | 2 | DRUGX | Drug X | — | ng/mL | — | — | ng/mL | NOT DONE | 0.5 | 2 | PERIOD 2 | 2025-03-10T07:45 | PREDOSE | 0 | 2025-03-10T08:00 | |
| YAMAA-01 | PC | 1 | DRUGX | Drug X | <0.5 | ng/mL | <0.5 | — | ng/mL | — | 0.5 | 1 | PERIOD 1 | 2025-03-03T07:45 | PREDOSE | 0 | 2025-03-03T08:00 | |
| YAMAA-01 | PC | 2 | DRUGX | Drug X | 40 | ng/mL | 40 | 40 | ng/mL | — | 0.5 | 2 | PERIOD 2 | 2025-03-10T09:00 | 1H | 1 | 2025-03-10T08:00 |
input/pp.csv
Edit20 rows| STUDYID | DOMAIN | USUBJID | PPSEQ | PPTESTCD | PPTEST | PPCAT | PPSTRESN | PPSTRESU | PPSPEC | VISITNUM | VISIT | PPRFTDTC |
|---|---|---|---|---|---|---|---|---|---|---|---|---|
| YAMAA-01 | PP | 1 | CMAX | Max Conc | DRUGX | 100 | ng/mL | PLASMA | 1 | PERIOD 1 | 2025-03-03T08:00 | |
| YAMAA-01 | PP | 2 | AUCLST | AUC to Last Nonzero Conc | DRUGX | 800 | h*ng/mL | PLASMA | 1 | PERIOD 1 | 2025-03-03T08:00 | |
| YAMAA-01 | PP | 3 | CMAX | Max Conc | DRUGX | 80 | ng/mL | PLASMA | 2 | PERIOD 2 | 2025-03-10T08:00 | |
| YAMAA-01 | PP | 4 | AUCLST | AUC to Last Nonzero Conc | DRUGX | 640 | h*ng/mL | PLASMA | 2 | PERIOD 2 | 2025-03-10T08:00 | |
| YAMAA-01 | PP | 5 | TMAX | Time of CMAX | DRUGX | 2 | h | PLASMA | 2 | PERIOD 2 | 2025-03-10T08:00 | |
| YAMAA-01 | PP | 1 | CMAX | Max Conc | DRUGX | 160 | ng/mL | PLASMA | 1 | PERIOD 1 | 2025-03-03T08:00 | |
| YAMAA-01 | PP | 2 | CMAX | Max Conc | DRUGX | 100 | ng/mL | PLASMA | 2 | PERIOD 2 | 2025-03-10T08:00 | |
| YAMAA-01 | PP | 3 | AUCLST | AUC to Last Nonzero Conc | DRUGX | 900 | h*ng/mL | PLASMA | 2 | PERIOD 2 | 2025-03-10T08:00 | |
| YAMAA-01 | PP | 1 | CMAX | Max Conc | DRUGX | 70 | ng/mL | PLASMA | 1 | PERIOD 1 | 2025-03-03T08:00 | |
| YAMAA-01 | PP | 2 | CMAX | Max Conc | DRUGX | 60 | ng/mL | PLASMA | 2 | PERIOD 2 | 2025-03-10T08:00 | |
| YAMAA-01 | PP | 1 | CMAX | Max Conc | DRUGX | 32 | ng/mL | PLASMA | 1 | PERIOD 1 | 2025-03-03T08:00 | |
| YAMAA-01 | PP | 2 | CMAX | Max Conc | DRUGX | 80 | ng/mL | PLASMA | 2 | PERIOD 2 | 2025-03-10T08:00 | |
| YAMAA-01 | PP | 1 | CMAX | Max Conc | DRUGX | 75 | ng/mL | PLASMA | 1 | PERIOD 1 | 2025-03-03T08:00 | |
| YAMAA-01 | PP | 2 | AUCLST | AUC to Last Nonzero Conc | DRUGX | 600 | h*ng/mL | PLASMA | 1 | PERIOD 1 | 2025-03-03T08:00 | |
| YAMAA-01 | PP | 3 | CMAX | Max Conc | DRUGX | 90 | ng/mL | PLASMA | 2 | PERIOD 2 | 2025-03-10T08:00 | |
| YAMAA-01 | PP | 1 | CMAX | Max Conc | DRUGX | 6 | ng/mL | PLASMA | 1 | PERIOD 1 | 2025-03-03T08:00 | |
| YAMAA-01 | PP | 2 | CMAX | Max Conc | DRUGX | 85 | ng/mL | PLASMA | 2 | PERIOD 2 | 2025-03-10T08:00 | |
| YAMAA-01 | PP | 1 | CMAX | Max Conc | DRUGX | 95 | ng/mL | PLASMA | 1 | PERIOD 1 | 2025-03-03T08:00 | |
| YAMAA-01 | PP | 2 | CMAX | Max Conc | DRUGX | 90 | ng/mL | PLASMA | 2 | PERIOD 2 | 2025-03-10T08:00 | |
| YAMAA-01 | PP | 3 | AUCLST | AUC to Last Nonzero Conc | DRUGX | 700 | h*ng/mL | PLASMA | 2 | PERIOD 2 | 2025-03-10T08:00 |
Expected output
Under review20 expected rowsexpected/adpp.csv
Edit20 rows| STUDYID | USUBJID | VISITNUM | VISIT | PARAMCD | PARAM | AVAL | PRECONC | PREPCMAX | ANL01FL |
|---|---|---|---|---|---|---|---|---|---|
| YAMAA-01 | 1 | PERIOD 1 | CMAX | Max Conc | 100 | 0 | 0 | Y | |
| YAMAA-01 | 1 | PERIOD 1 | AUCLST | AUC to Last Nonzero Conc | 800 | 0 | 0 | Y | |
| YAMAA-01 | 2 | PERIOD 2 | CMAX | Max Conc | 80 | 1 | 1.25 | Y | |
| YAMAA-01 | 2 | PERIOD 2 | AUCLST | AUC to Last Nonzero Conc | 640 | 1 | 1.25 | Y | |
| YAMAA-01 | 2 | PERIOD 2 | TMAX | Time of CMAX | 2 | 1 | 1.25 | Y | |
| YAMAA-01 | 1 | PERIOD 1 | CMAX | Max Conc | 160 | 0 | 0 | Y | |
| YAMAA-01 | 2 | PERIOD 2 | CMAX | Max Conc | 100 | 7 | 7 | — | |
| YAMAA-01 | 2 | PERIOD 2 | AUCLST | AUC to Last Nonzero Conc | 900 | 7 | 7 | — | |
| YAMAA-01 | 1 | PERIOD 1 | CMAX | Max Conc | 70 | 0 | 0 | Y | |
| YAMAA-01 | 2 | PERIOD 2 | CMAX | Max Conc | 60 | 3 | 5 | Y | |
| YAMAA-01 | 1 | PERIOD 1 | CMAX | Max Conc | 32 | 0 | 0 | Y | |
| YAMAA-01 | 2 | PERIOD 2 | CMAX | Max Conc | 80 | 2 | 2.5 | Y | |
| YAMAA-01 | 1 | PERIOD 1 | CMAX | Max Conc | 75 | 6 | 8 | — | |
| YAMAA-01 | 1 | PERIOD 1 | AUCLST | AUC to Last Nonzero Conc | 600 | 6 | 8 | — | |
| YAMAA-01 | 2 | PERIOD 2 | CMAX | Max Conc | 90 | 0 | 0 | Y | |
| YAMAA-01 | 1 | PERIOD 1 | CMAX | Max Conc | 6 | 0 | 0 | Y | |
| YAMAA-01 | 2 | PERIOD 2 | CMAX | Max Conc | 85 | — | — | Y | |
| YAMAA-01 | 1 | PERIOD 1 | CMAX | Max Conc | 95 | 0 | 0 | Y | |
| YAMAA-01 | 2 | PERIOD 2 | CMAX | Max Conc | 90 | — | — | Y | |
| YAMAA-01 | 2 | PERIOD 2 | AUCLST | AUC to Last Nonzero Conc | 700 | — | — | Y |
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 | VISITNUM | Visit Number | numeric | Copy value from PP.VISITNUM. | Predecessor | ||
| ADPP | VISIT | Visit Name | character | Copy value from PP.VISIT. | Predecessor | ||
| ADPP | PARAMCD | Parameter Code | character | Copy value from PP.PPTESTCD. | Predecessor | ||
| ADPP | PARAM | Parameter | character | Copy value from PP.PPTEST. | Predecessor | ||
| ADPP | AVAL | Analysis Value | numeric | Copy value from PP.PPSTRESN. | Predecessor | ||
| ADPP | PRECONC | Pre-Dose Concentration of the Period | numeric | Aggregate ONLY(PREVAL) over records whose STUDYID equals PP.STUDYID, USUBJID equals PP.USUBJID and PCRFTDTC equals PP.PPRFTDTC, where PC.PCTPT = 'PREDOSE', with PREVAL as if PC.PCSTRESC LIKE '<%' then "0"; otherwise "PC.PCSTRESN". | Derived | ||
| ADPP | PREPCMAX | Pre-Dose Concentration as Percent of Cmax | numeric | Compute 100 * PRECONC / NULLIF(CMAXPER, 0). | Derived | ||
| ADPP | ANL01FL | Analysis Flag 01 | character | Y | "Y" when PREPCMAX IS NULL OR PREPCMAX <= 5; blank otherwise. | Derived |
| Variable | Permitted values |
|---|---|
| ANL01FL | Y |
| 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-carryover-exclusion/full.md
Edit35 linesFollowing CDISC ADaM standards, use the provided PC and PP datasets to create an ADPP dataset with one record per subject, period, and pharmacokinetic parameter.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, VISITNUM, VISIT, PARAMCD, PARAM, AVAL, PRECONC, PREPCMAX, ANL01FL
- VISITNUM and VISIT name the dosing period the parameter belongs to, as PP gives them, and PARAMCD and PARAM are the parameter's test code and test name.
- AVAL is the parameter's numeric result in standard units.
- PRECONC is the concentration of the period's pre-dose sample: the PC record for the same subject planned at "PREDOSE" whose reference dose time is the parameter's.
- A pre-dose result below the lower limit of quantitation, recorded as a character result beginning with "<", counts as 0.
- PRECONC has no value when the period has no pre-dose sample or the sample was not done, and no other sample stands in for it.
- PREPCMAX is PRECONC as a percentage of the same subject's Cmax in the same period, the AVAL of the period's "CMAX" parameter, and is not rounded.
- PREPCMAX has no value when PRECONC has no value, and has no value when the period's Cmax is zero.
- ANL01FL has no value on every parameter of a period whose PREPCMAX is greater than 5, and is "Y" on every other record, including a period whose PREPCMAX has no value.
- Exactly 5 percent stays in.
- Every period is checked, the first one included, and the period is the unit left out: the subject's other period keeps "Y" and every record stays in the dataset.
- PRECONC, PREPCMAX and ANL01FL repeat on every parameter of the period.
Read the source datasets from /app/input and save the completed dataset as /app/output/adpp.csv.
prompts/adam-adpp-carryover-exclusion/conventions.md
Edit12 linesFollowing CDISC ADaM standards, use the provided PC and PP datasets to create an ADPP dataset with one record per subject, period, and pharmacokinetic parameter.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, VISITNUM, VISIT, PARAMCD, PARAM, AVAL, PRECONC, PREPCMAX, ANL01FL
PREPCMAX is not rounded. ANL01FL is "Y" or has no value.
Read the source datasets from /app/input and save the completed dataset as /app/output/adpp.csv.
prompts/adam-adpp-carryover-exclusion/brief.md
Edit10 linesFollowing CDISC ADaM standards, use the provided PC and PP datasets to create an ADPP dataset with one record per subject, period, and pharmacokinetic parameter.
The output dataset should contain the following columns in this order: STUDYID, USUBJID, VISITNUM, VISIT, PARAMCD, PARAM, AVAL, PRECONC, PREPCMAX, ANL01FL
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-carryover-exclusion/result.R
Edit60 lines# Reference solution for the yamaa benchmark adam-adpp-carryover-exclusion (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(stringr)pp <- read_csv( "/app/input/pp.csv", col_types = cols( PPSTRESN = col_double(), VISITNUM = col_integer(), .default = col_character() ))pc <- read_csv( "/app/input/pc.csv", col_types = cols(PCSTRESN = col_double(), .default = col_character()))# The period's pre-dose sample: planned at PREDOSE, with the parameter's# reference dose time. A below-limit result ("<" and the limit) counts as 0;# a sample not done has no result and gives no value.predose <- pc |> filter(PCTPT == "PREDOSE") |> transmute( STUDYID, USUBJID, PPRFTDTC = PCRFTDTC, PRECONC = if_else( !is.na(PCSTRESC) & str_starts(PCSTRESC, fixed("<")), 0, PCSTRESN ) )stopifnot(!anyDuplicated(predose[c("STUDYID", "USUBJID", "PPRFTDTC")]))# The same subject's Cmax in the same period.cmax <- pp |> filter(PPTESTCD == "CMAX") |> transmute(STUDYID, USUBJID, PPRFTDTC, CMAX = PPSTRESN)stopifnot(!anyDuplicated(cmax[c("STUDYID", "USUBJID", "PPRFTDTC")]))keys <- c("STUDYID", "USUBJID", "PPRFTDTC")adpp <- pp |> left_join(predose, by = keys) |> left_join(cmax, by = keys) |> mutate( PREPCMAX = if_else(!is.na(CMAX) & CMAX != 0, 100 * PRECONC / CMAX, NA_real_), # Left out only when the percentage is known and above 5. ANL01FL = if_else(!is.na(PREPCMAX) & PREPCMAX > 5, NA_character_, "Y") ) |> transmute( STUDYID, USUBJID, VISITNUM, VISIT, PARAMCD = PPTESTCD, PARAM = PPTEST, AVAL = PPSTRESN, PRECONC, PREPCMAX, ANL01FL )dir.create("/app/output", showWarnings = FALSE)write_csv(adpp, "/app/output/adpp.csv", na = "")solutions/adam-adpp-carryover-exclusion/result.py
Edit119 lines# Reference solution for the yamaa benchmark adam-adpp-carryover-exclusion (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 PC and PP: pre-dose carryover exclusion flag.One record per subject, period, and pharmacokinetic parameter (from PP).PRECONC is the concentration of the period's pre-dose PC sample (planned"PREDOSE", matched to the parameter by reference dose time); a characterresult beginning with "<" counts as 0. PREPCMAX is PRECONC as apercentage of the period's Cmax. ANL01FL is blank on every parameter ofa period whose PREPCMAX is greater than 5, and "Y" otherwise."""import csvimport osINPUT_DIR = "/app/input"OUTPUT_DIR = "/app/output"def read_csv(name): with open(os.path.join(INPUT_DIR, name), newline="") as f: return list(csv.DictReader(f))def fmt(value): """Format a float for CSV: integers without a decimal point.""" if value is None: return "" if value == int(value): return str(int(value)) return repr(value)def main(): pc = read_csv("pc.csv") pp = read_csv("pp.csv") # Pre-dose concentrations keyed by (subject, reference dose time). preconc = {} for row in pc: if row["PCTPT"] != "PREDOSE": continue key = (row["USUBJID"], row["PCRFTDTC"]) if row["PCSTAT"] == "NOT DONE": preconc[key] = None elif row["PCSTRESC"].startswith("<"): preconc[key] = 0.0 elif row["PCSTRESN"]: preconc[key] = float(row["PCSTRESN"]) else: preconc[key] = None # Cmax (AVAL of the period's CMAX parameter) per (subject, visit). cmax = {} for row in pp: if row["PPTESTCD"] == "CMAX": cmax[(row["USUBJID"], row["VISITNUM"])] = float(row["PPSTRESN"]) # Period-level values: PRECONC, PREPCMAX, ANL01FL per (subject, visit). period = {} for row in pp: key = (row["USUBJID"], row["VISITNUM"]) if key in period: continue pre = preconc.get((row["USUBJID"], row["PPRFTDTC"])) c = cmax.get(key) if pre is None or c is None or c == 0: prepct = None else: prepct = 100.0 * pre / c if prepct is not None and prepct > 5: anl01fl = "" else: anl01fl = "Y" period[key] = (pre, prepct, anl01fl) out_rows = [] for row in pp: pre, prepct, anl01fl = period[(row["USUBJID"], row["VISITNUM"])] out_rows.append( { "STUDYID": row["STUDYID"], "USUBJID": row["USUBJID"], "VISITNUM": row["VISITNUM"], "VISIT": row["VISIT"], "PARAMCD": row["PPTESTCD"], "PARAM": row["PPTEST"], "AVAL": fmt(float(row["PPSTRESN"])), "PRECONC": fmt(pre), "PREPCMAX": fmt(prepct), "ANL01FL": anl01fl, } ) fieldnames = [ "STUDYID", "USUBJID", "VISITNUM", "VISIT", "PARAMCD", "PARAM", "AVAL", "PRECONC", "PREPCMAX", "ANL01FL", ] os.makedirs(OUTPUT_DIR, exist_ok=True) with open(os.path.join(OUTPUT_DIR, "adpp.csv"), "w", newline="") as f: writer = csv.DictWriter(f, fieldnames=fieldnames) writer.writeheader() writer.writerows(out_rows)if __name__ == "__main__": main()solutions/adam-adpp-carryover-exclusion/result.sas
Edit81 lines/* opensas reference solution for the yamaa benchmark adam-adpp-carryover-exclusion. 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 PPTESTCD PPTEST PPCAT PPSTRESU PPSPEC VISIT PPRFTDTC $200; infile "/app/input/pp.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char200. DOMAIN : $char200. USUBJID : $char200. PPSEQ PPTESTCD : $char200. PPTEST : $char200. PPCAT : $char200. PPSTRESN PPSTRESU : $char200. PPSPEC : $char200. VISITNUM VISIT : $char200. PPRFTDTC : $char200.; ORD = _n_;run;data pc; length STUDYID DOMAIN USUBJID PCTESTCD PCTEST PCORRES PCORRESU PCSTRESC PCSTRESU PCSTAT VISIT PCDTC PCTPT PCRFTDTC $200; infile "/app/input/pc.csv" dsd dlm="," firstobs=2 truncover lrecl=32767; input STUDYID : $char200. DOMAIN : $char200. USUBJID : $char200. PCSEQ PCTESTCD : $char200. PCTEST : $char200. PCORRES : $char200. PCORRESU : $char200. PCSTRESC : $char200. PCSTRESN PCSTRESU : $char200. PCSTAT : $char200. PCLLOQ VISITNUM VISIT : $char200. PCDTC : $char200. PCTPT : $char200. PCTPTNUM PCRFTDTC : $char200.;run;/* The period's pre-dose sample: planned at PREDOSE, with the parameter's reference dose time. A below-limit result counts as 0; a sample not done has no result and gives no value. */data predose; length PRFT $200; set pc; if PCTPT = 'PREDOSE'; PRFT = PCRFTDTC; if index(PCSTRESC, '<') = 1 then PRECONC = 0; else PRECONC = PCSTRESN; keep STUDYID USUBJID PRFT PRECONC;run;/* The same subject's Cmax in the same period. */data cmax; length CRFT $200; set pp; if PPTESTCD = 'CMAX'; CRFT = PPRFTDTC; CMAXV = PPSTRESN; keep STUDYID USUBJID CRFT CMAXV;run;proc sql; create table withpre as select p.*, d.PRECONC from pp as p left join predose as d on p.STUDYID = d.STUDYID and p.USUBJID = d.USUBJID and p.PPRFTDTC = d.PRFT; create table withcmax as select p.*, c.CMAXV from withpre as p left join cmax as c on p.STUDYID = c.STUDYID and p.USUBJID = c.USUBJID and p.PPRFTDTC = c.CRFT;quit;/* Left out only when the percentage is known and above 5. */data final; length PARAMCD PARAM $200 ANL01FL $1; set withcmax; PARAMCD = PPTESTCD; PARAM = PPTEST; AVAL = PPSTRESN; if not missing(PRECONC) and not missing(CMAXV) and CMAXV ne 0 then PREPCMAX = 100 * PRECONC / CMAXV; ANL01FL = 'Y'; if not missing(PREPCMAX) and PREPCMAX > 5 then ANL01FL = ' ';run;proc sort data=final; by ORD; run;proc sql; create table adpp as select STUDYID, USUBJID, VISITNUM, VISIT, PARAMCD, PARAM, AVAL, PRECONC, PREPCMAX, ANL01FL from final;quit;proc export data=adpp outfile="/app/output/adpp.csv" dbms=csv replace; run;
yamaa