fix: support basic SDTM domains (dm/ex/pc) in reformat_data_sdtm_to_modeling#6
Merged
roninsightrx merged 3 commits intomainfrom Apr 3, 2026
Merged
fix: support basic SDTM domains (dm/ex/pc) in reformat_data_sdtm_to_modeling#6roninsightrx merged 3 commits intomainfrom
roninsightrx merged 3 commits intomainfrom
Conversation
…odeling The function previously required adsl, vs, and lb domains but many users only have basic SDTM domains. This change: - Derives ADSL from DM when ADSL is not provided (RFXSTDTC → TRTSDT/TRTSDTM, ARM/ACTARM → TRT01P/TRT01A) - Makes EX→ADSL merge conditional (matching existing PC pattern) - Makes VS and LB domains optional for covariate derivation - Builds param_lookup dynamically from actual PCTESTCD values instead of hardcoding DRUGX - Fixes invalid !!!adsl_vars splice in keep_source_vars - Sets ignore_seconds_flag=FALSE for admiral 1.4.0+ compatibility - Adds 33 tests covering all SDTM reformatting paths Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Contributor
There was a problem hiding this comment.
Pull request overview
This PR extends reformat_data_sdtm_to_modeling() to support generating modeling (NONMEM-style) datasets from “basic” SDTM inputs (DM/EX/PC), including deriving ADSL when not provided, and adds comprehensive test coverage for the SDTM reformatting paths.
Changes:
- Derive
ADSLfromDMwhenADSLis absent; makeVS/LBoptional for covariate derivations (ensuringWTexists even withoutVS). - Build
param_lookupdynamically from observedPCTESTCDvalues rather than hardcoding a specific analyte. - Add an extensive
testthatsuite for SDTM → modeling reformatting behaviors.
Reviewed changes
Copilot reviewed 3 out of 3 changed files in this pull request and generated 3 comments.
| File | Description |
|---|---|
R/reformat_data_sdtm_to_modeling.R |
Adds ADSL-from-DM derivation, dynamic param_lookup, optional VS/LB handling, and minor output-shaping adjustments. |
tests/testthat/test-reformat_data_sdtm_to_modeling.R |
Adds a full set of unit tests covering basic SDTM inputs and key dataset invariants (EVID/MDV/TIME/covariates). |
DESCRIPTION |
Bumps development version. |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
Tests cover default na="." replacement, na=NA pass-through, na=NULL (skip conversion), and custom na=-99. Updates existing tests to account for new default NA→"." conversion. Co-Authored-By: Claude Opus 4.6 (1M context) <noreply@anthropic.com>
Co-authored-by: Copilot <175728472+Copilot@users.noreply.github.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.
Summary
param_lookupdynamically from actual PCTESTCD values instead of hardcoding DRUGXignore_seconds_flagcompatibility with admiral 1.4.0+ (default changed from FALSE to TRUE)!!!adsl_varssplice insidec()inkeep_source_varsTest plan
🤖 Generated with Claude Code