- Notifications
You must be signed in to change notification settings - Fork2
🏥 Clinical coding of patients with kidney disease using KDIGO clinical practice guidelines
License
Unknown, MIT licenses found
Licenses found
alwinw/epocakir
Folders and files
| Name | Name | Last commit message | Last commit date | |
|---|---|---|---|---|
Repository files navigation
/ˈiːpɒk ə keɪ aɪ ɑː/
Theepocakir package makes clinical coding of patients with kidneydisease using clinical practice guidelines easy. The guidelines used arethe evidence-basedKDIGO guidelines.This package covers acute kidney injury (AKI), anemia, and chronickidney disease (CKD):
aki_staging(): Classification of AKI staging (aki_stages) withautomatic selection of:aki_bCr(): AKI based on baseline creatinineaki_SCr(): AKI based on changes in serum creatinineaki_UO(): AKI based on urine output
anemia(): Classification of anemiaClassification of albuminuria (
Albuminuria_stages)Albuminuria_staging_ACR(): Albuminuria based on Albumin excretionrateAlbuminuria_staging_AER(): Albuminuria based onAlbumin-to-creatinine ratio
eGFR(): Estimation of glomerular filtration rate with automaticselection of:eGFR_adult_SCr(): eGFR based on the 2009 CKD-EPI creatinineequationeGFR_adult_SCysC(): eGFR based on the 2012 CKD-EPI cystatin CequationeGFR_adult_SCr_SCysC(): eGFR based on the 2012 CKD-EPIcreatinine-cystatin C equationeGFR_child_SCr(): eGFR based on the pediatric creatinine-basedequationeGFR_child_SCr_BUN(): eGFR based on the pediatric creatinine-BUNequationeGFR_child_SCysC(): eGFR based on the pediatric cystatin C-basedequation
GFR_staging(): Staging of GFR (GFR_stages)Multiple utility functions including:
conversion_factors: Conversion factors used throughout the KDIGOguidelinesas_metric(): Conversion of a measured value into metric unitsdob2age(): Calculation of age from a date of birthbinary2factor(): Conversion of binary data into factors based on acolumn namecombine_date_time_cols(): Combining separate date and time columnsinto a single date and time columncombn_changes: Generating changes between measurements
You can install thereleased version fromCRAN with:
install.packages("epocakir")You can install thedevelopment version fromGitHub with:
# install.packages("remotes")remotes::install_github("alwinw/epocakir")
library(epocakir)library(dplyr)library(units)
Often clinical data must be cleansed and tidied before analysis canbegin. To assist in this, several utility functions have been included.To explore these, consider a sample clinical datasetclinical_obvs:
glimpse(clinical_obvs)#> Rows: 3#> Columns: 9#> $ `Patient Number` <chr> "p10001", "p10002", "p10003"#> $ `Admission Date` <chr> "2020-03-05", "2020-03-06", "2020-03-17"#> $ `Admission Time` <chr> "14:01:00", "09:10:00", "12:48:00"#> $ Discharge_date <chr> "2020-03-10", "2020-03-16", "2020-03-18"#> $ Discharge_time <chr> "16:34:00", "18:51:00", "09:12:00"#> $ `Date of Birth` <chr> "1956-01-09", "1997-12-04", "1973-05-28"#> $ Male <lgl> TRUE, FALSE, TRUE#> $ Height <dbl> 182, 161, 168#> $ Surgery <lgl> FALSE, FALSE, TRUEtidy_obvs<-clinical_obvs %>% combine_date_time_cols() %>% mutate(Age= dob2age(`Date of Birth`),Height= as_metric(height= set_units(as.numeric(Height),"cm")) ) %>% binary2factor(Male,Surgery)glimpse(tidy_obvs)#> Rows: 3#> Columns: 8#> $ `Patient Number` <chr> "p10001", "p10002", "p10003"#> $ `Admission DateTime` <dttm> 2020-03-05 14:01:00, 2020-03-06 09:10:00, 2020-03-17 12:48:00#> $ Discharge_DateTime <dttm> 2020-03-10 16:34:00, 2020-03-16 18:51:00, 2020-03-18 09:12:00#> $ `Date of Birth` <chr> "1956-01-09", "1997-12-04", "1973-05-28"#> $ Male <ord> Male, Not_Male, Male#> $ Height [m] 1.82 [m], 1.61 [m], 1.68 [m]#> $ Surgery <ord> Not_Surgery, Not_Surgery, Surgery#> $ Age <Duration> 2203286400s (~69.82 years), 880934400s (~27.92 years), 1654732800s…
Make sure to useset_units() from theunits package to convert allmeasurements into unit objects for automatic unit conversion inepocakir.
It is possible to useaki_staging() to automatically classify thepresence and staging of AKI. If a particular method is required, it ispossible to classify AKI usingaki_bCr(),aki_SCr() oraki_UO().
head(aki_pt_data)#> # A tibble: 6 × 7#> SCr_ bCr_ pt_id_ dttm_ UO_ aki_staging_type aki_#> [mg/dl] [mg/dl] <chr> <dttm> [ml/kg] <chr> <ord>#> 1 2 1.5 <NA> NA NA aki_bCr No AKI#> 2 2.5 1.5 <NA> NA NA aki_bCr AKI Stage 1#> 3 3 1.5 <NA> NA NA aki_bCr AKI Stage 2#> 4 3.5 1.5 <NA> NA NA aki_bCr AKI Stage 2#> 5 4 1.5 <NA> NA NA aki_bCr AKI Stage 3#> 6 4.5 1.5 <NA> NA NA aki_bCr AKI Stage 3aki_staging(aki_pt_data,SCr="SCr_",bCr="bCr_",UO="UO_",dttm="dttm_",pt_id="pt_id_")#> [1] No AKI AKI Stage 1 AKI Stage 2 AKI Stage 2 AKI Stage 3 AKI Stage 3 No AKI#> [8] No AKI AKI Stage 1 No AKI No AKI AKI Stage 1 No AKI No AKI#> [15] No AKI AKI Stage 1 No AKI AKI Stage 2 AKI Stage 3 AKI Stage 1 AKI Stage 3#> [22] AKI Stage 2 No AKI AKI Stage 1 AKI Stage 3 AKI Stage 3 No AKI#> Levels: No AKI < AKI Stage 1 < AKI Stage 2 < AKI Stage 3aki_pt_data %>% mutate(aki= aki_staging(SCr=SCr_,bCr=bCr_,UO=UO_,dttm=dttm_,pt_id=pt_id_ )) %>% select(pt_id_,SCr_:dttm_,aki)#> # A tibble: 27 × 5#> pt_id_ SCr_ bCr_ dttm_ aki#> <chr> [mg/dl] [mg/dl] <dttm> <ord>#> 1 <NA> 2 1.5 NA No AKI#> 2 <NA> 2.5 1.5 NA AKI Stage 1#> 3 <NA> 3 1.5 NA AKI Stage 2#> 4 <NA> 3.5 1.5 NA AKI Stage 2#> 5 <NA> 4 1.5 NA AKI Stage 3#> 6 <NA> 4.5 1.5 NA AKI Stage 3#> 7 pt1 3.4 NA 2020-10-23 09:00:00 No AKI#> 8 pt1 3.9 NA 2020-10-25 21:00:00 No AKI#> 9 pt1 3 NA 2020-10-20 09:00:00 AKI Stage 1#> 10 pt2 3.4 NA 2020-10-18 22:00:00 No AKI#> # ℹ 17 more rowsaki_pt_data %>% mutate(aki= aki_SCr(SCr=SCr_,dttm=dttm_,pt_id=pt_id_ )) %>% select(pt_id_,SCr_:dttm_,aki)#> # A tibble: 27 × 5#> pt_id_ SCr_ bCr_ dttm_ aki#> <chr> [mg/dl] [mg/dl] <dttm> <ord>#> 1 <NA> 2 1.5 NA No AKI#> 2 <NA> 2.5 1.5 NA No AKI#> 3 <NA> 3 1.5 NA No AKI#> 4 <NA> 3.5 1.5 NA No AKI#> 5 <NA> 4 1.5 NA No AKI#> 6 <NA> 4.5 1.5 NA No AKI#> 7 pt1 3.4 NA 2020-10-23 09:00:00 No AKI#> 8 pt1 3.9 NA 2020-10-25 21:00:00 No AKI#> 9 pt1 3 NA 2020-10-20 09:00:00 AKI Stage 1#> 10 pt2 3.4 NA 2020-10-18 22:00:00 No AKI#> # ℹ 17 more rows
Similarly,eGFR() offers the ability to automatically select theappropriate formula to estimate the glomerular filtration rate. If aparticular formula is required, theneGFR_adult_SCr,eGFR_adult_SCysC,eGFR_adult_SCr_SCysC,eGFR_child_SCr,eGFR_child_SCr_BUN, oreGFR_child_SCysC can be used.
head(eGFR_pt_data)#> # A tibble: 6 × 10#> SCr_ SCysC_ Age_ male_ black_ height_ BUN_ eGFR_calc_type_ eGFR_ pediatric_#> [mg/dl] [mg/L] [years] <lgl> <lgl> [m] [mg/dl] <chr> [mL/(1.73m… <lgl>#> 1 0.5 NA 20 FALSE FALSE NA NA eGFR_adult_SCr 139. FALSE#> 2 NA 0.4 20 FALSE FALSE NA NA eGFR_adult_SCysC 162. FALSE#> 3 0.5 0.4 20 FALSE FALSE NA NA eGFR_adult_SCr_SCysC 167. FALSE#> 4 0.5 NA 30 FALSE TRUE NA NA eGFR_adult_SCr 150. FALSE#> 5 NA 0.4 30 FALSE TRUE NA NA eGFR_adult_SCysC 155. FALSE#> 6 0.5 0.4 30 FALSE TRUE NA NA eGFR_adult_SCr_SCysC 171. FALSEeGFR(eGFR_pt_data,SCr="SCr_",SCysC="SCysC_",Age="Age_",height="height_",BUN="BUN_",male="male_",black="black_",pediatric="pediatric_")#> Units: [mL/(min*1.73m^2)]#> [1] 139.32466 161.68446 166.81886 150.52336 155.33226 171.35616 139.32466 66.77365 96.41798#> [10] 150.52336 64.15027 99.04045 49.63420 161.68446 97.06854 53.62373 155.33226 99.70870#> [19] 49.63420 66.77365 56.10368 53.62373 64.15027 57.62964 155.99874 173.48118 178.86404#> [28] 168.53768 166.66552 183.72895 155.99874 71.64555 103.37985 168.53768 68.83077 106.19167#> [37] 66.06766 173.48118 116.50660 71.37808 166.66552 119.67546 66.06766 71.64555 67.33849#> [46] 71.37808 68.83077 69.17003 99.12000 148.21219 165.89761eGFR_pt_data %>%dplyr::mutate(eGFR= eGFR(SCr=SCr_,SCysC=SCysC_,Age=Age_,height=height_,BUN=BUN_,male=male_,black=black_,pediatric=pediatric_ )) %>% select(SCr_:pediatric_,eGFR)#> # A tibble: 51 × 11#> SCr_ SCysC_ Age_ male_ black_ height_ BUN_ eGFR_calc_type_ eGFR_ pediatric_ eGFR#> [mg/dl] [mg/L] [years] <lgl> <lgl> [m] [mg/dl] <chr> [mL/… <lgl> [mL/…#> 1 0.5 NA 20 FALSE FALSE NA NA eGFR_adult_SCr 139. FALSE 139.#> 2 NA 0.4 20 FALSE FALSE NA NA eGFR_adult_SCysC 162. FALSE 162.#> 3 0.5 0.4 20 FALSE FALSE NA NA eGFR_adult_SCr_SCy… 167. FALSE 167.#> 4 0.5 NA 30 FALSE TRUE NA NA eGFR_adult_SCr 150. FALSE 151.#> 5 NA 0.4 30 FALSE TRUE NA NA eGFR_adult_SCysC 155. FALSE 155.#> 6 0.5 0.4 30 FALSE TRUE NA NA eGFR_adult_SCr_SCy… 171. FALSE 171.#> 7 0.5 NA 20 FALSE FALSE NA NA eGFR_adult_SCr 139. FALSE 139.#> 8 NA 1.2 20 FALSE FALSE NA NA eGFR_adult_SCysC 66.8 FALSE 66.8#> 9 0.5 1.2 20 FALSE FALSE NA NA eGFR_adult_SCr_SCy… 96.4 FALSE 96.4#> 10 0.5 NA 30 FALSE TRUE NA NA eGFR_adult_SCr 150. FALSE 151.#> # ℹ 41 more rowseGFR_pt_data %>%dplyr::mutate(eGFR= eGFR_adult_SCr(SCr=SCr_,Age=Age_,male=male_,black=black_ )) %>% select(SCr_:pediatric_,eGFR)#> # A tibble: 51 × 11#> SCr_ SCysC_ Age_ male_ black_ height_ BUN_ eGFR_calc_type_ eGFR_ pediatric_ eGFR#> [mg/dl] [mg/L] [years] <lgl> <lgl> [m] [mg/dl] <chr> [mL/… <lgl> [mL/…#> 1 0.5 NA 20 FALSE FALSE NA NA eGFR_adult_SCr 139. FALSE 139.#> 2 NA 0.4 20 FALSE FALSE NA NA eGFR_adult_SCysC 162. FALSE NA#> 3 0.5 0.4 20 FALSE FALSE NA NA eGFR_adult_SCr_SCy… 167. FALSE 139.#> 4 0.5 NA 30 FALSE TRUE NA NA eGFR_adult_SCr 150. FALSE 151.#> 5 NA 0.4 30 FALSE TRUE NA NA eGFR_adult_SCysC 155. FALSE NA#> 6 0.5 0.4 30 FALSE TRUE NA NA eGFR_adult_SCr_SCy… 171. FALSE 151.#> 7 0.5 NA 20 FALSE FALSE NA NA eGFR_adult_SCr 139. FALSE 139.#> 8 NA 1.2 20 FALSE FALSE NA NA eGFR_adult_SCysC 66.8 FALSE NA#> 9 0.5 1.2 20 FALSE FALSE NA NA eGFR_adult_SCr_SCy… 96.4 FALSE 139.#> 10 0.5 NA 30 FALSE TRUE NA NA eGFR_adult_SCr 150. FALSE 151.#> # ℹ 41 more rows
KDIGO Guidelines -https://kdigo.org/guidelines/
Seehttps://alwinw.github.io/epocakir/reference/index.html for moreusage details and package reference.
About
🏥 Clinical coding of patients with kidney disease using KDIGO clinical practice guidelines
Topics
Resources
License
Unknown, MIT licenses found
Licenses found
Contributing
Uh oh!
There was an error while loading.Please reload this page.
Stars
Watchers
Forks
Contributors6
Uh oh!
There was an error while loading.Please reload this page.