Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Cache DB on package loading #417

Merged
merged 3 commits into from
Nov 25, 2024
Merged

Cache DB on package loading #417

merged 3 commits into from
Nov 25, 2024

Conversation

joshwlambert
Copy link
Member

This PR adds data caching to the {epiparameter} package for library of epidemiological parameters (using {cachem}).

Since #415 the epiparameter database was being created (i.e. parameters calculated and <epiparameter> objects created) each time epiparameter_db() was called. This resurfaced a previous issue (#198) that was resolved in PR #207 by using sysdata. However, since PR #415 sysdata was removed and instead the JSON library was loaded from {epiparameterDB}.

NB: {epiparameter} cannot hold the library of parameters as it requires it's own data license and due to CRAN rules this requires being housed in its own package.

To resolve this issue with a new approach, this PR implements data caching of the database of parameters when the {epiparameter} package is loaded (using .onLoad()). This should reduce the runtime of epiparameter_db(), especially if called repeatedly.

Note: data caching is not implement in epidist_db() as it is deprecated and will be removed after the next version release.

@joshwlambert joshwlambert added data management internal Updates that only change internal functions labels Nov 22, 2024
@joshwlambert joshwlambert merged commit 0979911 into main Nov 25, 2024
10 checks passed
@joshwlambert joshwlambert deleted the cache-db branch November 25, 2024 14:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
data management internal Updates that only change internal functions
Projects
None yet
Development

Successfully merging this pull request may close these issues.

1 participant