Skip to content

mycaule/can-we-row

Repository files navigation

Can we row?

Build Status dependencies Status devDependencies Status

A simple webapp for rowers to check if they can row based on different time-series metrics (water levels, weather).

The project uses French government dataset on rivers activity.

It is available for the following French cities: Amiens, Besançon, Bordeaux, Caen, Châlons-en-Champagne, Clermont-Ferrand, Dijon, Lille, Limoges, Lyon, Marseille, Metz, Montpellier, Nantes, Orléans, Paris, Poitiers, Rennes, Rouen, Strasbourg, Toulouse.

Open an issue if the data is incorrect or if you want your city to appear on the list. You can also check the roadmap for this application.

I hope you have lots of fun using it!

Setup

The web application serves a /metrics endpoint to scrape historical data and to expose latest to the Prometheus monitoring system. A summary of the latest data can be obtained using /latest.

Routes

GET /metrics/hauteurs?stations=...

# HELP hauteurs Observations par hauteur H
# TYPE hauteurs gauge
hauteurs{station="F700000103"} 1.46 1512993000000
hauteurs{station="M800001010"} 5.26 1512994800000
hauteurs{station="O222251001"} -0.18 1512995400000
hauteurs{station="U472002001"} 2.32 1512993600000
hauteurs{station="O972001001"} 5.23 1512995400000
hauteurs{station="A060005050"} 2.87 1512993600000

GET /metrics/temperatures?cities=...

# HELP temperatures Températures
# TYPE temperatures gauge
temperatures{city="paris"} 5.56 1513008710000
temperatures{city="lyon"} 7.46 1513008710000

GET /latest/temperatures?cities=...

[{
  city: "paris",
  time: 1513086316000,
  meas: 5.63
}, {
  city: "lyon",
  time: 1513086316000,
  meas: 5.44
}]

GET /latest/hauteurs?stations=...

[{
  station: "F700000103",
  time: 1513083000000,
  meas: 1.89
}, {
  station: "U472002001",
  time: 1513080000000,
  meas: 2.32
}, {
  station: "O972001001",
  time: 1513083300000,
  meas: 4.59
}, {
  station: "M800001010",
  time: 1513081200000,
  meas: 5.46
}, {
  station: "O222251001",
  time: 1513082700000,
  meas: -0.39
}, {
  station: "A060005050",
  time: 1513080000000,
  meas: 3.07
}]

Setting up API keys

Go to darksky.net to get a developer access to their API. Then, make sure to set process.env.DARKSKY_API_KEY = 'xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx' before running the web server.

Vigicrues doesn't need an API key.

Running a Prometheus instance

docker run --name prometheus -d -p 127.0.0.1:9090:9090 quay.io/prometheus/prometheus

Configuring the Prometheus scrapers.

# Login into the docker instance
docker exec -it prometheus sh

# Edit the config file to match our template /config/prometheus.yml
vi /etc/prometheus/prometheus.yml

# Get the pid for prometheus
ps -ef

# Reload Prometheus configuration
kill -HUP [pid]

Contributions

Changes and improvements are welcome! Feel free to fork and open a pull request into master.

Roadmap

License

can-we-row is licensed under the MIT License.

References

Data sources

Application

Usability