Skip to main content

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)

Release files for sttn 0.4.0

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

Source distribution (sdist)

Source distribution for sttn 0.4.0
File Size Uploaded
sttn-0.4.0.tar.gz 259.7 kB Details

Built distribution (wheel)

Table of built distributions (wheels) for sttn 0.4.0
File Interpreter ABI Platform
sttn-0.4.0-py2.py3-none-any.whl Python 2, Python 3 none any Details

Total release size: 338.8 kB

Release files / sttn-0.4.0.tar.gz

Download URL sttn-0.4.0.tar.gz
Size 259.7 kB
Tags Source
SHA-256 checksum
How to use checksums
65a06b404409112161130dc8e52de56dc20fc3af76da3e7872f0af017b4100dd
BLAKE2b-256 checksum
How to use checksums
bb324527ee9da7ca31657ebea7ce1b115d3bb591f3c8d006a1810b500fe63393
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.11

Release files / sttn-0.4.0-py2.py3-none-any.whl

Download URL sttn-0.4.0-py2.py3-none-any.whl
Size 79.0 kB
Tags Python 2 Python 3
SHA-256 checksum
How to use checksums
a75a658802acd8e293130e4c3890506e78f152f3cc455f95f71464d16afd25ab
BLAKE2b-256 checksum
How to use checksums
a31fd3d0c9dd95ef894d99d4958b864ace07c5b2a48f02728a4548ca33b1d9fa
Upload date
Uploaded using Trusted Publishing?
What is trusted publishing?
No
Uploaded via twine/6.1.0 CPython/3.11.11

Release history Release notifications | RSS feed

This release

0.4.0 This release

2 release files

0.3.5

2 release files

0.3.4

2 release files

0.3.3

2 release files

0.3.2

2 release files

0.2.2

2 release files

0.2.1

2 release files

0.2.0

2 release files

0.1.1

2 release files

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