Package: healthdb 0.5.1.9000

Kevin Hu

healthdb: Working with Healthcare Databases

A system for identifying diseases or events from healthcare databases and preparing data for epidemiological studies. It includes capabilities not supported by 'SQL', such as matching strings by 'stringr' style regular expressions, and can compute comorbidity scores (Quan et al. (2005) <doi:10.1097/01.mlr.0000182534.19832.83>) directly on a database server. The implementation is based on 'dbplyr' with full 'tidyverse' compatibility.

Authors:Kevin Hu [aut, cre, cph]

healthdb_0.5.1.9000.tar.gz
healthdb_0.5.1.9000.zip(r-4.7)healthdb_0.5.1.9000.zip(r-4.6)healthdb_0.5.1.9000.zip(r-4.5)
healthdb_0.5.1.9000.tgz(r-4.6-any)healthdb_0.5.1.9000.tgz(r-4.5-any)
healthdb_0.5.1.9000.tar.gz(r-4.7-any)healthdb_0.5.1.9000.tar.gz(r-4.6-any)
healthdb_0.5.1.9000.tgz(r-4.6-emscripten)
manual.pdf |manual.html
DESCRIPTION |NEWS
card.svg |card.png
healthdb/json (API)

# Install 'healthdb' in R:
install.packages('healthdb', repos = c('https://kevinhzq.r-universe.dev', 'https://cloud.r-project.org'))

Bug tracker:https://github.com/kevinhzq/healthdb/issues

Pkgdown/docs site:https://kevinhzq.github.io

Datasets:
  • elix_codes - ICD codes defining the Elixhauser comorbidity categories

On CRAN:

Conda:

5.68 score 2 stars 9 scripts 417 downloads 21 exports 28 dependencies

Last updated from:7a8a877ab1. Checks:9 OK. Indexed: yes.

TargetResultTimeFilesSyslog
linux-devel-x86_64OK190
source / vignettesOK230
linux-release-x86_64OK179
macos-release-arm64OK101
macos-oldrel-arm64OK94
windows-develOK135
windows-releaseOK131
windows-oldrelOK134
wasm-releaseOK121

Exports:%>%bind_sourcebuild_defcollapse_episodecompute_comorbiditycompute_durationcut_perioddefine_casedefine_case_with_ageexcludeexecute_deffetch_varidentify_rowidentify_rowsif_datelookupmake_test_datpool_casereport_nrestrict_daterestrict_n

Dependencies:blobcliclockcpp11data.tableDBIdbplyrdplyrgenericsgluelifecyclelubridatemagrittrpillarpkgconfigpurrrR6rlangstringistringrtibbletidyrtidyselecttimechangetzdbutf8vctrswithr

Introduction to healthdb
What it does | Motivation | Installation | Intended use case | make_test_dat() makes either a toy data.frame or database table in memory with known number of rows that satisfy the query we will show later | this is a database table | note that in-memory SQLite database stores dates as numbers | this is a local data.frame/tibble | convert Date to numeric to be consistent with claim_db | Interactive functions | here we use filter mode to remove records that failed the restriction | here we use flag mode to flag records that met the restriction instead of removing those | Class of result4 | execute query and download the result | Number of rows in source | Number of rows in the current result | make two look up tables | get year from dates for matching | note that keys must be present in all tables | Call-building functions | Next steps

Last update: 2026-06-13
Started: 2024-05-06

Data wrangling helpers
Report sample sizes for your flowchart with report_n() | Compute age and age groups with compute_duration() | Decode codes with lookup() | Score comorbidity with compute_comorbidity() | Combine related records into episodes with collapse_episode() | Split long periods into regular intervals with cut_period() | Check date patterns directly with if_date() | Where these fit in a typical workflow

Last update: 2026-06-11
Started: 2026-06-11

The logic behind if_date() and restrict_date()
Why not brute force? | The easy half: within | The hard half: apart | Anchor at the extremes | A worked example | Both conditions at once | Teaching SQL to loop | Trust, but verify | Where this sits among known techniques

Last update: 2026-06-11
Started: 2026-06-11