# My Perfect Weather

## Inspiration

Have you ever complained about the weather in your location, had some time off booked and money to spend, but did not know where to go? If the answer is yes, then you would really do with My Perfect Weather app.

Just to illustrate how the app could be used, here are some use cases:

1. You have a child that you promised to fly a kite this week, but it's absolutely windless where you live and you don't want to break your word.

2. You live in a windy and rainy place like I do (Edinburgh, Scotland) and want to feel warmth on your skin and definitely NO rain.

3. You have an urge to build a snowman and you won't rest until you fulfil it.

4. You want to go fishing, and this time, you really want to catch something.

5. Last time, you spent 5 days looking for a place with good weather for your 3-day cycling trip and you want to make the decision faster this time.

## What it does

The idea behind the service is very simple. First, you define what a perfect weather means for you at a given moment in time. Currently, you can filter by temperature, wind speed, precipitation type and probability of precipitation. Then, the service does the rest and you are presented with the best matching destinations. The results are sorted by the amount of perfect days, those matching the original query, found in a week for each city and limited to top five. Perfect days are also marked with a different background. Currently, only 100 touristy cities in Europe are supported.

Let's see how we could use the service for the use cases defined in the previous section.

1. Set the wind to be between 16 and 32 km/h ideal for flying a kite, small chance of rain, comfortable temperature.

2. Set the min temperature to be warm enough for you, set the chance of rain to 0%.

3. Set the temperature to be around and below 0 C, choose snow as a precipitation type and the chance of precip. to be high.

4. Set the wind speed to be less than 16km/h, little rain and clouds as you want to avoid it being too sunny and have the fish go deeper in the water, comfortable temperature.

5. Choose whatever conditions you want to have for your multi-day cycling trip.

If you wish, you can easily check out how to get to your chosen destination, as the application comes integrated with a travel search service SkyScanner.

## How I built it

Basically, everything except of the external travel service runs inside of the IBM Bluemix. Check this blog for details.

## Challenges I ran into

As Spark is still quite fresh addition to IBM Bluemix, it has certain limitations. Currently, the code can only be executed as part of a notebook, thus there is no way of scheduling the runs. This was quite a discovery at the end of the time I had for the hackathon. What it means for My Perfect Weather, is that the presented weather days will slowly get out of date if Spark notebook is not re-run manually. I hope that IBM will address this shortcoming promptly.

## Accomplishments that I'm proud of

I think My Perfect Weather is quite a cool idea and I'm proud I could implement it very quickly blending all those various technologies together. It is a hack nonetheless, with many loose ends, but what's most important, it is working!

## What I learned

I learned quite a lot during this short project. I was new to the IBM Bluemix so it was an adventure on it's own. I've never heard of Cloudant DB before, but with some experience of MongoDB the transition was rather easy.

## What's next for My Perfect Weather

I'd like to add more weather controls and extend it to cover most of the world or at least the whole Europe in the nearest future. With more cities/weather-days matching the criteria, it will be more challenging to present best perfect days, so there is a scope for using Spark MLlib with Spark Streaming for the data coming from users' sessions.

I hope the IBM will add a capability of scheduling Spark jobs soon, so the service can become fully automated.

Most up-to-date feature requests and issues can be found here: https://github.com/radek1st/my-perfect-weather/issues

+ 30 more