Ecosyste.ms: Awesome
An open API service indexing awesome lists of open source software.
https://github.com/rugaard/pollen
π©π°π€§ API for retrieving latest pollen measurements from Astma-Allergi Denmark.
https://github.com/rugaard/pollen
allergy api asthma astma-allergi astma-allergi-danmark astma-allergi-denmark measurements pollen pollen-measurements
Last synced: about 2 months ago
JSON representation
π©π°π€§ API for retrieving latest pollen measurements from Astma-Allergi Denmark.
- Host: GitHub
- URL: https://github.com/rugaard/pollen
- Owner: rugaard
- License: other
- Created: 2019-07-27T09:36:09.000Z (over 5 years ago)
- Default Branch: master
- Last Pushed: 2020-11-14T18:27:17.000Z (about 4 years ago)
- Last Synced: 2024-04-25T14:41:11.591Z (8 months ago)
- Topics: allergy, api, asthma, astma-allergi, astma-allergi-danmark, astma-allergi-denmark, measurements, pollen, pollen-measurements
- Language: PHP
- Homepage: https://github.com/rugaard
- Size: 20.5 KB
- Stars: 7
- Watchers: 2
- Forks: 0
- Open Issues: 0
-
Metadata Files:
- Readme: README.md
- License: LICENSE
Awesome Lists containing this project
README
# π©π°π€§ Pollen measurements from Astma-Allergi Denmark
Astma-Allergi Denmark does unfortunately not offer an official API for the latest pollen measurements in Denmark.
This package is (in some form) a workaround for that. It collects the latest measurements from the official Astma-Allergi Denmark website and turns it into structured data objects.
The returned data shows the measured pollen between **13:00** _(1:00 PM)_ yesterday and **13:00** _(1:00 PM)_ present day. Everyday at **16:00** _(4:00 PM)_ the latest measurements are being published.
## β οΈ Disclaimer
Since Astma-Allergi Denmark is an independent union, with a very little government funding, this package is made available under a very strict license, which prohibits any use other than personal.If you wish to use the pollen measurements commercially, you should contact Astma-Allergi Denmark directly and support them by buying the data instead. The payment goes directly to the maintenance and further development of their Pollen measurement service.
For more info about a commercial license, [visit their official website](https://hoefeber.astma-allergi.dk/pollenfeed).
## π Table of contents
* [Installation](#-installation)
* [Laravel](#laravel)
* [Usage](#%EF%B8%8F-usage)
* [Pollen Client](#pollen-client)
* [Methods](#methods)
* [Get measurements](#get-measurements)
* [Pollen stations](#-pollen-stations)
* [Frequently Asked Questions (FAQ)](#-frequently-asked-questions-faq)
* [What is this `Tightenco\Collect\Support\Collection` class and how does it work?](#what-is-this-tightencocollectsupportcollection-class-and-how-does-it-work)
* [Donating to Astma-Allergi Denmark](#-donating-to-astma-allergi-denmark)
* [License](#-license)## π¦ Installation
You can install the package via [Composer](https://getcomposer.org/), by using the following command:
```shell
composer require rugaard/pollen
```### Laravel
This package comes with a out-of-the-box Service Provider for the [Laravel](http://laravel.com) framework.
If you're using a newer version of Laravel (`>= 5.5`) then the service provider will be loaded automatically.Are you using an older version, then you need to manually add the service provider to the `config/app.php` file:
```php
'providers' => [
Rugaard\Pollen\Providers\Laravel\ServiceProvider::class,
]
```## βοΈ Usage
First thing you need to do, is to instantiate the `Pollen` client
```php
# Instantiate the Pollen client.
$pollen = new \Rugaard\Pollen\Pollen;
```Once you've done that, you're able to request the latest measurements from one of the [supported pollen stations](#-pollen-stations):
```php
# Copenhagen pollen station.
$measurements = $pollen->get('copenhagen');
```### Pollen client
The Pollen client which handles the requests to Astma-Allergi Denmark.
```php
new Pollen(?Client $httpClient);
```| Parameter | Type | Default | Description |
| :--- | :--- | :---: | :--- |
| `$httpClient` | `\GuzzleHttp\ClientInterface` | `null` | Replace the default underlying HTTP Client |### Methods
#### Get measurements.
Get latest pollen measurements from a specific pollen station.
```php
get(string $stationCode);
```| Parameter | Type | Description |
| :--- | :--- | :--- |
| `$stationCode` | `string` | Code of station. [Supported pollen stations.](#-pollen-stations) |_**Note**: The returned data shows the measured pollen between 13:00 (1:00 PM) yesterday and 13:00 (1:00 PM) present day. The measurements are updated everyday at 16:00 (4:00 PM)._
## π Pollen stations
Currently there only exists two Pollen stations in Denmark.
| ID | Name | Code | Region |
| :---: | :--- | :--- | :---: |
| 48 | KΓΈbenhavn | `copenhagen` | East |
| 49 | Viborg | `viborg` | West |## π£ Frequently Asked Questions (FAQ)
#### What is this `Tightenco\Collect\Support\Collection` class and how does it work?
All data is returned within a `Tightenco\Collect\Support\Collection` class. The class is a port of the popular `Collection` class from [Laravel](https://laravel.com).
Please refer to [Laravel](https://laravel.com)'s detailed documentation, to learn more about how you work with a `Collection`:
[https://laravel.com/docs/master/collections](https://laravel.com/docs/master/collections)## π° Donating to Astma-Allergi Denmark
To help Astma-Allergi Denmark maintain and further develop the Pollen measurement service.
Please consider [sending them a donation](https://www.astma-allergi.dk/stoetos).## π License
This package is licensed under a [Creative Commons Attribution-NonCommercial-NoDerivatives 4.0 (CC BY-NC-ND 4.0)](https://creativecommons.org/licenses/by-nc-nd/4.0/).