create_opioid_cohort.Rd
This function creates the cohort to be used for opioid analytics. It take the obi_cohort dataframe created by obstinit::create_obi_cohort() and creates a variable for number of days from delivery to discharge, then filters the dataframe to births in 2023 where the birthing person did not use opioids during pregnancy, the LOS was <= 4 days, and births with an opioid prescribed at discharge are not missing data on opioid type, unit, quantity, or dose. It creates groups for mode of delivery (vaginal, vaginal with advanced laceration, and cesarean) and selects only the variables relevant to opioid analyses. Last, it reads in OME conversion factors from the Turbo drive and merges them into the OBI dataframe.
create_opioid_cohort(df)
A dataframe; preferably the dataframe created by create_obi_cohort()