This class provides an API to various data sources used in BRIDGES.
BRIDGES currently supports a few external datasets for use with BRIDGES assignments: USGIS Earthquake Tweeet streaming data feed, IMDB (file), Book metadata collection, IGN Game Data, Shakespear book/poem meta data, etc.
Functions are provided that access a user specified number of data records; objects of the appropriate type are returned as a list.
|
| DataSource (bridges::Bridges *br=nullptr) |
|
| DataSource (bridges::Bridges &br) |
|
vector< Game > | getGameData () |
| Get meta data of the IGN games collection. More...
|
|
vector< ActorMovieIMDB > | getActorMovieIMDBData (int number=0) |
| Get ActorMovie IMDB Data Data is retrieved, formatted into a list of ActorMovieIMDB objects. More...
|
|
vector< ActorMovieIMDB > | getActorMovieIMDBData2 () |
| Get ActorMovie IMDB Data Data is retrieved, formatted into a list of ActorMovieIMDB objects. More...
|
|
vector< EarthquakeUSGS > | getEarthquakeUSGSData (int number=0) |
| Get USGS earthquake data USGS Tweet data (https://earthquake.usgs.gov/earthquakes/map/) retrieved, formatted into a list of EarthquakeUSGS objects. More...
|
|
vector< Shakespeare > | getShakespeareData (string type="", bool textonly=false) |
| Get data of Shakespeare works (plays, poems) More...
|
|
Song | getSong (string songTitle, string artistName) |
| Get data of a particular songs (including lyrics) using the Genius API (https://docs.genius.com/), given the song title and artist name. Valid endpoints: http://bridgesdata.herokuapp.com/api/songs/find/ Valid queryParams: song title, artist name. More...
|
|
vector< Song > | getSongData () |
| Get data of the songs (including lyrics) using the Genius API https://docs.genius.com/ Valid endpoints: https://bridgesdata.herokuapp.com/api/songs/. More...
|
|
vector< GutenbergBook > | getGutenbergBookData (int num=0) |
| Get meta data of the Gutenberg book collection. This function retrieves, and formats the data into a list of GutenbergBook objects. More...
|
|
vector< CancerIncidence > | getCancerIncidenceData (int num=0) |
| Retrieves the CDC dataset of Cancer Incidence. Data is retrieved into a vector of records See CancerIncidence class for more information. More...
|
|
OSMData | getOSMDataFromJSON (const string &osm_json) |
| Retrieves the Open Street Map data from a prebuilt JSON of OSM dataset. More...
|
|
OSMData | getOSMData (double lat_min, double long_min, double lat_max, double long_max, string level="default") |
| Get OpenStreetMap data given a bounding rectangle of lat/long values. More...
|
|
void | getAmenityData (double minLat, double minLon, double maxLat, double maxLon, std::string amenity) |
|
void | getAmenityData (const std::string &location, const std::string &amenity) |
|
OSMData | getOSMData (string location, string level="default") |
|
bridges::GraphAdjList< int, std::string > | getGraphFromAssignment (const std::string &user, int assignment, int subassignment=0) |
| old interface for the OSM data set. More...
|
|
bridges::ColorGrid | getColorGridFromAssignment (const std::string &user, int assignment, int subassignment=0) |
|
std::vector< MovieActorWikidata > | getWikidataActorMovie (int yearbegin, int yearend) |
| This function returns the Movie and Actors playing in them between two years. More...
|
|
ElevationData | getElevationData (double latitMin, double longitMin, double latitMax, double longitMax, double res=0.0166) |
|
ElevationData | getElevationDataFromJSON (string elev_json) |
|
bridges::GraphAdjList<int, std::string> bridges::DataSource::getGraphFromAssignment |
( |
const std::string & |
user, |
|
|
int |
assignment, |
|
|
int |
subassignment = 0 |
|
) |
| |
|
inline |
old interface for the OSM data set.
This is hitting a simpler API that has only a few map in there: "uncc_campus", "charlotte", "washington_dc", "saint_paul", "new_york", "los_angeles", "san_francisco", "miami", "minneapolis", "dallas"
- Parameters
-
location | which location to get the map from OSMData getOSMDataOld (string location) { std::transform(location.begin(), location.end(), location.begin(), ::tolower); std::string osm_json; bool from_cache = false; try { if (my_cache.inCache(location)) { osm_json = my_cache.getDoc(location); from_cache = true; } } catch (CacheException& ce) { something went bad trying to access the cache std::cout << "Exception while reading from cache. Ignoring cache and continue." << std::endl; } |
string url = string("http://osm-api.herokuapp.com/name/") + location;
if (!from_cache) { get the OSM data json osm_json = ServerComm::makeRequest(url, {"Accept: application/json"});
try { my_cache.putDoc(location, osm_json); } catch (CacheException& ce) { something went bad trying to access the cache std::cerr << "Exception while storing in cache. Weird but not critical." << std::endl; } }
return getOSMDataFromJSON(osm_json);
} Reconstruct a GraphAdjList from an existing GraphAdjList on the Bridges server
The reconstructed assignment sees vertices identified as integers in the order they are stored in the server. The data associated with a vertex is a string that comes from the label of that vertices. The data associated with an edge is the string that comes from the label of that edge. The edge weights are also reobtained from the bridges server.
- Parameters
-
user | the name of the user who uploaded the assignment |
assignment | the ID of the assignment to get |
subassignment | the ID of the subassignment to get |
- Returns
- the ColorGrid stored in the bridges server