Skip to content

feat: add CDISC PPTESTCD/PPTEST columns to PKNCAresults#536

Draft
Gero1999 wants to merge 12 commits intohumanpred:mainfrom
Gero1999:403-cdisc-columns
Draft

feat: add CDISC PPTESTCD/PPTEST columns to PKNCAresults#536
Gero1999 wants to merge 12 commits intohumanpred:mainfrom
Gero1999:403-cdisc-columns

Conversation

@Gero1999
Copy link
Copy Markdown
Contributor

@Gero1999 Gero1999 commented Apr 20, 2026

Fixes #403

What this does

Adds out_format = \"cdisc\" to as.data.frame.PKNCAresults(). Translates PPTESTCD to CDISC PP domain codes and adds a PPTEST column.

Key design decisions

  1. CDISC metadata stored in add.interval.col() — new pptestcd_cdisc/pptest_cdisc args, defaulting to parameter name/description. All parameter files updated.

  2. Route-dependent codes — CL, VZ, MRT, VSS use list(route = list(extravascular = ..., intravascular = ...)). Resolved per row by joining against dose data. Falls back to extravascular. See resolve_cdisc_value() and pknca_cdisc_get_route() in class-PKNCAresults.R.

  3. PPSTINT/PPENINT columns — Added when any PPTESTCD contains "INT". ISO 8601 durations relative to last dose time (most recent dose ≤ interval start). Time unit designator from timeu_pref or timeu. Only populated for INT rows, NA otherwise.

  4. DN parameters — Inherit base CDISC code with "D" appended. Route-dependent lists passed through unchanged.

Files changed

  • R/001-add.interval.col.R — new args
  • R/class-PKNCAresults.R — translation + PPSTINT/PPENINT logic
  • R/zzz-pk.calc.dn.R — DN CDISC derivation
  • 9 parameter files — CDISC mappings added to all add.interval.col() calls
  • tests/testthat/test-class-PKNCAresults.R — 9 new tests

How to test

devtools::test(filter = \"class-PKNCAresults\")
```"

Gero1999 added 10 commits April 20, 2026 15:04
New optional arguments for CDISC standard parameter code and name.
Accepts a character string for simple mappings or a named list for
route-dependent mappings. Defaults to name/desc when not provided.
Map all NCA parameters to CDISC PPTESTCD/PPTEST codes. Route-dependent
parameters (CL, VZ, MRT, VSS) use nested lists to distinguish
intravascular (IC) and extravascular (EV) CDISC codes.
Add as.data.frame.PKNCAresults() logic to extract PPTESTCD and PPTEST
columns from the CDISC metadata stored in each parameter's formalsmap.
Handles route-dependent parameters by matching against the dosing route.
Map DN parameters to their CDISC PPTESTCD/PPTEST codes. Uses the same
route-dependent nested list pattern for CL, VZ, MRT, and VSS variants.
Add pptestcd_cdisc and pptest_cdisc to expected lists in
test-001-add.interval.col.R. Remove test-cdisc.R; CDISC output tests
now live in test-class-PKNCAresults.R.
When out_format='cdisc' and any PPTESTCD contains 'INT', add PPSTINT
and PPENINT columns with ISO 8601 durations relative to the last dose
time. The time unit designator is derived from timeu_pref or timeu.
…esults.R

Cover PPTESTCD/PPTEST translation, route-dependent resolution,
PPSTINT/PPENINT with various time units, multi-dose relative timing,
and format_iso8601_duration edge cases.
@Gero1999 Gero1999 force-pushed the 403-cdisc-columns branch from 011c3e5 to 7be890e Compare April 22, 2026 09:16
@Gero1999 Gero1999 force-pushed the 403-cdisc-columns branch from 008f37c to c74c4e6 Compare April 28, 2026 11:43
@Gero1999 Gero1999 marked this pull request as ready for review April 28, 2026 13:25
@billdenney
Copy link
Copy Markdown
Member

Can you please add tests for the newly missing lines? https://app.codecov.io/gh/humanpred/pknca/pull/536

Also, I have removed document.yaml in main, so it shouldn't be a problem in upcoming PRs.

@Gero1999 Gero1999 marked this pull request as draft April 29, 2026 07:42
@Gero1999 Gero1999 force-pushed the 403-cdisc-columns branch from 91f12bd to be16dae Compare April 29, 2026 08:04
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Add SDTM columns to output

2 participants