##  HITS UP THE REMOTE DISK (ON THE R BOX) AND PULLS THE SAVED DATA FILE

{
  .RObjName = "DB.raw"
  if (!exists("ext"))
      ext = ".Rda"

  # ------------------------------------------ #
  #   We can use file  from previous section   #
  # ------------------------------------------ #
    if (is.character("file") && grepl(paste0(ext, "$"), file)) {
      .rstudiohome <- "/mnt/data/rstudiohome/"
      remotefile <- gsub("(\\~|/Users/rsaporta)/?", .rstudiohome, file)
      remotefolder <- NULL
    } else {
  # ------------------------------------------ #
      remotefolder <- as.path("/mnt/data/rstudiohome/git/orch/data/", projName)
      remotefile <- as.path("QRESExport", ext=ext)
    }
  # ------------------------------------------ #

  localfile <- paste(projName, "QRES_Import", timeStamp(frmt="%m%d%H"), sep="_")
  local <- as.path(dataDir, localfile, ext=ext)


  bringMeData(folder=remotefolder, files=remotefile, local=local
                  , open.folder=FALSE, verbose=TRUE, checkExist=TRUE)

  readFUNC <- {if (toupper(ext)==".RDA")
                load
                else if (toupper(ext)==".RDS")
                  readRDS
                else 
                  stop("Auto Import not setup for file type '", ext, "'")
              }


  ## Assign the imported object. 
  assign(.RObjName, readFUNC(local))
  ## for .Rda like objects, what gets assigned is the _name_ of the object, 
  ##   so we have to `get()` it and assign it again
  if (is.character(get(.RObjName)))
    assign(.RObjName, get(get(.RObjName)))


  ## TEMPRORARY ###   TODO: Currently cannot handle .RDS
  if (ext==".RDS") {
    stop("THIS PART NEEDS WORK"); cls(5)
  }

  ## Check for releaseDates
  # search for release dates in the names of QRES.Export
  .rd.nm <- grep("^releaseDates", names(DB.raw), value=TRUE, ignore.case=TRUE)
  if (length(.rd.nm) > 1)
    stop("More than one `releaseDate` table. Check Manually")
  if (length(.rd.nm)) {
    DT.releaseDates <- copy(DB.raw[[.rd.nm]])
    DB.raw[[.rd.nm]] <- NULL
  }

  ## Cleanup
  if (identical(get(.RObjName), QRES.Export))
    rm(QRES.Export)

  if (is.data.table(get(.RObjName)[[1]])) {
    assign(.RObjName, rbindlist(get(.RObjName)))
    assign(.RObjName, unique(get(.RObjName), by=names(get(.RObjName))))
  }


}