Handling Tabulated Input (CSV Data)

The Kolbert components are aimed to be used for BI and interactive reporting. Thus tabulated data (CSV files also) are a common data input that should be handled correctly. From such consideration, we have enabled these reporting components with a common model for fast and effective CSV analysis. Beyond analyzing columns and rows, the tabulated inputs can be processed in different ways before consumed by the components. Several features and options have been made available to extract or generate the needed information that should be rendered and visualized. Among these operations, we can enumerate :

The following options enables mainly data processing and customization of content to be extracted. While describing these options, we will see how they can enhance :

Let's consider the following CSV sample in our analysis of tabulated data parsing features:

CSV delimiter (csvDelimiter)

The CSV delimiter is the character that delimits two fields.
By default, the csvDelimiter is ";" (with is also the delimiter of our example). It can be modified if the CSV data source is separated by a different delimiter.

Record delimiter (recordDelimiter)

The record Delimiter indicates the delimiter of a field (if it exists). It is generally used when data field content contains CSVDelimiter string as in such situations CSV parsing produces wrong results. By default, the recordDelimiter property is "" and can be modified when needed.

With Headers (withHeaders)

withHeaders property indicates if the first row should be considered as column headers. If set to false, the reference to each column of the parsed csv input is the string representation of its index. This reference is also used as properties for component unit data element (nodes for the Visualizer, TreeMapNode for TreeMap...). In the case where set to true (default case), column headers are the properties of the constructed elements.

FilterPath (filterPath)

The filterPath is the equivalent of the analysisPath property in the Visualizer component.


Unlike Visualizer, the filter path of all other components can have one column reference as they display entities and they don't care about hierarchies.

Merge Descriptor (mergeDescriptor)

This class defines merging tasks that must be applied on the CSV source. In fact, a MergeDescriptor is a set of MergeEntity instances, each one defines columns to be merged in one column according to a merging function. A MergeEntity instance is created by defining :

A MergeEntity is a unit merging task that must be added to the MergeDescriptor to be taken into account using the addMergeDescription(mergeEntity) method. When merging, you can choose between leaving the content of merged columns to be taken into account when performing data processing and adding the merging column or replacing them by the resulting column. This can be accomplished by setting to true or false the leaveMergeColumns of the MergeDescriptor instance.

The following example shows how a MergeDescriptor can be applied to our CSV sample.

var mergeDescriptor:MergeDescriptor=new MergeDescriptor(); 
var mergeEntity:MergeEntity=new MergeEntity(["work_days","total_days"],"holidays",mergeFunction); 

private function mergeFunction(arr:Array):Number
 	return 0;
   return Number(arr[1])-Number(arr[0]);					

Attributes Descriptor (attributesDescriptor)

When manipulating CSV files, some columns are often ignored or non-useful for the current data analysis. Thus, the content of these columns is a junk content and can be source of data overloading especially when manipulating large CSV files. The AttributesDescriptor is a solution for that problem. In fact, for columns defined in the analysis or filter path ( which are parsed as data items), the AttributesDescriptor assigns some column headers to a buildPath column as attributes. Thus, the generated data sets have the selected column headers as properties.
An AttributesDescriptor instance is a set of AttributesEntity instances defining the attributes of the data sets extracted from the buildPath column reference. An AttributesEntity is initialized by defining the column Name (must be a buildPath element) and its attributes array that contains selected column names. In analogy with the MergeDescriptor class, an AttributesEntity must be registered in the AttributesDescriptor using the function addAttributesEntity(attributesEntity).

The following example shows how a AttributesDescriptor can be used (defined after merge).

visualizer.buildPath=["Enterprise", "Name", "Department"];
var attributesDescriptor:AttributesDescriptor=new AttributesDescriptor(); 
var attributesEntity1:AttributesEntity=new AttributesEntity("Enterprise",["Technology","Age"]);
var attributesEntity2:AttributesEntity=new AttributesEntity("Name",["Holidays"]);
var attributesEntity3:AttributesEntity=new AttributesEntity("Department",["Age"]); 

Types Descriptor (typesDescriptor)

The component can recognize by his own the type of columns content if they are standard types. But, in some cases, numbers can refer to IDs and thus cannot be considered as Numbers but as Strings. The Types Descriptor is a Dictionary that allows to assign a Type Class to a given column data and thus giving the developer the possibility to avoid the modification of his data source while feeding the typesDescriptor property by the dictionary that describes well the content of his data source columns.

var typesDescriptor:Dictionary= new Dictionary();

Reporting functions (reportingFunctions)

The reporting functions are an important part of the CSV data analysis. In fact, when building data Items and their corresponding data from a given column (based on a ReducedTable analysis), several rows are grouped into one row and each data field content (attribute column) is grouped in an array. Transforming the data fields arrays into a real data by applying standard or custom functions, can be very important to have correct and coherent data for data items generated from the CSV analysis.
The reportingFunctions property is a Dictionary that assigns to a given column key (column name) its reporting function. This function should accept as parameters an array and a type class (Integer for example).
Actually, there are two standard functions that can be accessed statically from the ReportingUtils class:

var reportingFunctions:Dictionary=new Dictionary();