Skip to content

An algorithm for creating user configurable, variable-precision sliding windows of time. Useful for binning time values in large collections of data.

License

Notifications You must be signed in to change notification settings

abeusher/timehash

Folders and files

NameName
Last commit message
Last commit date

Latest commit

e59a3d3 · Nov 3, 2022

History

47 Commits
Nov 18, 2018
Oct 16, 2019
Mar 22, 2014
Jan 7, 2022
Mar 22, 2014
Mar 22, 2014
Mar 22, 2014
Mar 17, 2016
Nov 3, 2022
Jan 7, 2022
Oct 7, 2018
Apr 21, 2019
Mar 17, 2016
Jan 7, 2022
Mar 5, 2016
Nov 18, 2018
Jun 4, 2016
Jan 26, 2018
Jun 2, 2016

Repository files navigation

timehash

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.

timehash-shaded-partial.png

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

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

Modified BSD License

Contact