-
Notifications
You must be signed in to change notification settings - Fork 120
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Add server-side support for storing trip and place additions #895
Merged
shankari
merged 108 commits into
e-mission:master
from
shankari:add_trip_place_additions
Apr 17, 2023
Merged
Changes from 11 commits
Commits
Show all changes
108 commits
Select commit
Hold shift + click to select a range
655b53b
Add server-side support for storing trip and place additions
shankari 2129075
Change the input matcher to support multiple matches for a single trip
shankari 28a3b75
Fix field addition to confirmed trip
shankari bdcf629
Add additional unit tests for the incoming matching
shankari 34d78fc
Start adding unit tests for finding the final candiate
shankari ae4983e
Merge branch 'master' of https://github.com/e-mission/e-mission-serve…
shankari a7ee02c
Handle the matching of user inputs that came in before the confirmed …
shankari bad2d69
Fix syntax errors in `get_additions_for_trip_object`
shankari d534ed0
Match by `match_id` instead of `_id`
shankari fcf5a9c
Fix regression in the input matching for new entries
shankari ef2ce21
Pass in the `continue_on_error` flag to cache series insertion from t…
shankari 8abd2ef
Create confirmedplace.py
sebastianbarry 743eca0
Added confirmedplace in entry.py and builtin_timeseries.py
sebastianbarry 64cab33
Removed expectedplace.py and inferredplace.py
sebastianbarry 9220dd2
Added confirmedplace into the pipeline
sebastianbarry e8a910d
First draft
sebastianbarry 286f233
create confirmed_places during CREATE_CONFIRMED_OBJECTS
JGreenlee 9eb812d
implement CREATE_COMPOSITE_OBJECTS
JGreenlee 5cdbdeb
Change confirmed_trip variable to confirmed_object for consistency
sebastianbarry 64f1f51
Remove unnecessary confirmed_place properties
sebastianbarry 3fbc72d
Remove info log spew by replacing Logging.info changes back to Loggin…
sebastianbarry d016b3d
update confirmed_place properties
JGreenlee 3d62c81
add a `locations` property to composite trip
JGreenlee 34baef6
correct confirmed_place generation
JGreenlee d90de7f
use enter_ts to query places and mark stage done
JGreenlee b690b0c
revise input matching functions
JGreenlee 01e0bb3
Remove weird overwrite of start and end timestamps on android
shankari 9aed65d
:bug: Read the match ID from 'data' instead of directly from the entry
shankari 763a3cb
add keys for place user input
JGreenlee 6bc5f84
revise input matching
JGreenlee 1cc481e
modify user input tests
JGreenlee 73841ab
Merge branch 'add_trip_place_additions' into add-composite-trip
JGreenlee 9b75391
unify tripuserinput and placeuserinput
JGreenlee c51aee9
add logic to check places for inputs
JGreenlee 8bcacc3
revise unit tests to work with places matching
JGreenlee 2573ced
fix matching on last place
JGreenlee d0c46f6
expand tests to check trip&place additions
JGreenlee 52ecab2
Merge pull request #4 from sebastianbarry/add-composite-trip
shankari 1c3f128
fix missing confirmed_places on existing confirmed_trips
JGreenlee 180a979
insert confirmed_place_entry to ts
JGreenlee 7fa3aa7
receive confirmed place id from ts.insert()
JGreenlee 8709243
Merge pull request #5 from sebastianbarry/update-missing-confirmed-pl…
shankari 0c5d1a5
comments explaining unit test changes
JGreenlee e4265d5
refactor composite trip creation into composite_trip_creation.py
JGreenlee 8f0bf45
optimize get_confirmed_obj_for_user_input_obj
JGreenlee e34c463
tidy/refactor functions in trip_queries.py
JGreenlee 3ea7b67
allow other keys than trip_user_input for trips
JGreenlee a62fa09
comment describing use of getattr
JGreenlee 54fd12e
import composite_trip_creation with alias eapcc
JGreenlee f56bd3c
Merge pull request #6 from sebastianbarry/additions-and-composite-cle…
shankari 7d544f3
allow timeline to support IDing trips by a key
JGreenlee 9ea47e0
add real_examples that demonstrate untracked time
JGreenlee 0aa7c83
refactor confirmed object creation to use Timeline
JGreenlee 9d41f1d
include untracked time in composite trip creation
JGreenlee df93a93
don't return early from create_composite_objects
JGreenlee c307647
Don't break the composite trip creation pipeline stage if there are n…
shankari 02c910a
Use the composite trip for the pipeline timestamps
shankari 2de4b4a
Merge pull request #8 from shankari/minor_pipeline_fixes
shankari 77f5db1
Merge branch 'add_trip_place_additions' into untracked-composite-trip
JGreenlee 9c51961
include origin_key in composite trip
JGreenlee 9bf0352
Merge branch 'add_trip_place_additions' into untracked-composite-trip
JGreenlee 8ac11d9
declare composite trip origin_key before key
JGreenlee 5e885f1
if using trip_id_key in Timeline, fallback to _id
JGreenlee 5586b2c
include empty locations list in untracked composite
JGreenlee 1c24095
reword comments in create_confirmed_objects
JGreenlee e81eede
create testJackUntrackedTimeMar12
JGreenlee e50f88d
Tweak the threshold for detecting untracked time to account for backg…
shankari 8cbdf43
add more unit tests for untracked time
JGreenlee 8330b72
add comment explaining places after untracked time
JGreenlee 1bb8a3e
update expected test result: shankariUntrackedTimeJul20
JGreenlee 9a43a07
Merge pull request #7 from sebastianbarry/untracked-composite-trip
shankari 93039ce
fix first composite trip of batch not being created
JGreenlee bad6126
make log statements clearer
JGreenlee c816632
Rename confirmed_place in compositetrip to end_confirmed_place
sebastianbarry 418cffc
Ensure that the composite trip metadata reflects the time that it was…
shankari e769c6b
Fix broken test case
shankari 73149e9
Merge pull request #9 from sebastianbarry/fix_first_composite_of_batc…
shankari 6a26c54
Merge pull request #10 from sebastianbarry/add_trip_place_additions_e…
shankari 3527525
Merge branch 'add_trip_place_additions' of https://github.com/shankar…
shankari 014a611
Merge pull request #11 from shankari/composite_metadata_fix
shankari b3d06ba
update expected composite trips for test JackMar12
JGreenlee 9f0de13
Merge pull request #12 from sebastianbarry/update-expected-composite-…
shankari 157e6f9
Create and link the timeline properly, similar to the `CLEAN_AND_RESA…
shankari 0729b41
Fix the backwards compat to generate correct confirmed object timelines
shankari 149025b
Update composite trips when confirmed objects are updated
shankari 33af6dd
Add unit tests to check the new functions in composite trip creation
shankari 5410d56
Expand the `save_ground_truth` script to also support saving a compos…
shankari 57abb97
Fix population of start place additions when grafting timeline
shankari fb6a982
Check in a new unit test to test incremental updates of the composite…
shankari c97b49c
Multiple fixes to the hack code
shankari b768571
Change deprecated `remove` to `delete_many`
shankari d3bbe37
Merge pull request #13 from shankari/fix_incremental_confirmed_obj_cr…
shankari 34dd104
Ensure that object <-> input matching code works properly
shankari 94ffc9e
Fix new issue uncovered in existing incremental test
shankari 2d9ee58
Set a flag to prevent the test data from being torn down
shankari cf48989
Final changes from cleaned_untracked -> confirmed_untracked
shankari 61d6e5c
Merge pull request #15 from shankari/fix_object_to_addition_matching
shankari afd11c7
Remove the ubuntu 18 environment + run manual tests on both OSX and u…
shankari f2647b9
Merge branch 'add_trip_place_additions' of https://github.com/shankar…
shankari 28ad00d
Remove the teardown step from the docker tests
shankari 1e67cd6
Remove manual install test on OSX
shankari 0ad1c10
Use EPOCH_MININUM when the start timestamp is None
shankari 564a9b5
Fix format of transition distance logging
shankari 6045174
Merge branch 'master' into add_trip_place_additions
shankari b74198d
Try setting the random seed for the test
shankari 0b272d6
Merge branch 'add_trip_place_additions' of https://github.com/shankar…
shankari 90a3d92
Temporarily commenting out the start timestamp checks
shankari 09de165
Expand the set of valid responses for the script tests
shankari File filter
Filter by extension
Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,31 @@ | ||
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.core.wrapper.wrapperbase as ecwb | ||
|
||
class Placeuserinput(ecwb.WrapperBase): | ||
props = {"enter_ts": ecwb.WrapperBase.Access.RO, # geojson representation of the point | ||
"enter_local_dt": ecwb.WrapperBase.Access.RO, # start datetime in local time | ||
"enter_fmt_time": ecwb.WrapperBase.Access.RO, # start formatted time (in timezone of point) | ||
"exit_ts": ecwb.WrapperBase.Access.WORM, # end UTC timestamp (in secs) | ||
"exit_local_dt": ecwb.WrapperBase.Access.RO, # end datetime in local time | ||
"exit_fmt_time": ecwb.WrapperBase.Access.RO, # end formatted time (in timezone of point) | ||
"label": ecwb.WrapperBase.Access.RO, # string summary of the survey | ||
"version": ecwb.WrapperBase.Access.RO, # the survey version | ||
"name": ecwb.WrapperBase.Access.RO, # the survey name | ||
"xmlResponse": ecwb.WrapperBase.Access.RO, # the XML string representation of the survey response | ||
"jsonDocResponse": ecwb.WrapperBase.Access.RO # the JSON representation of the survey response | ||
} | ||
|
||
enums = {} | ||
geojson = [] | ||
nullable = [] | ||
local_dates = ["enter_local_dt", "exit_local_dt"] | ||
|
||
def _populateDependencies(self): | ||
pass |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
12 changes: 12 additions & 0 deletions
12
emission/net/usercache/formatters/android/place_addition_input.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
16 changes: 16 additions & 0 deletions
16
emission/net/usercache/formatters/android/trip_addition_input.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,16 @@ | ||
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): | ||
import arrow | ||
|
||
entry["data"]["start_ts"] = 0 | ||
entry["data"]["end_ts"] = arrow.get() | ||
return fgl.format(entry) |
12 changes: 12 additions & 0 deletions
12
emission/net/usercache/formatters/ios/place_addition_input.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
12 changes: 12 additions & 0 deletions
12
emission/net/usercache/formatters/ios/trip_addition_input.py
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -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) |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.
Add this suggestion to a batch that can be applied as a single commit.
This suggestion is invalid because no changes were made to the code.
Suggestions cannot be applied while the pull request is closed.
Suggestions cannot be applied while viewing a subset of changes.
Only one suggestion per line can be applied in a batch.
Add this suggestion to a batch that can be applied as a single commit.
Applying suggestions on deleted lines is not supported.
You must change the existing code in this line in order to create a valid suggestion.
Outdated suggestions cannot be applied.
This suggestion has been applied or marked resolved.
Suggestions cannot be applied from pending reviews.
Suggestions cannot be applied on multi-line comments.
Suggestions cannot be applied while the pull request is queued to merge.
Suggestion cannot be applied right now. Please check back later.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
I have been having a hard time understanding how input matching works on phone vs server. I now understand why:
I see here that input matching on the server works by iterating through each user input (
ui
), and thenui
is matched to the appropriate trip byesdt.get_trip_for_user_input_obj()
This is fundamentally different on the phone: input matching works by iterating through each trip, and then finds the user inputs that correspond to that trip (with the functions
getUserInputForTrip()
andgetTripAdditionsForTrip()
ininput-matcher.js
)If we want to unify the matching functions, and improve interoperability and maintainability, we would have to reconcile that fundamental difference
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@JGreenlee the server actually does both:
That is of the complexity of the system, especially around handling user inputs. You can probably tell that I am a distributed systems person at heart 😄