<commit_before>'use strict';

const Promise = require('promise');
const cassandraConnector = require('../../clients/cassandra/CassandraConnector');
const featureServiceClient = require('../../clients/locations/FeatureServiceClient');
const { tilesForBbox, parseTimespan, parseFromToDate, withRunTime, toPipelineKey, toConjunctionTopics } = require('../shared');
const { makeSet, makeMap, makeMultiMap } = require('../../utils/collections');
const { trackEvent } = require('../../clients/appinsights/AppInsightsClient');

/**
 * @param {{site: string, fromDate: string, toDate: string, sourceFilter: string[]}} args
 * @returns {Promise.<{runTime: string, edges: Array<{name: string}>}>}
 */
function terms(args, res) { // eslint-disable-line no-unused-vars
  return new Promise((resolve, reject) => {
    const query = `
    SELECT topic
    FROM fortis.watchlist
    `.trim();

    const params = [
    ];

    cassandraConnector.executeQuery(query, params)
    .then(rows => {
      const topics = makeSet(rows, row => row.topic);
      const edges = Array.from(topics).map(topic => ({name: topic}));

      return {
        edges
      };
    })
    .catch(reject);
  });
}

/**
 * @param {{site: string}} args
 * @returns {Promise.<{runTime: string, edges: Array<{name: string, coordinates: number[]}>}>}
 */
function locations(args, res) { // eslint-disable-line no-unused-vars
  return new Promise((resolve, reject) => {
    if (!args || !args.site) return reject('No site specified for which to lookup locations');

    const query = `
    SELECT geofence
    FROM fortis.sitesettings
    WHERE sitename = ?
    `.trim();

    const params = [
      args.sitename
    ];

    cassandraConnector.executeQuery(query, params)
    .then(rows => {
      if (!rows || !rows.length) return reject(`No geofence configured for site ${args.site}`);
      if (rows.length > 1) return reject(`More than one geofence configured for site ${args.site}`);
      if (!rows[0].geofence || rows[0].geofence.length !== 4) return reject(`Bad geofence for site ${args.site}`);<commit_msg>Fix value not being returned<commit_after>'use strict';

const Promise = require('promise');
const cassandraConnector = require('../../clients/cassandra/CassandraConnector');
const featureServiceClient = require('../../clients/locations/FeatureServiceClient');
const { tilesForBbox, parseTimespan, parseFromToDate, withRunTime, toPipelineKey, toConjunctionTopics } = require('../shared');
const { makeSet, makeMap, makeMultiMap } = require('../../utils/collections');
const { trackEvent } = require('../../clients/appinsights/AppInsightsClient');

/**
 * @param {{site: string, fromDate: string, toDate: string, sourceFilter: string[]}} args
 * @returns {Promise.<{runTime: string, edges: Array<{name: string}>}>}
 */
function terms(args, res) { // eslint-disable-line no-unused-vars
  return new Promise((resolve, reject) => {
    const query = `
    SELECT topic
    FROM fortis.watchlist
    `.trim();

    const params = [
    ];

    cassandraConnector.executeQuery(query, params)
    .then(rows => {
      const topics = makeSet(rows, row => row.topic);
      const edges = Array.from(topics).map(topic => ({name: topic}));

      resolve({
        edges
      });
    })
    .catch(reject);
  });
}

/**
 * @param {{site: string}} args
 * @returns {Promise.<{runTime: string, edges: Array<{name: string, coordinates: number[]}>}>}
 */
function locations(args, res) { // eslint-disable-line no-unused-vars
  return new Promise((resolve, reject) => {
    if (!args || !args.site) return reject('No site specified for which to lookup locations');

    const query = `
    SELECT geofence
    FROM fortis.sitesettings
    WHERE sitename = ?
    `.trim();

    const params = [
      args.sitename
    ];

    cassandraConnector.executeQuery(query, params)
    .then(rows => {
      if (!rows || !rows.length) return reject(`No geofence configured for site ${args.site}`);
      if (rows.length > 1) return reject(`More than one geofence configured for site ${args.site}`);
      if (!rows[0].geofence || rows[0].geofence.length !== 4) return reject(`Bad geofence for site ${args.site}`);
{'fraction_non_alphanumeric': 0.1633437424933942, 'fraction_numerical': 0.0019216910881575786, 'mean_word_length': 3.6577181208053693, 'pattern_counts': {'":': 0, '<': 11, '<?xml version=': 0, '>': 25, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '2544923', 'n_tokens_mistral': 1259, 'n_tokens_neox': 1238, 'n_words': 317}