Skip to content

Commit

Permalink
wip: Integrate predictions based on machine learning models - updated…
Browse files Browse the repository at this point in the history
… predictions job to use variable (#22)
  • Loading branch information
claustres committed Nov 16, 2021
1 parent a724d55 commit 7f2fd98
Showing 1 changed file with 2 additions and 1 deletion.
3 changes: 2 additions & 1 deletion jobfile-predictions.js
Original file line number Diff line number Diff line change
Expand Up @@ -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)
Expand Down Expand Up @@ -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'))
Expand Down

0 comments on commit 7f2fd98

Please sign in to comment.