Skip to main content

airqo Adaptor developer README.md

Source: https://github.com/OpenFn/adaptors/tree/main/packages/airqo

language-airqo

An OpenFn adaptor for building integration jobs for use with the AirQo air quality monitoring API.

Documentation

View the docs site for full technical documentation.

Configuration

View the configuration-schema for required and optional configuration properties.

Usage

The adaptor currently exposes:

  • getRecentMeasurements(entityType, entityId) and getHistoricalMeasurements(entityType, entityId, params) for the most common use case: fetching air quality readings for a site, device, grid, or cohort.
  • Generic http.get(), http.post(), and http.request() operations for calling any other AirQo endpoint directly.
// Adaptor: @openfn/language-airqo

// Fetch recent PM2.5/PM10 readings for a site
getRecentMeasurements('sites', 'YOUR_AIRQO_SITE_ID');

// Fetch historical readings for a grid over a date range
getHistoricalMeasurements('grids', 'YOUR_AIRQO_GRID_ID', {
startTime: '2024-01-01T00:00:00Z',
endTime: '2024-01-31T23:59:59Z',
});

// Call any other AirQo endpoint directly while you find out which
// resource-specific helpers are worth promoting
http.get('devices/metadata/grids');

Development

Clone the adaptors monorepo. Follow the "Getting Started" guide inside to get set up.

Run tests using pnpm run test or pnpm run test:watch

Build the project using pnpm build.

To build only the docs run pnpm build docs.