// generic definitions
SET ThousandSep=',';
SET DecimalSep='.';
SET MoneyThousandSep=',';
SET MoneyDecimalSep='.';
SET MoneyFormat='£#,##0.00;-£#,##0.00';
SET TimeFormat='hh:mm:ss';
SET DateFormat='YYYY-MM-DD';
SET TimestampFormat='YYYY-MM-DD hh:mm:ss[.fff]';
SET MonthNames='Jan;Feb;Mar;Apr;May;Jun;Jul;Aug;Sep;Oct;Nov;Dec';
SET DayNames='Mon;Tue;Wed;Thu;Fri;Sat;Sun';
SET HidePrefix = '_';
SET ErrorMode = 2;
// default SmartFilter NoiseLevel variable 0.4
// applies if no dynamic slider is incorporated in the Dashboard
SET vThreshold = '0.4';
// In the case of using the QlikView loading engine to feed Squirro with new data
// input / output data files will be used to export data into a Squirro readable format
// and import it from this file
LET vDataSource = 'DataSources\';
LET vInTickets = '$(vDataSource)tickets\bugzilla.csv';
LET vOutTickets = '$(vDataSource)output\squirro.csv';
LET vOutFingerprintScores  = '$(vDataSource)fingerprints\squirro.csv';
// Export is done via the Qlik "STORE" command (see 02_data.txt)
// ignore https://squirro.com 
LET vCluster = if (vSquirroCluster = 'https://squirro.com', '', '--cluster $(vSquirroCluster)');
// Use the bulk loader executable for importing data into Squirro
LET vSquirroBulkLoader = 'squirro_bulk_loader $(vCluster) -t $(vSquirroToken) $(vLogSettings)bulk.log --project-id $(vSquirroProjectID) $(vMapSettings) $(vTimestampParsing) $(vKeywordSettings) --infile $(vOutTickets) --reset csv';
// Use the bulk scorer executable for exporting SmartFilter scores from Squirro in order to load them into Qlik. This only applies if Qlik data has a foreign key (external_id) in Squirro. 
// Each Squirro item has a rating per SmartFilter and applicable NoiseLevel which is then loaded into a Qlik table(see 03_squirro.txt). This allows to show relevant Squirro items in QlikView 
// according to the choice made in the dashboard (connected by a Qlik "ID" field matching the "external_id" field in the Squirro item).
LET vSquirroBulkScorer = 'squirro_bulk_scorer $(vCluster) -t $(vSquirroToken) $(vLogSettings)score.log --project-id $(vSquirroProjectID) --fingerprint-tags $(vScorerFingerprintTags) --out-file $(vOutFingerprintScores)';
// bulk loader / bulk scorer command-line options
// * use a log file on disk
// * default item mapping
// * date / time parsing of ISO 8601 format
// * data classification according to structured data attributes
// * fingerprints which are tagged with the label "apache"
LET vLogSettings = '-v --log-file $(vDataSource)';
// it is important to specify how the data exported from Qlik maps to Squirro items in order to know the foreign key. 
// (Note: In other cases where data is not loaded into Squirro via QlikView (e.g. web sources) a foreign key may be missing
// which would result in limited dependency/interaction of the Squirro data inside the Qlik dashboard) 
LET vMapSettings = '--map-id id --map-link link --map-created-at ts --map-title title --map-body body';
LET vTimestampParsing = '--created-at-format YYYY-MM-DDTHH:mm:ss';
LET vKeywordSettings = '--map-keyword status GeneralStatus classification resolution priority severity GeneralSeverity';
// When bulk exporting fingerprint scores from Squirro in order to load them into Qlik a tag can be specified which determines
// which of the existing smart filters should be considered. A Squirro project may have a long list of SmartFilters but only some
// may apply for being used in QlikView - this is the way to separate those. 
// Note: the tags must be set on the Squirro side
LET vScorerFingerprintTags = 'apache';

// General Squirro connectivity settings (typically one Squirro project)
// If several Squirro projects are used in the dashboard specify specify all of them in a readable and usable manner
LET vSquirroProjectID = '7sJQVzBdSECah5_ONGtvvg';
LET vSquirroCluster = '';
LET vSquirroToken = '22ce6730d601a705589e637d878355037ddf9b209b12cef5d4abaf457bd5032fdc97f981d4b315d07bbd0c26077d312a4b0030eddb924430718ec4e65d33971f';