Pro-Med-Str - Part II

This tutorial describes how to process structured medication data, especially focusing on e-prescription data.

Elizabeth McNeer

Here add links to vignettes

Introduction

This tutorial describes how to use the Pro-Med-Str - Part II module in EHR2PKPD to process structured e-prescription data.

The major tasks the module performs are as follows:

Raw E-Prescription Data

To use this module, all prescriptions must be for only one drug. Different names, such as brand names and generic names, for the same drug are allowed (e.g., Lamictal and lamotrigine). The data used in this module must include columns for ID, date, strength, dose amount, and frequency. If a description column is included, this module will attempt to extract the strength from the description column in cases where the strength is missing.

Below is example e-prescription data from the EHR package including columns for ID, drug name, dose, frequency, date, strength, and description.

rawDataDir <- system.file("examples", "str_ex2", package="EHR")
(eRX <- read.csv(file.path(rawDataDir,"e-rx_DATA.csv"),stringsAsFactors = FALSE))
  GRID    MED_NAME   RX_DOSE             FREQUENCY ENTRY_DATE STRENGTH_AMOUNT                                        DESCRIPTION
1  ID1 lamotrigine         1                   bid 2009-02-24             100 lamotrigine 100 mg tablet (Also Known As Lamictal)
2  ID2 lamotrigine         2                   bid 2006-12-30             100 lamotrigine 100 mg tablet (Also Known As Lamictal)
3  ID2    Lamictal         1                   bid 2006-12-30             200                             LaMICtal 200 mg tablet
4  ID3 Lamictal XR         3                   bid 2004-08-24                                       Lamictal XR 100 mg 24 hr Tab
5  ID4 lamotrigine         1           twice a day 2010-05-22          200 mg lamotrigine 200 mg tablet (Also Known As Lamictal)
6  ID5 lamotrigine    2 tabs                   qam 2007-06-13             200         LaMICtal XR 200 mg tablet,extended release
7  ID6 lamotrigine 1.5+1+1.5 brkfst, lunch, dinner 2015-03-14             100 lamoTRIgine 100 mg tablet (Also Known As Lamictal)

To get a daily dose for each patient, we multiply strength*dose*frequency. In order to do this, the STRENGTH_AMOUNT, RX_DOSE, and FREQUENCY variables need to be converted to numeric. Strengths that include units will have the units removed (e.g., numeric strength for ID4 will be 200), frequencies will be converted to the equivalent number of times per day that the medication is taken (e.g., bid = 2, twice a day = 2, qam = 1), and doses will have words like “tabs” removed (e.g., numeric dose for ID5 will be 2). For ID6, separate doses are written for breakfast, lunch, and dinner, so the numeric dose will be 4 (1.5+1+1.5), and the daily dose will be calculated as strength*dose. ID3 is missing a value for STRENGTH_AMOUNT, but we can use the strength that is present in the DESCRIPTION column. In the next section, we show how the run_MedStrII function in the EHR package takes care of all of these tasks for us and calculates a daily dose.

Processing the Data

We begin by loading the EHR package.

The e-prescription data can be processed by the run_MedStrII function using:

eRX.out <- run_MedStrII(file.path(rawDataDir,"e-rx_DATA.csv"),
    dat.columns = list(id = 'GRID', dose = 'RX_DOSE', freq = 'FREQUENCY', date = 'ENTRY_DATE', str = 'STRENGTH_AMOUNT', desc = 'DESCRIPTION')
)

The following arguments are used in the run_MedStrII function:

eRX.out
  GRID    MED_NAME   RX_DOSE             FREQUENCY ENTRY_DATE STRENGTH_AMOUNT                                        DESCRIPTION strength
1  ID1 lamotrigine         1                   bid 2009-02-24             100 lamotrigine 100 mg tablet (also known as lamictal)      100
2  ID2 lamotrigine         2                   bid 2006-12-30             100 lamotrigine 100 mg tablet (also known as lamictal)      100
4  ID3 Lamictal XR         3                   bid 2004-08-24                                       lamictal xr 100 mg 24 hr tab      100
5  ID4 lamotrigine         1           twice a day 2010-05-22          200 mg lamotrigine 200 mg tablet (also known as lamictal)      200
6  ID5 lamotrigine    2 tabs                   qam 2007-06-13             200         lamictal xr 200 mg tablet,extended release      200
7  ID6 lamotrigine 1.5+1+1.5 brkfst, lunch, dinner 2015-03-14             100 lamotrigine 100 mg tablet (also known as lamictal)      100
  freq.standard freq.num dose daily.dose num_doses num_freqs
1           bid        2    1        200        NA        NA
2           bid        2    2        400        NA        NA
4           bid        2    3        600        NA        NA
5           bid        2    1        400        NA        NA
6            am        1    2        400        NA        NA
7           tid        3    4        400         3         3

In the above example, daily dose was calculated for the first 5 patients by multiplying strength*dose*freq.num, and a redundant daily dose was removed for the patient with ID2. In order to calculate a daily dose for the patient with ID3, the strength of 100 from the description was used because STRENGTH_AMOUNT was missing. For the patient with ID6, the dose amounts of 1.5, 1, and 1.5 are added together to get a dose of 4, and the daily dose is calculated as strength*dose.

References

  1. Choi L, Beck C, McNeer E, Weeks HL, Williams ML, James NT, Niu X, Abou-Khalil BW, Birdwell KA, Roden DM, Stein CM. Development of a System for Post-marketing Population Pharmacokinetic and Pharmacodynamic Studies using Real-World Data from Electronic Health Records. Clinical Pharmacology & Therapeutics. 2020 Apr;107(4):934-43. doi: 10.1002/cpt.1787.

Corrections

If you see mistakes or want to suggest changes, please create an issue on the source repository.