Skip to main content

itinerum-tripkit

Documentation for library usage: https://itinerum-tripkit.readthedocs.io/

This library serves as a framework to process data from the Itinerum platform and hardware GPS loggers (e.g., QStarz). It can be used both through as a library in Jupyter to explore datasets interactively or imported as a module in standalone scripts and applications.

This repository also serves as the development bed for the Itinerum platform algorithms within the TRIP Lab repositories.

Looking to get started without coding? Try the itinerum-tripkit-cli!

Setup

Quickstart

  1. Install this library from PyPI (a Python virtual environment is recommended)
  2. Create a configuration file with input filepaths, output filepaths, and trip processing parameters. See the included tripkit_config.py file for a full example.
  3. Import tripkit as a dependency in a notebook or script

For more complete installation information, see the official itinerum-tripkit documentation.

Loading Subway Stations

Subway station data for trip detection can be loaded similarly for all processing modules. Place a .csv file of station entrances with the columns of x (or longitude) and y (or latitude). Locations are expected as geographic coordinates only. Edit the SUBWAY_STATIONS_FP config parameter to reflect the subway stations .csv filepath.

Example

View attributes on a User

import tripkit_config
itinerum = Itinerum(tripkit_config)

# create a new database and read in .csv data
itinerum.setup()

# load all users from database
users = itinerum.load_all_users()

test_user = users[0]
print(test_user.coordinates)
print(test_user.prompt_responses)

Run trip detection on a User

import tripkit_config
itinerum = Itinerum(tripkit_config)

# load user from database by uuid
user = itinerum.database.load_user('00000000-0000-0000-0000-000000000000')

# run a provided trip detection algorithm
parameters = {
    'subway_entrances': itinerum.database.load_subway_entrances(),
    'break_interval_seconds': tripkit_config.TRIP_DETECTION_BREAK_INTERVAL_SECONDS,
    'subway_buffer_meters': tripkit_config.TRIP_DETECTION_SUBWAY_BUFFER_METERS,
    'cold_start_distance': tripkit_config.TRIP_DETECTION_COLD_START_DISTANCE_METERS,
    'accuracy_cutoff_meters': tripkit_config.TRIP_DETECTION_ACCURACY_CUTOFF_METERS
}
trips = itinerum.process.trip_detection.triplab.v2.algorithm.run(user.coordinates, parameters)

Processing

Trip Detection

Arguments
parameters A dictionary to supply arbitrary kwargs to an algorithm
subway_stations A list of subway station entrance database objects containing latitude and longitude attributes
coordinates A timestamp-ordered list of coordinates as dicts for a specific user. Multiple users should be run in sequence and have their output coordinates concatenated into a single list after if desired.

Trip Outputs

Trips will be output with the following trip codes to indicate the type of trip:

Trip Code Description
1 Complete trip
2 Complete trip - subway
101 Missing trip
102 Missing trip - subway
103 Missing trip - less than 250m
201 Single point
202 Distance too short - less than 250m

Outputs

The aim of this library is to provide easy visualization of Itinerum data to assist in writing trip processing algorthms. Therefore at a minimum, the library provides exporting processed coordinates and traces as .geojson files (TBA: GeoPackage format). With a PostgreSQL backend for caching, PostGIS can be enabled (unimplemented) and a geom column generated for directly connection QGIS to the output data. The library should also easily provide methods for easily plotting GPS within Jupyter notebooks.

Metadata

Release files for itinerum-tripkit 0.0.26

For a detailed explanation of source distributions (sdists) and built distributions (wheels), please see the package formats documentation.

Source distribution (sdist)

Source distribution for itinerum-tripkit 0.0.26
File Size Uploaded Provenance Actions
itinerum-tripkit-0.0.26.tar.gz 88.3 kB Without provenance Details for itinerum-tripkit-0.0.26.tar.gz

Built distribution (wheel)

Table of built distributions (wheels) for itinerum-tripkit 0.0.26
File Interpreter ABI Platform Actions
itinerum_tripkit-0.0.26-py3-none-any.whl Python 3 none any Details for itinerum_tripkit-0.0.26-py3-none-any.whl

Total release size: 215.3 kB

Release files / itinerum-tripkit-0.0.26.tar.gz

Download URL itinerum-tripkit-0.0.26.tar.gz
Size 88.3 kB
Tags Source
SHA-256 checksum
How to use checksums
ffcc39d67ad505365216453f6686021da872c789bc52333124349eebb141cb3f
BLAKE2b-256 checksum
How to use checksums
ff356bdaf4478a217141c9e786b54f40e3601a79541cde7a16f8129a0cb1ff7a
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.8

Release files / itinerum_tripkit-0.0.26-py3-none-any.whl

Download URL itinerum_tripkit-0.0.26-py3-none-any.whl
Size 127.0 kB
Tags Python 3
SHA-256 checksum
How to use checksums
33e6e4a5d574fd4a6cf02c356f960a8ca1a110869c4dc62e987deb5b9e873345
BLAKE2b-256 checksum
How to use checksums
de578c8933b7e4dfd5bf14fcaf51a0d0056787987a91512ccfc6b6adba27945e
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/3.8.0 pkginfo/1.8.2 readme-renderer/34.0 requests/2.27.1 requests-toolbelt/0.9.1 urllib3/1.26.9 tqdm/4.63.0 importlib-metadata/4.11.3 keyring/23.5.0 rfc3986/2.0.0 colorama/0.4.4 CPython/3.9.8

Security for itinerum-tripkit 0.0.26

Provenance

Provenance describes where a file came from. On PyPI, provenance is shared via attestations, which provide a verifiable record of the build or publishing details. View details, limitations and caveats.

No provenance found

None of the files in this release were uploaded with provenance metadata.

A note on package security

PyPI is a repository for distributing packages, not a service for auditing them. While third-party security researchers and our staff do their best to detect and remove malicious packages, PyPI cannot guarantee the quality, security or suitability of any given package.

To learn more about protecting yourself from malicious actors, visit our package security documentation.

Anthropic, PBC Visionary sponsor Bloomberg Visionary sponsor Hudson River Trading Visionary sponsor Meta Visionary sponsor NVIDIA Visionary sponsor Microsoft Sustainability sponsor Depot Continuous Integration AWS Cloud computing and Security Sponsor Datadog Monitoring Fastly CDN Google Download Analytics Sentry Error logging StatusPage Status page