Skip to content

add FeRx implementation support to model objects - #146

Open
JordanBrooks33 wants to merge 1 commit into
masterfrom
RXR-3282
Open

JordanBrooks33 wants to merge 1 commit into
masterfrom
RXR-3282

Conversation

@JordanBrooks33

@JordanBrooks33 JordanBrooks33 commented Sep 16, 2026 •

Copy link
Copy Markdown
Contributor

Summary

Adds FeRx implementation support to PKPDsim model objects, mirroring the existing NONMEM implementation pattern.

This change enables models to carry FeRx code as an attribute, allowing downstream tools (e.g., irxmodval) to access and utilize FeRx implementations for model validation and translation workflows.

Changes

R/model_from_api.R

  • Added ferx parameter to model_from_api() function signature
  • Added logic to read FeRx file contents when both ferx path and def$implementations$ferx exist
  • Pass ferx to new_ode_model() call

R/new_ode_model.R

  • Added ferx parameter to new_ode_model() function signature
  • Added roxygen documentation for new parameter
  • Added NULL/empty handling: if(is.null(ferx) || length(ferx) == 0) { ferx <- "NULL" }
  • Added [FERX] placeholder to template replacement matrix

inst/template/R/model.R

  • Added attr(ret, "ferx") <- "[FERX]" to store FeRx implementation as model attribute

Pattern

Follows identical pattern to existing NONMEM support:

  • Parameter flows: model_from_api() → new_ode_model() → template substitution → model attribute
  • Stored as string attribute on compiled model object
  • Accessible via attr(model, "ferx")

Related PRs

  • models: RXR-3282 (FeRx implementations added to model definitions)
  • irxmodval: RXR-3282 (FeRx validation support)

Test Plan

  • Verify existing NONMEM attribute behavior unchanged
  • Verify ferx attribute present on models built with FeRx implementations
  • Verify ferx attribute is "NULL" when no FeRx implementation provided

Associated PRs:

Mirrors existing NONMEM pattern: new `ferx` parameter in model_from_api()
and new_ode_model(), stored as model attribute for downstream use.

Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>

@jasmineirx jasmineirx left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

lgtm, but it could be nice to add some testing around these metadata fields

This branch has not been deployed

No deployments
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.

2 participants