Skip to content

Latest commit

 

History

History
75 lines (54 loc) · 3.55 KB

README.md

File metadata and controls

75 lines (54 loc) · 3.55 KB

Yesterdays-pollen-today

GoDoc Build Status go report

A service to collect and store historical pollen data, as well as the predicted values generated by Tomorrowspollen.today (Github).

The data is stored in Apache Ignite, and the web api as well as the collection scripts are written in GO.

The repository can be built to two executeables: the API and the pollen collector. Both use the same underlying database.


Pollen API

The API listens on port 8001, which is not yet configurable.
The API has the following endpoints:

/api/pollentype:
Retrieves a list of all pollen types and their ids.

/api/location/{location}:
Get a location by id.

/api/location?country={country}&city={city}:
Find a location from country and city. For now they need to be exact matches. On the to-do is omitting one and getting a list (when more than one location is handled).

/api/pollen/{date}:
Exists for temporary backwards compatibility. Calls the next endpoint with pollentype=0 (grass) and location=0 (copenhagen).

/api/pollen/{date}?pollentype={pollentype}&location={location}:
Get pollen count and the predicted pollen count for a given date, pollen type and location.

/api/pollen?from={from}&to={to}&pollentype={pollentype}&location={location}:
Get a list of pollen count and the predicted pollen count for a given date range, pollen type and location.

Database configuration

Both the pollen collector and the API expects a database configuration named db.toml to exist next to the executeable. The example configuration is shown here:

SQLConnectionString = "tcp://localhost:10800/PollenDb?version=1.1.0&schema=PUBLIC"
CacheName = "PollenDb"

[ConnInfo]
Network =  "tcp"
Host =     "127.0.0.1"
Port =     10800
Major =    1
Minor =    1
Patch =    0

Most communication with Apache Ignite is done through an SQL driver. The connection string is defined in SQLConnectionString. To create the associated Ignite cache on first run, a ConnInfo object should be defined as well. The details of how to specify it can be found here.


Pollen collector

The pollen collector is an executeable that retrieves the pollen counts from the DMI feed, and the predicted pollen counts from a predictor service exposed from Azure ML Studio. The data is stored in Apache Ignite.

Configuration

The pollen collector expects a db.toml (same as for the API), as well as a configuration file named collector.toml to exist next to the execueteable. Example below:

PredictionApiEndpoint=""
PredictionApiKey=""
HistoricalApiEndpoint=""
HistoricalApiKey=""

The endpoints and API keys are for a web service from Azure ML studio.

Arguments

The pollen collector has the following command line arguments:

  • full-history: bool
    • If set, will retrieve predictions and pollen counts from a historical predictions service and store all of it in the database