summaryrefslogtreecommitdiff
path: root/backend/index.js
diff options
context:
space:
mode:
authorschneefux <schneefux+commit@schneefux.xyz>2018-05-07 09:06:04 +0200
committerschneefux <schneefux+commit@schneefux.xyz>2018-05-07 09:06:04 +0200
commit5caf4e48174533710243e8eeaf52567795ec9d01 (patch)
tree1396f09bd14c3c4e1af3164ef924f2190b3f949f /backend/index.js
parentded191658af266a764332b9a1b72d628de3d5b6e (diff)
downloadbrokentalents-5caf4e48174533710243e8eeaf52567795ec9d01.tar.gz
brokentalents-5caf4e48174533710243e8eeaf52567795ec9d01.zip
move files to backend subdir, push data in submodule
Diffstat (limited to 'backend/index.js')
-rw-r--r--backend/index.js27
1 files changed, 27 insertions, 0 deletions
diff --git a/backend/index.js b/backend/index.js
new file mode 100644
index 0000000..5da0f82
--- /dev/null
+++ b/backend/index.js
@@ -0,0 +1,27 @@
+#!/usr/bin/node
+
+const R = require('ramda'),
+ Future = require('fluture'),
+ moment = require('moment'),
+ reduce = require('./reduce'),
+ source = require('./source'),
+ config = require('./config');
+
+const loadFTimestamped = source.loadFTimestamped(config);
+const deriveStatistics = reduce.deriveStatistics(config.reduce);
+const aggregatePayloads = reduce.aggregatePayloads(config.reduce);
+
+function main() {
+ const firstOfMay = moment('2018-05-01');
+
+ const later = R.curry((base, hs) => base.clone().add(hs, 'hours'));
+ const hours = R.range(0, 24 * 5);
+ const laterMoments = R.map(later(firstOfMay), hours);
+
+ const futures = R.map(loadFTimestamped, laterMoments);
+ Future.parallel(1, futures)
+ .map(R.compose(deriveStatistics, aggregatePayloads, R.unnest))
+ .fork(console.error, (d) => console.log(JSON.stringify(d, null, 2)));
+}
+
+main();