Example solution that demonstrates the use of the EDK npm package to integrate with BOM API and historic data sets.
The solution can be built using the following command edk build
.
The project will involve creating an application containing an Weather plugin. Use of this plugin requires manually defining the following Environment
values with respect to each other:
- WEATHER_NAME: the name of a station as found in ftp://ftp.bom.gov.au/anon/gen/clim_data/IDCKWCDEA0/tables/stations_db.txt
- WEATHER_GEOHASH, WEATHER_STATE: the geohash and state of the station, as by searching by postcode https://api.weather.bom.gov.au/v1/locations?search=3130
The whole application can be added with the following command edk add plugin --name "Application" --def_dir src/plugin
. The plugin, a SuperUser
and related environment variables are added as:
import * as ELARA from "@elaraai/edk/lib"
import { ApplicationPlugin, WeatherPlugin, Const, EnvironmentVariable, Poll, SuperUser } from "@elaraai/edk/lib"
export default ELARA.Schema(
ApplicationPlugin({
name: "Weather Plugin",
schemas: {
"Weather" : WeatherPlugin({
poll: Poll({ value: 1, unit: 'day' }),
})
},
users: [
SuperUser({
email: '[email protected]',
name: 'Admin',
password: Const('admin'),
})
],
environments: [
EnvironmentVariable({ name: 'WEATHER_GEOHASH' }),
EnvironmentVariable({ name: 'WEATHER_NAME' }),
EnvironmentVariable({ name: 'WEATHER_STATE' }),
]
})
)
General reference documentation for EDK usage is available in the following links: