From 2bc545486e6bb53fa63507d0582802c6959b1829 Mon Sep 17 00:00:00 2001 From: Jenna Ruzekowicz Date: Fri, 6 Aug 2021 16:33:55 -0400 Subject: [PATCH 1/6] Additions for the survey response additions to the database. --- emission/core/wrapper/entry.py | 2 ++ .../usercache/formatters/android/survey_response.py | 12 ++++++++++++ .../net/usercache/formatters/ios/survey_response.py | 12 ++++++++++++ emission/storage/timeseries/builtin_timeseries.py | 1 + 4 files changed, 27 insertions(+) create mode 100644 emission/net/usercache/formatters/android/survey_response.py create mode 100644 emission/net/usercache/formatters/ios/survey_response.py diff --git a/emission/core/wrapper/entry.py b/emission/core/wrapper/entry.py index 39c86a539..1faa6c6bc 100644 --- a/emission/core/wrapper/entry.py +++ b/emission/core/wrapper/entry.py @@ -73,6 +73,8 @@ def _getData2Wrapper(): "manual/mode_confirm": "userlabel", # user confirmation of the travel purpose "manual/purpose_confirm": "userlabel", + #user response to the survey questions + "manual/survey_response": "userlabel", # user survey results. The survey results are a JSON blob "manual/survey": "survey", # user confirmation of the destination (unsure how this will diff --git a/emission/net/usercache/formatters/android/survey_response.py b/emission/net/usercache/formatters/android/survey_response.py new file mode 100644 index 000000000..c0fe3b60a --- /dev/null +++ b/emission/net/usercache/formatters/android/survey_response.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/survey_response.py b/emission/net/usercache/formatters/ios/survey_response.py new file mode 100644 index 000000000..c0fe3b60a --- /dev/null +++ b/emission/net/usercache/formatters/ios/survey_response.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 10af6d75e..f5eb3da00 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/survey_response": self.timeseries_db, "manual/destination_confirm": self.timeseries_db, "segmentation/raw_trip": self.analysis_timeseries_db, "segmentation/raw_place": self.analysis_timeseries_db, From 9cf625ab4b6e655b2cd0577e45e5304c9162ab1d Mon Sep 17 00:00:00 2001 From: Jenna Ruzekowicz Date: Fri, 6 Aug 2021 16:46:15 -0400 Subject: [PATCH 2/6] Integration of the new key for the addition of survey response information to the database. --- emission/core/wrapper/entry.py | 2 ++ .../usercache/formatters/android/survey_response.py | 12 ++++++++++++ .../net/usercache/formatters/ios/survey_response.py | 12 ++++++++++++ emission/storage/timeseries/builtin_timeseries.py | 1 + 4 files changed, 27 insertions(+) create mode 100644 emission/net/usercache/formatters/android/survey_response.py create mode 100644 emission/net/usercache/formatters/ios/survey_response.py diff --git a/emission/core/wrapper/entry.py b/emission/core/wrapper/entry.py index 39c86a539..1faa6c6bc 100644 --- a/emission/core/wrapper/entry.py +++ b/emission/core/wrapper/entry.py @@ -73,6 +73,8 @@ def _getData2Wrapper(): "manual/mode_confirm": "userlabel", # user confirmation of the travel purpose "manual/purpose_confirm": "userlabel", + #user response to the survey questions + "manual/survey_response": "userlabel", # user survey results. The survey results are a JSON blob "manual/survey": "survey", # user confirmation of the destination (unsure how this will diff --git a/emission/net/usercache/formatters/android/survey_response.py b/emission/net/usercache/formatters/android/survey_response.py new file mode 100644 index 000000000..c0fe3b60a --- /dev/null +++ b/emission/net/usercache/formatters/android/survey_response.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/survey_response.py b/emission/net/usercache/formatters/ios/survey_response.py new file mode 100644 index 000000000..c0fe3b60a --- /dev/null +++ b/emission/net/usercache/formatters/ios/survey_response.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 10af6d75e..f5eb3da00 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/survey_response": self.timeseries_db, "manual/destination_confirm": self.timeseries_db, "segmentation/raw_trip": self.analysis_timeseries_db, "segmentation/raw_place": self.analysis_timeseries_db, From 8101c962dd473fb69fe752301d38e073453a6932 Mon Sep 17 00:00:00 2001 From: Jenna Ruzekowicz Date: Mon, 9 Aug 2021 07:06:29 -0400 Subject: [PATCH 3/6] First survey_response addition --- emission/core/wrapper/entry.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/emission/core/wrapper/entry.py b/emission/core/wrapper/entry.py index 1faa6c6bc..36f7fa66e 100644 --- a/emission/core/wrapper/entry.py +++ b/emission/core/wrapper/entry.py @@ -80,6 +80,8 @@ def _getData2Wrapper(): # user confirmation of the destination (unsure how this will # interact with purpose "manual/destination_confirm": "userlabel", + #add key for the syncing of survey responses + "manual/survey_response":"userlabel", ### END: incoming data types ### ### BEGIN: analysis result data types ### ### ** BEGIN: objects generated after the initial segmentation step ** From f2f269ced860a86ca4d9623d188fe07d502649a0 Mon Sep 17 00:00:00 2001 From: Jenna Ruzekowicz Date: Mon, 9 Aug 2021 07:09:04 -0400 Subject: [PATCH 4/6] Revert commit --- emission/core/wrapper/entry.py | 2 -- 1 file changed, 2 deletions(-) diff --git a/emission/core/wrapper/entry.py b/emission/core/wrapper/entry.py index 36f7fa66e..1faa6c6bc 100644 --- a/emission/core/wrapper/entry.py +++ b/emission/core/wrapper/entry.py @@ -80,8 +80,6 @@ def _getData2Wrapper(): # user confirmation of the destination (unsure how this will # interact with purpose "manual/destination_confirm": "userlabel", - #add key for the syncing of survey responses - "manual/survey_response":"userlabel", ### END: incoming data types ### ### BEGIN: analysis result data types ### ### ** BEGIN: objects generated after the initial segmentation step ** From 58a4b30d72cda752c7890bcd831b07e4b4013f6e Mon Sep 17 00:00:00 2001 From: Jenna Ruzekowicz Date: Wed, 11 Aug 2021 13:58:21 -0400 Subject: [PATCH 5/6] Indentation errors fixed. --- .../formatters/android/survey_response.py | 20 +++++++++---------- .../formatters/ios/survey_response.py | 20 +++++++++---------- 2 files changed, 20 insertions(+), 20 deletions(-) diff --git a/emission/net/usercache/formatters/android/survey_response.py b/emission/net/usercache/formatters/android/survey_response.py index c0fe3b60a..7e83d379d 100644 --- a/emission/net/usercache/formatters/android/survey_response.py +++ b/emission/net/usercache/formatters/android/survey_response.py @@ -1,12 +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 +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) +def format(entry): + return fgl.format(entry) diff --git a/emission/net/usercache/formatters/ios/survey_response.py b/emission/net/usercache/formatters/ios/survey_response.py index c0fe3b60a..7e83d379d 100644 --- a/emission/net/usercache/formatters/ios/survey_response.py +++ b/emission/net/usercache/formatters/ios/survey_response.py @@ -1,12 +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 +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) +def format(entry): + return fgl.format(entry) From b4269019cb122791c6ff81093de89bfdba5c8295 Mon Sep 17 00:00:00 2001 From: Jenna Ruzekowicz Date: Thu, 12 Aug 2021 14:51:09 -0400 Subject: [PATCH 6/6] Needed another import. --- bin/debug/extract_timeline_for_day_range_and_user.py | 1 + 1 file changed, 1 insertion(+) diff --git a/bin/debug/extract_timeline_for_day_range_and_user.py b/bin/debug/extract_timeline_for_day_range_and_user.py index d0f376e66..52a9ff326 100644 --- a/bin/debug/extract_timeline_for_day_range_and_user.py +++ b/bin/debug/extract_timeline_for_day_range_and_user.py @@ -25,6 +25,7 @@ # only needed to read the motion_activity # https://github.com/e-mission/e-mission-docs/issues/356#issuecomment-520630934 import emission.export.export as eee +import emission.core.wrapper.user as ecwu def export_timeline(user_id, start_day_str, end_day_str, timezone, file_name): logging.info("Extracting timeline for user %s day %s -> %s and saving to file %s" %