Skip to content

add FeRx implementation support to model objects - #146

Merged
JordanBrooks33 merged 4 commits into
masterfrom
RXR-3282
Nov 25, 2026
Merged

JordanBrooks33 merged 4 commits 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

ronkeizer and others added 3 commits October 23, 2026 13:57
Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Move ferx argument to end of model_from_api() and new_ode_model()
  signatures so existing positional calls keep their bindings
- Set ferx attribute on directly compiled (non-package) models
- Serialize ferx code as an escaped R string literal before inserting
  into the package template, so quotes/backslashes/newlines round-trip
- Add tests for the above

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
- Serialize nonmem code as an escaped R string literal in the package
  template, so quotes/backslashes/newlines round-trip
- Set nonmem attribute on directly compiled (non-package) models

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

@roninsightrx roninsightrx left a comment

Copy link
Copy Markdown
Collaborator

Choose a reason for hiding this comment

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

lgtm

@JordanBrooks33
JordanBrooks33 merged commit 754713d into master Nov 25, 2026
4 checks passed
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.

4 participants