Commit Graph

170 Commits

Author SHA1 Message Date
Paul van Tilburg c8b951ab7e
Fix clippy issue 2023-03-21 11:05:03 +01:00
Paul van Tilburg 32ec6b516c
Cargo update
This fixes build issues with the `geo-types` crate versio 0.7.7.
Also replace use of now deprecated functions/methods.
2023-01-31 14:02:46 +01:00
Paul van Tilburg a6301fa678 Fix markdownlint issues 2022-10-23 10:50:05 +02:00
Paul van Tilburg f00537d5f3
Add more lints; fix issues 2022-10-17 20:02:54 +02:00
Paul van Tilburg c8970fa3bb
Cargo update 2022-10-17 19:53:01 +02:00
Paul van Tilburg aee3409f4a Bump dependency on cached to 0.38.0
This fixes the unused `*_prime_cache` compile warnings.
2022-08-12 09:46:17 +02:00
Paul van Tilburg dbdd7bef0f Cargo update 2022-08-12 09:44:15 +02:00
Paul van Tilburg d749233b24 Merge uses 2022-08-12 09:44:08 +02:00
Paul van Tilburg abb6657212
Cargo update 2022-07-17 13:25:22 +02:00
Paul van Tilburg 8b03f2162b
Bump dependency on geocoding to 0.4.0
This finally removes the duplicate dependency tree on older versions of
crates we're already using (chrono, request, etc.).
2022-07-17 13:25:22 +02:00
Paul van Tilburg 789bb1d1ac
Update the changelog 2022-07-05 14:46:51 +02:00
Paul van Tilburg 2e999f5a78
Bump the version to 0.2.4 2022-07-05 14:42:51 +02:00
Paul van Tilburg 712b3a9acf
Check sample coordinate bounds (closes: #24) 2022-06-06 19:51:07 +02:00
Paul van Tilburg 2b23885692
Default to now if Last-Modified header missing
As a result, if the header is missing, it is no longer considered an
error.
2022-06-06 19:39:32 +02:00
Paul van Tilburg dc47c1c73c Merge pull request 'Handle errors internally and show them via the API' (#25) from handle-errors into main
Reviewed-on: #25
2022-06-06 16:49:03 +02:00
Paul van Tilburg 014ca5a151
Handle errors on the API side
* The map endpoints return an HTTP 404 error in case of unknown or
  out-of-bound locations
* The forecast endpoint with an address returns an HTTP 404 with error
  JSON in case geocoding fails
* The forecast endpoints return the errors per metric in the `errors`
  field of the forecast
* Implement `Display` for `Metric`
* Use a `BTreeMap` to have an ordered `errors` field/object
* Also log the errors to the console
* Update the tests
* Document the errors that can occur
2022-06-06 16:46:52 +02:00
Paul van Tilburg 8a2a6d769d
Log errors of the map refresher task separately 2022-06-06 15:38:38 +02:00
Paul van Tilburg 69ef08002c
Introduce error types, switch to Results everywhere
* Add dependency on the `thiserror` crate
* Add a global `Error` type, but also `maps::Error` and
  `providers::combined::MergeError` for convenience
* Add matching `Result` types that default to the respective `Error`
  type
* Refactor code to yield all kinds of error variants
* Add FIXMEs where library errors still need to be handled
* Remove documentation that explained why `None` was returned, this is
  captured in the error now
2022-06-06 15:37:54 +02:00
Paul van Tilburg 7d0cd4a822
Drop pollen and AQI max for PAQI metric
* This was introduced as per #20 but no longer deemed necessary
* Fix up some comments
* Keep the PAQI documentation in `README.md`
2022-06-05 21:47:12 +02:00
Paul van Tilburg fb8236696d
Use world map emoji! 2022-06-05 21:29:12 +02:00
Paul van Tilburg aab3b737be
Run map refresher as an ad hoc liftoff fairing
* Simplify the library `setup()` method
* Simplify launching Rocket
* Drop dependency on color-eyre
2022-06-05 21:25:56 +02:00
Paul van Tilburg 3451445de1
Update the changelog 2022-05-21 09:51:59 +02:00
Paul van Tilburg b88c7f77a0
Bump the version to 0.2.3 2022-05-21 09:49:18 +02:00
Paul van Tilburg 705ffae249
Fix typo in map key color for level 8 2022-05-21 09:47:23 +02:00
Paul van Tilburg bd2344beb6
Transform map key colors to hexadecimal format 2022-05-21 09:47:01 +02:00
Paul van Tilburg bad20b803a
Don't set unnecessary status 2022-05-10 15:47:37 +02:00
Paul van Tilburg fc4672328f
Fix missing type for tests
This was introduced by the changes in commit e204e79.
2022-05-10 15:47:08 +02:00
Paul van Tilburg 769f0745c8
Update examples with fixes of v0.2.2 taken into account 2022-05-10 15:26:58 +02:00
Paul van Tilburg 3fb899d1fd
Update the changelog 2022-05-10 15:05:57 +02:00
Paul van Tilburg f0cc54f074
Bump the version to 0.2.2 2022-05-10 14:58:21 +02:00
Paul van Tilburg ac653ef0c9
Cargo update 2022-05-10 14:57:03 +02:00
Paul van Tilburg e204e7905c
Update to Rocket 0.5-rc.2 2022-05-10 14:55:57 +02:00
Paul van Tilburg 08cdfe1e1c Merge pull request 'Fix timestamps for map samples not being correct' (#22) from 21-fix-ts-map-samples into main
Reviewed-on: #22
2022-05-10 14:26:38 +02:00
Paul van Tilburg 89395f21f6
Introduce RetrievedMaps; refactor around it
The `RetrievedMaps` struct captures the image and its metadata:
the last modification time and the base timestamp for the maps.

* No longer store the last modification time, called "stamp" before,
  separately in the `Maps` struct
* Update methods on `Maps` to use the `RetrievedMaps` structs and
  the timestamp base in particular for sampling and map marking
* Update the `MapsRefresh` implemention to use the last modification
  time
* Rename some variables from `map` to `image` in the helper functions
  for consistency
* Update tests and documentation
2022-05-10 14:19:09 +02:00
Paul van Tilburg ff9f1ac371
Parse timestamp base from filename 2022-05-10 13:21:21 +02:00
Paul van Tilburg 4a6eeab787
Fix sample/item being out of the combined series time range
For example, if there are 24 valid pollen samples and 20 valid air
quality items, the maximum pollen sample could be de 23th, but the
resulting combined series will only cover 20 items. So, it is should not
return that, but only look in the first 20 pollen samples for the
maximum sample.
2022-05-10 12:26:10 +02:00
Paul van Tilburg ab4b0bba72
Fix valid samples/items being discarded too early
A forecasted sample/item may be for example timestamped at 14:00.
For hourly forecasts, it will still be valid until 14:59:59, not
14:29:59.
2022-05-10 12:24:26 +02:00
Paul van Tilburg b61eb63cdf
Update the changelog 2022-05-08 14:04:05 +02:00
Paul van Tilburg e5e006dc00
Bump the version to 0.2.1 2022-05-08 14:02:47 +02:00
Paul van Tilburg a0c4e0da77
Don't use Option for the max sample/item return values
If the sample/item series are empty, the function already returns
`None`, so the tuple values are always `Some(_)` which makes the
`Option` type redundant.
2022-05-08 14:01:22 +02:00
Paul van Tilburg 34b63ec94d
Compact merge tests by using constructors
Add the constructors to sample/item structs for testing purposes.
2022-05-08 14:00:12 +02:00
Paul van Tilburg 5a23e83b7f
Extend tests for combined provider merge function
* Check that merging fails if the samples/items are too far apart
* Check that nothing is returned if either of the lists is empty
* Check that if either series is shifted, they are merged correctly
2022-05-08 13:48:09 +02:00
Paul van Tilburg e2d1a1d9df
Filter out old item/samples in combined provider
* Only retain samples/items that have timestamps that are at least half
  an hour ago
* Add a test to verify that the merge discards them
2022-05-08 12:53:32 +02:00
Paul van Tilburg 29b79c720d
Derive PartialEq for most item/sample structs 2022-05-08 12:53:09 +02:00
Paul van Tilburg 5d37c5b5ee
Bump the version to 0.2.0 2022-05-07 21:55:03 +02:00
Paul van Tilburg 2c04a92965
Update the changelog 2022-05-07 21:54:53 +02:00
Paul van Tilburg e408fbb91d
Add a changelog 2022-05-07 21:50:59 +02:00
Paul van Tilburg 5972697cf1
Yield pollen and AQI max for PAQI metric (closes: #20)
* Make the combined provider keep track of the AQI and pollen maximum
  value
* Extend the `Forecast` struct with the `aqi_max` and `pollen_max`
  fields
* Fill the `aqi_max` and `pollen_max` fields when the PAQI metric is
  selected
* Update the documentation
* Extend the tests
2022-05-07 21:43:35 +02:00
Paul van Tilburg 7feae97ee2
Bump dependencies; cargo update 2022-05-07 20:21:09 +02:00
Paul van Tilburg 0bf07bd134
Split off all functionality to a library crate
This way we can build Rockets from outside the crate and run benchmarks,
for example.

* Add top-level `setup()` function to create a Rocket and set up the
  maps refresher task
* Change the type of `maps::run` since `!` is still an unstable type
* Fix HTTP code blocks in `README.md` so they don't appear as doctests
  to rustdoc
2022-03-15 09:54:02 +01:00