Secure your code as it's written. Use Snyk Code to scan source code in minutes - no build needed - and fix issues immediately.
create: function _CDPB_create(storageBackend) {
let node = createNode({
identifier: "interestDashboardDataProcessorBolt",
listenType: "chartData",
emitType: "interestDashboardData",
_daysPostEpochToDate: function(dayCount) {
return parseInt(dayCount) * 24 * 60 * 60 * 1000;
},
ingest: function _HSB_ingest(message) {
DataProcessorHelper.initChartInStorage("interestDashboardData", this.storage);
/* Processing data for pie chart. */
let interestDashboardTypeNamespace = message["keywords"]["58-cat"];
let chartData = [];
for (let interestData of interestDashboardTypeNamespace.sortedInterests) {
create: function _SDPB_create(storageBackend) {
let node = createNode({
_spiderInput: {"children": {}, "weight": 100},
NUM_NODES_PER_LAYER: 4,
identifier: "spiderDataProcessorBolt",
listenType: "chartData", // Can also listen to other chart data processors
emitType: "spiderData",
_getRadius: function(isToplevel, parentRadius) {
if (!isToplevel) {
return parentRadius / 3.5; // A subcat should be 3.5 times smaller than its parent.
}
// For demo purposes, generate a random number of recommendations between 1-50.
let recommendationCount = Math.floor(Math.random() * 50) + 1;
let radius = 0;
if (recommendationCount <= 10) {
create: function _TDPB_create(storageBackend) {
let node = createNode({
identifier: "areaDataProcessorBolt",
listenType: "chartData", // Can also listen to other chart data processors
emitType: "areaData",
_daysPostEpochToDate: function(dayCount) {
return parseInt(dayCount) * 24 * 60 * 60 * 1000;
},
ingest: function _HSB_ingest(message) {
DataProcessorHelper.initChartInStorage("areaData", this.storage);
let areaTypeNamespace = message["keywords"]["58-cat"];
let chartJSON = [];
let top = areaTypeNamespace.sortedInterests.slice(0, 6);
let topInterests = top.map(interest => {
return interest.name;
create: function _WIDPB_create(storageBackend) {
let node = createNode({
identifier: "weightIntensityDataProcessorBolt",
listenType: "chartData", // Can also listen to other chart data processors
emitType: "weightIntensityData",
ingest: function _HSB_ingest(message) {
DataProcessorHelper.initChartInStorage("weightIntensityData", this.storage);
DataProcessorHelper.iterateOverTypeNamespace(message, this.storage.chartData.weightIntensityData, (message, storedData) => {
// pointToInterestsMap is used to make up for a bug in nvd3 where multiple points can't
// appear in the same location.
let pointToInterestsMap = {};
let values = [];
storedData["xMin"] = message.xMin;
storedData["yMin"] = message.yMin;
storedData["xMax"] = message.xMax;
storedData["yMax"] = message.yMax;
create: function _TDPB_create(storageBackend) {
let node = createNode({
identifier: "timelineDataProcessorBolt",
listenType: "chartData", // Can also listen to other chart data processors
emitType: "timelineData",
ingest: function _HSB_ingest(message) {
DataProcessorHelper.initChartInStorage("timelineData", this.storage);
DataProcessorHelper.iterateOverTypeNamespace(message, this.storage.chartData.timelineData, (message, storedData) => {
let chartJSON = [];
let interestList = Object.keys(message.categories);
for (let i = 0; i < interestList.length; i++) {
let dataPoints = message.categories[interestList[i]].days;
chartJSON.push({
key: interestList[i],
values: Object.keys(dataPoints).map(key => {
dataPoints[key]["y"] = i;
return dataPoints[key];
})
create: function _IIDPB_create(storageBackend) {
let node = createNode({
identifier: "intentInterestDataProcessorBolt",
listenType: "chartData", // Can also listen to other chart data processors
emitType: "intentInterestData",
ingest: function _HSB_ingest(message) {
DataProcessorHelper.initChartInStorage("intentInterestData", this.storage);
DataProcessorHelper.iterateOverTypeNamespace(message, this.storage.chartData.intentInterestData, (message, storedData) => {
storedData["sortedInterests"] = [];
storedData["sortedIntents"] = [];
for (let intentData of message.sortedIntents.splice(0, 10)) {
let maxWeightDate = intentData.maxWeightDate;
let domainList = intentData.days[maxWeightDate]["domainList"];
let maxIntentDate = (new Date(intentData.days[maxWeightDate]["x"])).toLocaleDateString();
let title = intentData.name + " (" + maxIntentDate + ")";
let chartJSON = IntentInterestDataProcessorBolt._createChartData(domainList, storedData, "sortedIntents", title);
}
create: function _DIS_create(storageBackend) {
let node = createNode({
identifier: "dailyInterestsSpout",
listenType: "interest",
emitType: "dailyInterests",
init: function _DIS_init() {
if (!this.storage.dayBufferInterests) {
this.storage.dayBufferInterests = {};
}
},
getInterests: function _DIS__getInterests() {
return this.storage.dayBufferInterests;
},
_storeInterest: function _DIS__storeInterest(host, visitIDs, visitDate, visitCount, namespace, type, interest, subcat) {
if (!this.storage.dayBufferInterests[visitDate]) {
create: function _DCRB_create(namespace, type, storageBackend) {
let capitalizedType = type.charAt(0).toUpperCase() + type.slice(1);
let node = createNode({
identifier: namespace+capitalizedType+"Ranker",
listenType: "dailyInterests",
namespace: namespace,
type: type,
storageKey: "daycount_" + namespace + "_" + type,
emitType: null,
init: function _DIR_init() {
if (!this.storage.ranking) {
this.storage.ranking = {};
}
if (!this.storage.ranking[this.storageKey]) {
this.storage.ranking[this.storageKey] = {};
}
this.interests = this.storage.ranking[this.storageKey];
},
create: function _CDPB_create(storageBackend) {
let node = createNode({
identifier: "chartDataProcessorBolt",
listenType: "dailyInterests",
emitType: "chartData",
ingest: function _HSB_ingest(message) {
try {
this.debugReport.push("~*~* chartDataProcessorBolt ingest() start *~*~");
DataProcessorHelper.initChartInStorage("genericChartData", this.storage);
let storageData = this.storage.chartData.genericChartData;
let days = Object.keys(message);
this.debugReport.push("Processing chart data for " + days.length + " days: [" + days.toString().replace(/,/g, '; ') + "]");
for (let day in message) {
for (let type in message[day]) {
for (let namespace in message[day][type]) {
if (!storageData[type]) {
storageData[type] = {};
}
create: function _HSB_create() {
let node = createNode({
identifier: "hostStripBolt",
listenType: "dailyInterests",
emitType: "hostlessInterests",
ingest: function _HSB_ingest(message) {
for (let timeKey in message) {
let period = message[timeKey];
for (let typeKey in period) {
let type = period[typeKey];
for (let nsKey in type) {
let namespace = type[nsKey];
for (let interestKey in namespace) {
let interest = namespace[interestKey];
let counts = [];
for (let hostKey in interest) {
counts.push(interest[hostKey]);
}