Codementor Events

Mixing Flight Tickets Data with Weather Data

Published Feb 16, 2017Last updated Feb 21, 2017
Mixing Flight Tickets Data with Weather Data

Hi, Codementor community!๐Ÿ˜ƒ

Once upon a time I had some spare time in the weekend and decided to make some pet-project/micro-hackathon for myself. There had been no sunny weather in Moscow for a couple of months when I decided to do that. Therefore, I decided to look into it!
tickets and weather

This is how I did it:

  • Step 1: I parced city coordinates from map.aviasales.ru

  • Step 2: I enriched it with the weather data taken from openweathermap.org.

  • Step 3: I plotted it on google maps as a heatmap!
    1.png
    Looks pretty...but, it's not very useful - color distribution was affected by the dots closeness, not by their temperature.

  • Step 4: I tried to plot it as colored circles where the colors were calculated as a HSL gradient.
    2.png
    It looks fine too, but was a bit too laggy with 3K points.

For such cases google maps have a cool feature currently is alpha-version - Fusion Tables.

  • Step 5: I uploaded my data to it, plotted - super, not lags.
    3.png

Fusion Tables web-interface also allows you to customize markers for data ranges. It wasn't too flexible, maybe that's because of alpha-state โ€” there are also hacky workarounds in JS but that's enough for me now!

4.png

  • Step 6: I parsed map.aviasales.ru again for the round-trip tickets prices, then filtered results slightly:
places = [place for place in Place.objects.all() if 17 <= place.weather['temp'] < 25 and place.price and place.price < 20000]
  • Step 7: with an ugly JS, I added it as a second layer of custom markers to the map:
    5.png

  • Step 8: I wrapped the whole project with Docker (django, uwsgi, nginx, postgres in a single container) and rolled it out on my VPS in Netherlands!

That' it! ๐Ÿ˜ƒ

To view the result, visit: http://catchthesummer.scythargon.ru

sources: https://github.com/scythargon/catch_the_summer

Time spent: less than 15 hours

Pity that aviasales.ru/calendar does not accept GET-parameters:)

Any comments are very welcomed!

Discover and read more posts from Dmitry Vasilev
get started
post comments3Replies
Anna Clerk
a year ago

I recently flew to Munich. Usually I hire a taxi at airports, but this time I didnโ€™t have much time to spend in the city, so I decided to make the trip more comfortable and rented a car at Munich airport on https://rental24h.com/germany/munich-airport-franz-josef-strauss As it turned out, renting a car is easier than I imagined, and it makes the trip much better

Jessica z
a year ago

Good evening everyone here. I need some help to get a refund compensation for cancelled flight so can you please help me with this stuff?/

jessica brown
a year ago

When it comes to flight cancellations and refunds, the first step I recommend is to directly get in touch with the airline, TUI in this case. They should provide you with information about your options and the compensation you might be entitled to. Be sure to keep any documentation related to your flight, booking, and cancellation handy. Additionally, researching your rights as a passenger based on your location and the airlineโ€™s policies can also give you a clearer understanding of what to expect. Online forums and communities like this https://airadvisor.com/en/airlines/tui-refund-compensation can be valuable sources of real-world experiences and tips from others who have been through similar situations. Remember, patience is key during this process. It might take some time for the airline to process your request and provide the compensation owed. I hope everything works out smoothly for you