From 7f2fd988a01fb25e43b82e18ed832210227d7c11 Mon Sep 17 00:00:00 2001 From: Luc Claustres Date: Tue, 16 Nov 2021 19:30:21 +0100 Subject: [PATCH] wip: Integrate predictions based on machine learning models - updated predictions job to use variable (#22) --- jobfile-predictions.js | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/jobfile-predictions.js b/jobfile-predictions.js index 026c47b..f3ad7c7 100644 --- a/jobfile-predictions.js +++ b/jobfile-predictions.js @@ -11,6 +11,7 @@ const baseUrl = process.env.PREDIKT_URL || 'http://localhost:5000/predict' const modelsPath = process.env.PREDIKT_MODELS_PATH || path.join('..', 'predikt', 'models', 'output', 'water_level_rnn', 'multiple', '12H') const ttl = parseInt(process.env.TTL) || (7 * 24 * 60 * 60) // duration in seconds const timeout = parseInt(process.env.TIMEOUT) || (30 * 60 * 1000) // duration in miliseconds +const variable = process.env.VARIABLE || 'HP' const collection = 'hubeau-observations' // Read available models const models = fs.readdirSync(modelsPath) @@ -69,7 +70,7 @@ module.exports = { // Use prediction feature as a template let feature = _.pick(predictionFeature, ['type', 'geometry', 'runTime', 'properties.code_station']) _.set(feature, 'time', time) - _.set(feature, 'properties.HP', values[index]) + _.set(feature, `properties.${variable}`, values[index]) features.push(feature) }) if (features.length > 0) console.log('Found ' + features.length + ' new predictions on station ' + _.get(predictionFeature, 'properties.code_station'))