mirror of
https://github.com/msberends/AMR.git
synced 2026-11-16 05:00:50 +01:00
- One cache design for as.ab() and as.mo() in R/aa_session_cache.R: lazily built lookup indices (ATC codes, drug synonyms, SNOMED codes) and coercion caches with the same structure (key, input, value), keyed on input plus outcome-relevant settings - Caches are invalidated whenever the lookup tables change (custom antimicrobials or microorganisms, set_mo_source()) - mo_*() functions use a fast path for valid <mo> input and work on unique values only - synonym_mo_to_accepted_mo() is memoised per code - Fix as.mo() cache keys that never matched again, fast_mode results of as.ab() being reused by regular calls, and ab_reset_session() clearing as.mo() uncertainties Co-authored-by: Claude Opus 5.5 <noreply@anthropic.com>
This commit is contained in:
1 parent
0ca43df459
commit
891d248fab
14 files changed
+462
-124
No files matched your search
@@ -40,16 +40,9 @@ AMR_env$mo_uncertainties <- data.frame(
|
||||
stringsAsFactors = FALSE
|
||||
)
|
||||
AMR_env$mo_renamed <- list()
|
||||
AMR_env$mo_previously_coerced <- data.frame(
|
||||
x = character(0),
|
||||
mo = character(0),
|
||||
stringsAsFactors = FALSE
|
||||
)
|
||||
AMR_env$ab_previously_coerced <- data.frame(
|
||||
x = character(0),
|
||||
ab = character(0),
|
||||
stringsAsFactors = FALSE
|
||||
)
|
||||
# session caches of as.ab() and as.mo(), see R/aa_session_cache.R
|
||||
AMR_env$mo_previously_coerced <- new_coercion_cache()
|
||||
AMR_env$ab_previously_coerced <- new_coercion_cache()
|
||||
AMR_env$av_previously_coerced <- data.frame(
|
||||
x = character(0),
|
||||
av = character(0),
|
||||
@@ -111,6 +104,7 @@ AMR_env$cross_icon <- if (isTRUE(base::l10n_info()$`UTF-8`)) "\u00d7" else "x"
|
||||
}
|
||||
|
||||
AMR_env$AB_lookup <- cbind(AMR::antimicrobials, AB_LOOKUP)
|
||||
reset_ab_cache()
|
||||
AMR_env$AV_lookup <- cbind(AMR::antivirals, AV_LOOKUP)
|
||||
}
|
||||
|
||||
|
||||
Reference in new issue
Block a user