Skip to content
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

Change the geojson export code to use confirmed trips instead of clea… #837

Merged
merged 2 commits into from
Oct 14, 2021
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 1 addition & 3 deletions .github/workflows/osx-ubuntu-manual-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,10 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-16.04, ubuntu-18.04, ubuntu-latest, macos-latest]
os: [ubuntu-18.04, ubuntu-latest, macos-latest]
include:
- os: macos-latest
PLATFORM: MacOSX-x86_64
- os: ubuntu-16.04
PLATFORM: Linux-x86_64
- os: ubuntu-18.04
PLATFORM: Linux-x86_64
- os: ubuntu-latest
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/test-with-manual-install.yml
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@ jobs:
runs-on: ${{ matrix.os }}
strategy:
matrix:
os: [ubuntu-16.04, ubuntu-18.04, ubuntu-latest]
os: [ubuntu-18.04, ubuntu-latest]

# Steps represent a sequence of tasks that will be executed as part of the job
steps:
Expand Down
10 changes: 7 additions & 3 deletions emission/analysis/plotting/geojson/geojson_feature_converter.py
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,11 @@ def trip_to_geojson(trip, tl):
end_place_geojson["properties"]["feature_type"] = "end_place"
feature_array.append(end_place_geojson)

trip_tl = esdt.get_cleaned_timeline_for_trip(trip.user_id, trip.get_id())
if "cleaned_trip" in trip.data:
trip_tl = esdt.get_cleaned_timeline_for_trip(trip.user_id, trip.data.cleaned_trip)
else:
trip_tl = esdt.get_cleaned_timeline_for_trip(trip.user_id, trip.get_id())

stops = trip_tl.places
for stop in stops:
feature_array.append(stop_to_geojson(stop))
Expand Down Expand Up @@ -267,13 +271,13 @@ def trip_to_geojson(trip, tl):
return trip_geojson

def get_geojson_for_ts(user_id, start_ts, end_ts):
tl = esdtl.get_cleaned_timeline(user_id, start_ts, end_ts)
tl = esdtl.get_confirmed_timeline(user_id, start_ts, end_ts)
tl.fill_start_end_places()
return get_geojson_for_timeline(user_id, tl)

def get_geojson_for_dt(user_id, start_local_dt, end_local_dt):
logging.debug("Getting geojson for %s -> %s" % (start_local_dt, end_local_dt))
tl = esdtl.get_cleaned_timeline_from_dt(user_id, start_local_dt, end_local_dt)
tl = esdtl.get_confirmed_timeline_from_dt(user_id, start_local_dt, end_local_dt)
tl.fill_start_end_places()
return get_geojson_for_timeline(user_id, tl)

Expand Down
10 changes: 10 additions & 0 deletions emission/storage/decorations/timeline.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,11 @@ def get_cleaned_timeline_from_dt(user_id, start_local_dt, end_local_dt,
return get_timeline_from_dt(user_id, esda.CLEANED_PLACE_KEY, esda.CLEANED_TRIP_KEY, esda.CLEANED_UNTRACKED_KEY,
start_local_dt, end_local_dt, geojson, extra_query_list)

def get_confirmed_timeline_from_dt(user_id, start_local_dt, end_local_dt,
geojson=None, extra_query_list=None):
return get_timeline_from_dt(user_id, esda.CLEANED_PLACE_KEY, esda.CONFIRMED_TRIP_KEY, esda.CLEANED_UNTRACKED_KEY,
start_local_dt, end_local_dt, geojson, extra_query_list)

def get_raw_timeline(user_id, start_ts, end_ts,
geojson=None, extra_query_list=None):
return get_timeline(user_id, esda.RAW_PLACE_KEY, esda.RAW_TRIP_KEY, esda.RAW_UNTRACKED_KEY,
Expand All @@ -36,6 +41,11 @@ def get_cleaned_timeline(user_id, start_ts, end_ts,
return get_timeline(user_id, esda.CLEANED_PLACE_KEY, esda.CLEANED_TRIP_KEY, esda.CLEANED_UNTRACKED_KEY,
start_ts, end_ts, geojson, extra_query_list)

def get_confirmed_timeline(user_id, start_ts, end_ts,
geojson=None, extra_query_list=None):
return get_timeline(user_id, esda.CLEANED_PLACE_KEY, esda.CONFIRMED_TRIP_KEY, esda.CLEANED_UNTRACKED_KEY,
start_ts, end_ts, geojson, extra_query_list)

def get_timeline(user_id, place_key, trip_key, untracked_key, start_ts, end_ts,
geojson=None, extra_query_list=None):
logging.info("About to query for timestamps %s -> %s" % (start_ts, end_ts))
Expand Down