Feature request: SDTM input (EX to PKNCAdose)#517
Open
Gero1999 wants to merge 9 commits intohumanpred:mainfrom
Open
Feature request: SDTM input (EX to PKNCAdose)#517Gero1999 wants to merge 9 commits intohumanpred:mainfrom
Gero1999 wants to merge 9 commits intohumanpred:mainfrom
Conversation
This script simulates a Phase I dose-escalation study with various parameters for drug exposure. It creates a data frame for the SDTM EX domain, detailing subjects, treatments, doses, and timing.
Add tests for ex_to_PKNCAdose function covering various scenarios including handling of oral doses, IV infusions, duration calculations, and optional columns.
Extract std_dtc_to_rdate, parse_iso8601_duration, and route_cdisc_to_pknca as top-level internal helpers. Parse EXELTM from ISO 8601 duration to numeric hours when character. Derive NFRLT = (EXRFTDTC + EXELTM) - min(EXRFTDTC) per dose grouping and use it as time.nominal in PKNCAdose instead of raw EXELTM. Co-authored-by: Ona <no-reply@ona.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Closes #516
This PR introduces
ex_to_PKNCAdoseto convert SDTM EX (Exposure) domain data into a PKNCAdose object, along with shared SDTM helpers and unit tests.Key changes
ex_to_PKNCAdoseEXSTDTC,EXENDTC,EXRFTDTC) with mixed precisionEXDURfromEXENDTC - EXSTDTCwhen not pre-existingEXELTMfromEXSTDTC - EXRFTDTCwhen not pre-existing; parses ISO 8601 duration strings (e.g."PT2H") to numeric hours when characterAFRLT(actual time from reference) as hours from first dose per subjectNFRLT(nominal time from reference) as(EXRFTDTC + EXELTM) - min(EXRFTDTC)per dose grouping (EXTRT + USUBJID), used astime.nominalin the PKNCAdose object"intravascular"/"extravascular"EXDUR,EXELTM,EXRFTDTC,EXROUTE,EXDOSU) are optional — the function adapts to what's availableShared internal helpers (extracted as top-level
@keywords internal)std_dtc_to_rdate— ISO 8601 date-time parsing with mixed precisionparse_iso8601_duration— ISO 8601 duration to numeric hours (supports negative values)route_cdisc_to_pknca— CDISC route mappingNFRLT derivation
When both
EXRFTDTCandEXELTMare present,NFRLTis derived per dose grouping as a continuous nominal time axis. When either is absent,NFRLTis not derived andtime.nominalis omitted from the PKNCAdose object.Tests
std_dtc_to_rdate,parse_iso8601_duration,route_cdisc_to_pkncaex_to_PKNCAdose: basic object creation, oral/IV duration, route mapping, relative time, mixed precision, EXELTM derivation, pre-existing EXDUR/EXELTM, minimal datasetstime.nominalassignment, absent EXRFTDTC fallback, per-treatment-group derivation