Parsing .fit binary files (leveraging Garmin SDK through Clojure Java interop),
retaining the original streaming capabilities of the Java API, exposing them
through core.async
channels.
All processing is defined as transducer application over channels
Clone the project, and run lein repl
in the project root, the repl will start
in the fit-to-edn.core
namespace by default and you can start experimenting.
- Finding maximal 1min power ever achieved in the directory containing .fit records:
fit-to-edn.core> (query-files
(list-fit-files "/Users/janherich/Documents/Training-data")
(comp q/power (q/max-average-interval 60))
q/max-aggregate
(f/format-query-result f/power))
566.567 watt
- The same for speed, but now we also want to know the activity where it happened:
fit-to-edn.core> (query-files
(list-fit-files "/Users/janherich/Documents/Training-data")
(comp q/speed (q/max-average-interval 60))
q/max-aggregate
(f/format-query-result f/speed-kmh #(.getName %)))
{:query-result "60.806 km/h" :activity "160726090112.fit"}
- Finding maximal normalized-power ever achieved, we want to know the activity as well:
fit-to-edn.core> (query-files
(list-fit-files "/Users/janherich/Documents/Training-data")
(comp q/power q/normalized-average)
q/max-aggregate
(f/format-query-result f/power #(.getName %)))
{:query-result "304.144 watt", :activity "160820193938.fit"}
- Overall best average moving speed ever achieved
fit-to-edn.core> (query-files
(list-fit-files "/Users/janherich/Documents/Training-data")
(comp q/moving-speed q/average)
q/max-aggregate
(f/format-query-result f/speed-kmh))
39.077 km/h
Copyright © 2017 Jan Herich
Distributed under the Eclipse Public License either version 1.0 or (at your option) any later version.