Skip to content

Commit

Permalink
Update README to include osm tags argument for gps summaries (#170)
Browse files Browse the repository at this point in the history
  • Loading branch information
GeorgeEfstathiadis authored Jun 2, 2023
1 parent d44ce08 commit b1f6ca0
Show file tree
Hide file tree
Showing 2 changed files with 19 additions and 6 deletions.
17 changes: 15 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -119,7 +119,7 @@ gps_to_csv(sample_gps_data, path_to_synthetic_gps_data, start_date, end_date)
# See https://github.com/onnela-lab/forest/wiki/Jasmine-documentation#input for details
# time zone where the study took place (assumes that all participants were always in this time zone)
tz_str = "Etc/GMT-1"
# Generate summary metrics e.g. Frequency.HOURLY, Frequency.DAILY or Frequency.HOURLY_AND_DAILY (see Frequency class in traj2stats.py)
# Generate summary metrics e.g. Frequency.HOURLY, Frequency.DAILY or Frequency.HOURLY_AND_DAILY (see Frequency class in constants.py)
frequency = Frequency.DAILY
# Save imputed trajectories?
save_traj = False
Expand All @@ -129,11 +129,24 @@ parameters = None
places_of_interest = ['cafe', 'bar', 'hospital']
# True if want to save a log of all locations and attributes of those locations visited
save_osm_log = True
# list of OpenStreetMap tags to use for identifying locations, leave None to default to amenity and leisure tagged locations or if you don't want to use OSM (see OSMTags class in constants.py)
osm_tags = None
# threshold of time spent in a location to count as being in that location, in minutes
threshold = 15

# 3. Impute location data and generate mobility summary metrics using the simulated data above
gps_stats_main(path_to_synthetic_gps_data, path_to_gps_summary, tz_str, frequency, save_traj, parameters, places_of_interest, save_osm_log, threshold)
gps_stats_main(
study_folder = path_to_synthetic_gps_data,
output_folder = path_to_gps_summary,
tz_str = tz_str,
frequency = frequency,
save_traj = save_traj,
parameters = parameters,
places_of_interest = places_of_interest,
save_osm_log = save_osm_log,
osm_tags = None,
threshold = threshold,
)

# 4. Generate daily summary metrics for call/text logs
option = Frequency.DAILY
Expand Down
8 changes: 4 additions & 4 deletions forest/jasmine/traj2stats.py
Original file line number Diff line number Diff line change
Expand Up @@ -108,9 +108,9 @@ def get_nearby_locations(
Args:
traj: numpy array, trajectory
osm_tags: list of strings, types of nearby locations
supported by Overpass API
defaults to ["amenity", "leisure"]
osm_tags: list of OSMTags (in constants),
types of nearby locations supported by Overpass API
defaults to [OSMTags.AMENITY, OSMTags.LEISURE]
Returns:
ids: dictionary, contains nearby locations' ids
locations: dictionary, contains nearby locations' coordinates
Expand Down Expand Up @@ -960,7 +960,7 @@ def gps_stats_main(
(resolution for summary statistics)
save_traj: bool, True if you want to save the trajectories as a
csv file, False if you don't
places_of_interest: list of amenities or leisure places to watch,
places_of_interest: list of places to watch,
keywords as used in openstreetmaps
save_osm_log: bool, True if you want to output a log of locations
visited and their tags
Expand Down

0 comments on commit b1f6ca0

Please sign in to comment.