Module to encode and decode timestamps to/from TimeHashes
Project description
About
timehash is an algorithm (with multiple reference implementations) for calculating variable precision sliding windows of time. When performing aggregations and correlations on large-scale data sets, the ability to convert precise time values into ‘malleable intervals’ allows for many novel analytics.
Using sliding windows of time is a common practice in data analysis but prior to the timehash algorithm it was more of an art than a science.
Features
- convert epoch miliseconds into an interval of time, depicted by an ASCII character ‘hash’ (a ‘timehash’)
- timehash values are well suited to referencing time intervals in key-value stores (e.g. Hbase, Acculumo, Redis)
- The creation of a compound key of space and time (e.g. geohash_timehash) is a powerful primitive for understanding geotemporal patterns
Implementations
- python timehash - a reference implementation in pure python
- perl timehash - a reference implementation in perl
- java timehash - a reference implementation in java
- javascript time-hash - port of reference implements
- golang timehash - a reference implementation in Go
Usage
Example of calculating a timehash value in python:
import timehash import time rightnow = time.time() rightnow60 = rightnow + 60.0 rightnow_hash = timehash.encode(rightnow, precision=10) rightnow60_hash = timehash.encode(rightnow60, precision=10) print 'timehash of right now: %s' % rightnow_hash print 'timehash of now +60s: %s'% rightnow60_hash % timehash of right now: ae0f0ba1fc % timehash of now +60s: ae0f0baa1c
License
Contact
- TimeHash Guru: AbeUsher
- Python Packager: Kevin Dwyer / @pheared
- Golang implementation: Justin Shelton / @kwonstant
- Javascript implementation: Eric Xanderson
- Rust implementation: Kevin Dwyer / @pheared
- C impelmentation Sam Mason
- C# impelmentation Sam Mason
Project details
Release history Release notifications | RSS feed
Download files
Download the file for your platform. If you're not sure which to choose, learn more about installing packages.
Source Distribution
timehash-1.2.tar.gz
(6.2 kB
view hashes)
Built Distribution
timehash-1.2-py3-none-any.whl
(6.3 kB
view hashes)