Fundacio-Bit / covid-tourism-rss-news-reporting

Media news data processing of Key Performance Indicators that will be included in reports that evaluate how the COVID global sanitary crisis affects the tourism sector in balearic islands.
0 stars 1 forks source link

Prepare for executions in production #10

Closed omoya-fundaciobit closed 4 years ago

omoya-fundaciobit commented 4 years ago

To execute main.js in production is necessary to:

  1. calculate week starting date automatically
  2. add paths to output files (local & production)
  3. create zip automatically

To resolve 1 use:

const moment = require('moment'); var week_ago_date = moment().subtract(7,'d').format('YYYY-MM-DD'); console.log("Generating KPI's for " + week_ago_date)

To resolve 2:

Add contexts in Mongo. Production/development modes can be controlled as an argument (covid-tourism-twitter-reporting likewise)

const path = require('path').resolve(__dirname, '..'); const argv = require('yargs').argv // ---------------------------------------------------- // Read arguments // ---------------------------------------------------- if (argv.date) week_ago_date = argv.date

if (argv.mode) { var output_path = path + '/files/output/twitter/covid_tourism' } else { var output_path = '/data-mongo/files/output/twitter/covid_tourism' } console.log("Output path: " + output_path)

To resolve 3 code (under development) in covid-tourism-twitter-reporting