项目作者: ojathelonius

项目描述 :
Better visualization for VIE job offers
高级语言: JavaScript
项目地址: git://github.com/ojathelonius/scrap-ton-vie.git
创建时间: 2019-05-11T10:05:37Z
项目社区:https://github.com/ojathelonius/scrap-ton-vie

开源协议:

下载


Example map

Scrap ton VIE

Scrap ton VIE aims at providing a convenient way to find VIE job offers. A development version lives at : https://vie.johanet.fr/

Note : on 11/21/19, SSL certificates got messed up on the civiweb website. I had to skip verifying certificates, although this is probably going to be fixed.
To ignore urllib3 warning from requests, use :

  1. export PYTHONWARNINGS="ignore:Unverified HTTPS request"

Development

Front-end

Install dependencies :

  1. npm install

Launch the development server with :

  1. npm run watch

Back-end

  1. npm install
  1. npm run build

Start scraping by running python scrap.py with a proper config.ini in the same directory, e.g :

  1. [credentials]
  2. api_key = ABCDEFGHIJKLMNOPQSRTUVW
  3. [civiweb]
  4. offer_list = https://www.civiweb.com/FR/offre-liste/page/
  5. offer_page = https://www.civiweb.com/FR/offre/
  6. [db]
  7. database = my_database
  8. hostname = localhost
  9. port = 5432
  10. username = my_username
  11. password = my_password

Production

Front-end

In production, use npm run build then serve the index.html with the dist folder with any web server.

Back-end

Run the scrapper as a CRON job.
Inclure full paths to avoid $PATH errors, and include stderr in the log file.

  1. crontab -e
  2. 0 1 */5 * * /usr/bin/env python3.6 /home/user/scrap/scrap.py >> /home/user/scrap/scrap.log 2>&1

Build the NodeJS app with npm run build then start the server with forever or pm2.

Play with data

Calculate VIE frequency percentage per country

  1. WITH total AS (SELECT COUNT(*)::numeric FROM offer)
  2. SELECT COUNT(country) AS nombre, ROUND(COUNT(country)/(SELECT * FROM total), 4) * 100 AS percentage , country FROM offer
  3. GROUP BY country
  4. ORDER BY nombre DESC

Find highest paying locations

  1. SELECT country, UPPER(city), salary FROM offer
  2. GROUP BY salary, UPPER(city), country
  3. ORDER BY salary DESC

Calculate n-quantiles

  1. SELECT salary, ntile(n) OVER (ORDER BY salary) AS quantile FROM offer GROUP BY salary;