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: turn noncompartmental analysis estimates into pharmacokinetic parameter (PP) records, with standard parameter codes and names.
Input: a noncompartmental analysis software export with subject, analyte, software parameter name, estimate, unit and reference dose time. The estimates have already been calculated from plasma concentrations.
Variables:
PPSEQnumbers parameters within each subject by reference dose time, analyte and standard parameter code.PPTESTCDidentifies the software'sCmax,TmaxandAUClastasCMAX,TMAXandAUCLST; it is missing when the parameter is absent.PPTESTnames those parameters as Max Conc, Time of CMAX Observation and AUC to Last Nonzero Conc; it is missing when the parameter code is absent.PPCATcarries the analyte name, or is missing when none is supplied.PPORRESretains the estimate as text, including its reported decimal places; it is missing when the estimate is absent.PPORRESUretains the analysis unit supplied for that estimate, without assigning a unit from the parameter code. It is missing when the unit is absent, independently of whether an estimate is supplied.PPSTRESCretains the estimate as text with its reported decimal places; it is missing when the estimate is absent, regardless of the unit.PPSTRESNholds the estimate as a number; it is missing when the estimate is absent, regardless of the unit.PPSTRESUretains the supplied analysis unit without conversion; it is missing when the unit is absent, regardless of the estimate.PPSPECis alwaysPLASMA.PPRFTDTCidentifies the reference dose date and time supplied by the analysis software, or is missing when none is supplied.
Note: this step publishes the supplied estimates; it does not recalculate them from a concentration profile or change their units. An unsupported parameter name or an estimate that is not numeric stops publication.
Inputs
Under review1 source fileinput/nca_transfer.csv
Edit6 rows| Protocol | Subject | Analyte | Parameter | Estimate | Unit | ReferenceDose |
|---|---|---|---|---|---|---|
| PK201 | PK201-001 | ZX-201 | Cmax | 10.0 | ng/mL | 2026-03-02T08:00:00 |
| PK201 | PK201-001 | ZX-201 | Tmax | 1.00 | h | 2026-03-02T08:00:00 |
| PK201 | PK201-001 | ZX-201 | AUClast | 12.5 | h*ng/mL | 2026-03-02T08:00:00 |
| PK201 | PK201-002 | ZX-201 | Tmax | 1.00 | h | 2026-03-02T08:00:00 |
| PK201 | PK201-002 | ZX-201 | AUClast | 25.0 | h*ng/mL | 2026-03-02T08:00:00 |
| PK201 | PK201-002 | ZX-201 | Cmax | 20.0 | ng/mL | 2026-03-02T08:00:00 |
Expected output
Under review6 expected rowsexpected/pp.csv
Edit6 rows| DOMAIN | STUDYID | USUBJID | PPSEQ | PPTESTCD | PPTEST | PPCAT | PPORRES | PPORRESU | PPSTRESC | PPSTRESN | PPSTRESU | PPSPEC | PPRFTDTC |
|---|---|---|---|---|---|---|---|---|---|---|---|---|---|
| PP | PK201 | 1 | AUCLST | AUC to Last Nonzero Conc | ZX-201 | 12.5 | h*ng/mL | 12.5 | 12.5 | h*ng/mL | PLASMA | 2026-03-02T08:00:00 | |
| PP | PK201 | 2 | CMAX | Max Conc | ZX-201 | 10.0 | ng/mL | 10.0 | 10 | ng/mL | PLASMA | 2026-03-02T08:00:00 | |
| PP | PK201 | 3 | TMAX | Time of CMAX Observation | ZX-201 | 1.00 | h | 1.00 | 1 | h | PLASMA | 2026-03-02T08:00:00 | |
| PP | PK201 | 1 | AUCLST | AUC to Last Nonzero Conc | ZX-201 | 25.0 | h*ng/mL | 25.0 | 25 | h*ng/mL | PLASMA | 2026-03-02T08:00:00 | |
| PP | PK201 | 2 | CMAX | Max Conc | ZX-201 | 20.0 | ng/mL | 20.0 | 20 | ng/mL | PLASMA | 2026-03-02T08:00:00 | |
| PP | PK201 | 3 | TMAX | Time of CMAX Observation | ZX-201 | 1.00 | h | 1.00 | 1 | h | PLASMA | 2026-03-02T08:00:00 |
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 "PP". | SDTM | 1 | ||||
| STUDYID | Study Identifier | Char | Collected | Copy value from NCA.Protocol. | SDTM | 2 | ||||
| USUBJID | Unique Subject Identifier | Char | Collected | Copy value from NCA.Subject. | SDTM | 3 | ||||
| PPTESTCD | PK Parameter Short Name | Char | Collected | Recode NCA.Parameter: "Cmax" → "CMAX", "Tmax" → "TMAX", "AUClast" → "AUCLST"; missing values stay missing; unlisted values are errors. | SDTM | 4 | ||||
| PPTEST | PK Parameter Name | Char | Derived | Recode PPTESTCD: "CMAX" → "Max Conc", "TMAX" → "Time of CMAX Observation", "AUCLST" → "AUC to Last Nonzero Conc"; missing values stay missing; unlisted values are errors. | SDTM | 5 | ||||
| PPCAT | Category for PK Parameters | Char | Collected | Copy value from NCA.Analyte. | SDTM | 6 | ||||
| PPORRES | Result or Finding in Original Units | Char | Collected | Copy value from NCA.Estimate. | SDTM | 7 | ||||
| PPORRESU | Original Units | Char | Collected | Copy value from NCA.Unit. | SDTM | 8 | ||||
| PPSTRESC | Character Result/Finding in Std Format | Char | Derived | Copy value from PPORRES. | SDTM | 9 | ||||
| PPSTRESN | Numeric Result/Finding in Standard Units | Num | Derived | Copy value from PPORRES. | SDTM | 10 | ||||
| PPSTRESU | Standard Units | Char | Derived | Copy value from PPORRESU. | SDTM | 11 | ||||
| PPSPEC | Specimen Material Type | Char | Assigned | Set constant value "PLASMA". | SDTM | 12 | ||||
| PPRFTDTC | Date/Time of Reference Point | Char | ISO 8601 | Collected | Copy value from NCA.ReferenceDose. | SDTM | 13 | |||
| PPSEQ | Sequence Number | Num | Derived | Row number within each group of NCA.Protocol, NCA.Subject, ordered by NCA.ReferenceDose then NCA.Analyte then NCA.Parameter. | SDTM | 14 |
| 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-pp-pk-parameters/full.md
Edit27 linesFollowing CDISC SDTM standards, use the provided NCA_TRANSFER dataset to create a PP dataset with one record per supplied analysis parameter estimate.
The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, PPSEQ, PPTESTCD, PPTEST, PPCAT, PPORRES, PPORRESU, PPSTRESC, PPSTRESN, PPSTRESU, PPSPEC, PPRFTDTC
DOMAIN is "PP" and PPSPEC is "PLASMA". STUDYID is the supplied Protocol identifier and USUBJID is the supplied Subject identifier, without alteration. PPSEQ starts at 1 within each subject and study, increasing by reference dose date and time, then analyte, then standard parameter code, all ascending. For software parameters "Cmax", "Tmax" and "AUClast", PPTESTCD is "CMAX", "TMAX" and "AUCLST", respectively. PPTEST is "Max Conc" for "CMAX", "Time of CMAX Observation" for "TMAX" and "AUC to Last Nonzero Conc" for "AUCLST". PPCAT identifies the supplied analyte. PPORRES and PPSTRESC are the supplied estimate as text, preserving all reported decimal places, including trailing zeros. PPSTRESN is the numeric value of that estimate, without rounding or recalculation from concentration profiles. PPORRESU and PPSTRESU are the supplied analysis unit, without conversion or assignment of a unit from the parameter code. PPRFTDTC identifies the supplied reference dose date and time.
Read the source datasets from /app/input and save the completed dataset as /app/output/pp.csv.
prompts/sdtm-pp-pk-parameters/conventions.md
Edit16 linesFollowing CDISC SDTM standards, use the provided NCA_TRANSFER dataset to create a PP dataset with one record per supplied analysis parameter estimate.
The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, PPSEQ, PPTESTCD, PPTEST, PPCAT, PPORRES, PPORRESU, PPSTRESC, PPSTRESN, PPSTRESU, PPSPEC, PPRFTDTC
DOMAIN is "PP" and PPSPEC is "PLASMA". For software parameters "Cmax", "Tmax" and "AUClast", PPTESTCD is "CMAX", "TMAX" and "AUCLST", respectively. PPTEST is "Max Conc" for "CMAX", "Time of CMAX Observation" for "TMAX" and "AUC to Last Nonzero Conc" for "AUCLST". PPORRES and PPSTRESC preserve all reported decimal places, including trailing zeros. PPSTRESN is not rounded.
Read the source datasets from /app/input and save the completed dataset as /app/output/pp.csv.
prompts/sdtm-pp-pk-parameters/brief.md
Edit9 linesFollowing CDISC SDTM standards, use the provided NCA_TRANSFER dataset to create a PP dataset with one record per supplied analysis parameter estimate.
The output dataset should contain the following columns in this order: DOMAIN, STUDYID, USUBJID, PPSEQ, PPTESTCD, PPTEST, PPCAT, PPORRES, PPORRESU, PPSTRESC, PPSTRESN, PPSTRESU, PPSPEC, PPRFTDTC
Read the source datasets from /app/input and save the completed dataset as /app/output/pp.csv.
R
Edit3 lineslibrary(yamaa)yamaa_spec("spec.yaml")$run()$outputPython
Edit3 linesimport yamaayamaa.spec("spec.yaml").run().outputsolutions/sdtm-pp-pk-parameters/result.R
Edit26 linessource <- read.csv("/app/input/nca_transfer.csv", colClasses = "character", stringsAsFactors = FALSE, check.names = FALSE)code_map <- c(Cmax = "CMAX", Tmax = "TMAX", AUClast = "AUCLST")name_map <- c(CMAX = "Max Conc", TMAX = "Time of CMAX Observation", AUCLST = "AUC to Last Nonzero Conc")stopifnot(all(source$Parameter %in% names(code_map)))pp <- data.frame( DOMAIN = "PP", STUDYID = source$Protocol, USUBJID = source$Subject, PPSEQ = integer(nrow(source)), PPTESTCD = unname(code_map[source$Parameter]), PPTEST = unname(name_map[code_map[source$Parameter]]), PPCAT = source$Analyte, PPORRES = source$Estimate, PPORRESU = source$Unit, PPSTRESC = source$Estimate, PPSTRESN = as.numeric(source$Estimate), PPSTRESU = source$Unit, PPSPEC = "PLASMA", PPRFTDTC = format(as.POSIXct(source$ReferenceDose, format = "%Y-%m-%dT%H:%M:%S", tz = "UTC"), "%Y-%m-%dT%H:%M:%S", tz = "UTC"), stringsAsFactors = FALSE)pp <- pp[order(pp$STUDYID, pp$USUBJID, pp$PPRFTDTC, pp$PPCAT, pp$PPTESTCD), ]group <- interaction(pp$STUDYID, pp$USUBJID, drop = TRUE)pp$PPSEQ <- as.integer(ave(seq_len(nrow(pp)), group, FUN = seq_along))stopifnot(nrow(pp) == nrow(source), !anyNA(pp))write.csv(pp, "/app/output/pp.csv", row.names = FALSE, na = "")solutions/sdtm-pp-pk-parameters/result.py
Edit80 linesimport csvfrom datetime import datetimefrom decimal import Decimalfrom pathlib import PathINPUT = Path("/app/input")OUTPUT = Path("/app/output")PARAMETERS = { "Cmax": ("CMAX", "Max Conc"), "Tmax": ("TMAX", "Time of CMAX Observation"), "AUClast": ("AUCLST", "AUC to Last Nonzero Conc"),}COLUMNS = [ "DOMAIN", "STUDYID", "USUBJID", "PPSEQ", "PPTESTCD", "PPTEST", "PPCAT", "PPORRES", "PPORRESU", "PPSTRESC", "PPSTRESN", "PPSTRESU", "PPSPEC", "PPRFTDTC",]def main(): records = [] with (INPUT / "nca_transfer.csv").open(newline="", encoding="utf-8-sig") as source: for row in csv.DictReader(source): code, name = PARAMETERS[row["Parameter"]] estimate = row["Estimate"] records.append( { "DOMAIN": "PP", "STUDYID": row["Protocol"], "USUBJID": row["Subject"], "PPTESTCD": code, "PPTEST": name, "PPCAT": row["Analyte"], "PPORRES": estimate, "PPORRESU": row["Unit"], "PPSTRESC": estimate, "PPSTRESN": format(Decimal(estimate), "f"), "PPSTRESU": row["Unit"], "PPSPEC": "PLASMA", "PPRFTDTC": datetime.fromisoformat(row["ReferenceDose"]).strftime( "%Y-%m-%dT%H:%M:%S" ), } ) records.sort( key=lambda row: ( row["STUDYID"], row["USUBJID"], row["PPRFTDTC"], row["PPCAT"], row["PPTESTCD"], ) ) previous = None sequence = 0 for row in records: subject = (row["STUDYID"], row["USUBJID"]) sequence = sequence + 1 if subject == previous else 1 row["PPSEQ"] = sequence previous = subject OUTPUT.mkdir(exist_ok=True) with (OUTPUT / "pp.csv").open("w", newline="", encoding="utf-8") as target: writer = csv.DictWriter(target, fieldnames=COLUMNS) writer.writeheader() writer.writerows(records)if __name__ == "__main__": main()solutions/sdtm-pp-pk-parameters/result.sas
Edit45 linesdata nca_transfer; length Protocol $100 Subject $100 Analyte $100 Parameter $100 Estimate $100 Unit $100 ReferenceDose $30; infile '/app/input/nca_transfer.csv' dsd dlm=',' firstobs=2; input Protocol $ Subject $ Analyte $ Parameter $ Estimate $ Unit $ ReferenceDose $;run;data mapped; length DOMAIN $2 STUDYID $100 USUBJID $100 PPTESTCD $8 PPTEST $40 PPCAT $100 PPORRES $100 PPORRESU $100 PPSTRESC $100 PPSTRESU $100 PPSPEC $10 PPRFTDTC $30; set nca_transfer; DOMAIN='PP'; STUDYID=Protocol; USUBJID=Subject; if Parameter='Cmax' then do; PPTESTCD='CMAX'; PPTEST='Max Conc'; end; else if Parameter='Tmax' then do; PPTESTCD='TMAX'; PPTEST='Time of CMAX Observation'; end; else if Parameter='AUClast' then do; PPTESTCD='AUCLST'; PPTEST='AUC to Last Nonzero Conc'; end; PPCAT=Analyte; PPORRES=Estimate; PPORRESU=Unit; PPSTRESC=Estimate; PPSTRESN=input(Estimate,best32.); PPSTRESU=Unit; PPSPEC='PLASMA'; PPRFTDTC=ReferenceDose;run;proc sort data=mapped; by STUDYID USUBJID PPRFTDTC PPCAT PPTESTCD;run;data pp; retain DOMAIN STUDYID USUBJID PPSEQ PPTESTCD PPTEST PPCAT PPORRES PPORRESU PPSTRESC PPSTRESN PPSTRESU PPSPEC PPRFTDTC; set mapped; by STUDYID USUBJID; if first.USUBJID then PPSEQ=0; PPSEQ+1; keep DOMAIN STUDYID USUBJID PPSEQ PPTESTCD PPTEST PPCAT PPORRES PPORRESU PPSTRESC PPSTRESN PPSTRESU PPSPEC PPRFTDTC;run;proc export data=pp outfile='/app/output/pp.csv' dbms=csv replace;run;
yamaa