Open cannawen opened 6 years ago
(defn parse []
(let [code->name (->> (slurp "countries.csv")
(clojure.data.csv/read-csv)
(map (fn [[name code]]
[(clojure.string/lower-case code) name]))
(into {}))
map-codes (->> (slurp "src/culture_map/client/views/map.cljs")
(re-seq #":data-cc \"(..)\"")
(map second)
set)
iso-codes (set (keys code->name))
countries (->> map-codes
(map (fn [code]
{:id code
:name (code->name code)
:type "country"})))]
#_(doseq [[code name] code->name]
(save-record! {:type "country"
:id code
:name name}))
(->> (s/difference iso-codes map-codes)
(map (fn [code]
[code (code->name code)]))
(into {})
(sort))))