Skip to contents

Introduction

Analysts may often wish to explore patient medication history as part of creating a standard “Table 1” or using medication history to define sub-cohorts of patients who have ever taken a specific medication (see the “Building Cohorts” vignette for examples). Within a PicnicHealth data set, there are two tables in which the analyst will find medication history. The first of these is the cohort_drug_era table which includes high-priority, disease-specific drug treatments that are included in each patient’s medical record and includes drug name, start date, end date, stop reason, and other fields. The cohort_drug_era table is part of PicnicHealth’s custom data elements abstraction process which synthesizes all information from both structured and unstructured narrative text and creates patient-level abstraction (PLA) drug eras. For example, in an early breast cancer data set (cohort), disease-specific treatments may include tamoxifen, letrozole, pertuzumab, among others, and treatments such as these would have custom PLA drug eras in the cohort_drug_era table. The second table in which we can find medication history is the visit_medication_list_occurrence table which includes every medication that would routinely be found on a visit “Medication list” included in each patient’s medical record and is part of PicnicHealth’s standard abstraction process. Using the same breast cancer as an example, we may find more general, non-disease-specific drugs and prescriptions in the visit_medication_list_occurrence table with both generic and brand names. For example, the visit_medication_list_occurrence table would include the generic diazepam but also the brand name Valium, or the generic acetaminophen and the corresponding brand name Tylenol.

See below for some hands-on implementation examples using the PicnicHealth R package which has a number of built-in functions to help facilitate this. Note that we will use a small, synthetic data set that may not necessarily be clinically plausible in all cases and is only used to demonstrate functionality.

PicnicHealth R Package

Once a PicnicHealth data set is loaded into memory, we can begin to retrieve medication history for each patient.

Loading Data

We can load a PicnicHealth data set into memory using the load_data_set() function. A PicnicHealth data set is an unzipped directory of CSV files and we need to specify the full path to that data set. See help("load_data_set") for more information.

library(PicnicHealth)
library(tidyverse)
ds = load_data_set("path/to/data")

Example 1: Cohort Drug Era

The cohort_drug_era table includes high-priority, disease-specific drug treatments included in each patient’s medical record and is part of PicnicHealth’s custom data elements abstraction which synthesizes all information from both structured and unstructured narrative text and creates patient-level abstraction (PLA) drug eras. Here we show a sample of some disease-specific medications related to Huntington’s chorea using the drug_concept_name field using the second patient listed in the person table as an example.

person_id_of_interest = ds$person$person_id[2]
ds$cohort_drug_era %>% 
  filter(person_id == person_id_of_interest) %>% 
  select(drug_concept_name) %>% 
  distinct() %>%
  head(10) %>%
  arrange(drug_concept_name) %>%
  kable() %>%
  kable_styling()
drug_concept_name
citalopram
clonazepam
paroxetine
risperidone

Example 2: Visit Medication List Occurrence

The visit_medication_list_occurrence table which includes every medication that would routinely be found on a visit “Medication list” included in each patient’s medical record and is part of PicnicHealth’s standard abstraction process. Here we show a sample of standard medications using the drug_concept_name field using the second patient listed in the person table as an example.

person_id_of_interest = ds$person$person_id[2]
ds$visit_medication_list_occurrence %>% 
  filter(person_id == person_id_of_interest) %>% 
  select(drug_concept_name) %>% 
  distinct() %>%
  head(15) %>%
  arrange(drug_concept_name) %>%
  kable() %>%
  kable_styling()
drug_concept_name
Actos
Aricept
Bactroban
DuoNeb
Flonase
Ginkgo biloba extract
MULTIVITAMIN
Motrin
Phenergan
Tylenol
ketoconazole
losartan potassium
magnesium oxide
melatonin
sertraline