<commit_before>'use strict';

const pkg = require(require('path').join(process.cwd(), 'package.json'));
const config = require('turing-config');
const getAggregatedStatus = require('./statusHelper').getAggregatedStatus;
const os = require('os');

module.exports = (() => {
  const statusDetails = {};

  // TODO: Add validation for status OK, WARNING, ERROR and having a message
  // TODO: Switch to event based status updating
  function addStatusDetail(name, statusDetail) {
    statusDetails[name] = statusDetail;
  }

  function getStatus() {
    return {
      application: {
        name: pkg.name,
        description: pkg.description,
        group: config.get('turing:status:application:group'),
        environment: process.env.NODE_ENV,
        version: pkg.version,
        commit: pkg.commit,
        vcsUrl: pkg.repository.url,
        status: getAggregatedStatus(statusDetails),
        statusDetails,
        dependencies: pkg.dependencies,
        versions: process.versions,
        pid: process.pid,
        cwd: process.cwd(),
        applicationUptime: process.uptime(),
        memoryUsage: process.memoryUsage()
      },
      system: {
        hostname: os.hostname(),
        port: config.get('turing:server:port'),
        platform: os.platform(),
        arch: os.arch(),
        release: os.release(),
        systemUpTime: os.uptime(),
        systemTime: new Date().toISOString()
      },
      team: {
        name: config.get('turing:status:team:name'),
        technicalContact: config.get('turing:status:team:contact:technical'),
        businessContact: config.get('turing:status:team:contact:business')
      }
    };
  }

  return {
    addStatusDetail,
    getStatus
  };
})();
<commit_msg>fixed undefined error<commit_after>'use strict';

const pkg = require(require('path').join(process.cwd(), 'package.json'));
const config = require('turing-config');
const getAggregatedStatus = require('./statusHelper').getAggregatedStatus;
const os = require('os');

module.exports = (() => {
  const statusDetails = {};

  // TODO: Add validation for status OK, WARNING, ERROR and having a message
  // TODO: Switch to event based status updating
  function addStatusDetail(name, statusDetail) {
    statusDetails[name] = statusDetail;
  }

  function getStatus() {
    return {
      application: {
        name: pkg.name,
        description: pkg.description,
        group: config.get('turing:status:application:group'),
        environment: process.env.NODE_ENV,
        version: pkg.version,
        commit: pkg.commit,
        vcsUrl: pkg.repository ? pkg.repository.url : '',
        status: getAggregatedStatus(statusDetails),
        statusDetails,
        dependencies: pkg.dependencies,
        versions: process.versions,
        pid: process.pid,
        cwd: process.cwd(),
        applicationUptime: process.uptime(),
        memoryUsage: process.memoryUsage()
      },
      system: {
        hostname: os.hostname(),
        port: config.get('turing:server:port'),
        platform: os.platform(),
        arch: os.arch(),
        release: os.release(),
        systemUpTime: os.uptime(),
        systemTime: new Date().toISOString()
      },
      team: {
        name: config.get('turing:status:team:name'),
        technicalContact: config.get('turing:status:team:contact:technical'),
        businessContact: config.get('turing:status:team:contact:business')
      }
    };
  }

  return {
    addStatusDetail,
    getStatus
  };
})();

{'fraction_non_alphanumeric': 0.13396442914515203, 'fraction_numerical': 0.0, 'mean_word_length': 2.8830734966592426, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 5, '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': '4106009', 'n_tokens_mistral': 993, 'n_tokens_neox': 975, 'n_words': 205}