Interface TimelineService

All Superinterfaces:
Service

public interface TimelineService
extends Service
Various utility functions to manipulate Timeline generation.
  • Method Summary

    Modifier and Type Method Description
    java.util.Map<java.lang.Integer,​java.lang.Float> transform​(TimelineDefinition timelineDef, java.util.List<BucketizedValue> sourceBucketizedVals, java.util.Map<Bucketization,​java.lang.String> transformFuncs, PlatformUserContext platformUserContext)
    Generates bucket data for aggregated data points.
  • Method Details

    • transform

      java.util.Map<java.lang.Integer,​java.lang.Float> transform​(TimelineDefinition timelineDef, java.util.List<BucketizedValue> sourceBucketizedVals, java.util.Map<Bucketization,​java.lang.String> transformFuncs, PlatformUserContext platformUserContext)
      Generates bucket data for aggregated data points.

      For example, if a timeline is generated for DAILY bucketization but some of the underyling data is WEEKLY, this function can be used to "disaggregate" the data using transform functions into DAILY buckets.

      The following standard transform functions are provided by ONE:

      NameDescription
      firstPut all data into first bucket
      lastPut all data into last bucket
      fairShareSplit value equally into all buckets based on number of buckets (not duration)
      fairShareRoundedFavorFirstLike fairShare, but round to integers, putting any remainder in the first bucket
      fairShareRoundedFavorLastLike fairShare, but round to integers, putting any remainder in the last bucket
      byDurationDisaggregate value in proportion to the duration of each bucket (i.e. a MONTHLY bucket will get a greater share than a WEEKLY bucket)
      byDurationRoundedFavorFirstLike byDuration, but round to integers, putting any remainder in the first bucket
      byDurationRoundedFavorLastLike byDuration, but round to integers, putting any remainder in the last bucket

      Transforms can be specified in the TLV XML: <BucketTransform sourceBucketType="MONTHLY" transformFunction="byDuration"/>

      You can also define your own transform function by implementing the BucketTransformer interface and provide fully qualified name of the class in the transformFuncs param below.

      Parameters:
      timelineDef - contains the startDayOfWeek, buckets on timeline etc.
      sourceBucketizedVals - raw, untransformed bucket data
      transformFuncs - map of source bucketization to transform function. Transform function can be one of the names above, or a fully-qualified BucketTransformer implementlation classname.
      platformUserContext - caller's context
      Returns:
      the list Map of affected bucket indexes (relative to timelineDef) and their new values