1st iPaaS Puzzle: Local Drought Water Calculator

Open Data provided by the Dutch government: KNMI - Data ophalen vanuit een script

3 Likes

One of many APIs from Brazilian National Institue of Meteorology (INMET):

curl https://apitempo.inmet.gov.br/condicao/capitais/2019-10-22

Wheather API catalog can be found HERE

3 Likes

Rainfall API for Vienna: Schnellstart Leitfaden — dataset-api 1.0 Dokumentation

Puzzle Solution:

EDIT:
I modified my solution so that it always returns result for the last 24h. I also decided to set 14L water as an assumed amount which tree needs per day to stay healthy.

11 Likes

Congratulations Anela on being the first solution posted :slight_smile:

3 Likes

Just so Anela isn’t alone in here, Here’s my solution for a tree in the UK!

Hoping to see many other solutions soon :slight_smile:
There are numerous ways and approaches to achieve the outcome for this puzzle, so I’m anticipating many different solutions and implementation choices/styles!

I used a combination, of Workflow (no-code), FlowService (low-code) and the REST Connector Creator.

The workflow:

  1. Gets the date in the correct format for the API, and is driven from a workflow parameter which allows me to test this for different dates (given it hasn’t rained much for quite some time!)


    You can see here, it’s got a date value 2022-08-17 (the last day I can remember with rainfall), but if I want to get today’s rainfall, I just use now as the parameter value.
    I could also use the date action to subtract a whole day - lets say I wanted to look at yesterday’s data (not today).

  2. Once it’s got the date (in the right format), then it uses the UK environment agency API (https://environment.data.gov.uk/flood-monitoring/doc/rainfall) to retrieve the historical rainfall data. For this, I created a reusable REST connector.


    .

    .
    Rather than use a location, I selected to use weather stations, but the lat/long could equally have been used via the API, which in essence just then finds the closest weather station to your coordinates.
    .
    Why did I use a REST API Connector - it makes this a reusable connector that any other person could use, to build other integrations in the same project. This ‘masks’ the API complexity from a non-technical user who might be orchestrating the actions in the workflow.

  3. Now we have the historical rainfall data for the given date, I next need to calculate how much water the tree needs. This isn’t quite as simple as you might think, because this depends on tree size, etc. I found a stat which basically says a tree with an area of 1m2 needs 100 litres of water daily, so I made an assumption the tree I adopt is 1m x 1m just to keep the maths simple :slight_smile:. For this calculation I used a FlowService, as this meant I could work with data from 1 or many weather stations, etc.
    .
    This flow services takes the response from the environment agency API, then loops through each of the data items (recorded at 15 minute intervals), creates a running total, and then eventually returns this:

  4. Finally (and really just to demonstrate something different, I could’ve done this in the same flow service), to calculate how much water was needed, here I used a transformer in the workflow itself, so I added a ‘logger’ and created a transformer on this step, with the logger showing the needed amount of water. You can see the blue square on the workflow diagram showing there’s a transformer there. The transformer simply takes the needed rainfall (100litres - set in a workflow parameter), and subtracts the total amount of rainfall for that date calculated from the flow service:

So what does this look like when it runs!

Here’s the API response from the connector:

Total rainfall in litres on that day:

Then finally, I do the calculation to work out how many litres the tree needs taking into account the amount of rain:
In this example: 96 litres
image

Sadly if I run this for most days right now, the tree needs 100 litres :frowning:

Export of the integration is attached.

This can be imported back as a workflow, or you can use the import APIs documented here: webMethods.io Integration API Reference - webMethods.io Integration) or here (GitHub - SoftwareAG/webmethods-io-integration-apicli: webMethods.io integration Public APIs CLI tool) for a node.js based CLI that utilizes the APIs)
UK-How much water does my tree need.zip (87.9 KB)

4 Likes

For the Iberia weather we have an awesome API-key secured resource from the AEMET:

1 Like

This weekend originally I wanted to try to solve this puzzle, but then I procrastinated and got distracted by AI Art Generation engine Midjourney

The origin of our iPaaS Puzzle was a story of Freiburg citizens adopting trees in their hoods to save them from drying out. I tried to capture that in an AI generated picture. An old Oak tree in Freiburg getting watered by the citizen with the Munster in the background.

Here are a couple of the results:





Therefore be careful, you can easily get lost in tweaking the parameters. :slight_smile:
For the tinkerers among us, you can download the open source AI Art Generation Engine Stable Diffusion and run it on your machine.

Good job. But you took the only reliable weather station in Austria. So I can’t join anymore :grin: But I want to suggest to broader this solution to other SAG products. Like of course ARIS Process Mining & ARIS 4 sustainability.

Put it in a process context, connect to an ESG (Environmental Social Governance)strategy.
Find out the current AS_IS process (like water your trees) find the bottlenecks (with Root cause miner) and of course improve the behavior to the desired as is (use the weather station data to optimize your water treatment. Outcome more happy trees , less water usage :wink: Only possible with ARIS & ARIS process mining

3 Likes

There’s many other ways to solve this, even using the same weather station API @Monika :slight_smile:

2 Likes

Well well well have you ever thought about that you now have conviced people to water their trees in the neighbourhood?
Maybe they will do it in different ways in means of time and watering.
If you want to find out what the best way would be to optimize your way of working, find out bottlenecks or best practises and learn from this insights and roll it out globally as a new standard to optimize your water consumption and time efforts to practically water more trees :evergreen_tree: :evergreen_tree: .
Then we are talking about Process Mining, process optimization and other fun stuff of SAG :grinning:

@Dave_Pemberton with your help I was able to load 3 weeks of data into ARIS Process Mining

First week - I went like maybe everyday to my tree and water it with the desired amount of water (this takes me 30 minutes time everyday and a lot of water 100 litres per week)

So I analyzed all data with process mining and realized that some clever person in the company takes the rainfall in count and does only weekly watering → this leads of course to less time duration and less water consumption. So we have a process optimization potential in means of time and water.


So why not take a best practise and make this the new way of working - means the new standard approach? So that I can compare this new to be model with my actual as_is execution, measure how conform I am or how close I am to my optimized process? I can easily put it next to a model (so that every one can see the real execution next to the model) or for higher analyis make more comprehensive analysis (using root-cause-miner or conformance check analysis)

And if this is not enough I can roll this out as new standard procedure and measure again if this is the new way of working to obtain operational excellence.
If this is not there could be also a nice wm.io workflow triggered e.g after 6. days a short notice - in case there was no rainfall please water your tree with the accurate amount (needed water - rainfall).

If you are interested in this topic there will be a webinar 22nd september 2022 - listen to one of our customer who is already on this process optimization journey

6 Likes

:heart: I love this Monika :heart:

Great combination of products and really extending this use-case to make something very cool!

For those interested in how this is done in the integration part - I created a FlowService to provide the historical data

This Flow Services

  • takes in input of a start date, end date, and amount of water your tree needs.
  • It then loops through each day
  • Using the REST connector I previously created it gets the rainfall measures for that day.
  • Reuses the FlowService to sum the rainfall amount across a day
  • Subtracts the rainfall amount from the amount the tree actually needs to get the net difference
  • For simplicity, builds a CSV line for the data point (which can be ingested into ARIS Process Mining).

I then enabled this as a webhook which can be called externally, that just returns the total data values as a CSV

This could have used the ARIS Process Mining Connector, but using the CSV keeps this easier for people to understand and also allows me to take the data easily into Power BI (or other analytics tools), like this:

5 Likes

Everybody else - you still have sometime to submit your own solutions!

1 Like

The goal of the iPaaS Puzzle series that we are doing for the next 4 weeks as a trial is to help you hone your webMethods skills with little challenges for you to solve and learn from others who also tackled the Puzzle. We do these check ins on Fridays with our iPaaS Puzzle Show!

Please join us tomorrow for our iPaaS Puzzle Shows:
1st iPaaS Puzzle Show: Local Drought Water Calculator! Friday 9th of September
APJ/EMEA 11.30am IST / 8am CEST See 1st iPaaS Puzzle Show: Local Drought Water Calculator! APJ/EMEA at Software AG Groups International webMethods User Group
EMEA/Americas 11am EDT / 8am PDT / 5pm CEST See 1st iPaaS Puzzle Show: Local Drought Water Calculator! EMEA/Americas at Software AG Groups International webMethods User Group

I made a little video that gives you more details:

Bildschirmfoto 2022-09-08 um 11.17.18

Solve our iPaaS Puzzle and join our iPaaS Puzzle Show this Friday September 9th!

Rest assured, these shows are community events, with friendly banter that you can join in! See you tomorrow!

1 Like

Just looked into the puzzle a bit more and found Bright Sky - Free JSON API for DWD’s open weather data. for the German weather service DWD aka Deutscher Wetter Dienst.

That looks promising! I’ll keep you posted!

@anela.osmanovic Thought about your solution and may be 48 hours would be an even better timeframe. How easy is it to make it a parameter that you change every time?

I learned that you can derive longitude and latitude from Google Maps URL :slight_smile:

That is the URL for the highest mountain in Germany the Zugspitze:

I know they have a weather station up there :slight_smile:

On Bright Sky API Documentation page you can enter the parameters for the query call.

Had to play around with the date parameter until I found one with some Precipitation:

In my API call to https://api.brightsky.dev/
I declare all the parameters needed: date, last_date, lat, lon, and fill them with the same data.

The API Input call looks great:

The Output looks good too, alas where are my parameters like Precipitation or Temperature?

I tried to get a Flowservice going as in Dave’s example from above, but it was getting too late. Solution tomorrow I guess :slight_smile:

Hello iPaaS Puzzle Fans,

We had our first iPaaS Puzzle Show earlier today. What I really loved was the walkthrough by Anela @anela.osmanovic of her solution. It made me aware where my solution is lacking. Which is a great insight. You learn much better and more when you have wrangled with problem yourself. It also sticks around longer if you struggle to solve something.

I also loved Monika’s @Monika introduction to the extension into Process Mining. Love when we can help break down silos between different departments and products. Check out the recording!

It is of great benefit to you to sharpen your webMethods skills by solving these iPaaS Puzzles. Boy do we have a great 2nd iPaaS Puzzle: Prevent “Epic Fails” in Customer Service introduced in the late show by Irene @Irene_Cramer

If you missed the EMEA/APJ one and would like to be part of the action, please join us for the

EMEA/Americas version this afternoon. 11am EDT / 8am PDT / 5pm CEST See 1st iPaaS Puzzle Show: Local Drought Water Calculator! EMEA/Americas at Software AG Groups International webMethods User Group

Starting solving and posting our 2nd iPaaS Puzzle: Prevent “Epic Fails” in Customer Service solution now. It’s from the interaction that we all learn and expand our horizon!

Thanks!

2 Likes

You didn’t show the URL you used, but I tested this with:

https://api.brightsky.dev/weather?date=2022-09-07&last_date=2022-09-08&lat=47.42&lon=10.98

and I can see the data on a test :slight_smile:

1 Like

Here is the recording of our iPaaS Puzzle Show EMEA/Americas.

Bildschirmfoto 2022-09-12 um 13.34.52

Check it out!

1 Like

This topic was automatically closed 180 days after the last reply. New replies are no longer allowed.