Bridges-Python
3.4.4
Bridges(Python API)
|
Classes | |
class | DataSource |
Functions | |
None | set_source_type (t) |
def | get_game_data () |
Get meta data of the IGN games collection. More... | |
List[City] | get_us_cities_data (**kwargs) |
retrieves a set of cities filtered by provided arguments More... | |
List[City] | get_world_cities_data (**kwargs) |
ActorMovieIMDB | get_actor_movie_imdb_data (count=0) |
Get ActorMovie IMDB Data. More... | |
List[ActorMovieIMDB] | get_actor_movie_imdb_data2 () |
Get ActorMovie IMDB Data. More... | |
List[EarthquakeUSGS] | get_earthquake_usgs_data (count=0) |
Get USGS earthquake data. More... | |
List[Shakespeare] | get_shakespeare_data (endpoint="", textonly=False) |
Get data of Shakespeare works (plays, poems) More... | |
List[GutenbergBook] | get_gutenberg_book_data (num=0) |
Get meta data of the Gutenberg book collection (1000 books) More... | |
List[CancerIncidence] | get_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[Song] | get_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[MovieActorWikiData] | get_wiki_data_actor_movie (year_begin, year_end) |
This method retrieves an actor-movie data from Wikidata. More... | |
List[Amenity] | get_amenity_data (*args) |
This method retrieves amenity data from Open Street Map datasets. More... | |
List[GutenbergMeta] | get_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_data (subreddit, time_request=-9999) | |
Variables | |
string | source_type = "live" |
List[str] bridges.data_src_dependent.data_source.available_subreddits | ( | ) |
GutenbergMeta bridges.data_src_dependent.data_source.get_a_gutenberg_book_metadata | ( | id | ) |
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
count | count of the number of actor/movie pairs, but currently unused, returns all records. |
Exception | if the request fails |
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
count | the number of actor/movie pairs, but currently unused, |
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"
minLat | minimum latitude of the bounding box (float) |
minLon | minimum longitude of the bounding box (float) |
maxLat | maximum latitude of the bounding box (float) |
maxLon | maximum longitude of the bounding box (float) |
type | amenity type (str) |
Args alternatively:
locname | name of a city (str) |
type | amenity type (str) |
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
num | count of records to be retrieved |
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.
server | server holding the assignment |
user | user name |
assignment | assignment number |
subassignment | sub-assignment number |
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
count | the number of earthquake records retrieved |
Exception | if the request fails |
ElevationData bridges.data_src_dependent.data_source.get_elevation_data | ( | * | args | ) |
This method retrieves an Elevation Map dataset, given a location by name (string).
args | a bounding box, aka an array [minLat, minLon, maxLat, maxLon] |
args | spatial resolution, aka the distance between two samples (in degrees) |
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
Exception | if the request fails |
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. )
Exception | if the request fails |
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
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" ]
locname | name of a city (str) |
level | level of detail (str) |
Args alternatively:
minLat | minimum latitude of the bounding box (float) |
minLon | minimum longitude of the bounding box (float) |
maxLat | maximum latitude of the bounding box (float) |
maxLon | maximum longitude of the bounding box (float) |
level | level of detail (str) |
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}
Exception | if the request fails |
endpoint | can be either "plays" or "poems". If this is specified, then only these types of works are retrieved. |
textonly | if this is set, then only the text is retrieved. |
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
songTitle | title of song |
artistName | name of artist |
Exception | if the request fails |
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.
Exception | if the request fails |
List[City] bridges.data_src_dependent.data_source.get_us_cities_data | ( | ** | kwargs | ) |
retrieves a set of cities filtered by provided arguments
kwargs | can 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 |
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
year_begin | beginning year of data request |
year_end | ending year of data request |
List[City] bridges.data_src_dependent.data_source.get_world_cities_data | ( | ** | kwargs | ) |
def bridges.data_src_dependent.data_source.gutenberg_book_text | ( | id, | |
strip = False |
|||
) |
Reddit bridges.data_src_dependent.data_source.reddit_data | ( | subreddit, | |
time_request = -9999 |
|||
) |
None bridges.data_src_dependent.data_source.set_source_type | ( | t | ) |
string bridges.data_src_dependent.data_source.source_type = "live" |