Skip to main content

Library for spatio-temporal transactional network analysis

Project description

STTN (spatio-temporal transactional network) is a generic data model to represent networks with spatial and temporal dimensions and a Python library that implements that standard.

Introduction

Multiple real-world processes can be described by a list of transactions that include temporal and spatial dimensions, while transactions themself form a network between entities. Examples include credit card transactions, phone calls, taxi trips, social network interactions, and the list goes on and on. Defining a generic data model to represent these datasets allows to:

  1. Re-use the data retrieval, parser, and network construction logic.

  2. Provide simplified API for network transformations (based on the knowledge of the network structure).

  3. Implement advanced visualization, analysis, and modeling functionality (thanks to the consistent representation of spatial and temporal components).

Installation

The latest library release and required dependencies can be installed from PyPI:

pip install sttn

Getting started

Import one of the included data providers, for example:

from sttn.data.lehd import OriginDestinationEmploymentDataProvider

The latest list of included data providers can be found in the data package. You can use available providers as an example to define your own parser. If the dataset is open we highly encourage you to open a Pull Request and contribute your provider to the community.

Now you can create an instance of the data provider and retrieve the data:

lehd_provider = OriginDestinationEmploymentDataProvider()
ny_lehd = lehd_provider.get_data(state='ny', year=2018)

Some data providers cache downloaded data on the local disk. The first run may take longer to download data from the Internet, while next runs will re-use the previously downloaded copy. The code above retrieves LEHD Origin-Destination Employment Statistics for New York state based on 2018 census. In addition to the origin-destination employment data the command above downloads shape files for census blocks and leverages both datasets to build the network.

Preview of node and edge attributes is helpful to understand the network structure:

ny_lehd.nodes # to see network nodes
ny_lehd.edges # to see network edges (or transactions)

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distribution

sttn-0.3.5.tar.gz (2.5 MB view details)

Uploaded Source

Built Distribution

sttn-0.3.5-py2.py3-none-any.whl (44.5 kB view details)

Uploaded Python 2 Python 3

File details

Details for the file sttn-0.3.5.tar.gz.

File metadata

  • Download URL: sttn-0.3.5.tar.gz
  • Upload date:
  • Size: 2.5 MB
  • Tags: Source
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.6

File hashes

Hashes for sttn-0.3.5.tar.gz
Algorithm Hash digest
SHA256 4f5cc10e5ed9f5a7a186f245206d06ce9b097020850947eef5c28d950068e1da
MD5 88f9729b86db24933e4100304782e050
BLAKE2b-256 6d0fe482dacffc59217e5cf3966e728dfc24549d696b3b51871afa391492254b

See more details on using hashes here.

File details

Details for the file sttn-0.3.5-py2.py3-none-any.whl.

File metadata

  • Download URL: sttn-0.3.5-py2.py3-none-any.whl
  • Upload date:
  • Size: 44.5 kB
  • Tags: Python 2, Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/4.0.2 CPython/3.8.6

File hashes

Hashes for sttn-0.3.5-py2.py3-none-any.whl
Algorithm Hash digest
SHA256 4fb872e4f52f17e0dc8a9e66c2bb382f39b45d04b2e58be4ca59db74f66b5fcd
MD5 c1c385d5d690ed93774edefeccdac25d
BLAKE2b-256 347807226ce476a7ac0f5a0e2fa217f0f5a88518c4d7ad5f3cdd3ec9e0a7b94c

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page