Support simulation from scratch when model has no dataset#52
Open
roninsightrx wants to merge 1 commit intomainfrom
Open
Support simulation from scratch when model has no dataset#52roninsightrx wants to merge 1 commit intomainfrom
roninsightrx wants to merge 1 commit intomainfrom
Conversation
… validation - create_sim_dataset(): when model$dataset is NULL and no data arg is supplied, build the simulation dataset from scratch if regimen is provided. Uses a placeholder-marker approach to carry covariate values into dose rows via fill() without leaving ghost rows in the output. - create_sim_dataset(): fix covariate join so newly-joined columns are retained when sim_data has no pre-existing covariate columns (union sim_data_cols with all_cov_cols before the select()). - run_sim(): abort with a clear message when model$dataset is NULL and data=NULL. - run_sim(): validate required columns via get_required_input_variables() before running, giving an actionable error when columns are missing. - Tests for all new paths in test-create_sim_dataset.R and test-run_sim.R. - Bump version to 0.0.0.9029. Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.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
create_sim_dataset(): whenmodel$datasetis NULL (i.e. the$DATAfile can't be found) and nodataargument is supplied, build the simulation dataset from scratch ifregimenis provided — otherwise error with a clear message. Uses a placeholder-marker approach to carry covariate values into dose rows viafill()without leaving ghost rows in the output.create_sim_dataset(): fix covariate column retention — whensim_datahas no pre-existing covariate columns (from-scratch case),union(sim_data_cols, all_cov_cols)ensures newly-joined columns survive theselect().run_sim(): abort with a clear message whenmodel$datasetis NULL anddata = NULL.run_sim(): validate required columns viaget_required_input_variables()before running, giving an actionable error (naming the missing columns) when the dataset is incomplete.Test plan
create_sim_dataset(no-data): error when no dataset and no regimencreate_sim_dataset(no-data): regimen-only produces correct dose + obs structurecreate_sim_dataset(no-data):n_subjectsdefaults to 1, or fromnrow(covariates)create_sim_dataset(no-data): covariates are applied correctly and appear in outputcreate_sim_dataset(no-data): no.placeholdercolumn leaks into outputrun_sim():data = NULLfalls back tomodel$dataset(existing model with real data)run_sim(): clear error whenmodel$datasetis NULL anddata = NULLrun_sim(): clear error naming the missing column when required column absent from datasetmodel$datasetis NULL)🤖 Generated with Claude Code