Providers Metadata¶
ChartFactor handles the data based on specific structures and metadata that is usually provided by the user when the visualization is built (using Attributes, Metrics…) and also by the Data Provider itself. This metadata is mostly related with field types, names, and labels.
This metadata is standard, so it means that no matter what the provider is, a “translation” must be done from the provider metadata to ChartFactor metadata.
Field metadata¶
A field, as ChartFactor understands it, is an object containing the following attributes:
- Name
- Type
- Label
- Function
Note
Please refer to Custom Metadata for examples to update the metadata of your source fields.
Name¶
This is the field identifier, it is what ChartFactor uses to identify a field as unique. It matches with the field name used in the data source. Example: eventid, lastname, pricepaid, saletime, catname.
Type¶
Valid field type values are:
- ATTRIBUTE
- TIME
- INTEGER
- NUMBER
- MONEY
- PERCENT
In general, three major types of fields exist: ATTRIBUTE, TIME, and Metrics.
ATTRIBUTE is used for all varchar, string, boolean and other types that are different from one provider to another. TIME is used for date and datetime fields. Metrics are divided in the following types:
- INTEGER
- NUMBER
- MONEY
- PERCENT
Integers represent non floating numbers. Money and Percent are floating number fields and their goal is to format (visualy) by adding a ($) or (%) to the value. Number is any other numeric field, commoly floating numbers. The purpose of these three types is to target almost all other types like long, int, double, float, etc.. used in different providers and give a way to format them when visualizing.
Label¶
Labels are the “friendly” names for a field. It is meant to be displayed instead of the field name in the visualization. So instead of lastname / pricepaid, we could have Last Name / Price. If a field label is not specified in the metadata definition, ChartFactor capitalizes the first leter of the field name for display purposes.
ChartFactor allows to specify field labels using its custom metadata structure. Additionally, the Raw Data Table allows overwriting field labels using the cf.Field object.
Function¶
This applies to time attributes and metrics. For time attributes, the function is the desired time granularity. For a date field, the lowest unit is DAY, and for datetimes it can be MINUTE or SECOND. Valid values are:
- YEAR
- MONTH
- DAY
- HOUR
- MINUTE
- SECOND
Metrics use this function to know what aggregation should be performed on the provider’s source. Valid values are:
- sum
- avg
- min
- max
- unique
- percentiles