Skip to content

Instantly share code, notes, and snippets.

@wheresalice
Created April 24, 2019 16:48
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save wheresalice/0c90d357f8b7c0168f47ed0bd60f935f to your computer and use it in GitHub Desktop.
Save wheresalice/0c90d357f8b7c0168f47ed0bd60f935f to your computer and use it in GitHub Desktop.
Take a MySQL export of Jira ticket count per day, use Facebook's Prophet library to predict the next year, and then graph that.
library(prophet)
# mysql -e "select distinct(CAST(CREATED AS DATE)) C, COUNT(*) from jira.jiraissue WHERE project=1 AND reporter='alice' group by C;" -N -B > jira.txt
jira <- read.delim('jira.txt', header=FALSE)
dates <- as.POSIXct(strptime(jira$V1, "%Y-%m-%d"))
jira_with_dates <-data.frame(dates, jira['V2'])
names(jira_with_dates) = c("ds", "y")
m <- prophet(daily.seasonality = TRUE)
m <- add_country_holidays(m, country_name = "UK")
m <- fit.prophet(m, jira_with_dates)
future = make_future_dataframe(m, periods = 365)
forecast = predict(m, future)
plot(m, forecast)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment