This function helps to pre-process the heath care resource utilization (HCRU) for a given electronic health record data for a given set of settings e.g. IP, OP, ED/ER, etc.
Usage
preproc_hcru_fun(
data,
cohort_col = "cohort",
patient_id_col = "patient_id",
admit_col = "admission_date",
discharge_col = "discharge_date",
index_col = "index_date",
visit_col = "visit_date",
encounter_id_col = "encounter_id",
setting_col = "care_setting",
pre_days = 180,
post_days = 365,
readmission_days_rule = 30
)
Arguments
- data
A dataframe specifying the health care details
- cohort_col
A character specifying the name of the cohort column
- patient_id_col
A character specifying the name of the patient identifier column
- admit_col
A character specifying the name of the date of admission column
- discharge_col
A character specifying the name of the date of discharge column
- index_col
A character specifying the name of the index date or diagnosis column
- visit_col
A character specifying the name of the date of visit/claim column
- encounter_id_col
A character specifying the name of the encounter/claim column
- setting_col
A character specifying the name of the HCRU setting column e.g. IP, ED, OP, etc.
- pre_days
Number of days before index (default 180 days)
- post_days
Number of days after index (default 365 days)
- readmission_days_rule
Rule for how many days can be permissible to define readmission criteria in AP setting (default 30 days)
Examples
preproc_hcru_fun(data = hcru_sample_data)
#> # A tibble: 1,089 × 17
#> patient_id cohort encounter_id care_setting visit_date admission_date
#> <chr> <chr> <chr> <chr> <date> <date>
#> 1 P_1001 control E_645327 IP 2023-08-23 2023-08-23
#> 2 P_1001 control E_379584 IP 2023-10-03 2023-10-03
#> 3 P_1001 control E_591096 ED 2023-08-27 NA
#> 4 P_1001 control E_864419 OP 2023-09-25 NA
#> 5 P_1001 control E_617025 ED 2024-02-07 NA
#> 6 P_1001 control E_379047 ED 2024-03-01 NA
#> 7 P_1005 control E_430504 IP 2023-04-13 2023-04-13
#> 8 P_1005 control E_921506 IP 2023-05-11 2023-05-11
#> 9 P_1005 control E_914515 OP 2023-09-07 NA
#> 10 P_1005 control E_467081 OP 2023-10-27 NA
#> # ℹ 1,079 more rows
#> # ℹ 11 more variables: discharge_date <date>, encounter_date <date>,
#> # index_date <date>, period <chr>, cost_usd <dbl>, visit_days <dbl>,
#> # time_window <chr>, length_of_stay <dbl>, next_admit <date>,
#> # days_to_next <dbl>, readmission <dbl>