Bridges-Python  3.4.3
Bridges(Python API)
Classes | Functions | Variables
bridges.data_src_dependent.data_source Namespace Reference

Classes

class  DataSource
 

Functions

None set_source_type (t)
 
def get_game_data ()
 Get meta data of the IGN games collection. More...
 
List[Cityget_us_cities_data (**kwargs)
 retrieves a set of cities filtered by provided arguments More...
 
List[Cityget_world_cities_data (**kwargs)
 
ActorMovieIMDB get_actor_movie_imdb_data (count=0)
 Get ActorMovie IMDB Data. More...
 
List[ActorMovieIMDBget_actor_movie_imdb_data2 ()
 Get ActorMovie IMDB Data. More...
 
List[EarthquakeUSGSget_earthquake_usgs_data (count=0)
 Get USGS earthquake data. More...
 
List[Shakespeareget_shakespeare_data (endpoint="", textonly=False)
 Get data of Shakespeare works (plays, poems) More...
 
List[GutenbergBookget_gutenberg_book_data (num=0)
 Get meta data of the Gutenberg book collection (1000 books) More...
 
List[CancerIncidenceget_cancer_incident_data (num=0)
 Retrieves the CDC cancer incidence dataset. More...
 
Song get_song (songTitle, artistName=None)
 Get data of a particular song (including lyrics) using the Genius API. More...
 
List[Songget_song_data ()
 Get data of the songs (including lyrics) using the Genius API. More...
 
ColorGrid get_color_grid_from_assignment (str server, str user, int assignment, int subassignment=0)
 Reconstruct a ColorGrid from an existing ColorGrid on the bridges server. More...
 
OsmData get_osm_data (*args)
 This method retrieves an OpenStreet Map dataset given a location. More...
 
ElevationData get_elevation_data (*args)
 This method retrieves an Elevation Map dataset, given a location by name (string). More...
 
List[MovieActorWikiDataget_wiki_data_actor_movie (year_begin, year_end)
 This method retrieves an actor-movie data from Wikidata. More...
 
List[Amenityget_amenity_data (*args)
 This method retrieves amenity data from Open Street Map datasets. More...
 
List[GutenbergMetaget_gutenberg_book_metadata (*args)
 function to search for a gutenberg book given a search string and type of metadata to search through More...
 
GutenbergMeta get_a_gutenberg_book_metadata (id)
 
def gutenberg_book_text (id, strip=False)
 
List[str] available_subreddits ()
 
Reddit reddit_data (subreddit, time_request=-9999)
 

Variables

string source_type = "live"
 

Function Documentation

◆ available_subreddits()

List[str] bridges.data_src_dependent.data_source.available_subreddits ( )

◆ get_a_gutenberg_book_metadata()

GutenbergMeta bridges.data_src_dependent.data_source.get_a_gutenberg_book_metadata (   id)

◆ get_actor_movie_imdb_data()

ActorMovieIMDB 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()

List[ActorMovieIMDB] 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()

List[Amenity] bridges.data_src_dependent.data_source.get_amenity_data ( args)

This method retrieves amenity data from Open Street Map datasets.

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

Parameters
minLatminimum latitude of the bounding box (float)
minLonminimum longitude of the bounding box (float)
maxLatmaximum latitude of the bounding box (float)
maxLonmaximum longitude of the bounding box (float)
typeamenity type (str)

Args alternatively:

Parameters
locnamename of a city (str)
typeamenity type (str)
Returns
A list of amenities

◆ get_cancer_incident_data()

List[CancerIncidence] 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()

ColorGrid bridges.data_src_dependent.data_source.get_color_grid_from_assignment ( str  server,
str  user,
int  assignment,
int   subassignment = 0 
)

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()

List[EarthquakeUSGS] 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()

ElevationData bridges.data_src_dependent.data_source.get_elevation_data ( args)

This method retrieves an Elevation Map dataset, given a location by name (string).

Parameters
argsa bounding box, aka an array [minLat, minLon, maxLat, maxLon]
argsspatial resolution, aka the distance between two samples (in degrees)
Returns
Elevation data for the bounding box and resolution requested (approximately) [type: ElevationData]

◆ 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()

List[GutenbergBook] 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

(deprecated you may want to use get_gutenberg_book_metadata() instead. )

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

◆ get_gutenberg_book_metadata()

List[GutenbergMeta] bridges.data_src_dependent.data_source.get_gutenberg_book_metadata ( args)

function to search for a gutenberg book given a search string and type of metadata to search through

:param args: args search string, i.e home args metadata type, i.e id, title, lang, date_added, authors, genres, loc_class

:return: a list of books with containing matched strings from the specified metadata type

◆ get_osm_data()

OsmData bridges.data_src_dependent.data_source.get_osm_data ( args)

This method retrieves an OpenStreet Map dataset given a location.

The function can either take a city name or a bounding box in lat/long. The city name can be taken from the list at http://bridges-data-server-osm.bridgesuncc.org/cities

The function also take a level of detail which can be anything in ["motorway", "trunk", "primary", "secondary", "tertiary, "unclassified", "residential", "living_street", "service", "trails", "walking", "bicycle" ]

Parameters
locnamename of a city (str)
levellevel of detail (str)

Args alternatively:

Parameters
minLatminimum latitude of the bounding box (float)
minLonminimum longitude of the bounding box (float)
maxLatmaximum latitude of the bounding box (float)
maxLonmaximum longitude of the bounding box (float)
levellevel of detail (str)
Returns
OsmData

◆ get_shakespeare_data()

List[Shakespeare] 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()

Song 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()

List[Song] 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_us_cities_data()

List[City] bridges.data_src_dependent.data_source.get_us_cities_data ( **  kwargs)

retrieves a set of cities filtered by provided arguments

Parameters
kwargscan be one or more of the following: 'city': city name 'state': US state 'timezone': cities within this timezone 'min_pop': include cities larger than this number 'max_pop': include cities smaller than this number 'min_elev': include cities larger than this elevation 'max_elev': include cities smaller than this elevation 'min_lat': min latitude 'min_long': min longitude 'max_lat': max latitude 'max_long': max longtude 'limit': number of cities to be included

◆ get_wiki_data_actor_movie()

List[MovieActorWikiData] bridges.data_src_dependent.data_source.get_wiki_data_actor_movie (   year_begin,
  year_end 
)

This method retrieves an actor-movie data from Wikidata.

Uses a sparql 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

◆ get_world_cities_data()

List[City] bridges.data_src_dependent.data_source.get_world_cities_data ( **  kwargs)

◆ gutenberg_book_text()

def bridges.data_src_dependent.data_source.gutenberg_book_text (   id,
  strip = False 
)

◆ reddit_data()

Reddit bridges.data_src_dependent.data_source.reddit_data (   subreddit,
  time_request = -9999 
)

◆ set_source_type()

None bridges.data_src_dependent.data_source.set_source_type (   t)

Variable Documentation

◆ source_type

string bridges.data_src_dependent.data_source.source_type = "live"