Ruby
Python
JavaScript

Search for '{{search_term}}'

Flight ticket vendor for low-cost flights

CMOS is the Code-Maven Open Source podcast that also includes video interviews. Subscribe to this feed RSS feed with your Podcast listener app or via iTunes iTunes.

Let's create a Web Application for flight ticket vendor as one of the projects.

As a model we can look at some of the features available at WizzAir or at Expedia.

Database:

  1. Airports: Each airport has a code, a city name, a country name, and a timezone represented as the offset from UTC.
  2. Flights. Each flight has a flight code, a source airport, and a destination airport. A departure time (at the timezone of the airport) a length of flight, a price in USD and a number of available seats. This number will be 0 in some of the cases.

When the user visits the website she needs to select a "From" airport and a "To" airport. Once a "From" is selected the choices in the destination should be limited to the cities to which there is a direct flight in the database.

Once the "From" and "To" are selected, the user needs to select a "Departure date" and optionally a "Return date". When the user clicks on "Search", show the available flights on the given dates.

Provide an option to see the N days. If N=3 show the day before and the day after the selected dates. If there is a flight but there are no more seats left, show "Sold out".

Views

  1. Show many dates around the current date, but show only the prices and when the user clicks through, only then show the details of the flight.
  2. Show few dates but also show the details of the flight (departure time, arrival time)

Increase complexity:

  • Allow the user to select the number of passangers and show the information using that number. (For now, don't deal with different ages.)
  • Each flight has several buckets of seats at different prices. Every time we show the cheapest available.
    So for example we assume that every airplane can hold 180 passangers we might have the following buckets: 60 seats for $80, 50 searts for $140, 40 seats for $200, 20 seats for $300, and 10 seats for $500.
    If 168 seats are taken and the user asks for 3 tickets, show 2 tickets for $300 and one ticket for $500.

Options:

  1. Show average ticket prices (interesting when not all the tickets are in the same bucket).
  2. Show total ticket prices for all the passangers.

From To Date   # Adults # Children (0-17)
Round Trip / One Way / Multiple Destination
(Each flight has a From, To, Date)

Direct flights Flights with 1 or 2 (or more?) stops. Data from multiple Airlines

Sample Data

There are several organizations that provide real flight data via an API. These could be used for getting real data.

I've also started to put together some random data that could be loaded in a database and used:

examples/data/airports.csv

code;city;country;timezone
BUD;Budapest;Hungary;+2
LTN;London Luton;UK;0
IBZ;Ibiza;Spain;+1

examples/data/flights.csv

code;from;to;departure;length;price,tickets
CM 2201;BUD;LTN;2016-05-29 06:00;2:35;80;20
CM 2203;BUD;LTN;2016-05-29 09:00;2:35;80;17
CM 2205;BUD;LTN;2016-05-29 12:20;2:35;100;0
CM 2201;BUD;LTN;2016-05-30 06:00;2:35;100;3
CM 2203;BUD;LTN;2016-05-30 09:00;2:35;120;5
CM 2205;BUD;LTN;2016-05-30 12:20;2:35;80;5
CM 2201;BUD;LTN;2016-05-31 06:00;2:35;80;5
CM 2203;BUD;LTN;2016-05-31 09:00;2:35;160;5
CM 2205;BUD;LTN;2016-05-31 12:20;2:35;100;5

CM 2202;LTN;BUD;2016-06-10 08:10;2:25;120;5
CM 2204;LTN;BUD;2016-06-10 11:10;2:25;160;5
CM 2206;LTN;BUD;2016-06-10 14:30;2:25;100;5
CM 2202;LTN;BUD;2016-06-11 08:10;2:25;180;5
CM 2204;LTN;BUD;2016-06-11 11:10;2:25;200;0
CM 2206;LTN;BUD;2016-06-11 14:30;2:25;80;5
CM 2202;LTN;BUD;2016-06-12 08:10;2:25;180;5
CM 2204;LTN;BUD;2016-06-12 11:10;2:25;200;5
CM 2206;LTN;BUD;2016-06-12 14:30;2:25;80;5

CM 1101;BUD;IBZ;2016-06-13 21:25;3:50;150;6
CM 1101;BUD;IBZ;2016-06-20 21:25;3:50;150;6
CM 1101;BUD;IBZ;2016-06-27 21:25;3:50;100;6

CM 1101;IBZ;BUD;2016-06-14 00:55;3:40;300;6
CM 1101;IBZ;BUD;2016-06-21 00:55;3:40;220;6
CM 1101;IBZ;BUD;2016-06-28 00:55;3:40;220;6

Comments

In the comments, please wrap your code snippets within <pre> </pre> tags and use spaces for indentation.
comments powered by Disqus