[Experiment] A simple scraping application to visualize data about water in São Paulo.
JavaScript API Blueprint
Clone or download
Fetching latest commit…
Cannot retrieve the latest commit at this time.
Permalink
Failed to load latest commit information.
config
lib
middleware
tests
.gitignore
.travis.yml
LICENSE
Procfile
README.md
apiary.apib
index.js
package.json
seed.js
yesterday.js

README.md

Sabesp Mananciais API

A simple scraping application to visualize data about water in São Paulo.

Build Status node Code Climate GitHub release License

A little bit about the technology envolve in this project:

  • Node.js 0.12.3
  • Bluebird 2.9.24
  • Cheerio 0.18.0
  • config 1.12.0
  • Cors 2.6.0
  • debug 2.1.3
  • Express 4.11.2
  • Moment 2.10.2
  • Mongojs 0.18.2
  • Newrelic 1.18.3
  • Request 2.55.0
  • Universal-Analytics 0.3.8

Dev Dependencies:

  • Istanbul 0.3.5
  • JSHint 2.6.0
  • Mocha 2.1.0
  • Nodemon 1.3.6
  • Supertest 0.15.0

Tests

$ npm test         # unit tests
$ npm run test-api # integration tests (with database)

Route Schema:

Description Method URL Params
Get data of today GET / NULL
Get data of a specific day GET /:date YYYY-MM-DD
Get data of today GET /v2 NULL
Get data of a specific day GET /v2/:date YYYY-MM-DD

v0

[
  {
    "name": "Cantareira",
    "data": [
      {"key": "volume armazenado", "value": "7,2 %"},
      {"key": "pluviometria do dia", "value": "0,0 mm"},
      {"key": "pluviometria acumulada no mês", "value": "0,0 mm"},
      {"key": "média histórica do mês", "value": "271,1 mm"} ]
  },
  //...
]

v2 (Simple way to serialize JSON data)

@wcastello suggestion:

[
  {
    "name": "Cantareira",
    "data": {
      "volume_armazenado": "19,0 %",
      "pluviometria_do_dia": "0,2 mm",
      "pluviometria_acumulada_no_mes": "206,5 mm",
      "media_historica_do_mes": "178,0 mm"
    }
  },
  //...
]

Team

Sabesp API was made with love and a lot of JavaScript by these guys:

Rafaell Lycan William Bruno
Rafaell Lycan William Bruno

OBS:

It isn't possible get data before January 1th, 2003.