             {"visualisations" {(:id visualisation) (merge visualisation map-data)}
              "metadata" {(:id visualisation) map-data}})))))
 
-(defmethod visualisation :default
-  [tenant-conn visualisation config]
+(defn run-unknown-type-visualisation 
+  [tenant-conn visualisation]
   (let [dataset-id (:datasetId visualisation)
         [tag dataset] (dataset/fetch-metadata tenant-conn dataset-id)]
     (when (= tag ::lib/ok)


(defn visualisation-response-data [tenant-conn id config]
  (try
    (let [[tag vis] (visualisation/fetch tenant-conn id)
          ;; provisional condition until akvo.lumen.lib.visualisation.maps is keywordized, tested and speced too
          vis (if (= "map" (:visualisationType vis))
                vis
                (update vis :spec keywordize-keys))]
     (when (= tag ::lib/ok)
       (visualisation tenant-conn vis config)))
    (catch Exception e (do
                         (log/warn e ::visualisation-response-data (str "problems fetching this vis-id: " id))
                         nil))))

(defn dashboard-response-data [tenant-conn id config]
  (let [[tag dashboard] (dashboard/fetch tenant-conn id)]

(defn get-share [tenant-conn id]
  (public-by-id tenant-conn {:id id}))

(defn run-visualisation 
  [tenant-conn visualisation]
  (let [visualisation (keywordize-keys visualisation)
        [dataset-tag dataset] (dataset/fetch-metadata tenant-conn (:datasetId visualisation))
        vis-aggregation-mapper {"pivot table" "pivot"
                                "line"      "line"
                                "bubble"    "bubble"
                                "area"      "line"
                                "pie"       "pie"
                                "donut"     "donut"
                                "polararea" "pie"
                                "bar"       "bar"
                                "scatter"   "scatter"}
        aggregation-type (get vis-aggregation-mapper (:visualisationType visualisation))
        [tag query-result] (aggregation/query tenant-conn
                                              (:datasetId visualisation)
                                              aggregation-type
                                              (:spec visualisation))]
    (when (and (= tag ::lib/ok)
               (= dataset-tag ::lib/ok))
      {"visualisations" {(:id visualisation) (assoc visualisation :data query-result)}
       "datasets" { (:id dataset) dataset}})))

(defn run-map-visualisation
  [tenant-conn visualisation {:keys [windshaft-url]}]
  (let [layers (get-in visualisation [:spec "layers"])]
    (if (some #(get % "datasetId") layers)
