## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
##   TODO 2015-05-25:
## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##
##           add info attribute to the DTs
## ~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~~ ##


## OPTIONAL
if (FALSE) {
  fresh()
}
{
  setScience("Spotify_Accounting_ETL", create=FALSE, subl=FALSE, load=FALSE)
  setGitBranchToSystem(); .g()
  productsUsing.forUserCounts <- c("A", "P", "PD", "U")
  productsUsing.forUserCounts <- TRUE

  if (.Pfm != "Darwin") {
    wh <- getWH_already_on(default="SCIENCE")
    dbname <- "prod"
    setSnowflake(wh=wh, dbname=dbname)
  }

  source("~/git/orch/src/Spotify_Accounting_ETL/01 Retrieve Files From FTP.r")
  if (!getOption("snowflake_inuse") && .Pfm != "Darwin") {
    warning("\n\nsnowflake_inuse has been reset during file 01\n\n");  setSnowflake(wh=wh, dbname=dbname)
  }
  source("~/git/orch/src/Spotify_Accounting_ETL/02 Ingest Spotify Files.r")
## 2015-08-15  Skip this for now, something has gone wrong
# try(  source("~/git/orch/src/Spotify_Accounting_ETL/11 Ingest & Clean Rates.r")  )
  source("~/git/orch/src/Spotify_Accounting_ETL/User Counts.r")
  source("~/git/orch/src/Spotify_Accounting_ETL/05 Revenue per Territory.r")

  ## 2015-08-14 Dont save image for now
  if (FALSE)
  saveImageTo()
}

## Note to self.  There was an updated file for DT.breakage for 2014-11-01
## The biggest difference was the addition of these two rows
#  KPN Hardbundle Higher Rate           KHB           NL      kpn-nl      EUR           4.45                           64003.90          2.15 per_user_payable   6123.1624   6123.1624      NA
#  KPN Hardbundle Lower Rate           KSB           NL      kpn-nl      EUR           4.99                            4567.00          2.51 per_user_payable    571.6655    571.6655      NA


2015-05-23
The plotting file for some reason is in Spotify_Streams_Per_Top_Artist
sourceSuppor
'~/git/orch/src/Spotify_Streams_Per_Top_Artist/11 Plotting.r'


if (FALSE) 
{
  source('~/git/orch/src/Spotify_Streams_Per_Top_Artist/supportFns/Plot_Users_By_Country_and_Product.r')
  source('~/git/orch/src/Spotify_Streams_Per_Top_Artist/11 Plotting.r')
}


&&& LEFT OFF HERE --- load (in previous dock)