OpenWeatherMap · Arazzo Workflow

OpenWeatherMap Historical Air Pollution Window

Version 1.0.0

Geocode a city, then fetch historical air pollution for a window and the current reading.

1 workflow 2 source APIs 1 provider
View Spec View on GitHub WeatherForecastClimateAir PollutionAir QualitySolarGeocodingHistoryMapsRoad RiskPublic APIsArazzoWorkflows

Provider

openweathermap

Workflows

historical-air-pollution-window
Resolve a city name, then return historical and current air pollution.
Calls direct geocoding to turn a city query into coordinates, then chains the latitude and longitude into the historical air pollution endpoint over a Unix time window and the current air pollution endpoint.
3 steps inputs: appid, end, q, start outputs: currentAqi, historyList, lat, lon
1
geocodeCity
getDirectGeocoding
Resolve the supplied city query into geographic coordinates, keeping the first and best match.
2
historicalAirPollution
getAirPollutionHistory
Fetch historical hourly air pollution at the geocoded coordinates across the supplied Unix start and end timestamps.
3
currentAirPollution
getCurrentAirPollution
Fetch the current air pollution reading at the same coordinates to compare against the historical series.

Source API Descriptions

Arazzo Workflow Specification

openweathermap-historical-air-pollution-window-workflow.yml Raw ↑
arazzo: 1.0.1
info:
  title: OpenWeatherMap Historical Air Pollution Window
  summary: Geocode a city, then fetch historical air pollution for a window and the current reading.
  description: >-
    Resolves a city name into coordinates with the geocoding API, then reads the
    historical air pollution endpoint for a supplied Unix time window and the
    current air pollution endpoint at the same point, so a historical series can
    be compared against the latest reading. Every step spells out its request
    inline, including the appid API key the security scheme requires, so the flow
    can be read and executed without opening the underlying OpenAPI
    descriptions.
  version: 1.0.0
sourceDescriptions:
- name: geocodingApi
  url: ../openapi/openweathermap-geocoding-openapi.yml
  type: openapi
- name: airPollutionApi
  url: ../openapi/openweathermap-air-pollution-openapi.yml
  type: openapi
workflows:
- workflowId: historical-air-pollution-window
  summary: Resolve a city name, then return historical and current air pollution.
  description: >-
    Calls direct geocoding to turn a city query into coordinates, then chains
    the latitude and longitude into the historical air pollution endpoint over a
    Unix time window and the current air pollution endpoint.
  inputs:
    type: object
    required:
    - q
    - start
    - end
    - appid
    properties:
      q:
        type: string
        description: City name, optionally with state and ISO country codes, comma-separated.
      start:
        type: integer
        description: Unix UTC start timestamp for the historical window.
      end:
        type: integer
        description: Unix UTC end timestamp for the historical window.
      appid:
        type: string
        description: OpenWeather API key.
  steps:
  - stepId: geocodeCity
    description: >-
      Resolve the supplied city query into geographic coordinates, keeping the
      first and best match.
    operationId: getDirectGeocoding
    parameters:
    - name: q
      in: query
      value: $inputs.q
    - name: appid
      in: query
      value: $inputs.appid
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      lat: $response.body#/0/lat
      lon: $response.body#/0/lon
      name: $response.body#/0/name
  - stepId: historicalAirPollution
    description: >-
      Fetch historical hourly air pollution at the geocoded coordinates across
      the supplied Unix start and end timestamps.
    operationId: getAirPollutionHistory
    parameters:
    - name: lat
      in: query
      value: $steps.geocodeCity.outputs.lat
    - name: lon
      in: query
      value: $steps.geocodeCity.outputs.lon
    - name: start
      in: query
      value: $inputs.start
    - name: end
      in: query
      value: $inputs.end
    - name: appid
      in: query
      value: $inputs.appid
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      historyList: $response.body#/list
  - stepId: currentAirPollution
    description: >-
      Fetch the current air pollution reading at the same coordinates to compare
      against the historical series.
    operationId: getCurrentAirPollution
    parameters:
    - name: lat
      in: query
      value: $steps.geocodeCity.outputs.lat
    - name: lon
      in: query
      value: $steps.geocodeCity.outputs.lon
    - name: appid
      in: query
      value: $inputs.appid
    successCriteria:
    - condition: $statusCode == 200
    outputs:
      currentAqi: $response.body#/list/0/main/aqi
      currentComponents: $response.body#/list/0/components
  outputs:
    lat: $steps.geocodeCity.outputs.lat
    lon: $steps.geocodeCity.outputs.lon
    historyList: $steps.historicalAirPollution.outputs.historyList
    currentAqi: $steps.currentAirPollution.outputs.currentAqi