6facts developer guide

If you are a small business or a small workgroup in a bigger organization with no access to IT teams, 6facts is the ideal solution for you. 6facts can be setup very quickly. You can signup for a free account, create an application and a fact table and send data thru REST API and see reports all in less than 30 minutes. All new acounts also get two free hours of consultation from our IT team who can help you setup and customize your first application.

Since 6facts resides in the cloud it takes the burden of maintenance, support, and upgrades away from your teams. 6facts can receive, process, analyze and report all kinds of data including application usage events, transaction events and your legacy data.

Business processes are the activities performed by an employee or customer of your company. These processes represent measurable events, like taking a mock test on your website or invoicing a client from your ERP. Business processes capture or generate unique performance metrics associated with each event. Your applications generate lots of usage data, whether on your website (eg: ecommerce, intranet portal) or on your iPhone/Android app, or desktop (eg: stock trading in excel, POS app in C#).

 These events translate into facts, with each business process represented by a single atomic fact table. Fact data is generated when a process event happens as shown below:

You may also have accumulated lots of data over time thats residing in your database or excel sheet or a text file, which you want to analyze and extract business intelligence.

With 6facts, you can easily capture this data, model into facts and dimensions and send to 6facts using simple HTTP REST api calls.

All you need to do is capture data, send to 6facts using REST api and see the reports in realtime. One simple REST api call will capture a fact by creating one entry into your own customized fact table on the cloud. Entries will be created in the dimension tables if they don't exist. Facts are of daily grain by default. You can have a higher grain of "second", by sending "Time":"HH:mm:ss" in the dimensions list of the api call. 6facts currently supports javascript, jQuery, Excel (VBA), Python and command line tools such as curl. Java, C#,  PHP APIs will follow soon.

To use 6facts, you need to sign up. When you sign up with 6facts, you will be created as a new Publisher. Your email id uniquely maps the Publisher.

6facts design methodology

6facts follows pure dimensional modeling techniques and Kimbal architecture as described by Ralph Kimbal of Kimbal Group. All data is stored in  mySQL database as pure relational tables in a star schema, having fact tables containing measures and attributes. Measures are the values that you measure (example: sale amount, tax, cost). Attributes are foreign keys to the dimension tables. They represent the dimensions for those measures. Group of your fact tables form a data mart and all these data marts make your data warehouse.

Unlike some of the other cloud based BI tools, we DO NOT use data cubes which use multi dimensional databases (MDB). Here is a good article on why the star schema with dimensional modeling is superior to OLAP cubes.

Heirarchy of Publisher, Accounts, Applications and Facts

6facts heirarchy

Every email registered with 6facts maps to a Publisher. Publisher can contain multiple Accounts. Each of these Accounts in turn can have many Applications. An application contains one or more Fact tables. A fact table will contain many facts (or fact data rows). Each of these rows contain fact measures and dimension foreign keys.

Create a new account

All publishers are given one default free account created at the time of sign up. Premium publishers can create additional accounts.

Create a new application

You may want to create a new application before adding fact tables inside that Application. You can also use the default application created at the time of sign up instead.

Create a new 6facts Application


Fact tables

Each business process is represented by a fact table. Once you set up the Application, you are ready to create your fact table inside the application. Before you start creating fact table and start capturing the facts data, you need to model your data into facts and dimensions. The four main decisions to make during the design of a dimensional model are:

  1. Select the business process. Examples:
    •  I want 6facts to capture the business process: "Invoicing my clients"
    • I want to capture all downloads of a PDF on my site.
  2. Declare the grain. Examples:
    • I  want the grain to be atomic transaction grain or in other words I want to capture all invoices as they are made.
    • Or I want to accumulate all sales for a product in a day and use that as my fact. This is periodic snapshot grain where the period is a day.
  3. Identify the dimensions. Example: The following dimensions are important for the Invoicing process events
    • Date
    • Time (Since I can have two invoices in a single day)
    • Location
      • City
      • State
      • Country
    • Customer
      • Key
      • Name
      • Industry
    • Invoice
      • Key
      • Number
      • Revenue Center Name
    • Bank
      • Key
      • Name
      • Address
  4. Identify the facts. Examples:
    • For the Invoicing process (fact table), the fact measures are Invoice amount, Bank Fees, Currency exchange rate etc.
    • Or if I want to capture all downloads of a PDF on my site. There are no measures. Its a  factless fact table.

Types of fact tables supported by 6facts

Create fact table

Create 6facts fact

Setup Fact Measures

Facts contains measures (also known as metrics or values). The numeric measures in a fact table fall into three categories. The most flexible and useful facts are fully additive. Fully Additive measures can be summed across any of the dimensions associated with the fact table. Semi-additive measures can be summed across some dimensions, but not all. Balance amounts are common semi-additive facts because they are additive across all dimensions except time. Finally, some measures are completely non-additive, such as ratios. 6facts currently only supports fully additive measures.With 6facts, you can have upto 5 measures per fact. These measures are of type decimal (10,2) For example, if you are capturing all your invoice data, you can create fact called Invoices and then define a fact measure called Amount. Once you define this Amount measure, you can use it in the API. Example: Fact.Amount = 135.98 . Fact measures can be shown in the reports in various ways.

Basic arithmetic operations that can be performed on these measures in the reports tab. They are: Count, Sum, Average, Min and Max.

Dimensions

Common dimensions (also known as confirmed dimensions)

Common dimensions that are provided out of the box by 6facts are listed below along with their pre defined attributes and types. The default type for all attributes is "string" unless mentioned in brackets.

Common dimensions come with their pre defined attributes (fields or parameters) such as City, State for Location, FirstName, LastName for Person etc. In most cases these pre-defined attributes are enough to capture most types of metrics.

Id, Key are present is all dimensions and function as primary keys. Id is number and Key is a String. These two attributes, if used can help you not to duplicate dimension data.

Customize a common dimension

In some scenarios, you may need additional attributes on the common dimensions. In such cases, you can customize the common dimensions by adding additional custom attributes. These customizations have scope of the Account. All facts in that account have access to these customizations. The custom attributes can be of type String or Number. You can have upto six custom attributes for each of the four common dimensions. The Date and Time dimensions can't be customized. Three custom attributes of type String and another three custom attributes of type Number can be defined using the below form.

Create a custom parameter on a common dimension

Custom dimensions

6facts provides these common dimensions: Date, Time, Location, Product, Person and WebRequest. These pre-defined dimensions (also known as common dimensions) are enough to capture most types of facts. However in some cases, you may need additional dimensions. In such scenarios, you can create new custom dimensions and define attributes on those custom dimensions. The attributes can be of type String or Number. You can have upto nine attributes for each of the custom dimensions. Six attributes of type String and another three attributes of type Number can be defined in  the admin interface. The custom dimensions live in the scope of the Account. A custom dimension that is created in your Account#1 is visible and accesible across all Aplications and Facts belonging to that particular Account#1. A Publisher (defined by login id) can have multiple Accounts. The custom dimensions are not shareable across Accounts.

Create a new custom dimension

Once a custom dimension is created, you need to create attributes for that custom dimension. You need to give a unique name for the attribute, type (String/Number/dateTime) and click on create attribute button.

Create Attributes On Custom Dimension

Creating facts (fact data basically translate to rows in the fact table)

Once a fact table is created and dimensions are finalized, you can insert fact rows into the fact table using the API calls. One simple API call shown below will create one row in the facts table.

Example command line (curl HTTP POST )

curl -i https://6facts.com/ -X POST -d '{"PubId":"yourid-actid-appid", "Fact":"Purchased", "Fact.Amount":45.50, "Fact.Taxes":3.75, "Date": "2016-02-12", "Person.FirstName": "Mark", "Person.LastName": "Thompson", "Person.Email": "Mark@gmail.com", "Person.Gender": "M", "Person.Age": 33, "Person.Salary": 80000, "Person.Industry": "Pharma", "Person.Profession": "VP", "Product.SKU": "IPHN6SPK", "Product.Name": "iPhone Speakers","Product.Manufacturer": "JBL", "Product.Size": "XXL", "Product.Variant": "Special Edition", "Product.Price": "120.50", "Product.Category1": "Accessories", "Product.Category2": "Phone Accessories", "Product.Category3": "Speakers", "Location.Area": "Downtown", "Location.City": "Chicago", "Location.District": "Cook County", "Location.State": "IL", "Location.Region": "Midwest", "Location.Country": "USA" , "Location.Pincode": "60601" }'

Example javascript

sfDataLayer.push({ 'Fact': 'Mock Test Taken', 'Fact.Marks': 92, 'Fact.TimeSpent': 60, 'Fact.Description': 'Mock Test application on mymocktest.co', 'Date': 'YYYY-MM-DD', 'Time': 'HH:mm:ss' 'Person.FirstName': 'Mike', 'Person.LastName': 'Odonnel', 'Person.Gender': 'M', 'Person.Age': 33, 'Person.Salary': 80000, 'Person.Industry': 'Pharma', 'Person.Profession': 'VP',
'MockTest.Key': 'MOC209', 'MockTest.Name': 'Maths Olympiad', 'MockTest.Subject': 'Maths', 'MockTest.Category1': 'Maths', 'Result.Date': '2015-04-24 12.25.45', 'Result.Marks': '1750', 'Result.Percentile': '98.5', 'Location.Area': 'Downtown', 'Location.City': 'Chicago', 'Location.District': 'Cook', 'Location.State': 'IL', 'Location.Region': 'Midwest', 'Location.Country': 'USA', 'Location.Pincode': '60601', });

Rules followed 6facts for creating new facts (fact data rows and dimension data rows)

We follow the essential rules of dimensional modeling compiled by Kimbal group.

For creating fact data

For creating dimension data

In a traditional data warehouse all the dimensions data is loaded one time in a process called ETL, before the first  fact data row is created. In 6facts the dimension data will be created real time along with fact data.

Reports

Once you start collecting your facts, you can login to your dashboard at 6facts.com and produce drill down reports of all your metrics. You can export your reports to PDF, Excel and CSV formats. You can also export your raw data to your inhouse datawarehouse when you have one

6facts reports