Just wanted to add onto this a little more also! I have attached Form Report for the little demo form that I have screenshots above. Hopefully make it easier to recreate this in your own teams.
Also wanted to provide the links to a couple other weather services for other areas of the world. The data that is provided by these other services will be in different formats so there will be some changes required to the form.
Canada: https://api.weather.gc.ca/openapi?f=html
OpenWeather: https://openweathermap.org/current (this depends on Lat / Long to pull the weather for a specific area)
------------------------------
Ian Chamberlain
Solutions Architect
TrueContext
------------------------------
Original Message:
Sent: 08-27-2024 10:00
From: Ian Chamberlain
Subject: Tech Talk: Implementation – US Weather Alert information in form
The National Weather Service (NWS) in the United States offers an open API providing various weather data and alerts. By using these alerts, we can enhance user awareness of weather patterns and potential hazards when working in the field. Alerts for high winds, high temperatures, strong currents, and thunderstorms are available. With TrueContext's ability to pull this data hourly, users will stay updated with the latest weather alerts while filling out forms.
The NWS API documentation is available here.
-
No credentials are needed, so use Anonymous Access.
-
Name the connection (e.g., "US National Weather Service").
-
Ensure Anonymous Access is selected.
-
Use TrueContext's HTTP GET data source to fetch the data.
-
Set the Data Format to XML on the Data Retrieval and Format tab.
-
On the Connection tab, set the URL path to alerts/active.
-
Filter for real alerts only: add status=actual under Query-String Arguments.
-
Add an HTTP header: Accept=application/atom+xml.
Reviewing the data provided, there are 2 columns explaining the alert's area or location.
AreaDesc has a list of city or region names in it but does not include the State.
Title has the actual title of the Alert, but it also has the State Code.
-
In the form, create a City and a State text question. The State will need to be the state code and not the full state (ex. NY).
-
Add in a Dropdown after the City and State.
-
Under Options we will point to our new Data Source.
-
Next, create a text area question which will hold the Summary of the alert.
-
Edit the Dropdown question again and move back to the Options Tab.
-
Add 2 filter options:
areaDesc Contains City
title Contains State
-
The final step is to set the Dropdown to push answers into the Text Area.
The data source will filter based on either the city, the State or, for most accurate results, both City and State.
------------------------------
Ian Chamberlain
Solutions Architect
TrueContext
------------------------------