# ratemyflight /

Filename Size Date modified Message
ratemyflight
214 B
53 B
5.7 KB
2.1 KB

# Overview

Rate My Flight is a Django application that allows users to rate flights they've taken. The application consists of two parts: an API and the homepage which implements it by displaying a map of the world which can be used to display data collected in various ways. Ratings can be entered directly on the website or via twitter.

Rate My Flight was created by Andrew Fisher, Josh de Blank and Stephen McDonald for the Django Dash competition 2010.

## Installation

Rate My Flight is available on pypi and can be installed via setuptools:

$easy_install -U ratemyflight  or via distribute: $ pip install ratemyflight


Once installed you can run the command ratemyflight project_name which will create a new Django project with the given project_name that has the ratemyflight app installed.

## Consuming Tweets

In order to consume tweets it is necessary to create a cron job that runs the command in your project's directory:

\$ python manage.py poll_twitter


Once the cron job is running it will consume tweets containing the hash tag #ratemyflight if found to contain rating information in the following format:

flight_number airport_from airport_to rating comment hashtag


For example if you flew British Airways (BA) flight 227 from Sydney (SYD) to Los Angeles (LAX) and gave it a rating of 8 you'd tweet:

BA227 SYD LAX 8/10 I really enjoyed this flight! #ratemyflight


## API

Rate My Flight primarily consists of an API callable over HTTP that returns JSON data. The following URLs are implemented.

/api/airport/boundary/<south>/<west>/<north>/<east>/ Returns a list of airports (maximum defined in ratemyflight.settings.MAX_AIRPORTS) within the given boundaries <south>, <west>, <north> and <east> which make up latitude and longitude in decimal format.

/api/flight/boundary/<south>/<west>/<north>/<east>/ Returns a list of flights (maximum defined in ratemyflight.settings.MAX_FLIGHTS) within the given boundaries <south>, <west>, <north> and <east> which make up latitude and longitude in decimal format.

/api/flight/airline/<iata_code>/ Returns a list of flights (maximum defined in ratemyflight.settings.MAX_FLIGHTS) for the given airline using its given <iata_code>.

/api/flight/username/<username>/ Returns a list of flights (maximum defined in ratemyflight.settings.MAX_FLIGHTS) that have been given ratings by the given <username>.

/api/flight/recent/ Returns the most recent flights (maximum defined in ratemyflight.settings.MAX_FLIGHTS).

### JSON

The following examples show the JSON format returns for aiports and flights.

Airports:

[
{
pk: 9044,
model: "ratemyflight.airport",
fields: {
longitude: 138.530555555556,
country: 235,
latitude: -34.945
}
}
]


Flights:

[
{
comment: "I like turtles!!",
flight: "GQ483",
name: "stephen_mcd",
tweet_id: null,
airport_from_id: 9075,
airport_from: {
city: "Tamworth",
name: "Tamworth",
icao_code: "YSTW",
country_id: 235,
longitude: 150.846666666667,
iata_code: "TMW",
latitude: -31.0838888888889,
id: 9075
},
tweet_text: null,
value: 6.7,
airport_to_id: 2082,
avatar_url: "http://a3.twimg.com/profile_images/690849843/UNI_2223_normal.jpg",
airline_id: 1428,
airport_to: {
city: "Swartkop",
name: "Swartkop",
country_id: 43,
longitude: 28.1644444444444,
iata_code: "N/A",
latitude: -25.8094444444444,
id: 2082
},
id: 81
}
]


## Notes

Rate My Flight has no specific dependencies but was developed and deployed with the following software selected for its environment, and using alternatives may result in issues due to limited amount of testing over the 48 hour competition period.

Tip: Filter by directory path e.g. /media app.js to search for public/media/app.js.
Tip: Use camelCasing e.g. ProjME to search for ProjectModifiedEvent.java.
Tip: Filter by extension type e.g. /repo .js to search for all .js files in the /repo directory.
Tip: Separate your search with spaces e.g. /ssh pom.xml to search for src/ssh/pom.xml.
Tip: Use ↑ and ↓ arrow keys to navigate and return to view the file.
Tip: You can also navigate files with Ctrl+j (next) and Ctrl+k (previous) and view the file with Ctrl+o.
Tip: You can also navigate files with Alt+j (next) and Alt+k (previous) and view the file with Alt+o.