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 × 2
#>    name              surgery   
#>    <chr>             <date>    
#>  1 Chen, Trevor      2022-08-12
#>  2 Graves, Acineth   2022-05-04
#>  3 Trujillo, Yanelly 2022-04-21
#>  4 Simpson, Kenneth  2022-07-24
#>  5 Chin, Nelson      2022-07-07
#>  6 Le, Christina     2022-02-08
#>  7 Kang, Xuan        2022-05-13
#>  8 Shuemaker, Lauren 2022-02-09
#>  9 Boucher, Teresa   2022-07-18
#> 10 Le, Soraiya       2022-06-22
#> # … 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 × 4
#>    name                 admission  icd10 hdia 
#>    <chr>                <date>     <chr> <lgl>
#>  1 Tran, Kenneth        2022-02-23 S134A FALSE
#>  2 Tran, Kenneth        2022-08-09 W3319 FALSE
#>  3 Tran, Kenneth        2022-07-19 Y0262 TRUE 
#>  4 Tran, Kenneth        2022-06-11 X0488 FALSE
#>  5 Sommerville, Dominic 2022-07-31 V8104 FALSE
#>  6 Sommerville, Dominic 2022-03-11 B853  FALSE
#>  7 Sommerville, Dominic 2022-07-26 Q174  FALSE
#>  8 Sommerville, Dominic 2022-03-16 A227  FALSE
#>  9 Sommerville, Dominic 2022-07-21 H702  FALSE
#> 10 Sommerville, Dominic 2021-11-12 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 × 4
#>    name                 atc      prescription code          
#>    <chr>                <chr>    <date>       <chr>         
#>  1 Le, Soraiya          L03AA16  2020-05-15   f1u?L03AA16d2 
#>  2 Cleveland, Mark      J07CA01  2018-01-23   f6p?J07CA01y5 
#>  3 Santistevan, Charlie QJ57EA06 2013-07-04   e0t.QJ57EA06s9
#>  4 Meier, Hayden        R03DB04  2018-11-04   q3p?R03DB04e2 
#>  5 Hill, Audrey         V09IA01  2016-04-18   e7t-V09IA01a1 
#>  6 Thumma, Phillip      L02AE02  2012-05-27   c7c-L02AE02b7 
#>  7 Yost, Rebecca        S01EB06  2016-10-19   z8r.S01EB06l2 
#>  8 Mandakh, Joseph      A03DA01  2018-05-23   f3s.A03DA01n9 
#>  9 Meier, Hayden        C09AA13  2020-11-11   a9n-C09AA13e4 
#> 10 Trinh, Schuyler      A07EA03  2022-09-11   v7v-A07EA03d0 
#> # … with 9,990 more rows