From eb111452aec1d02547fa513bace5e5c0037cbd59 Mon Sep 17 00:00:00 2001 From: "K. Shankari" Date: Wed, 8 May 2019 19:44:52 -0700 Subject: [PATCH] Add support for the new destination_confirm class Changes include: - new wrapper class - formatters for the input processing This is also hopefully a nicer, shorter, self-contained example of how to add new manually reported objects to the server. --- emission/core/wrapper/entry.py | 3 +++ .../formatters/android/destination_confirm.py | 12 ++++++++++++ .../usercache/formatters/ios/destination_confirm.py | 12 ++++++++++++ emission/storage/timeseries/builtin_timeseries.py | 1 + 4 files changed, 28 insertions(+) create mode 100644 emission/net/usercache/formatters/android/destination_confirm.py create mode 100644 emission/net/usercache/formatters/ios/destination_confirm.py diff --git a/emission/core/wrapper/entry.py b/emission/core/wrapper/entry.py index 8d8d7fc29..40a64eab5 100644 --- a/emission/core/wrapper/entry.py +++ b/emission/core/wrapper/entry.py @@ -73,6 +73,9 @@ def _getData2Wrapper(): "manual/mode_confirm": "userlabel", # user confirmation of the travel purpose "manual/purpose_confirm": "userlabel", + # user confirmation of the destination (unsure how this will + # interact with purpose + "manual/destination_confirm": "userlabel", ### END: incoming data types ### ### BEGIN: analysis result data types ### ### ** BEGIN: objects generated after the initial segmentation step ** diff --git a/emission/net/usercache/formatters/android/destination_confirm.py b/emission/net/usercache/formatters/android/destination_confirm.py new file mode 100644 index 000000000..7e83d379d --- /dev/null +++ b/emission/net/usercache/formatters/android/destination_confirm.py @@ -0,0 +1,12 @@ +from __future__ import unicode_literals +from __future__ import print_function +from __future__ import division +from __future__ import absolute_import +from future import standard_library +standard_library.install_aliases() +from builtins import * +import logging +import emission.net.usercache.formatters.generic.userlabel as fgl + +def format(entry): + return fgl.format(entry) diff --git a/emission/net/usercache/formatters/ios/destination_confirm.py b/emission/net/usercache/formatters/ios/destination_confirm.py new file mode 100644 index 000000000..7e83d379d --- /dev/null +++ b/emission/net/usercache/formatters/ios/destination_confirm.py @@ -0,0 +1,12 @@ +from __future__ import unicode_literals +from __future__ import print_function +from __future__ import division +from __future__ import absolute_import +from future import standard_library +standard_library.install_aliases() +from builtins import * +import logging +import emission.net.usercache.formatters.generic.userlabel as fgl + +def format(entry): + return fgl.format(entry) diff --git a/emission/storage/timeseries/builtin_timeseries.py b/emission/storage/timeseries/builtin_timeseries.py index fecd9c95d..1fde69e53 100644 --- a/emission/storage/timeseries/builtin_timeseries.py +++ b/emission/storage/timeseries/builtin_timeseries.py @@ -59,6 +59,7 @@ def __init__(self, user_id): "manual/incident": self.timeseries_db, "manual/mode_confirm": self.timeseries_db, "manual/purpose_confirm": self.timeseries_db, + "manual/destination_confirm": self.timeseries_db, "segmentation/raw_trip": self.analysis_timeseries_db, "segmentation/raw_place": self.analysis_timeseries_db, "segmentation/raw_section": self.analysis_timeseries_db,