General Discussion

Expand all | Collapse all

Tech Talk: Implementation – US Weather Alert information in form

  • 1.  Tech Talk: Implementation – US Weather Alert information in form

    Posted 08-27-2024 10:00
    Edited by Pat Cooney 08-27-2024 10:10

    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. 

    Create a New Connection: 

    1. No credentials are needed, so use Anonymous Access. 

    1. Name the connection (e.g., "US National Weather Service"). 

    1. Set the Base Connection URL to https://api.weather.gov/. 

    1. Ensure Anonymous Access is selected. 

    Create the Data Source: 

    1. Use TrueContext’s HTTP GET data source to fetch the data. 

    1. Set the Data Format to XML on the Data Retrieval and Format tab. 

    1. On the Connection tab, set the URL path to alerts/active. 

    1. Filter for real alerts only: add status=actual under Query-String Arguments. 

    1. Add an HTTP header: Accept=application/atom+xml. 

    1. Click Update. 

     

    Form Usage 

    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. 

    1. 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). 

    1. Add in a Dropdown after the City and State. 

    1. Under Options we will point to our new Data Source. 
       

    1. Next, create a text area question which will hold the Summary of the alert. 

    1. Edit the Dropdown question again and move back to the Options Tab. 

    1. Add 2 filter options: 
      areaDesc Contains City 
      title Contains State  

    1. The final step is to set the Dropdown to push answers into the Text Area. 
       

    Results 

    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
    ------------------------------



  • 2.  RE: Tech Talk: Implementation – US Weather Alert information in form

    Posted 08-29-2024 10:15
      |   view attached

    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
    ------------------------------

    Attachment(s)

    xlsx
    Weather Alerts v7.xlsx   5 KB 1 version


Reminder: Content posted to our Community is public content.  Please be careful not to post Intellectual Property that you do not have permission to share.  For more information please refer to our Terms Of Use