Business Intelligence in Ruby (Blazer Gem)

 tudip-logo

Tudip

10 February 2020

No matter what kind of online business you run, you might collect some data. To be honest we have a tendency to collect and store additional and additional information these days. The problem is that nearly nobody understands collected information and it can not be wont to build higher business choices.

The reason is simple. Database tables are hard to read. It is not easy to see trends and make assumptions based on the raw table view.

You can feel you need a data expert to obtain a useful knowledge of your data. It is not true. You just have to be compelled to see it in an exceedingly new manner. Visualize it to assist you perceive what’s hidden within the information.

You might find yourself writing SQL queries and custom dashboard for your business team. It’s a good starting point, but sooner or later things will get difficult to maintain.

Business Intelligence: Meaning and Scope

Bussiness_Intellidence_1

Business Intelligence (BI) in the simplest way is analyzing organizational raw data to support decision-making processes. Business Intelligence (BI) encompasses a company’s activities, applications, tools, and strategies to analyze information to run its business. Often software-driven, business intelligence solutions flip data into helpful info that helps businesses build choices and improve performance.

Business intelligence (BI) represents the tools and systems that play a vital role in the strategic planning process within a corporation. These BI systems allow a corporation to collect, store, access and analyze corporate data to aid in decision-making.

Smaller organizations are unit additional probably to travel for Business Intelligence solutions for everyday tasks like time pursuit or leave management. On the other hand, larger organizations would like dashboards to give a better and more graphical view of their pipeline of opportunity and help managers by suggesting better allocations of sales resources.

Business Intelligence solutions give current, historical, and predictive views of internally structured data for products and departments by establishing more effective decision-making and strategic operational insights.

Business Intelligence has many business benefits:

  • Helps within the measuring of performance and benchmarking progress toward business goals.
  • The quantitative analysis is initiated through predictive analysis, predictive modeling, business process modeling and statistical analysis.
  • Facilitates coverage of departmental/divisional and enterprise views of information visual image.
  • Identifies and creates insights and experiences for learning management and restrictive compliance through information management programs.

Business Intelligence Software

Business intelligence software is designed with the primary goal of extracting necessary knowledge from an organization’s raw data to reveal insights to assist a business create quicker and a lot of correct choices. The software generally integrates information from across the enterprise and provides end-users with self-service coverage and analysis. BI software uses a variety of analytics options as well as statistics, information and text mining and prophetical analytics to reveal patterns and switch info into insights.

We have some free gems in the world of rails that can be useful. Like administrate or active_admin. They can display data on a nice table. You can use filters and search on them. But that is basically all. The work with data can be a bit easier, but still quite hard.

Blazer

Blazer – a gem that makes business intelligence simple.It allows you to execute SQL queries on your database from the web panel and visualize the data in a convenient and clear way. If you are not good at SQL you can ask your dev team to write some fundamental queries. Save them and use them on your own.

Another cool and useful blazer’s features are:

  • Checking for anomalies in knowledge – to allow you to apprehend (by email for example) if there is something wrong with new data you’re assembling
  • Works with many data sources. You make your queries with SQL thus it looks familiar and it works fine with most popular SQL-based databases (like Postgres, MySQL or SQL server). What is a lot of attention-grabbing there’s conjointly support for MongoDB or ElasticSearch!

Installation

Let’s see blazer in action. You can install it in normal rails manner by adding it to GemfileBussiness_Intelligence_2

and then run:Bussiness_Intelligence_3

Finally, you should mount Blazer in your routes.rb:Bussiness_Intelligence_4

As you could see in your project, the generator of gem added two files:

  • db/migrate/XXXXXXXXXXXX_install_blazer.rb
    queries are stored in the database, so you need to create a few additional tables.
  • config/blazer.yml
    config file for Blazer.

Blazer tries to protect against queries which modify data (by running each query in a transaction and rolling it back), but a safer approach is to use a read only user.

Make it secure

Without authorization, every visitor will be able to select any piece of information from your database — including such sensitive data as a combination of email and encrypted password.

You must be aware that using tools like Blazer always creates the additional attack vector and it is your responsibility to secure and test your web app well.

Bussiness_Intelligence_5-1024x445

To make sure the data is secure, We can implement following things:

  • Create a database user with only SELECT privilege and place its URL on the server as BLAZER_DATABASE_URL environment variable (default blazer configuration).Bussiness_Intelligence_6
  • Keep in mind that everyone who can access Blazer also has access to each table in a database. If you want to keep in secret specific columns (for example auth tokens that can be used to take over user account), please follow these instructions.
  • The default authorization of Blazer (before action::authenticate!) is not enough! If something goes wrong (e.g. typo), the gem will not send you any feedback. Devise Authentication Routing Constraints return 404 for the authenticated user— that’s pretty neat! Still not satisfied? You can prohibit /blazer access to office IP address.Bussiness_Intelligence_7

This is just an introduction to the basic usage of the Blazer gem. If you want to learn more about it, please refer below links:

Request a quote