Skip to content

Add add_if_missing parameter to control NA handling in interpretive rules#264

Open
msberends wants to merge 1 commit intomainfrom
claude/review-issues-plan-XhvdR
Open

Add add_if_missing parameter to control NA handling in interpretive rules#264
msberends wants to merge 1 commit intomainfrom
claude/review-issues-plan-XhvdR

Conversation

@msberends
Copy link
Copy Markdown
Owner

Summary

Added a new add_if_missing parameter to interpretive_rules() and eucast_rules() functions to provide fine-grained control over whether rules should be applied to missing (NA) values.

Key Changes

  • Added add_if_missing parameter (default: TRUE) to interpretive_rules() function signature
  • Updated documentation with detailed explanation of the new parameter's behavior
  • Modified edit_sir() helper function to accept and handle the add_if_missing parameter
  • Refactored the cell modification logic in edit_sir() to use a unified apply_mask approach that respects both overwrite and add_if_missing settings
  • Passed the parameter through all internal function calls (4 locations where edit_sir() is invoked)
  • Updated version number and NEWS.md with feature documentation

Implementation Details

The new parameter enables users to:

  • When add_if_missing = TRUE (default): Apply rules to all cells, including NA values (preserves existing behavior)
  • When add_if_missing = FALSE: Apply rules only to cells that already contain an SIR value, leaving NA cells untouched

This is particularly useful when using overwrite = TRUE with custom rules to update reported results without imputing values for drugs that were not tested.

The implementation consolidates the conditional logic for cell selection into a single apply_mask variable, improving code maintainability and reducing duplication in the warning handling section.

https://claude.ai/code/session_01Nucc8nXGLqNUjtuC9GrhTc

#259)

When `add_if_missing = FALSE`, rules are only applied to cells that already
contain an SIR value; `NA` cells are left untouched. This is useful with
`overwrite = TRUE` to update reported results without imputing values for
drugs that were not tested.

https://claude.ai/code/session_01Nucc8nXGLqNUjtuC9GrhTc
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