One of my responsibilities as a medical writer is to write and manage annual safety reports, called DSURs, which are submitted to the FDA and other international health authorities. These are large documents with many contributors, and sometimes we have more than one at a time.
We had Microsoft Project to manage timelines, but everyone hated it. So a few years ago I created a make-shift Gantt chart in R. Our client data is confidential, so here is a recreation of that chart with fake data.
Colors via a Wes Anderson palette just for fun.
library(tidyverse)
library(tidyr)
library(tidyselect)
library(lubridate)
library(readxl)
library(ggplot2)
library(ggrepel)
library(ggiraph)
library(plotly)
library(wesanderson)
library(pander)
data <- read_excel("~/R/DSURs/fakedata.xlsx", col_types = c("numeric", "text", "text", "date", "date"))
data = as_tibble(data)
Prog <- c("Drug 1","Drug 2", "Drug 3", "Drug 4", "Drug 5", "Drug 6",
"Drug 7", "Drug 8")
Element <- c("DLP", "Writing & Review", "Submit for Publishing",
"Day 60")
data$Program = factor(data$Program, levels = Prog)
data$DSUR_Element = factor(data$DSUR_Element, ordered = TRUE)
data.long = data %>% pivot_longer(cols = starts_with("Date_"), names_to = 'State',
names_prefix = "Date_",
values_to = "date")
Month = month(data.long$date, label = T)
Month = as.character(Month)
Day = mday(data.long$date)
data.long$Lab = paste(Month, Day)
data.long = na.omit(data.long)
interact = ggplot(data.long, aes(date, Program, color = DSUR_Element,
group=Item, text = Lab)) +
scale_color_manual(values = wes_palette(n=4, name="Darjeeling1"),
labels = Element) +
geom_line(size = 3) + geom_point(size = 5) +
labs(x="Month", y=NULL, title="DSURs", color="DSUR Element") +
scale_x_datetime(breaks = "1 month", date_labels = "%b") +
theme_classic()
#interactive plot
ggplotly(p = interact,width=900, height=600, tooltip = 'Lab') %>%
layout(legend = list(orientation = "h", x = 0.2, y = -0.2))
A note about the elements: ‘DLP’ is the data lock point, essentially the date after which we get the data. Day 60 is the date that the document is due to health authorities. For any drug in clinical development, you have 60 days from the DLP to submit the report (hence the label).