Technology: Innovations
And Solutions Tech-IS INC.
-
One of the use cases for NoSQL stores is the tracking of activities and events. In some cases, a process can then be used to generate Metrics from the events or activities data.
The Activity Metrics System (AMS) track Activities, Scores, Reactions, Ratings, and user responses by storing the information in the activities table. A process can then be executed to generate metrics. The generation of metrics from the Activities is achieved using Calculators.
AMS is designed in a way that means you only need to create custom Calculators – the entire mechanism of writing, reading and querying NoSQL datastores is abstracted. Calculators are pieces of custom code that examines the data in the activity table and generates new information - the metrics.
To create a Metrics Generator, you will need an instance of a Calculator. The first implementation of AMS which is the Azure Table API implementation, ships with only one built-in Calculator – The Count Calculator.
You may write your own Calculators according to your needs. For example, your can write Calculators for averages, standard deviations, percentiles, Minimums and Maximums.
AMS is made up of 4 key interfaces and 2 DTOs. These interfaces and DTOs can be implemented against any NoSQL datastore that exposes data fields.
IActivityTracker<TEntity>
This is the ActivityTracker interface. Use this to add and delete activities. The Activity Tracker interface also has a supporting factory interface that can be used to create instances of Activity Tracker objects.
IMetricsGenerator<TResult>
This is the MetricGenerator interface. Use this to generate metrics against activities. The Metric Generator interface also has a supporting factory interface that can be used to create instances of Metric Generator objects.
ICalculator<TResult, EntityProperty>
This is the Calculator interface. Classes that implement this interface are used by Metrics Generators to generate metrics against activities. The Calculator interface also has a supporting factory interface that can be used to create instances of Calculator objects.
IMetricsQueryable<TEntity>
This is the MetricQueryable interface. Use this to query for metrics or activities. The Metrics Queryable interface also has a supporting factory interface that can be used to create instances of MetricsQueryable objects. The IMetricsQueryable interface is supported by two DTOs - QueryFilter and QueryFilterCondition.
QueryFilter
QueryFilter represents a name and a value. This is used to filter resultsets based on the name of a field and the expected value in the field. The QueryFilter accepts strongly typed primitive types as values.
QueryFilterCondition
A QueryFilterCondition is a QueryFilter plus a comparison operator. For more information on which expressions to use, click here.
The TECHIS.Cloud.ActivityMetrics.AzureTable package is the Microsoft Azure Table API implementation of the Activity Metrics interface.
The TECHIS.Cloud.ActivityMetrics.Reactions package is an implementation of AMS that has been specialized for tracking user reactions in Apps and Web Applications
Tracking boolean or numeric valued activities like reviews, reactions, ratings and scores.
A simple use case is tracking the reactions to a web post - likes, up-votes, down-votes etc. these activities can be track with quantitative qualifiers (e.g., a down-vote can be a -3 instead of just -1).
The activities are stored in an “Activities” table.
Additional processes can then be executed to generate the metrics, for example, counting the number of likes, or the average likes for an area of a website. The generated metrics are stored in the “Metrics” table.