Created
December 4, 2014 06:16
-
-
Save llowder/88e3d1773f50121ea757 to your computer and use it in GitHub Desktop.
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(ns run-nerd-miner.core | |
(:require [edn-config.core :refer [env]]) | |
(:require [clojure.java.io :as io]) | |
(:require [clojure.data.xml :as xml]) | |
(:require [clojure.zip :as zip]) | |
(:require [clojure.data.zip.xml :as xz]) | |
(:gen-class)) | |
(defn only-files | |
[file-s] | |
(filter #(.isFile %) file-s) | |
) | |
(def tcx_data | |
(-> | |
(first (only-files (file-seq (io/file (:source-data-dir env))))) | |
io/input-stream | |
xml/parse | |
)) | |
(def tcx_data-zip (zip/xml-zip tcx_data)) | |
(def heartrates (map zip/node | |
(map zip/down | |
(xz/xml-> tcx_data-zip :HeartRateBpm :Value)))) | |
(defn -main | |
"I don't do a whole lot ... yet." | |
[& args] | |
(println (xz/xml1-> tcx_data-zip :HeartRateBpm :Value)) | |
(println heartrates) | |
;; (println (-> tcx_data-zip zip/down zip/down zip/down zip/node)) | |
) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<!-- snip --> | |
<Track> | |
<Trackpoint> | |
<Time>2014-11-03T22:19:51.000Z</Time> | |
<Position> | |
<LatitudeDegrees>37.24515781737864</LatitudeDegrees> | |
<LongitudeDegrees>-93.41323326341808</LongitudeDegrees> | |
</Position> | |
<AltitudeMeters>382.3999938964844</AltitudeMeters> | |
<DistanceMeters>0.0</DistanceMeters> | |
<HeartRateBpm> | |
<Value>94</Value> | |
</HeartRateBpm> | |
<Extensions> | |
<TPX xmlns="http://www.garmin.com/xmlschemas/ActivityExtension/v2"> | |
<Speed>0.0</Speed> | |
</TPX> | |
</Extensions> | |
</Trackpoint> | |
<!-- snip --> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
(defproject run-nerd-miner "0.1.0-SNAPSHOT" | |
:description "Data analysis tool for runner." | |
:url "https://github.com/llowder/run-nerd-miner" | |
:license {:name "Apache 2.0" | |
:url "http://www.apache.org/licenses/LICENSE-2.0.html"} | |
:dependencies [ | |
[org.clojure/clojure "1.6.0"] | |
[org.clojure/data.xml "0.0.8"] | |
[org.clojure/data.zip "0.1.1"] | |
[incanter "1.2.3-SNAPSHOT"] | |
[edn-config "0.2"] | |
[puppetlabs/kitchensink "1.0.0"] | |
[prismatic/schema "0.3.3"] | |
] | |
:profiles {:prod {:resource-paths ["config/prod"]} | |
:dev {:resource-paths ["config/dev"]} | |
:test {:resource-paths ["config/test"]} | |
:uberjar {:aot :all} | |
} | |
:main ^:skip-aot run-nerd-miner.core | |
:target-path "target/%s" | |
) |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment