Commit Graph

24 Commits

Author SHA1 Message Date
Paul van Tilburg f4e7c82b53
Fix test; remove maps load/maps test race
Check, lint and test using Cargo / Check, lint and test (push) Successful in 4m39s Details
Introduce the Rocket core that can be used to test the API without
background processes interfering with the test setup.
2024-05-09 12:04:00 +02:00
Paul van Tilburg a29d7f3535
Fix test; reduce require accurancy for coordinates
There are currently two entries for the city of Eindhoven in the
Nomanitim geoecoding database. Reduced acccuracy still is enough to
check that the API works properly.
2024-05-09 12:03:48 +02:00
Paul van Tilburg c86f001fee
Fix clippy issues
Check, lint and test using Cargo / Check, lint and test (push) Failing after 5m23s Details
2024-05-03 14:34:46 +02:00
Paul van Tilburg e62699c102
Tweak/fix tests; reduce required accuracy for geocoded coordinates
Also somebody seems to have slightly moved Eindhoven.
2024-02-27 16:06:56 +01:00
Paul van Tilburg f830d34464
Cargo update; fixes RUSTSEC-2020-0071 and RUSTSEC-2023-0044
Fix the tests for small changes in Rocket 0.5-rc.4.
Also fix the usage of a deprecate method.
2023-11-03 10:39:47 +01:00
Paul van Tilburg 38fb28c248 Add a /version API endpoint
Check, lint and test using Cargo / Check, lint and test (pull_request) Successful in 6m5s Details
Check, lint and test using Cargo / Check, lint and test (push) Has been cancelled Details
* Introduce the `VersionInfo` struct, build from the vergen environment
  variables
* Add the `version` handler to construct and return the version info
* Update the README
2023-05-29 15:48:36 +02:00
Paul van Tilburg 7c2b012e95 Print the version on lift off 2023-05-29 15:48:36 +02:00
Paul van Tilburg 1c71ca79ef
Switch back to the original Buienradar color scheme (refs: #27)
Check, lint and test using Cargo / Check, lint and test (push) Successful in 6m29s Details
This reverts commit a52313ffb7.
2023-05-26 19:43:37 +02:00
Paul van Tilburg a52313ffb7
Switch to new Buienradar color scheme (closes: #27)
Check, lint and test using Cargo / Check, lint and test (push) Successful in 6m13s Details
2023-05-24 22:13:13 +02:00
Paul van Tilburg 1aad3e2eb6
Nomatim seems to geocode Eindhoven differently now
Check, lint and test using Cargo / Check, lint and test (push) Successful in 5m32s Details
2023-05-22 20:50:46 +02:00
Paul van Tilburg bc140a9d1e
Remove unnecessary debug statement
Check Details
Lints Details
Test Suite Details
2023-03-23 16:57:30 +01:00
Paul van Tilburg 6a04fc958f
Fix float comparison in tests 2023-03-21 11:15:32 +01:00
Paul van Tilburg c8b951ab7e
Fix clippy issue 2023-03-21 11:05:03 +01:00
Paul van Tilburg f00537d5f3
Add more lints; fix issues 2022-10-17 20:02:54 +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 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 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 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 e204e7905c
Update to Rocket 0.5-rc.2 2022-05-10 14:55:57 +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 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 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