Example data

library(coder)

This vignette contains some example data used in the other vignettes.

Patients

ex_people contains 100 patients (with random names from the randomNames package) who received total hip arthroplasty (THA) surgery at given (random) dates (surgery column). This data represent a sample from a national quality register.

See also ?ex_people.

ex_people
#> # A tibble: 100 x 2
#>    name              surgery   
#>    <chr>             <date>    
#>  1 Chen, Trevor      2020-09-29
#>  2 Graves, Acineth   2020-06-21
#>  3 Trujillo, Yanelly 2020-06-08
#>  4 Simpson, Kenneth  2020-09-10
#>  5 Chin, Nelson      2020-08-24
#>  6 Le, Christina     2020-03-28
#>  7 Kang, Xuan        2020-06-30
#>  8 Shuemaker, Lauren 2020-03-29
#>  9 Boucher, Teresa   2020-09-04
#> 10 Le, Soraiya       2020-08-09
#> # … with 90 more rows

Diagnoses data

We are interested in comorbidity for the patients above and have collected some synthesized diagnostics data (ex_icd10) from a national patient register (we can at least assume that for now). Patients have one entry for every combination of recorded diagnoses codes according to the International classification of diseases version 10, icd10, and corresponding dates of hospital admissions for which those codes were recorded. (Column hdia is TRUE for main diagnoses and FALSE for underlying/less relevant codes).

See also ?ex_icd10.

ex_icd10
#> # A tibble: 2,376 x 4
#>    name                 admission  icd10 hdia 
#>    <chr>                <date>     <chr> <lgl>
#>  1 Tran, Kenneth        2020-04-12 S134A FALSE
#>  2 Tran, Kenneth        2020-09-26 W3319 FALSE
#>  3 Tran, Kenneth        2020-09-05 Y0262 TRUE 
#>  4 Tran, Kenneth        2020-07-29 X0488 FALSE
#>  5 Sommerville, Dominic 2020-09-17 V8104 FALSE
#>  6 Sommerville, Dominic 2020-04-28 B853  FALSE
#>  7 Sommerville, Dominic 2020-09-12 Q174  FALSE
#>  8 Sommerville, Dominic 2020-05-03 A227  FALSE
#>  9 Sommerville, Dominic 2020-09-07 H702  FALSE
#> 10 Sommerville, Dominic 2019-12-31 X6051 TRUE 
#> # … with 2,366 more rows

Medical data

Assume we have some external code data from a national prescription register. Such register would likely cover additional patients but let’s just consider a small sample with ATC codes for patients above, such that each patient can have zero, one, or several codes prescribed at different dates.

ex_atc
#> # A tibble: 10,000 x 4
#>    name                atc      prescription code          
#>    <chr>               <chr>    <date>       <chr>         
#>  1 Meier, Hayden       QC01BD02 2012-08-18   q7g-QC01BD02x8
#>  2 Garza, Kenia        C05AA05  2017-02-26   l3e-C05AA05f2 
#>  3 Chapa, Nicholas     L01XC29  2017-07-17   o5v-L01XC29x2 
#>  4 Slater, Trina       QI07AA03 2012-08-03   d8r.QI07AA03a0
#>  5 Banks, Silbret      QD06BB11 2014-03-01   x5q?QD06BB11g1
#>  6 Winn, Robert        M01CC    2014-12-19   h4k.M01CCs1   
#>  7 Cornelius, Kelly    A16AA07  2017-11-30   r0j.A16AA07j6 
#>  8 Rubin, Miriah       QD10AD   2013-09-24   t2l?QD10ADg7  
#>  9 Slater, Trina       A12AA09  2015-09-13   n4w.A12AA09l3 
#> 10 Jefferson, Deontrae S01AA05  2012-06-26   v1l?S01AA05s7 
#> # … with 9,990 more rows