GitXplorerGitXplorer
l

collect_sp_data

public
0 stars
1 forks
0 issues

Commits

List of commits on branch master.
Verified
a132cdbf645475bbe09f232589f414c5b2f76fba

Merge pull request #2 from higoramario/pull-request-citybik

DDylanGuedes committed 7 years ago
Unverified
a8fc3c57bf4687b81eac52650b91202c0ac9222c

collects data of new cities from citybik and reduces the collecting time to 5 min

committed 7 years ago
Unverified
0f8ba3272ff731de70c13332f2aefd70766ab5f2

update citybik script

DDylanGuedes committed 7 years ago
Unverified
18970834745b07e98229899ff380a0f3bc68e6e7

fix state

DDylanGuedes committed 7 years ago
Unverified
2c9fbf55fc239931bf365da6935cd2aa73dd5af7

update playbook

DDylanGuedes committed 7 years ago
Unverified
7ad4aee0b0705c170a87efb364db59cd3e552fbc

adds python deps

DDylanGuedes committed 7 years ago

README

The README file for this repository.

Collect data from São Paulo city

This repository contains a set of scripts that collect some data about São Paulo city for future analysis. We use mongodb to store our date since we will collect a huge amount of data and in some point we will need to scale this.

Install dependencies

  • ruby and bundler: $ apt install ruby bunler -qy
  • mongodb: $ apt install mongodb -qy
  • scripts' dependencies: $ bundle install --path vendor/

If you have any problem during the scripts' dependencies installation, probably your issue will be around the nokogiri's build dependencies. So install them too:

$ apt install libxml2 zlib1g-dev libpq-dev

Configuration

  • You need to create a database in your mongodb instace
    • Login in mongodb admin shell: $ mongo admin
    • Create/use your database: > use sp

If you use another name (not 'sp') in your database or your mongodb instance do not run locally you need to set these configuration in seetings.yml file.

Collect data

  • Weather: $ bundle exec ruby weather.rb
    • The weather collection is based on neighborhood file, if you want to add or remove some neighborhood you should edit this file and everything will work well
  • Air quality: $ bundle exec ruby air_quality.rb
  • Citybike: $ bundle exec ruby citybik.rb

If you want to run scripts from another directory you should execute something like these:

$ BUNDLE_GEMFILE=<path-to-project>/Gemfile bundle exec ruby <path-to-project>/weather.rb <path-to-project>/ $ BUNDLE_GEMFILE=<path-to-project>/Gemfile bundle exec ruby <path-to-project>/air_quality.rb <path-to-project>/ $ BUNDLE_GEMFILE=<path-to-project>/Gemfile bundle exec ruby <path-to-project>/citybik.rb <path-to-project>/ $ BUNDLE_GEMFILE=<path-to-project>/Gemfile bundle exec ruby <path-to-project>/olho_vivo.rb <path-to-project>/

InterSCity publishing

To publish script's data in InterSCity platform, just:

  1. Configures interscity_config.sh with your configuration (such as the ResourceAdaptor host)
  2. Source interscity_config.sh file:
source interscity_config.sh
  1. Run scripts