In [3]:
import emission.analysis.plotting.geojson.geojson_feature_converter as gfc
import emission.analysis.plotting.leaflet_osm.our_plotter as lo
import emission.analysis.plotting.leaflet_osm.ipython_helper as ipy

In [4]:
import logging
logging.getLogger().setLevel(logging.DEBUG)

In [49]:
reload(lo)


Out[49]:
<module 'emission.analysis.plotting.leaflet_osm.our_plotter' from '/Users/shankari/e-mission/e-mission-server/emission/analysis/plotting/leaflet_osm/our_plotter.py'>

In [6]:
import uuid

In [7]:
import emission.storage.timeseries.abstract_timeseries as esta

In [8]:
esta.TimeSeries.get_uuid_list()


Out[8]:
[UUID('0763de67-f61e-3f5d-90e7-518e69793954'),
 UUID('993f14f0-79f0-33fa-bdbc-049b88056fbf'),
 UUID('079e0f1a-c440-3d7c-b0e7-de160f748e35')]

In [9]:
locations_1_min = gfc.get_all_points_for_range(uuid.UUID('0763de67-f61e-3f5d-90e7-518e69793954'), "background/filtered_location", 1445446800, 1445468400)


DEBUG:root:sort_key = metadata.write_ts
Found 32 points

In [10]:
ipy.inline_maps([lo.get_maps_for_geojson_unsectioned([locations_1_min])])


DEBUG:root:Getting midpoint of (-122.0838538, 37.3946757) and (-122.086272, 37.3909335)
Out[10]:

In [11]:
locations_high_accuracy = gfc.get_all_points_for_range(uuid.UUID('0763de67-f61e-3f5d-90e7-518e69793954'), "background/filtered_location", 1445540400, 1445563800)


DEBUG:root:sort_key = metadata.write_ts
Found 96 points

In [12]:
locations_30_sec = gfc.get_all_points_for_range(uuid.UUID('0763de67-f61e-3f5d-90e7-518e69793954'), "background/filtered_location", 1445349600, 1445371200)


DEBUG:root:sort_key = metadata.write_ts
Found 93 points

In [13]:
locations_2_sec = gfc.get_all_points_for_range(uuid.UUID('0763de67-f61e-3f5d-90e7-518e69793954'), "background/filtered_location", 1445424000, 1445445600)


DEBUG:root:sort_key = metadata.write_ts
Found 242 points

In [14]:
ipy.inline_maps([lo.get_maps_for_geojson_unsectioned([locations_high_accuracy])])


DEBUG:root:Getting midpoint of (-122.0862619, 37.3909674) and (-122.0865425, 37.391022)
Out[14]:

In [15]:
ipy.inline_maps([lo.get_maps_for_geojson_unsectioned([locations_2_sec])])


DEBUG:root:Getting midpoint of (-122.0829817, 37.3958529) and (-122.08626, 37.3909252)
Out[15]:

In [16]:
ipy.inline_maps([lo.get_maps_for_geojson_unsectioned([locations_30_sec])])


DEBUG:root:Getting midpoint of (-122.0849769, 37.3930595) and (-122.0862697, 37.3909558)
Out[16]:

In [17]:
locations_30_sec_2 = gfc.get_all_points_for_range(uuid.UUID('0763de67-f61e-3f5d-90e7-518e69793954'), "background/filtered_location", 1445957053, 1445979189)
ipy.inline_maps([lo.get_maps_for_geojson_unsectioned([locations_30_sec_2])])


DEBUG:root:sort_key = metadata.write_ts
DEBUG:root:Getting midpoint of (-122.0862882, 37.3909517) and (-122.086287, 37.3909319)
Found 62 points
Out[17]:

In [18]:
ongoing_locations_30_sec = gfc.get_all_points_for_range(uuid.UUID('0763de67-f61e-3f5d-90e7-518e69793954'), "background/location", 1446002095, 1446023140)
ipy.inline_maps([lo.get_maps_for_geojson_unsectioned([ongoing_locations_30_sec])])


DEBUG:root:sort_key = metadata.write_ts
DEBUG:root:Getting midpoint of (-122.086273, 37.3909339) and (-122.0862886, 37.3909501)
Found 657 points
Out[18]:

In [19]:
ongoing_locations_30_sec_2 = gfc.get_all_points_for_range(uuid.UUID('0763de67-f61e-3f5d-90e7-518e69793954'), "background/location", 1445980311, 1446002095)
ipy.inline_maps([lo.get_maps_for_geojson_unsectioned([ongoing_locations_30_sec_2])])


DEBUG:root:sort_key = metadata.write_ts
DEBUG:root:Getting midpoint of (-122.0862876, 37.390949) and (-122.0862773, 37.3909329)
Found 792 points
Out[19]:

In [20]:
ongoing_locations_30_sec_3 = gfc.get_all_points_for_range(uuid.UUID('0763de67-f61e-3f5d-90e7-518e69793954'), "background/location", 1446002095, 1446023140)
ipy.inline_maps([lo.get_maps_for_geojson_unsectioned([ongoing_locations_30_sec_3])])


DEBUG:root:sort_key = metadata.write_ts
DEBUG:root:Getting midpoint of (-122.086273, 37.3909339) and (-122.0862886, 37.3909501)
Found 657 points
Out[20]:

In [21]:
ongoing_locations_30_sec_4 = gfc.get_all_points_for_range(uuid.UUID('0763de67-f61e-3f5d-90e7-518e69793954'), "background/location", 1446045087, 1446068393)
ipy.inline_maps([lo.get_maps_for_geojson_unsectioned([ongoing_locations_30_sec_4])])


DEBUG:root:sort_key = metadata.write_ts
DEBUG:root:Getting midpoint of (-122.0862828, 37.390913) and (-122.0862961, 37.3909564)
Found 778 points
Out[21]:

In [22]:
ongoing_locations_30_sec_5 = gfc.get_all_points_for_range(uuid.UUID('0763de67-f61e-3f5d-90e7-518e69793954'), "background/location", 1446068421, 1446105101)
ipy.inline_maps([lo.get_maps_for_geojson_unsectioned([ongoing_locations_30_sec_5])])


DEBUG:root:sort_key = metadata.write_ts
DEBUG:root:Getting midpoint of (-122.08629, 37.390959) and (-122.086263, 37.3909684)
Found 1013 points
Out[22]:

In [23]:
tablet_high_accuracy_tue_evening = gfc.get_all_points_for_range(uuid.UUID('993f14f079f033fabdbc049b88056fbf'), "background/location", 1446606757, 1446623987)
ipy.inline_maps([lo.get_maps_for_geojson_unsectioned([tablet_high_accuracy_tue_evening])])


DEBUG:root:sort_key = metadata.write_ts
DEBUG:root:Getting midpoint of (-122.2595261, 37.8761459) and (-122.2588089, 37.8758723)
Found 205 points
Out[23]:

In [24]:
tablet_high_accuracy_wed = gfc.get_all_points_for_range(uuid.UUID('993f14f079f033fabdbc049b88056fbf'), "background/location", 1446660660, 1446677464)
ipy.inline_maps([lo.get_maps_for_geojson_unsectioned([tablet_high_accuracy_wed])])


DEBUG:root:sort_key = metadata.write_ts
DEBUG:root:Getting midpoint of (-122.2593566, 37.8752977) and (-122.0862641, 37.391085)
Found 238 points
Out[24]:

In [25]:
tablet_high_accuracy_fri = gfc.get_all_points_for_range(uuid.UUID('993f14f079f033fabdbc049b88056fbf'), "background/location", 1446820833, 1446829215)
ipy.inline_maps([lo.get_maps_for_geojson_unsectioned([tablet_high_accuracy_fri])])


DEBUG:root:sort_key = metadata.write_ts
DEBUG:root:Getting midpoint of (-122.0859737, 37.3914758) and (-122.2585256, 37.8755198)
Found 115 points
Out[25]:

In [27]:
iphone_transition_thu = gfc.get_all_points_for_range(uuid.UUID('079e0f1ac4403d7cb0e7de160f748e35'), "background/location", 1446710400, 1446796800)
ipy.inline_maps([lo.get_maps_for_geojson_unsectioned([iphone_transition_thu])])


DEBUG:root:sort_key = metadata.write_ts
DEBUG:root:Getting midpoint of (-122.0861374931347, 37.39097279006875) and (-122.0938555386964, 37.39196597342645)
Found 503 points
Out[27]:

In [28]:
iphone_transition_fri = gfc.get_all_points_for_range(uuid.UUID('079e0f1ac4403d7cb0e7de160f748e35'), "background/location", 1446796800, 1446883200)
ipy.inline_maps([lo.get_maps_for_geojson_unsectioned([iphone_transition_fri])])


DEBUG:root:sort_key = metadata.write_ts
DEBUG:root:Getting midpoint of (-122.0866178513586, 37.39067819779412) and (-122.258755151958, 37.87533772178821)
Found 474 points
Out[28]:

In [50]:
tablet_high_accuracy_tue_evening_filtered = gfc.get_all_points_for_range(uuid.UUID('993f14f079f033fabdbc049b88056fbf'), "background/filtered_location", 1446606757, 1446623987)
ipy.inline_maps([lo.get_maps_for_geojson_unsectioned([tablet_high_accuracy_tue_evening_filtered])])


DEBUG:root:sort_key = metadata.write_ts
DEBUG:root:Getting midpoint of (-122.2580368, 37.8757397) and (-122.2588089, 37.8758723)
Found 124 points
Out[50]:

In [40]:
iphone_transition_thu_filtered = gfc.get_all_points_for_range(uuid.UUID('079e0f1a-c440-3d7c-b0e7-de160f748e35'), "background/filtered_location", 1446710400, 1446796800)
ipy.inline_maps([lo.get_maps_for_geojson_unsectioned([iphone_transition_thu_filtered])])


DEBUG:root:sort_key = metadata.write_ts
DEBUG:root:Getting midpoint of (-122.0861374931347, 37.39097279006875) and (-122.0862758359535, 37.39077347461228)
Found 401 points
Out[40]:

In [53]:
ipy.inline_maps([lo.get_maps_for_usercache(uuid.UUID('993f14f079f033fabdbc049b88056fbf'))])


DEBUG:root:Before pipeline, trips to phone list has length 1
DEBUG:root:keys are [u'diary/trips-2015-11-04']
DEBUG:root:After pipeline, trips to phone list has length 1
DEBUG:root:centering based on start = AttrDict({u'geometry': {u'type': u'Point', u'coordinates': [-122.2585816, 37.8748994]}, u'type': u'Feature', u'id': u'564233cbf6858f41066dba27', u'properties': {u'enter_fmt_time': u'2015-11-04T10:37:23-08:00', u'exit_local_dt': datetime.datetime(2015, 11, 4, 10, 42, 34), u'feature_type': u'start_place', u'exit_fmt_time': u'2015-11-04T10:42:34-08:00', u'enter_local_dt': datetime.datetime(2015, 11, 4, 10, 37, 23), u'ending_trip': ObjectId('564233cbf6858f41066dba26'), u'starting_trip': ObjectId('564233cbf6858f41066dba28'), u'source': u'DwellSegmentationTimeFilter', u'enter_ts': 1446662243, u'duration': 311, u'exit_ts': 1446662554}}), end = AttrDict({u'geometry': {u'type': u'Point', u'coordinates': [-122.0863711, 37.3910776]}, u'type': u'Feature', u'id': u'564233cbf6858f41066dba29', u'properties': {u'enter_fmt_time': u'2015-11-04T13:44:29-08:00', u'exit_local_dt': datetime.datetime(2015, 11, 4, 13, 56, 46), u'feature_type': u'end_place', u'exit_fmt_time': u'2015-11-04T13:56:46-08:00', u'enter_local_dt': datetime.datetime(2015, 11, 4, 13, 44, 29), u'ending_trip': ObjectId('564233cbf6858f41066dba28'), u'starting_trip': ObjectId('564233cbf6858f41066dba2a'), u'source': u'DwellSegmentationTimeFilter', u'enter_ts': 1446673469, u'duration': 737, u'exit_ts': 1446674206}}) 
DEBUG:root:centering based on start = AttrDict({u'geometry': {u'type': u'Point', u'coordinates': [-122.0865083, 37.3910889]}, u'type': u'Feature', u'id': u'564233cbf6858f41066dba37', u'properties': {u'enter_fmt_time': u'2015-11-04T16:22:05-08:00', u'exit_local_dt': datetime.datetime(2015, 11, 4, 16, 27, 49), u'feature_type': u'start_place', u'exit_fmt_time': u'2015-11-04T16:27:49-08:00', u'enter_local_dt': datetime.datetime(2015, 11, 4, 16, 22, 5), u'ending_trip': ObjectId('564233cbf6858f41066dba36'), u'starting_trip': ObjectId('564233cbf6858f41066dba38'), u'source': u'DwellSegmentationTimeFilter', u'enter_ts': 1446682925, u'duration': 344, u'exit_ts': 1446683269}}), end = AttrDict({u'geometry': {u'type': u'Point', u'coordinates': [-122.0933271, 37.3646469]}, u'type': u'Feature', u'id': u'564233cbf6858f41066dba39', u'properties': {u'enter_fmt_time': u'2015-11-04T16:38:23-08:00', u'exit_local_dt': datetime.datetime(2015, 11, 4, 16, 49, 58), u'feature_type': u'end_place', u'exit_fmt_time': u'2015-11-04T16:49:58-08:00', u'enter_local_dt': datetime.datetime(2015, 11, 4, 16, 38, 23), u'ending_trip': ObjectId('564233cbf6858f41066dba38'), u'starting_trip': ObjectId('564233cbf6858f41066dba3a'), u'source': u'DwellSegmentationTimeFilter', u'enter_ts': 1446683903, u'duration': 695, u'exit_ts': 1446684598}}) 
DEBUG:root:centering based on start = AttrDict({u'geometry': {u'type': u'Point', u'coordinates': [-122.0932649, 37.3647434]}, u'type': u'Feature', u'id': u'564233cbf6858f41066dba3d', u'properties': {u'enter_fmt_time': u'2015-11-04T17:10:39-08:00', u'exit_local_dt': datetime.datetime(2015, 11, 4, 17, 39, 50), u'feature_type': u'start_place', u'exit_fmt_time': u'2015-11-04T17:39:50-08:00', u'enter_local_dt': datetime.datetime(2015, 11, 4, 17, 10, 39), u'ending_trip': ObjectId('564233cbf6858f41066dba3c'), u'starting_trip': ObjectId('564233cbf6858f41066dba3e'), u'source': u'DwellSegmentationTimeFilter', u'enter_ts': 1446685839, u'duration': 1751, u'exit_ts': 1446687590}}), end = AttrDict({u'geometry': {u'type': u'Point', u'coordinates': [-122.1139053, 37.380681]}, u'type': u'Feature', u'id': u'564233cbf6858f41066dba3f', u'properties': {u'enter_fmt_time': u'2015-11-04T18:00:38-08:00', u'exit_local_dt': datetime.datetime(2015, 11, 4, 18, 7, 24), u'feature_type': u'end_place', u'exit_fmt_time': u'2015-11-04T18:07:24-08:00', u'enter_local_dt': datetime.datetime(2015, 11, 4, 18, 0, 38), u'ending_trip': ObjectId('564233cbf6858f41066dba3e'), u'starting_trip': ObjectId('564233cbf6858f41066dba40'), u'source': u'DwellSegmentationTimeFilter', u'enter_ts': 1446688838, u'duration': 406, u'exit_ts': 1446689244}}) 
DEBUG:root:centering based on start = AttrDict({u'geometry': {u'type': u'Point', u'coordinates': [-122.1136553, 37.3806664]}, u'type': u'Feature', u'id': u'564233cbf6858f41066dba45', u'properties': {u'enter_fmt_time': u'2015-11-04T18:38:20-08:00', u'exit_local_dt': datetime.datetime(2015, 11, 4, 18, 44, 38), u'feature_type': u'start_place', u'exit_fmt_time': u'2015-11-04T18:44:38-08:00', u'enter_local_dt': datetime.datetime(2015, 11, 4, 18, 38, 20), u'ending_trip': ObjectId('564233cbf6858f41066dba44'), u'starting_trip': ObjectId('564233cbf6858f41066dba46'), u'source': u'DwellSegmentationTimeFilter', u'enter_ts': 1446691100, u'duration': 378, u'exit_ts': 1446691478}}), end = AttrDict({u'geometry': {u'type': u'Point', u'coordinates': [-122.0866473, 37.391165]}, u'type': u'Feature', u'id': u'564233cbf6858f41066dba47', u'properties': {u'enter_fmt_time': u'2015-11-04T19:21:53-08:00', u'exit_local_dt': datetime.datetime(2015, 11, 4, 19, 45, 1), u'feature_type': u'end_place', u'exit_fmt_time': u'2015-11-04T19:45:01-08:00', u'enter_local_dt': datetime.datetime(2015, 11, 4, 19, 21, 53), u'ending_trip': ObjectId('564233cbf6858f41066dba46'), u'starting_trip': ObjectId('564233cbf6858f41066dba48'), u'source': u'DwellSegmentationTimeFilter', u'enter_ts': 1446693713, u'duration': 1388, u'exit_ts': 1446695101}}) 
Out[53]:

In [ ]: