Bridges-Python  3.2.0
Bridges(PythonAPI)
Classes | Functions
bridges.data_src_dependent.data_source Namespace Reference

Classes

class  DataSource
 

Functions

def get_game_data ()
 Get meta data of the IGN games collection. More...
 
def parse_actor_movie_imdb (item)
 Parses an actor movie pair. More...
 
def get_actor_movie_imdb_data (count=0)
 Get ActorMovie IMDB Data. More...
 
def get_actor_movie_imdb_data2 ()
 Get ActorMovie IMDB Data. More...
 
def get_earthquake_usgs_data (count=0)
 Get USGS earthquake data. More...
 
def get_shakespeare_data (endpoint="", textonly=False)
 Get data of Shakespeare works (plays, poems) More...
 
def get_gutenberg_book_data (num=0)
 Get meta data of the Gutenberg book collection (1000 books) More...
 
def get_cancer_incident_data (num=0)
 Retrieves the CDC cancer incidence dataset. More...
 
def get_song (songTitle, artistName=None)
 Get data of a particular song (including lyrics) using the Genius API. More...
 
def get_song_data ()
 Get data of the songs (including lyrics) using the Genius API. More...
 
def get_color_grid_from_assignment
 Reconstruct a ColorGrid from an existing ColorGrid on the bridges server. More...
 
def get_assignment
 This method retrieves a stored assignment from the server. More...
 
def osm_server_request (url)
 Fulfills a server request for OpenStreetMap. More...
 
def get_osm_data (args)
 
def elevation_server (url)
 Fulfills a server request for elevation data. More...
 
def get_elevation_data (args)
 
def get_wiki_data_actor_movie (year_begin, year_end)
 This method retrieves an actor-movie data from Wikidata. More...
 
def get_amenity_data (args)
 This method retrieves amenity data from Open Street Map datasets. More...
 

Function Documentation

◆ elevation_server()

def bridges.data_src_dependent.data_source.elevation_server (   url)

Fulfills a server request for elevation data.

For internal use only

◆ get_actor_movie_imdb_data()

def bridges.data_src_dependent.data_source.get_actor_movie_imdb_data (   count = 0)

Get ActorMovie IMDB Data.

Data is retrieved, formatted into a list of ActorMovieIMDB objects

Parameters
countcount of the number of actor/movie pairs, but currently unused, returns all records.
Returns
a list of ActorMovieIMDB objects, but only actor and movie fields in this version
Exceptions
Exceptionif the request fails

◆ get_actor_movie_imdb_data2()

def bridges.data_src_dependent.data_source.get_actor_movie_imdb_data2 ( )

Get ActorMovie IMDB Data.

Data is retrieved, formatted into a list of ActorMovieIMDB objects

Parameters
countthe number of actor/movie pairs, but currently unused,
Returns
All records.
Throws
Exception if the request fails

◆ get_amenity_data()

def bridges.data_src_dependent.data_source.get_amenity_data (   args)

This method retrieves amenity data from Open Street Map datasets.

[0]: minimum latitude [1]: minimum longitude [2]: maximum latitude [3]: maximum longitude [4]: amenity type

Parameters
or[0]: location string [1]: amenity type

Valid types are "food", "school", "firestation", "airport", "heli"

Returns
A list of amenities

◆ get_assignment()

def bridges.data_src_dependent.data_source.get_assignment (   server)

This method retrieves a stored assignment from the server.

Parameters
serverserver holding the assignment
userthe name of the user who uploaded the assignment
assignmentassignment number
subassignmentsub-assignment number
Returns
data structure representation of the assignment as a JSON string

◆ get_cancer_incident_data()

def bridges.data_src_dependent.data_source.get_cancer_incident_data (   num = 0)

Retrieves the CDC cancer incidence dataset.

Returns a list of records. See CancerIncidence class for more information

Parameters
numcount of records to be retrieved
Returns
cancer incidence data records in a list

◆ get_color_grid_from_assignment()

def bridges.data_src_dependent.data_source.get_color_grid_from_assignment (   server)

Reconstruct a ColorGrid from an existing ColorGrid on the bridges server.

This method can be useful in early CS courses like CS1 or CS2 to work with an existing data structure holding a dataset, like an image.

Parameters
serverserver holding the assignment
useruser name
assignmentassignment number
subassignmentsub-assignment number
Returns
ColorGrid structure

◆ get_earthquake_usgs_data()

def bridges.data_src_dependent.data_source.get_earthquake_usgs_data (   count = 0)

Get USGS earthquake data.

USGS Tweet data (https://earthquake.usgs.gov/earthquakes/map/). Data retrieved, formatted into a list of EarthquakeUSGS objects

Parameters
countthe number of earthquake records retrieved
Exceptions
Exceptionif the request fails
Returns
a list of earthquake records

◆ get_elevation_data()

def bridges.data_src_dependent.data_source.get_elevation_data (   args)

◆ get_game_data()

def bridges.data_src_dependent.data_source.get_game_data ( )

Get meta data of the IGN games collection.

This function retrieves and formats the data into a list of Game objects

Exceptions
Exceptionif the request fails
Returns
a list of Game objects,

◆ get_gutenberg_book_data()

def bridges.data_src_dependent.data_source.get_gutenberg_book_data (   num = 0)

Get meta data of the Gutenberg book collection (1000 books)

This function retrieves, and formats the data into a list of GutenbergBook objects

Exceptions
Exceptionif the request fails
Returns
A list of GutenbergBook objects,

◆ get_osm_data()

def bridges.data_src_dependent.data_source.get_osm_data (   args,
  OsmData 
)

◆ get_shakespeare_data()

def bridges.data_src_dependent.data_source.get_shakespeare_data (   endpoint = "",
  textonly = False 
)

Get data of Shakespeare works (plays, poems)

This function retrieves and formats the data into a a list of Shakespeare objects.

Valid 'poems','plays' Valid format{simple}

Exceptions
Exceptionif the request fails
Parameters
endpointcan be either "plays" or "poems". If this is specified, then only these types of works are retrieved.
textonlyif this is set, then only the text is retrieved.
Returns
An array of Shakespeare objects

◆ get_song()

def bridges.data_src_dependent.data_source.get_song (   songTitle,
  artistName = None 
)

Get data of a particular song (including lyrics) using the Genius API.

Data from Genius API(https://docs.genius.com/), given the song title and artist name. Valid http://bridgesdata.herokuapp.com/api/songs/find/ Valid song title, artist name

This function retrieves and formats the data into a Song object. The song if not cached in the local DB is queried and added to the DB

Parameters
songTitletitle of song
artistNamename of artist
Exceptions
Exceptionif the request fails
Returns
a Song object,

◆ get_song_data()

def bridges.data_src_dependent.data_source.get_song_data ( )

Get data of the songs (including lyrics) using the Genius API.

Song data from https://docs.genius.com/. Valid https://bridgesdata.herokuapp.com/api/songs/

This function retrieves and formats the data into a list of Song objects. This version of the API retrieves all the cached songs in the local DB.

Exceptions
Exceptionif the request fails
Returns
A list of Song objects,

◆ get_wiki_data_actor_movie()

def bridges.data_src_dependent.data_source.get_wiki_data_actor_movie (   year_begin,
  year_end 
)

This method retrieves an actor-movie data from Wikidata.

Usess a sparkl query

Parameters
year_beginbeginning year of data request
year_endending year of data request
Returns
A list of the actor-movie data of type MovieActorWikiData

◆ osm_server_request()

def bridges.data_src_dependent.data_source.osm_server_request (   url)

Fulfills a server request for OpenStreetMap.

For internal use only

Parameters
urlurl for server to process

◆ parse_actor_movie_imdb()

def bridges.data_src_dependent.data_source.parse_actor_movie_imdb (   item)

Parses an actor movie pair.

Parameters
iteminput actor-movie pair