This is an old revision of the document!

TimEL: Time-series Expression Language

Monitoring, metering, IoT, pay-per-use billing: these are only few examples of applications that rely on time-series data! Often you want the final user to be able to manipulate and customize some results based on some time-series data - that's when TimEL comes in handy!

TimEL is a Java library to compile and evaluate TimEL expressions. TimEL expressions are written in a user-friendly language that allows time-series manipulation without the need of taking care about upscaling, downscaling or mixing up different time series intervals.

Let's see an expression to count the number of days:

scale(                                      // (3) and then downsample for the whole interval
        uniform(1.0),                       // (1) let's take an integral value 1.0
        every(1, "DAY_OF_YEAR", "UTC")      // (2) repeat it every day

If we evaluate this expression for an interval in the same day, let's say 06:00-18:00, it'll report 0.5 - that is half day. If we evaluate it for more days it will count how many days are contained in the interval. The function uniform here returns an integral, so TimEL knows how to interpolate it properly - that is handled by the interpreter so the user does not need to worry no more about time frames.

TL;DR? Pick a random example in the 📺 online console and try it yourself!

With TimEL you can:

  • Mix multiple time frames - for example you can sum daily data with hourly data, or even non-regular data like monthly data;
  • Express easily recurrent quantities, like 10 units every hour;
  • Scale natively integral values (like consumptions) and averages;
  • Stream results without the need of having all the operands in memory;
  • Support integer, floating point and double expressions;
  • Extend with your own types and functions.

TimEL requires Java 8 and will run in any J2SE or J2EE container.


I wish to thank ej-technologies for providing the TimEL development team with a free JProfiler license, a great Java Profiler.

  • home.1558519650.txt.gz
  • Last modified: 2019/05/22 10:07
  • by a.leofreddi