AWS Lambda based API service to get pollen data forecast for a given zipcode. It's designed to attempt to get pollen data from 3 sources in parallel and return the data from the service that responds first. Instrumented with AWS x-ray.
To use this labmda handler, grab the pollen_handler.zip
from the latest release and create a lambda function in your AWS account.
When creating the function on AWS ... in the Function code section be sure to upload the pollen_handler.zip
, select the 'Go' runtime, and select 'pollen' as the handler name:
To test the service, create a simple test event for your Lambda function. The event should include the zipcode you want to get pollen data for:
{
"zipcode": "30019"
}
You should get a nice JSON response that looks like this:
{
"location": "DACULA, GA",
"zip": "30019",
"predominant_pollen": "Oak, Birch and Sycamore.",
"startdate": "2019-04-18T13:00:33.548528198Z",
"data": [
10.2,
1,
7.9,
10
],
"service": "Nasacort",
"version": "1.0.4.f3092bea655df439b7b3eaa3cfe9b628dec03cff"
}
Parameter | Description |
---|---|
location | The detected city/state location for the report |
zip | The zipcode that was passed to the Lambda function |
predominant_pollen | The predominant pollen currently detected in the area |
startdate | The date/time for the report |
data | An array of floats. This indicates the pollen indices by day, starting with today. In the case of the example above, today's pollen index is 10.2, tomorrow's pollen index is 1, the next day's index is 7.9, etc. |
service | The reporting service |
version | The version of the pollen Lambda service being used |
Simple! Just use AWS API Gateway to setup a REST API that calls your new Lambda function.
Yep -- the service is instrumented with AWS X-ray, so you can get an idea of runtime performance. Just navigate to X-Ray in your console to check it out.