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      2023-02-28
#>  2 Graves, Acineth   2022-11-20
#>  3 Trujillo, Yanelly 2022-11-07
#>  4 Simpson, Kenneth  2023-02-09
#>  5 Chin, Nelson      2023-01-23
#>  6 Le, Christina     2022-08-27
#>  7 Kang, Xuan        2022-11-29
#>  8 Shuemaker, Lauren 2022-08-28
#>  9 Boucher, Teresa   2023-02-03
#> 10 Le, Soraiya       2023-01-08
#> # ℹ 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-09-11 S134A FALSE
#>  2 Tran, Kenneth        2023-02-25 W3319 FALSE
#>  3 Tran, Kenneth        2023-02-04 Y0262 TRUE 
#>  4 Tran, Kenneth        2022-12-28 X0488 FALSE
#>  5 Sommerville, Dominic 2023-02-16 V8104 FALSE
#>  6 Sommerville, Dominic 2022-09-27 B853  FALSE
#>  7 Sommerville, Dominic 2023-02-11 Q174  FALSE
#>  8 Sommerville, Dominic 2022-10-02 A227  FALSE
#>  9 Sommerville, Dominic 2023-02-06 H702  FALSE
#> 10 Sommerville, Dominic 2022-05-31 X6051 TRUE 
#> # ℹ 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-12-01   u8z-L03AA16j0 
#>  2 Cleveland, Mark      J07CA01  2018-08-11   m4w.J07CA01b6 
#>  3 Santistevan, Charlie QJ57EA06 2014-01-20   h1w?QJ57EA06q2
#>  4 Meier, Hayden        R03DB04  2019-05-23   o8m?R03DB04l6 
#>  5 Hill, Audrey         V09IA01  2016-11-04   x8t?V09IA01w3 
#>  6 Thumma, Phillip      L02AE02  2012-12-13   i1z-L02AE02s7 
#>  7 Yost, Rebecca        S01EB06  2017-05-07   r6h.S01EB06z3 
#>  8 Mandakh, Joseph      A03DA01  2018-12-09   t0g.A03DA01f2 
#>  9 Meier, Hayden        C09AA13  2021-05-30   v5e?C09AA13i4 
#> 10 Trinh, Schuyler      A07EA03  2023-03-30   v6n.A07EA03b4 
#> # ℹ 9,990 more rows