bridges 3.4.6__tar.gz → 3.5.0.dev2__tar.gz
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- {bridges-3.4.6/bridges.egg-info → bridges-3.5.0.dev2}/PKG-INFO +2 -3
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/array1d.py +2 -2
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/bar_chart.py +12 -12
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/bin_tree_element.py +1 -1
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/color.py +2 -2
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/connector.py +10 -8
- bridges-3.5.0.dev2/bridges/data_src_dependent/country.py +99 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/data_src_dependent/data_source.py +78 -48
- bridges-3.5.0.dev2/bridges/data_src_dependent/map_constants.py +73 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/data_src_dependent/us_county.py +2 -2
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/data_src_dependent/us_state.py +2 -2
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/dl_element.py +1 -1
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/graph_adj_list.py +7 -7
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/graph_adj_matrix.py +1 -1
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/grid.py +1 -1
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/kd_tree_element.py +1 -1
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/link_visualizer.py +1 -1
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/ml_element.py +1 -1
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/non_blocking_game.py +13 -13
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/polyline.py +1 -1
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/rectangle.py +1 -1
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/sl_element.py +1 -1
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/sorting_benchmark.py +2 -2
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/symbol_collection.py +1 -1
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/text.py +1 -1
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/tree_element.py +3 -1
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/us_map.py +9 -3
- bridges-3.5.0.dev2/bridges/world_map.py +107 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2/bridges.egg-info}/PKG-INFO +2 -3
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges.egg-info/SOURCES.txt +2 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/setup.py +2 -1
- bridges-3.4.6/bridges/world_map.py +0 -50
- {bridges-3.4.6 → bridges-3.5.0.dev2}/LICENSE +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/MANIFEST.in +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/README.md +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/__init__.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/array.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/array2d.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/array3d.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/audio_channel.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/audio_clip.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/avl_tree_element.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/bfs_benchmark.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/blocking_game.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/bridges.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/bst_element.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/camera.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/circ_dl_element.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/circ_sl_element.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/circle.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/color_grid.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/data_src_dependent/__init__.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/data_src_dependent/actor_movie_imdb.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/data_src_dependent/amenity.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/data_src_dependent/cancer_incidence.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/data_src_dependent/city.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/data_src_dependent/earthquake_usgs.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/data_src_dependent/elevation.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/data_src_dependent/game.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/data_src_dependent/gutenberg_book.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/data_src_dependent/gutenberg_meta.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/data_src_dependent/lru_cache.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/data_src_dependent/movie_actor_wiki_data.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/data_src_dependent/osm.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/data_src_dependent/reddit.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/data_src_dependent/shakespeare.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/data_src_dependent/song.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/data_src_dependent/world_cities.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/edge.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/element.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/element_visualizer.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/game_cell.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/game_grid.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/gamebase.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/gamebase3D.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/graph_benchmark.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/input_helper.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/input_state_machine.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/keypress_listener.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/light.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/line_chart.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/map.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/mesh.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/named_color.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/named_symbol.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/non_blocking_game3D.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/page_rank_benchmark.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/particle_system.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/polygon.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/primitives.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/scene.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/shortest_path_benchmark.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/socket_connection.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/symbol.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges/symbol_group.py +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges.egg-info/dependency_links.txt +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges.egg-info/requires.txt +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/bridges.egg-info/top_level.txt +0 -0
- {bridges-3.4.6 → bridges-3.5.0.dev2}/setup.cfg +0 -0
|
@@ -1,6 +1,6 @@
|
|
|
1
|
-
Metadata-Version: 2.
|
|
1
|
+
Metadata-Version: 2.4
|
|
2
2
|
Name: bridges
|
|
3
|
-
Version: 3.
|
|
3
|
+
Version: 3.5.0.dev2
|
|
4
4
|
Summary: Bridging Real-world Infrastructure Designed to Goal-align, Engage, and Stimulate, an NSF TUES
|
|
5
5
|
Home-page: https://github.com/BridgesUNCC/bridges-python
|
|
6
6
|
Author: BRIDGES
|
|
@@ -10,7 +10,6 @@ Classifier: License :: OSI Approved :: MIT License
|
|
|
10
10
|
Classifier: Operating System :: OS Independent
|
|
11
11
|
Requires-Python: >3.5.2
|
|
12
12
|
Description-Content-Type: text/markdown
|
|
13
|
-
License-File: LICENSE
|
|
14
13
|
Requires-Dist: requests>=2.21.0
|
|
15
14
|
Requires-Dist: webcolors>=1.8.1
|
|
16
15
|
Requires-Dist: python-socketio[client]>=4.3.0
|
|
@@ -14,14 +14,14 @@ class Array1D(Array):
|
|
|
14
14
|
|
|
15
15
|
Array1D has iterator semantic to enable range for loops. For instance,
|
|
16
16
|
|
|
17
|
-
|
|
17
|
+
@code{java}
|
|
18
18
|
arr = Array1D(3)
|
|
19
19
|
arr[0] = Element("a")
|
|
20
20
|
arr[1] = Element("b")
|
|
21
21
|
arr[2] = Element("c")
|
|
22
22
|
for el in arr:
|
|
23
23
|
print(el.label)
|
|
24
|
-
|
|
24
|
+
@endcode
|
|
25
25
|
|
|
26
26
|
Example Tutorial at: https://bridgesuncc.github.io/tutorials/Array.html (1D, 2D, and 3D Array)<br>
|
|
27
27
|
"""
|
|
@@ -27,7 +27,7 @@ class BarChart:
|
|
|
27
27
|
displayed by hovering on a bar. One can append a string to the
|
|
28
28
|
value using barchart.tooltip_suffix to specify units in the tooltip if desired.
|
|
29
29
|
|
|
30
|
-
|
|
30
|
+
@sa See tutorial on using BarChart at:
|
|
31
31
|
https://bridgesuncc.github.io/tutorials/BarChart.html
|
|
32
32
|
"""
|
|
33
33
|
|
|
@@ -51,49 +51,49 @@ class BarChart:
|
|
|
51
51
|
@property
|
|
52
52
|
def title(self) -> str:
|
|
53
53
|
"""
|
|
54
|
-
|
|
54
|
+
Get title of the plot
|
|
55
55
|
"""
|
|
56
56
|
return self._title
|
|
57
57
|
|
|
58
58
|
@title.setter
|
|
59
59
|
def title(self, plot_title: str) -> None:
|
|
60
60
|
"""
|
|
61
|
-
|
|
61
|
+
Set title of the plot
|
|
62
62
|
"""
|
|
63
63
|
self._title = plot_title
|
|
64
64
|
|
|
65
65
|
@property
|
|
66
66
|
def subtitle(self) -> str:
|
|
67
67
|
"""
|
|
68
|
-
|
|
68
|
+
Get subtitle of the plot
|
|
69
69
|
"""
|
|
70
70
|
return self._subtitle
|
|
71
71
|
|
|
72
72
|
@subtitle.setter
|
|
73
73
|
def subtitle(self, plot_sub_title: str) -> None:
|
|
74
74
|
"""
|
|
75
|
-
|
|
75
|
+
Set subtitle of the plot
|
|
76
76
|
"""
|
|
77
77
|
self._subtitle = plot_sub_title
|
|
78
78
|
|
|
79
79
|
@property
|
|
80
80
|
def value_label(self) -> str:
|
|
81
81
|
"""
|
|
82
|
-
|
|
82
|
+
Get label for the value axis
|
|
83
83
|
"""
|
|
84
84
|
return self._v_label
|
|
85
85
|
|
|
86
86
|
@value_label.setter
|
|
87
87
|
def value_label(self, value_label: str) -> None:
|
|
88
88
|
"""
|
|
89
|
-
|
|
89
|
+
Set label for the value axis
|
|
90
90
|
"""
|
|
91
91
|
self._v_label = value_label
|
|
92
92
|
|
|
93
93
|
@property
|
|
94
94
|
def categories_label(self) -> str:
|
|
95
95
|
"""
|
|
96
|
-
|
|
96
|
+
Get label for the categories axis
|
|
97
97
|
"""
|
|
98
98
|
return self._c_label
|
|
99
99
|
|
|
@@ -107,14 +107,14 @@ class BarChart:
|
|
|
107
107
|
@property
|
|
108
108
|
def orientation(self) -> str:
|
|
109
109
|
"""
|
|
110
|
-
|
|
110
|
+
Get orientation of the bar chart.
|
|
111
111
|
|
|
112
112
|
Will always be either "horizontal" or "vertical"
|
|
113
113
|
"""
|
|
114
114
|
return self._orientation
|
|
115
115
|
|
|
116
116
|
@orientation.setter
|
|
117
|
-
def orientation(self, orient) ->
|
|
117
|
+
def orientation(self, orient) -> None:
|
|
118
118
|
"""
|
|
119
119
|
Sets orientation of the bar chart.
|
|
120
120
|
|
|
@@ -136,7 +136,7 @@ class BarChart:
|
|
|
136
136
|
@tooltip_suffix.setter
|
|
137
137
|
def tooltip_suffix(self, suffix: str) -> None:
|
|
138
138
|
"""
|
|
139
|
-
the tooltip suffix
|
|
139
|
+
Set the tooltip suffix
|
|
140
140
|
|
|
141
141
|
This string is appended to the values in the hover tooltip.
|
|
142
142
|
"""
|
|
@@ -145,7 +145,7 @@ class BarChart:
|
|
|
145
145
|
@property
|
|
146
146
|
def categories(self) -> list[str]:
|
|
147
147
|
"""
|
|
148
|
-
|
|
148
|
+
Get categories for this bar chart
|
|
149
149
|
"""
|
|
150
150
|
return self._cats
|
|
151
151
|
|
|
@@ -21,7 +21,7 @@ class BinTreeElement(TreeElement):
|
|
|
21
21
|
|
|
22
22
|
@date 2018, 7/23/19, 1/6/21
|
|
23
23
|
|
|
24
|
-
|
|
24
|
+
@sa Binary tree tutorial, https://bridgesuncc.github.io/tutorials/BinTree.html
|
|
25
25
|
"""
|
|
26
26
|
|
|
27
27
|
def __init__(self, **kwargs) -> None:
|
|
@@ -210,14 +210,14 @@ class Color(object):
|
|
|
210
210
|
ValueError: if any of the RGBA values are outside of their respective range
|
|
211
211
|
|
|
212
212
|
Examples:
|
|
213
|
-
|
|
213
|
+
@code{.py}
|
|
214
214
|
my_color = Color("red") # equivalent to (255, 0, 0, 1.0)
|
|
215
215
|
my_color.rgba(255, 0, 0, 1.0) # using rgba notation
|
|
216
216
|
my_color = Color(r=255) # equivalent to (255, 0, 0, 1.0)
|
|
217
217
|
my_color = Color(255, 0, 0) # equivalent to (255, 0, 0, 1.0)
|
|
218
218
|
my_color = Color()
|
|
219
219
|
my_color.red = 255 # equivalent to (255, 0, 0, 1.0)
|
|
220
|
-
|
|
220
|
+
@endcode
|
|
221
221
|
"""
|
|
222
222
|
self._red = 0
|
|
223
223
|
self._green = 0
|
|
@@ -9,11 +9,12 @@ class Connector:
|
|
|
9
9
|
@brief This is a class for handling calls to the BRIDGES server to transmit JSON to the server and subsequent visualization. It is not intended for external use
|
|
10
10
|
"""
|
|
11
11
|
|
|
12
|
-
server_url_live = "http://
|
|
12
|
+
server_url_live = "http://assignments.bridgesuncc.org"
|
|
13
13
|
server_type = "application"
|
|
14
|
-
server_url_clone = "http://
|
|
14
|
+
server_url_clone = "http://assignments-clone.bridgesuncc.org"
|
|
15
15
|
server_url_local = "http://127.0.0.1:3000"
|
|
16
|
-
server_url_game = "http://
|
|
16
|
+
server_url_game = "http://games.bridgesuncc.org"
|
|
17
|
+
server_url_game_clone = "http://games-clone.bridgesuncc.org"
|
|
17
18
|
|
|
18
19
|
key = ""
|
|
19
20
|
username =""
|
|
@@ -38,7 +39,7 @@ class Connector:
|
|
|
38
39
|
"""
|
|
39
40
|
@brief Set the server based on a keyword for url
|
|
40
41
|
Args:
|
|
41
|
-
server: is one of the three string keywords('live', 'clone', 'local') that is passed to change the server that the bridges visualization will be sent to
|
|
42
|
+
server: is one of the three string keywords('live', 'clone', 'games', 'games-clone' 'local') that is passed to change the server that the bridges visualization will be sent to
|
|
42
43
|
"""
|
|
43
44
|
self.set_server_url(server)
|
|
44
45
|
|
|
@@ -48,13 +49,14 @@ class Connector:
|
|
|
48
49
|
@brief Set the server url (string) that is passed to change the server that the bridges visualization will be sent to
|
|
49
50
|
|
|
50
51
|
Args:
|
|
51
|
-
server: is one of the three strings ('live', 'clone', 'local')
|
|
52
|
+
server: is one of the three strings ('live', 'clone', 'games', 'games-clone', 'local')
|
|
52
53
|
"""
|
|
53
54
|
switcher = {
|
|
54
|
-
"live": "http://
|
|
55
|
-
"clone": "http://
|
|
55
|
+
"live": "http://assignments.bridgesuncc.org",
|
|
56
|
+
"clone": "http://assignments-clone.bridgesuncc.org",
|
|
56
57
|
"local": "http://127.0.0.1:3000",
|
|
57
|
-
"games": "http://
|
|
58
|
+
"games": "http://games.bridgesuncc.org",
|
|
59
|
+
"games-clone": "http://games-clone.bridgesuncc.org"
|
|
58
60
|
}
|
|
59
61
|
force = os.getenv("FORCE_BRIDGES_APISERVER", "")
|
|
60
62
|
if (force != ""):
|
|
@@ -0,0 +1,99 @@
|
|
|
1
|
+
from bridges.color import *
|
|
2
|
+
|
|
3
|
+
class Country:
|
|
4
|
+
"""
|
|
5
|
+
@brief This object stores a Country and links to information
|
|
6
|
+
|
|
7
|
+
This object is used alongside with the WorldMap object. Each country
|
|
8
|
+
has a stroke color and fill color.
|
|
9
|
+
|
|
10
|
+
See tutorial at https://bridgesuncc.github.io/tutorials/WorldMap.html
|
|
11
|
+
|
|
12
|
+
@author Kalpathi Subramanian
|
|
13
|
+
@date Last modified June 7, 2025
|
|
14
|
+
"""
|
|
15
|
+
|
|
16
|
+
def __init__(self, country: str):
|
|
17
|
+
"""
|
|
18
|
+
@brief Constructor for a specific state
|
|
19
|
+
|
|
20
|
+
@param state sets default values for the state
|
|
21
|
+
"""
|
|
22
|
+
self._name = country
|
|
23
|
+
self._alpha2_id = ""
|
|
24
|
+
self._alpha3_id = ""
|
|
25
|
+
self._numeric3_id = 0
|
|
26
|
+
self._stroke_width = 1.
|
|
27
|
+
self._stroke_color = Color('green')
|
|
28
|
+
self._fill_color = Color('lightblue')
|
|
29
|
+
|
|
30
|
+
def __init__(self, name: str, alpha2: str, alpha3: str, numeric3: int):
|
|
31
|
+
"""
|
|
32
|
+
@brief Constructor for a specific state
|
|
33
|
+
|
|
34
|
+
@param sets provided values for the country
|
|
35
|
+
"""
|
|
36
|
+
self._name = name
|
|
37
|
+
self._alpha2_id = alpha2
|
|
38
|
+
self._alpha3_id = alpha3
|
|
39
|
+
self._numeric3_id = numeric3
|
|
40
|
+
self._stroke_width = 1.
|
|
41
|
+
self._stroke_color = Color('green')
|
|
42
|
+
self._fill_color = Color('lightblue')
|
|
43
|
+
|
|
44
|
+
@property
|
|
45
|
+
def name(self):
|
|
46
|
+
return self._name
|
|
47
|
+
|
|
48
|
+
@name.setter
|
|
49
|
+
def name(self, n):
|
|
50
|
+
self._name = n
|
|
51
|
+
|
|
52
|
+
@property
|
|
53
|
+
def alpha2_id(self):
|
|
54
|
+
return self._alpha2_id
|
|
55
|
+
|
|
56
|
+
@alpha2_id.setter
|
|
57
|
+
def alpha2_id(self, id):
|
|
58
|
+
self._alpha2_id = id
|
|
59
|
+
|
|
60
|
+
@property
|
|
61
|
+
def alpha3_id(self):
|
|
62
|
+
return self._alpha3_id
|
|
63
|
+
|
|
64
|
+
@alpha3_id.setter
|
|
65
|
+
def alpha3_id(self, id):
|
|
66
|
+
self._alpha3_id = id
|
|
67
|
+
|
|
68
|
+
@property
|
|
69
|
+
def numeric3_id(self):
|
|
70
|
+
return self._numeric3_id
|
|
71
|
+
|
|
72
|
+
@numeric3_id.setter
|
|
73
|
+
def numeric3_id(self, id):
|
|
74
|
+
self._numeric3_id = id
|
|
75
|
+
|
|
76
|
+
@property
|
|
77
|
+
def stroke_color(self):
|
|
78
|
+
return self._stroke_color
|
|
79
|
+
|
|
80
|
+
@stroke_color.setter
|
|
81
|
+
def stroke_color(self, value):
|
|
82
|
+
self._stroke_color = value
|
|
83
|
+
|
|
84
|
+
@property
|
|
85
|
+
def stroke_width(self):
|
|
86
|
+
return self._stroke_width
|
|
87
|
+
|
|
88
|
+
@stroke_width.setter
|
|
89
|
+
def stroke_width(self, value):
|
|
90
|
+
self._stroke_width = value
|
|
91
|
+
|
|
92
|
+
@property
|
|
93
|
+
def fill_color(self):
|
|
94
|
+
return self._fill_color
|
|
95
|
+
|
|
96
|
+
@fill_color.setter
|
|
97
|
+
def fill_color(self, value):
|
|
98
|
+
self._fill_color = value
|
|
99
|
+
|
|
@@ -20,13 +20,14 @@ from bridges.data_src_dependent.osm import *
|
|
|
20
20
|
from bridges.data_src_dependent.elevation import *
|
|
21
21
|
from bridges.data_src_dependent.amenity import *
|
|
22
22
|
from bridges.data_src_dependent.actor_movie_imdb import *
|
|
23
|
+
from bridges.data_src_dependent.map_constants import *
|
|
23
24
|
from bridges.color_grid import ColorGrid
|
|
24
25
|
from bridges.color import Color
|
|
25
26
|
from bridges.data_src_dependent.us_state import *
|
|
26
27
|
from bridges.data_src_dependent.us_county import *
|
|
28
|
+
from bridges.data_src_dependent.country import *
|
|
27
29
|
from SPARQLWrapper import SPARQLWrapper, JSON
|
|
28
30
|
|
|
29
|
-
|
|
30
31
|
source_type = "live"
|
|
31
32
|
_debug = False
|
|
32
33
|
|
|
@@ -42,33 +43,33 @@ def set_source_type(t) -> None:
|
|
|
42
43
|
|
|
43
44
|
def _get_reddit_url():
|
|
44
45
|
if source_type == "testing":
|
|
45
|
-
return "http://
|
|
46
|
+
return "http://reddit-t-data.bridgesuncc.org"
|
|
46
47
|
elif source_type == "local":
|
|
47
48
|
return "http://localhost:9999"
|
|
48
49
|
else:
|
|
49
|
-
return "http://
|
|
50
|
+
return "http://reddit-data.bridgesuncc.org"
|
|
50
51
|
|
|
51
52
|
def _get_gutenberg_url():
|
|
52
53
|
if source_type == "testing":
|
|
53
|
-
return "http://
|
|
54
|
+
return "http://gutenberg-t-data.bridgesuncc.org"
|
|
54
55
|
elif source_type == "local":
|
|
55
56
|
return "http://localhost:3000"
|
|
56
|
-
return "http://
|
|
57
|
+
return "http://gutenberg-data.bridgesuncc.org"
|
|
57
58
|
|
|
58
59
|
def _get_osm_baseurl():
|
|
59
60
|
if source_type == "local":
|
|
60
61
|
return "http://localhost:3000"
|
|
61
|
-
return "http://
|
|
62
|
+
return "http://osm-data.bridgesuncc.org"
|
|
62
63
|
|
|
63
64
|
def _get_elevation_url():
|
|
64
65
|
if source_type == "local":
|
|
65
66
|
return "http://localhost:3000"
|
|
66
|
-
return "http://
|
|
67
|
+
return "http://elevation-data.bridgesuncc.org"
|
|
67
68
|
|
|
68
69
|
def _get_amenity_url():
|
|
69
70
|
if source_type == "local":
|
|
70
71
|
return "http://localhost:3000"
|
|
71
|
-
return "http://
|
|
72
|
+
return "http://osm-data.bridgesuncc.org"
|
|
72
73
|
|
|
73
74
|
def get_game_data():
|
|
74
75
|
"""
|
|
@@ -84,7 +85,7 @@ def get_game_data():
|
|
|
84
85
|
|
|
85
86
|
wrapper = []
|
|
86
87
|
|
|
87
|
-
url = "http://
|
|
88
|
+
url = "http://static-data.bridgesuncc.org/api/games"
|
|
88
89
|
PARAMS = {"Accept: application/json"}
|
|
89
90
|
|
|
90
91
|
if _debug:
|
|
@@ -127,7 +128,7 @@ def get_us_cities_data(**kwargs) -> List[City]:
|
|
|
127
128
|
|
|
128
129
|
wrapper = []
|
|
129
130
|
|
|
130
|
-
url = "http://
|
|
131
|
+
url = "http://static-data.bridgesuncc.org/api/us_cities"
|
|
131
132
|
if len(kwargs) > 0:
|
|
132
133
|
# do some error checking on argumnts
|
|
133
134
|
# put legal keys in a set
|
|
@@ -186,8 +187,7 @@ def get_us_cities_data(**kwargs) -> List[City]:
|
|
|
186
187
|
def get_world_cities_data(**kwargs) -> List[City]:
|
|
187
188
|
wrapper = []
|
|
188
189
|
|
|
189
|
-
|
|
190
|
-
url = "http://bridgesdata.herokuapp.com/api/world_cities"
|
|
190
|
+
url = "http://static-data.bridgesuncc.org/api/world_cities"
|
|
191
191
|
if len(kwargs) > 0:
|
|
192
192
|
url = url + '?'
|
|
193
193
|
if kwargs.get('state'):
|
|
@@ -236,7 +236,7 @@ def get_us_map_county_data(state_name = [], view_counties = True):
|
|
|
236
236
|
'''
|
|
237
237
|
wrapper = []
|
|
238
238
|
|
|
239
|
-
url = "http://
|
|
239
|
+
url = "http://static-data.bridgesuncc.org/api/us_map?state="
|
|
240
240
|
for i in range(len(state_name)):
|
|
241
241
|
url += state_name[i] + ","
|
|
242
242
|
url = url[:-1]
|
|
@@ -264,20 +264,54 @@ def get_us_map_county_data(state_name = [], view_counties = True):
|
|
|
264
264
|
|
|
265
265
|
return wrapper
|
|
266
266
|
|
|
267
|
-
|
|
268
|
-
all_states = ["Alabama", "Alaska", "Arizona", "Arkansas", "California", "Colorado", "Connecticut", "Delaware", "Florida", "Georgia", "Hawaii", "Idaho", "Illinois", "Indiana", "Iowa", "Kansas", "Kentucky", "Louisiana", "Maine", "Maryland", "Massachusetts", "Michigan", "Minnesota", "Mississippi", "Missouri", "Montana", "Nebraska", "Nevada", "New Hampshire", "New Jersey", "New Mexico", "New York", "North Carolina", "North Dakota", "Ohio", "Oklahoma", "Oregon", "Pennsylvania", "Rhode Island", "South Carolina", "South Dakota", "Tennessee", "Texas", "Utah", "Vermont", "Virginia", "Washington", "West Virginia", "Wisconsin", "Wyoming"]
|
|
269
|
-
|
|
270
267
|
def get_us_map_data():
|
|
271
268
|
'''
|
|
272
269
|
See https://bridgesuncc.github.io/tutorials/Map.html on how to use these objects
|
|
273
270
|
'''
|
|
274
|
-
|
|
271
|
+
map_const = MapConstants()
|
|
272
|
+
return get_us_map_county_data(map_const.ALL_US_STATES, False)
|
|
275
273
|
|
|
276
274
|
def get_all_us_map_county_data():
|
|
277
275
|
'''
|
|
278
276
|
See https://bridgesuncc.github.io/tutorials/Map.html on how to use these objects
|
|
279
277
|
'''
|
|
280
|
-
|
|
278
|
+
map_const = MapConstants()
|
|
279
|
+
return get_us_map_county_data(map_const.ALL_US_STAtES, True)
|
|
280
|
+
|
|
281
|
+
def get_world_map_data(countries = []):
|
|
282
|
+
'''
|
|
283
|
+
@brief Gets the country information for the provided countries
|
|
284
|
+
|
|
285
|
+
For now, reading from a data file containing the country data as a JSON
|
|
286
|
+
See https://bridgesuncc.github.io/tutorials/WorldMap.html on how to use these objects
|
|
287
|
+
'''
|
|
288
|
+
|
|
289
|
+
url = "http://bridgesdata.herokuapp.com/api/world_map"
|
|
290
|
+
PARAMS = {"Accept: application/json"}
|
|
291
|
+
|
|
292
|
+
if _debug:
|
|
293
|
+
print ("Accessing " + url)
|
|
294
|
+
r = requests.get(url = url, params = str(PARAMS))
|
|
295
|
+
|
|
296
|
+
r = r.json()
|
|
297
|
+
|
|
298
|
+
if (len(countries) == 0): # no arguments, entire world is passed
|
|
299
|
+
map_const = MapConstants()
|
|
300
|
+
countries = map_const.ALL_COUNTRIES
|
|
301
|
+
country_dict = {}
|
|
302
|
+
country_info = r['data']
|
|
303
|
+
|
|
304
|
+
for i in range(len(country_info)):
|
|
305
|
+
c = Country (country_info[i]["name"], country_info[i]["alpha-2"],
|
|
306
|
+
country_info[i]["alpha-3"], country_info[i]["numeric-3"])
|
|
307
|
+
country_dict[c.name] = c
|
|
308
|
+
|
|
309
|
+
country_list = []
|
|
310
|
+
for i in range(len(countries)):
|
|
311
|
+
country_list.append(country_dict[countries[i]])
|
|
312
|
+
|
|
313
|
+
return country_list
|
|
314
|
+
|
|
281
315
|
|
|
282
316
|
def _parse_actor_movie_imdb(item) -> ActorMovieIMDB:
|
|
283
317
|
"""
|
|
@@ -309,7 +343,7 @@ def get_actor_movie_imdb_data(count = 0) -> ActorMovieIMDB:
|
|
|
309
343
|
|
|
310
344
|
wrapper = []
|
|
311
345
|
|
|
312
|
-
url = "http://
|
|
346
|
+
url = "http://static-data.bridgesuncc.org/api/imdb?limit=" + str(count)
|
|
313
347
|
if _debug:
|
|
314
348
|
print ("accessing "+url)
|
|
315
349
|
PARAMS = {"Accept: application/json"}
|
|
@@ -341,7 +375,7 @@ def get_actor_movie_imdb_data2() -> List[ActorMovieIMDB]:
|
|
|
341
375
|
Throws:
|
|
342
376
|
Exception if the request fails
|
|
343
377
|
"""
|
|
344
|
-
url = "https://
|
|
378
|
+
url = "https://static-data.bridgesuncc.org/api/imdb2"
|
|
345
379
|
if _debug:
|
|
346
380
|
print ("Accessing "+url)
|
|
347
381
|
|
|
@@ -374,7 +408,7 @@ def get_earthquake_usgs_data(count = 0) -> List[EarthquakeUSGS]:
|
|
|
374
408
|
@brief Get USGS earthquake data
|
|
375
409
|
|
|
376
410
|
USGS Tweet data (https://earthquake.usgs.gov/earthquakes/map/). Data
|
|
377
|
-
retrieved, formatted into a list of EarthquakeUSGS objects
|
|
411
|
+
retrieved, formatted into a list of EarthquakeUSGS objects. The most recent earthqaukes are returned.
|
|
378
412
|
|
|
379
413
|
Args:
|
|
380
414
|
count: the number of earthquake records retrieved
|
|
@@ -385,29 +419,25 @@ def get_earthquake_usgs_data(count = 0) -> List[EarthquakeUSGS]:
|
|
|
385
419
|
a list of earthquake records
|
|
386
420
|
"""
|
|
387
421
|
wrapper = []
|
|
388
|
-
url = "http://earthquakes-
|
|
389
|
-
latest_url = "http://earthquakes-
|
|
422
|
+
url = "http://earthquakes-data.bridgesuncc.org/eq"
|
|
423
|
+
latest_url = "http://earthquakes-data.bridgesuncc.org/eq/latest/" + str(count)
|
|
390
424
|
PARAMS = {"Accept: application/json"}
|
|
391
425
|
|
|
392
426
|
if count <= 0:
|
|
393
427
|
if _debug:
|
|
394
|
-
print
|
|
428
|
+
print("Accessing: " + url)
|
|
395
429
|
r = requests.get(url=url, params=str(PARAMS))
|
|
396
|
-
r = r.json()
|
|
397
|
-
for i in range(len(r)):
|
|
398
|
-
V = r[i]["properties"]
|
|
399
|
-
G = r[i]["geometry"]["coordinates"]
|
|
400
|
-
wrapper.append(EarthquakeUSGS(V["mag"], G[0], G[1], V["place"], V["title"], V["url"], V["time"]))
|
|
401
430
|
else:
|
|
402
431
|
if _debug:
|
|
403
|
-
print
|
|
432
|
+
print("Accessing: " + latest_url)
|
|
404
433
|
r = requests.get(url=latest_url, params=str(PARAMS))
|
|
405
|
-
|
|
406
|
-
|
|
407
|
-
|
|
408
|
-
|
|
409
|
-
|
|
410
|
-
|
|
434
|
+
|
|
435
|
+
data = r.json()
|
|
436
|
+
D = data["Earthquakes"]
|
|
437
|
+
for i in range(len(D)):
|
|
438
|
+
V = D[i]["properties"]
|
|
439
|
+
G = D[i]["geometry"]["coordinates"]
|
|
440
|
+
wrapper.append(EarthquakeUSGS(V["mag"], G[0], G[1], V["place"], V["title"], V["url"], V["time"]))
|
|
411
441
|
return wrapper
|
|
412
442
|
|
|
413
443
|
|
|
@@ -433,7 +463,7 @@ def get_shakespeare_data(endpoint = "", textonly = False) -> List[Shakespeare]:
|
|
|
433
463
|
"""
|
|
434
464
|
|
|
435
465
|
wrapper = []
|
|
436
|
-
url = "http://
|
|
466
|
+
url = "http://static-data.bridgesuncc.org/api/shakespeare/"
|
|
437
467
|
PARAMS = {"Accept: application/json"}
|
|
438
468
|
|
|
439
469
|
if endpoint == "plays" or endpoint == "poems":
|
|
@@ -469,7 +499,7 @@ def get_gutenberg_book_data(num = 0) -> List[GutenbergBook]:
|
|
|
469
499
|
A list of GutenbergBook objects,
|
|
470
500
|
"""
|
|
471
501
|
wrapper = []
|
|
472
|
-
url = "http://
|
|
502
|
+
url = "http://static-data.bridgesuncc.org/api/books"
|
|
473
503
|
PARAMS = {"Accept: application/json"}
|
|
474
504
|
|
|
475
505
|
if num > 0:
|
|
@@ -522,7 +552,7 @@ def get_cancer_incident_data(num = 0) -> List[CancerIncidence]:
|
|
|
522
552
|
cancer incidence data records in a list
|
|
523
553
|
"""
|
|
524
554
|
wrapper = []
|
|
525
|
-
url = "https://
|
|
555
|
+
url = "https://static-data.bridgesuncc.org/api/cancer/withlocations"
|
|
526
556
|
PARAMS = {"Accept: application/json"}
|
|
527
557
|
|
|
528
558
|
if num > 0:
|
|
@@ -568,7 +598,7 @@ def get_song(songTitle, artistName = None) -> Song:
|
|
|
568
598
|
@brief Get data of a particular song (including lyrics) using the Genius API.
|
|
569
599
|
|
|
570
600
|
Data from Genius API(https://docs.genius.com/), given the song title and artist name.
|
|
571
|
-
Valid endpoints: http://
|
|
601
|
+
Valid endpoints: http://static-data.bridgesuncc.org/api/songs/find/
|
|
572
602
|
Valid queryParams: song title, artist name
|
|
573
603
|
|
|
574
604
|
This function retrieves and formats the data into a
|
|
@@ -585,7 +615,7 @@ def get_song(songTitle, artistName = None) -> Song:
|
|
|
585
615
|
a Song object,
|
|
586
616
|
"""
|
|
587
617
|
wrapper = []
|
|
588
|
-
url = "http://
|
|
618
|
+
url = "http://static-data.bridgesuncc.org/api/songs/find/"
|
|
589
619
|
PARAMS = {"Accept: application/json"}
|
|
590
620
|
|
|
591
621
|
if len(songTitle):
|
|
@@ -631,7 +661,7 @@ def get_song_data() -> List[Song]:
|
|
|
631
661
|
Get data of the songs (including lyrics) using the Genius API.
|
|
632
662
|
|
|
633
663
|
Song data from https://docs.genius.com/.
|
|
634
|
-
Valid endpoints: https://
|
|
664
|
+
Valid endpoints: https://static-data.bridgesuncc.org/api/songs/
|
|
635
665
|
|
|
636
666
|
This function retrieves and formats the data into a list of
|
|
637
667
|
Song objects. This version of the API retrieves all the cached
|
|
@@ -643,7 +673,7 @@ def get_song_data() -> List[Song]:
|
|
|
643
673
|
A list of Song objects,
|
|
644
674
|
"""
|
|
645
675
|
all_songs = []
|
|
646
|
-
url = "http://
|
|
676
|
+
url = "http://static-data.bridgesuncc.org/api/songs/"
|
|
647
677
|
params = {"Accept: application/json"}
|
|
648
678
|
|
|
649
679
|
if _debug:
|
|
@@ -847,7 +877,7 @@ def get_osm_data(*args) -> OsmData:
|
|
|
847
877
|
"""
|
|
848
878
|
@brief This method retrieves an OpenStreet Map dataset given a location.
|
|
849
879
|
|
|
850
|
-
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://
|
|
880
|
+
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://osm-data.bridgesuncc.org/cities
|
|
851
881
|
|
|
852
882
|
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" ]
|
|
853
883
|
|
|
@@ -909,7 +939,7 @@ def get_osm_data(*args) -> OsmData:
|
|
|
909
939
|
try:
|
|
910
940
|
data = json.loads(content.decode('utf-8'), object_hook=lambda d: Namespace(**d))
|
|
911
941
|
except:
|
|
912
|
-
print("Error: Corrupted JSON download...\nAttempting redownload...")
|
|
942
|
+
print("Error: Corrupted JSON download...\nAttempting redownload...") #The way the OSM server is written, the first hit to the server could cause a timeout
|
|
913
943
|
content = _osm_server_request(url)
|
|
914
944
|
try:
|
|
915
945
|
data = json.loads(content.decode('utf-8'), object_hook=lambda d: Namespace(**d))
|
|
@@ -1159,7 +1189,7 @@ def get_amenity_data(*args) -> List[Amenity] :
|
|
|
1159
1189
|
try:
|
|
1160
1190
|
data = json.loads(content.decode('utf-8'))
|
|
1161
1191
|
except:
|
|
1162
|
-
print("Error: Corrupted JSON download...\nAttempting redownload...")
|
|
1192
|
+
print("Error: Corrupted JSON download...\nAttempting redownload...") #The way the OSM server is written, the first hit to the server could cause a timeout
|
|
1163
1193
|
content = _osm_server_request(url)
|
|
1164
1194
|
try:
|
|
1165
1195
|
data = json.loads(content.decode('utf-8'))
|
|
@@ -1285,10 +1315,10 @@ def available_subreddits() -> List[str]:
|
|
|
1285
1315
|
content = _server_request(url)
|
|
1286
1316
|
return json.loads(content.decode("utf-8"))
|
|
1287
1317
|
|
|
1288
|
-
def reddit_data(subreddit, time_request = -9999) -> Reddit:
|
|
1318
|
+
def reddit_data(subreddit, time_request = -9999) -> List[Reddit]:
|
|
1289
1319
|
"""
|
|
1290
1320
|
@brief retrieves the reddit post from a subreddit
|
|
1291
|
-
:param subreddit: the name of the subreddit ( check list available at http://
|
|
1321
|
+
:param subreddit: the name of the subreddit ( check list available at http://reddit-data.bridgesuncc.org/list )
|
|
1292
1322
|
:param time_request: unix timestamp of when requested subreddit was generated or less than 0 for now
|
|
1293
1323
|
:return: a list of reddit objects with the data of the posts
|
|
1294
1324
|
"""
|