function getAvgUserResponseTimesLast30Days(req, res, next) { db.any('select * from avg_user_response_times_30_days') .then(function (data) { res.status(200) .json(data); }) .catch(function (err) { return next(err); }); }
function getIntentsMostUsed(req, res, next) { const bot_id = req.params.bot_id; db.any('select * from intents_most_used where bot_id=$1', bot_id) .then(function (data) { res.status(200) .json(data); }) .catch(function (err) { return next(err); }); }
function getActiveUserCountLast12Months(req, res, next) { db.any('select * from active_user_count_12_months') .then(function (data) { res.status(200) .json(data); }) .catch(function (err) { return next(err); }); }
function getActiveUserCountLast30Days(req, res, next) { db.any('select * from active_user_count_30_days') .then(function (data) { res.status(200) .json(data); }) .catch(function (err) { return next(err); }); }
function getAvgNluResponseTimesLast30Days(req, res, next) { db.any('select * from avg_nlu_response_times_30_days') .then(function (data) { res.status(200) .json(data); }) .catch(function (err) { return next(err); }); }
function getNluParseLogByBot(req, res, next) { const bot_id = req.params.bot_id; db.any('select * from nlu_parse_log where bot_id = $1 order by timestamp desc', bot_id) .then(function (data) { res.status(200) .json(data); }) .catch(function (err) { return next(err); }); }
function getAvgIntentUsageByDay(req, res, next) { db.any('select round(avg(count)) as avg from intent_usage_by_day') .then(function (data) { res.status(200) .json(data); }) .catch(function (err) { return next(err); }); }
function getBotsByIntentConfidencePct(req, res, next) { const bot_id = req.params.bot_id; db.any('select count(*),intent_confidence_pct, bots.bot_id, bots.bot_name from nlu_parse_log, bots, messages ' + ' where messages.bot_id = bots.bot_id and messages.messages_id=nlu_parse_log.messages_id ' + ' and bots.bot_id=$1 group by intent_confidence_pct, bots.bot_id, bots.bot_name ', bot_id) .then(function (data) { res.status(200) .json(data); }) .catch(function (err) { return next(err); }); }