Brief
Our 'simple' goal today was to build an Alteryx App that builds an HTML trend analysis report based on the user input.
We were able to pick between the Historical Weather API or the Wikimedia API.
We had to design an Alteryx App that allows for user inputs:
- A location (if using the Weather API)
- A Wikipedia page (if using the Wikipedia API)
- A time range (start and end date)
- Optional inputs that allows the user to change the prompts / output formats to the desired standard.
The Alteryx App will need to pull in the data for that timeframe, create an LLM prompt using the Al Prompt tool and request a trend report in HTML format so it can be rendered directly in our browsers upon completion.
Plan
Connecting to Historical Weather API
First I had to read through the documentation to find out what fields were needed in my text input.
Required fields:
- base url - https://archive-api.open-meteo.com/v1/archive?
- latitude, longitude format = "&latitude=51"
Everything else was optional and was dependent on what you want to bring back
Fields I chose to bring:
temperature_2m_max, temperature_2m_mean, temperature_2m_min, precipitation_sum, precipitation_hours, apparent_temperature_max, apparent_temperature_mean, apparent_temperature_min, weather_code, sunshine_duration, wind_speed_10m_max and then also start and end date as that was noted in the brief.
this in the url would be:
&start_date=##Start##&end_date=##End##&daily=weather_code,temperature
_2m_max,temperature_2m_min,temperature_2m_mean,apparent_temperature
_max,precipitation_sum,precipitation_hours,sunshine_duration,wind_speed_10
m_max&tiemzone=auto$
Building the flow first
I decided to just build the flow first before I put in any user inputs.

All this flow does is pull the data from the API, and then the prompt tool sends the data to Gemini along with an instruction to write a weather trend analysis as a self contained HTML document. A formula tool was used to set the output file path and then the response was converted to a blob and written to the disk as a html file that opened directly into the browser. The output format can be found further down in the prompt section.
User Input Location
One of the requirements was getting location as a user input field. This is possible by using the Map Input Tool which allows a user to select a point on a map. Then by connecting it to a Spatial Info Tool, we can extract the latitude and longitude of that point.


Designing the Prompt
At first I inputted a very generic prompt:
You are a climate data analyst producing a weather trend report for a general audience. Analyse the daily weather data provided and write a complete, self-contained HTML report.
Work only from the data given. Do not estimate, infer, or invent any figure that is not present in the data.
Daily weather observations, as JSON:
Return a complete HTML document beginning with <!DOCTYPE html>. No
markdown, no code fences
As you can expect it outputted a very generic report:

Formatting the Prompt
To keep it easy to read and process, I split my prompt into different sections
- #Role
- #Rules: What they have to adhere to
- #Data: [DownloadData]
- #WMO Code Translation
- #Output Format
- #Data Array
- #Page Structure
- #Header
- #KPI Cards
- #Tabs
- #Closing
- #Style: What applies to every style
- #Requested Style: [Style]
The Data and Requested Style were pointed to my [DownloadData] and [Style] columns so it would pull the data from the requested dates and location as well as requested Style.
I also decided to make sure that I added some other features such as:
- Tabbed Sections
- Survival rating - Score each day on a made-up index from the actual wind, temperature and precipitation, then show a calendar heatmap coloured by score.
- Laundry Index - Should you have done your laundry based on the weather conditions
Challenges
- Over-engineering - the more complex my prompt was, the more times it just would not render
- Consistency with outputs - even with the same prompt the output would be different every time I ran it.
- Not asking Gemini what the best structure it needed was. I only did this later on where I fed Gemini the prompt I had and asked it to make it more readable for Gemini. This in theory should have made it more optimal however I found that the prompt it gave back was missing some instructions - e.g. what tabs I wanted and style guides.
- I ended up reverting back to my original prompt.
Prompt Outputs
Clean and Professional
View embedded content on yeungsophie.github.ioPinks
View embedded content on yeungsophie.github.ioRetro
View embedded content on yeungsophie.github.io
