Commit Graph

170 Commits

Author SHA1 Message Date
Paul van Tilburg 576bcc6640
Fix UV index maps base URL
The typo was introduced in commit d432bb4.
2022-02-13 16:55:21 +01:00
Paul van Tilburg f6b26c9659
Fix expect message 2022-02-13 16:55:03 +01:00
Paul van Tilburg 79dac18655
Parse Buienradar as CSV file using serde
* Add the `csv` crate as a dependency
* Use the `Row` struct as intermediate object
* Turn the `parse_value` function into the `convert_value` function that
  cannot fail
2022-02-13 16:46:02 +01:00
Paul van Tilburg 4232263a45
Hook up the Buienradar provider metric in the forecast
Also, sync up the Luchtmeetnet provider documentation a bit.
2022-02-13 15:39:09 +01:00
Paul van Tilburg 6279d379ab
Add the Buienradar provider 2022-02-13 15:38:17 +01:00
Paul van Tilburg d432bb4cd6
Use URL objects instead of formatted strings
Use `request::Url` for this, so we don't have to depend on the `url`
crate ourselves.

Also, make the URL constants more uniform.
2022-02-13 13:10:12 +01:00
Paul van Tilburg 66abc9c4db
Hook up the Luchtmeetnet provider metrics in the forecast 2022-02-13 12:46:42 +01:00
Paul van Tilburg 59c177d508
Add the Luchtmeetnet provider
Also introduce the providers module.
2022-02-13 12:45:27 +01:00
Paul van Tilburg cbd686bd60
Small documentation improvements 2022-02-13 11:22:22 +01:00
Paul van Tilburg cf77dbb5e7
Refactor maps cache to hold lock as short as possible
This makes the response time way more snappy when the maps thread
is updating its cache.

* Move the `MapsHandle` type to the `maps` module
* SWitch to using the standard library mutex
* Split refresh methods into retrieval methods that don't need the lock
  and check timestamp & update methods that only need it shortly
* Introduce the `MapsRefresh` trait and implement it for `MapsHandle`
* Reorder some methods for clarity
* Small documentation fixes
2022-02-13 11:22:02 +01:00
Paul van Tilburg 9b9b1a5f77
Refactor so that no static is necessary for the maps cache
* Replace the lazy `once_cell` by a maps handle type
* Use Rocket's managed state to manage a handle
* Ensure that the handlers have access to it
* Pass another handle to the maps updater loop
* Try to keep the lock as short as possible

Still, long downloads block the lock. Add a FIXME to refactor this
so the lock is only taken when updating the maps fields.
2022-02-12 21:35:58 +01:00
Paul van Tilburg 72fe9577bd
Implement retrieving and caching maps 2022-02-12 21:08:13 +01:00
Paul van Tilburg d058ab4448
Set up a global maps (cache) object 2022-02-12 17:20:36 +01:00
Paul van Tilburg b5dae45868
Create maps cache and run its task next to Rocket 2022-02-12 17:12:06 +01:00
Paul van Tilburg 6b24c4f6e7
Move blocking geocding forward resolving to a separate thread 2022-02-12 17:12:01 +01:00
Paul van Tilburg ae2d2c1c56 Merge pull request 'Clarify that PAQI is the combination of pollen and air quality index' (#1) from admar/sinoptik:clarify-PAQI into main
Reviewed-on: #1
2022-02-12 17:10:45 +01:00
Admar Schoonen 85d5d34a65 Clarify that PAQI is the combination of pollen and air quality index 2022-02-12 16:18:30 +01:00
Paul van Tilburg 7b496887c2
Properly implement all metrics expansion 2022-02-12 15:03:02 +01:00
Paul van Tilburg ebf1b0618b
Number forecast output per metric (for now)
Also don't include a `null` value in the JSON if it is not enabled.
2022-02-12 15:03:02 +01:00
Paul van Tilburg 0b5e980f04
Initial import into Git 2022-02-12 15:03:00 +01:00