“Rabbit Data Intelligence” Documentation by “Fabio Covolo Mazzo” v1.0


“Rabbit Data Intelligence”

Created: 08/02/2016
By: Fabio Covolo Mazzo
Email: fabiomazzo@gmail.com

Thank you for purchasing my CodeCanyon Item. If you have any questions that are beyond the scope of this help file, please feel free to email via my user page contact form here. Thanks so much!


Table of Contents

  1. Introduction
  2. How does it work
  3. Requirements
  4. Supported Data Repositories
  5. Package Content
  6. Install on Xampp/Uwamp
  7. Install on Cpanel
  8. Install on Apache Server
  9. Configuration
  10. Default username and password
  11. Jobs
  12. DataLoaders
  13. Dashboards

A) Introduction - top

Rabbit Data Intelligence is a PHP platform to load and show data from several data sources, you can read data from any relational database supported by PHP PDO (SqLite, MySQL, Postgres, Oracle, SQL Server, etc.), MongoDB Database and others with a little customization (Details in Extending Data Loader Interface)


B) How does it work - top

The functioning is simple, the Rabbit Data Intelligence reads data periodically from a source of data, stores it in a repository, and makes them available to their Dashboards. That way you can have fast reports and dashboards without the need for constant consultation to the database. If you are developing software and use the Rabbit Data Intelligence to create reports for a user, you will see that access is simple and uncomplicated.

Of course, to create queries, some technical knowledge is required, but the Rabbit Data Intelligence makes it simpler for you. Their only concern is write the query and create dashboard layout,the Rabbit Data Intelligence cares the rest.

The intelligence of the Rabbit is made up of the following main components:

  1. Data Loaders
  2. Jobs
  3. Dashboards

Data Loader is responsible for connect to the database, perform the query, transform data, store it in a configured repository and make available for inspection.

Jobs is responsible for running all dashboards associated with it, consider a job as a data loaders group available to be run. You can run a job from the command line or include IN the cron-job to fire periodically. See how here.

Dashboards is responsible for parse the layout and presents the data to the user.


C) Requirements - top

Rabbit Data Intelligence is developed with the PHP and CodeIgniter Framework version 3.0.1 and it has been tested in PHP versions 5.6+ and 7+

Recommended Environment: - The Rabbit Rabbit Intelligence was very well tested in this environment

  1. Apache Server
  2. PHP 5.6+ or PHP 7+
  3. MySQL 5.6+

Other databases can be used, but is not officially supported, all compatible CodeIgniter databases are technically compatible, but maybe some adaptation in the build script is required.


D) Supported Repositories - top

By default, all data loaded from the data sources are stored in the file system, works like a cache and the Rabbit Data Intelligence not have to always get same data from data source that maybe cannot be available at that time. Usually, using the file system for this purpose is fast enough, especially if you use an SSD drive. But if you want a faster solution, or your disk is not fast enough, or simply you do not have access to the disk, you can choose other alternatives, Rabbit Data Intelligence have a following drivers to write data:

  1. Files (default option)
  2. Leveldb
  3. Memcache
  4. Sqlite
  5. Mongodb Legacy
  6. Mongodb
  7. Predis
  8. Redis
  9. Ssdb

E) Package Content - top

When you unzip the package you'll se the following folder structure:

  1. documentation (this documentation)
  2. build (the source code the be deployed in a webserver)
  3. database (Database creation script)
  4. datasample (a single Sqlite with a sample data that you can use for testing purposes)

F) Install on Xampp - top

Unzip all folders and files included in package file using a zip program (7-Zip, WinZip, WinRar, etc.). you will see the package contents.

Then follow this steps:

  1. Create a new folder in htdocs folder (or www folder in Uwamp). Example: rabbitdataintelligence
  2. Copy all content in build folder to this new folder. (don't copy entire build folder, only content inside)
  3. Start Xampp or Uwamp
  4. Open PhpMyAdmin in your browser (http://localhost/phpmyadmin in Xampp or http://localhost/mysql in Uwampp)
  5. Login with your MySQL Credentials (default user/password in Xampp and Uwamp is: root/root
  6. Click in New link on left menu and choose a database name (Ex: rabbitdata) and choose a Collation (recommended collation is utf8_general_ci) and click in create
  7. You will redirect to the manager screen of new database, then click in SQL tab, copy and paste content from database.sql in database folder and click in run go

After run script on PhpMyAdmin you will see the following screen:

successfully database creation

G) Install on Cpanel - top

If you have a Cpanel account in any hosting provider, following this steps:

  1. Unzip all folders and files included in package file using a zip program (7-Zip, Winzip, Winrar, etc). you will see the package contents.
  2. Connect via FTP using a FTP Program like a FileZilla and create a folder in public_html or use public_html if you can publish Rabbit Data Intelligence in Website root.
  3. Send all content in build folder to this new folder via FTP)
  4. Go in MySQL Databases, type a name that you want for new database and click in Create Database
  5. Click in go-back, scroll-down the page to the Add New User, choose a name and password and click in Create User
  6. Click in go-back again, scroll-down the page to the Add User To Database, choose a Select the user and database that you have created and click in Add
  7. Check All Privileges and click in Make Changes
  8. Open PhpMyAdmin in Home of CPanel
  9. Click in database that you have created in left menu
  10. You will redirect to the manager screen of new database, then click in SQL tab, copy and paste content from database.sql in database folder and click in run go

H) Install on Apache Server - top

Install on Apache Server/MySQL is very similar to installation on Xampp, follow this steps, the only difference is that you will not have a PhpMyAdmin installation by default. You can install PhpMyAdmin or download a tool to create the database.


I) Configuration - top

Application configuration process is very simple you must alter following files:

application\config\database.php - Database configuration In this file you will define the following variables:

  1. hostname (MySQL Hostname - if is in same machine use: localhost)
  2. username (MySQL Username - if using default Xampp installation in development mode is root)
  3. password (MySQL Password)
  4. database (MySQL Database name - You chose in the previous steps)

Example of database configuration:

successfully database creation

application\config\config.php - General Configuration and Data Repository Configuration

If you want keep cache in files, only configure the "base_url" variable, just ignore others configurations

In this file you will define the following variables:

  1. $config['base_url'] (Base URL of installation. Ex: http://localhost/rabbitdataintelligence)
  2. $config['cache_instance_type'](Instance type of cache repository, se all supported types here)

Example of database configuration:

successfully database creation

After this, add or alter (if exists) a variable config of chosen drive cache_instance_type. The variable is formed by name of drive (case-sensitive) + "cache_config".

Examples of cache_config per instance:

files

$config['files_cache_config'] = array('path' => FCPATH . DIRECTORY_SEPARATOR . 'cache');

Mongodb

$config['Mongodb_cache_config'] = array('host' => '127.0.0.1' /*, 'username'=> '', 'password' => ''*/); // (if your MongoDb instance don't have a authentication, comment username and password in array, don't pass blank passwords)

Memcache

$config['Memcache_cache_config'] => array(array(/*Host Ip*/ '127.0.0.1', /* Port */11211, /* Number of instances */ 1), /* if number of instances is greater than one, add a corresponding number of array with a config */ array("new.host.ip",11211,1))

Redis

$config['Redis_cache_config'] => array('host' => '127.0.0.1' 'port' =>'6380 ', 'username'=> '', 'password' => '', /* In seconds */'timeout' => '');

Predis

$config['Predis_cache_config'] => array('host' => '127.0.0.1' 'port' =>'6380 ', 'username'=> '', 'password' => '', /* In seconds */'timeout' => '');

Leveldb

$config['Leveldb_cache_config'] = array('path' => 'filenameOfLevelDbWithoutDatabaseExtension');

Sqlite

$config['SqlLite_cache_config'] = array('path' => 'filenameOfSqlliteWithoutDatabaseExtension');

Ssdb

$config['ssdb_cache_config'] => array('host' => '127.0.0.1' 'port' =>'6380 ', 'username'=> '', 'password' => '', /* In seconds */'timeout' => '');


J) Default username and password - top

The default username is admin and password is 123456


K) Jobs - top

Jobs run all associated Data Loaders via CLI command line or via cron-tab. if you want run via browser, you must run each data loader in data loader edit

Command is simple: php index.php job_runner run_job nameOfYourJob

The index.php file is the main index.php located in root folder of Rabbit Data Intelligence installation. The expected result is: Job run result

You can't add the command to cron-tab of your server, for this consult documentation of your server. If you use cpanel you can check documentation here


L) Dataloaders - top

DataLoaders read data from any supported data source, transform and save in a repository. If any problem occurs, error will be writed in Log (accessible in Left Menu).

Choose a type of DataLoader (Relational Database or MongoDB), provided a name, username and password and fill this fields:

Connection String

For relational databases use DSN, you can view more details in PDO documentation here

DSN examples:

  1. Mysql: "mysql://username:password@localhost:3306/databasename";
  2. Postgres: "pgsql:host=localhost;port=5432;dbname=databasename;user=username;password=password";
  3. Sqlite: "sqlite:/opt/databases/filename.sq3"
  4. Oracle: "oci:dbname=//localhost:1521/mydb"

For MongoDb instances use URI, you can see details in MongoDb official documentation here

Example: mongodb://db1.example.net,db2.example.net:2500/?replicaSet=test

Query

For relational databases use SQL compatible with your database that's returns any value our values.

Example: "SELECT CITY, count(SALES) as SALES_PER_CITY from sales GROUP BY CITY"

For MongoDb use aggregate: (Important: use keys with quotes, a PHP MongoDb driver don't work with keys without quotes).

Example:

{ "aggregate": "teste",
     "pipeline": [
                 { "$project": { "name": 1 } },
                 { "$unwind": "$name" },
                 { "$group": {
                             "_id": "$name",
                             "count": { "$sum" : 1 }
                           }
                 }
               ]
   }

Transformation (optional)

Your transformation code must be in PHP without "". The object will be returned by query and passed to the transformation code scope with name $dataObject. Just, make the transformations in this object. The object will be saved with transformations.

Expiration Time

0 for never expire or a Number in Seconds (after this time, your data will be obsolete and a new load will be necessary.

After the DataLoader runs, you can inspect loaded data:

Data inspector

M) Dashboards - top

Dashboard supports full Twig 1.2.4 language (excepts include or other file manipulations). Dashboard have a specific functions too:

Box

Dashboard Box Open dashboard box with default md size: '{{'label_of_box'|openbox}}' or specify size: '{{'label_of_box'|openbox('xs')}}' Close dashbord box (You can use a empty string in left side or use a same label to identify better which openbox this close functions is closing: '{{''|closebox}]}' or '{[{'label_of_box'|closebox}}'

Box Example

Chart

Rabbit Data Intelligence have a simple command to create a EChart, you just use the following expression: uniqueIdOfElementInDashBoard|createchart(Title, Legend, xAxis, yAxis, [[nameOfSerie, type, [data]] ]

In the first part of expression put unique id of element in Dashboard, after pipe "|" call a createChart function passing Title, Legend Elemnts, xAxis Values, yAxis Values and a array with series and data. It may seem complicated at first glance, but it is a helper that receives the data in much the way that Echart gets, you can see more details in his documentation here:here

Example:

{{'sales'|createchart('My Cool Chart', ['Sales','Product Inquiries'],
                        ["shirt","cardign","chiffon shirt","pants","heels","socks"],[],
                        [{name:'Sales', type:'bar' ,data:[5, 20, 36, 10, 10, 20]},{name:'Product Inquiries', type:'line' ,data:[200, 100, 300, 1050, 600, 700]}])}}

Fabio Covolo Mazzo

Go To Table of Contents