    hosts-col - the index of the Hosts in each CSV line"
   [csv-header]
   (let [csv-header (mapv str/trim csv-header)]
-   {:product-col (.indexOf csv-header "Product")
-    :version-col (.indexOf csv-header "Version")
-    :hosts-col (.indexOf csv-header "Hosts")}))
+    {:product-col (.indexOf csv-header "Product")
+     :version-col (.indexOf csv-header "Version")
+     :hosts-col (.indexOf csv-header "Hosts")}))
 
 (defn- read-csv-column
   "Read a column from the csv, if the column is exists. Otherwise, return nil."

  Returns the concept id and revision id of the saved humanizer."
  [context params community-usage-csv]
  (validate-update-community-usage-params params)
  (let [metrics (community-usage-csv->community-usage-metrics context community-usage-csv (:comprehensive params))
        metrics (seq (aggregate-usage-metrics metrics))] ; Combine access-counts for entries with the same version/short-name
    (validate-metrics metrics)
    (humanizer-service/update-humanizers-metadata context :community-usage-metrics metrics)))

            results (qe/execute-query context query)]
        (:short-name (first (:items results)))))))

(defn- cache-or-search
  "Uses the `product` value to check the short-name-cache.  If there is a miss
  it checks the current-metrics-cache.  If the `product` is unavailable in either,
  elasticsearch is queried directly."
  [context cache current-metrics product]
  (if (.containsKey cache product)
    (.get cache product) ;; return cache hit
    (if (contains? current-metrics product)
      (do ;; current-metrics hit
        (.put cache product product)
        product) ;; return product as short-name
      (let [short-name (get-collection-by-product-id context product)] ;; query elastic
        (.put cache product short-name)
        short-name)))) ;; return queried short-name

(defn- get-short-name
  "Parse the short-name from the given csv-line and verify it exists in CMR.  
   If it doesn't exist in CMR, use the `product` value as-is.
   Throws a service error if the product column is empty."
  [context cache csv-line product-col current-metrics]
  (let [product (read-csv-column csv-line product-col)
        _ (when-not (seq product)
            (errors/throw-service-error
             :invalid-data
             "Error parsing 'Product' CSV Data. Product may not be empty."))
        short-name (cache-or-search context cache current-metrics product)]
    (if (seq short-name)
      short-name
      (do
        (warn (format (str "While constructing community metrics humanizer, "
                           "could not find corresponding collection when searching for the term %s. "
                           "Csv line entry: %s")
                      product
                      csv-line))
        product))))

(defn- get-access-count
  "Parse access-count from given csv-line.  Throws service errors if the hosts column
   is empty or contains an invalid integer."
  [csv-line hosts-col]
  (let [access-count (read-csv-column csv-line hosts-col)]
    (if (seq access-count)
      (try
        (Integer/parseInt (str/replace access-count "," "")) ; Remove commas in large ints
        (catch java.lang.NumberFormatException e
          (errors/throw-service-error :invalid-data
                                      (format (str "Error parsing 'Hosts' CSV Data. "
                                                   "Hosts must be an integer. "
                                                   "Csv line entry: [%s]")
                                              csv-line))))
      (errors/throw-service-error :invalid-data
                                  (format (str "Error parsing 'Hosts' CSV Data. "
                                               "Hosts may not be empty. "
                                               "Csv line entry: [%s]")
                                          csv-line)))))

(defn- csv-entry->community-usage-metric
  "Convert a line in the csv file to a community usage metric. Only storing short-name (product)
   and access-count (hosts)."
  [context csv-line product-col hosts-col current-metrics cache]
  (when (seq (remove empty? csv-line)) ; Don't process empty lines
    {:short-name (get-short-name context cache csv-line product-col current-metrics)
     :access-count (get-access-count csv-line hosts-col)}))

(defn- validate-and-read-csv
  "Validate the ingested community usage metrics csv and if valid, return the data lines read
