<commit_before>//
//  Author: <NAME> <EMAIL>
//  backendjs 2018
//

var path = require('path');
var util = require('util');
var fs = require('fs');
var http = require('http');
var url = require('url');
var bkjs = require('backendjs');
var db = bkjs.db;
var api = bkjs.api;
var app = bkjs.app;
var ipc = bkjs.ipc;
var msg = bkjs.msg;
var core = bkjs.core;
var lib = bkjs.lib;
var logger = bkjs.logger;

// Account management
var mod = {
    name: "bk_data",
    controls: {
        region: { type: "string" },
    },
};
module.exports = mod;

// Create API endpoints and routes
mod.configureWeb = function(options, callback)
{
    api.registerControlParams(mod.controls);
    this.configureDataAPI();
    callback()
}

// API for full access to all tables
mod.configureDataAPI = function()
{
    var self = this;

    // Return table columns
    api.app.all(/^\/data\/columns\/?([a-z_0-9]+)?$/, function(req, res) {
        var options = api.getOptions(req);
        if (req.params[0]) {
            return res.json(db.getColumns(req.params[0], options));
        }
        // Cache columns and return, only the current region
        delete options.region;<commit_msg>data search<commit_after>//
//  Author: <NAME> <EMAIL>
//  backendjs 2018
//

const bkjs = require('backendjs');
const db = bkjs.db;
const api = bkjs.api;

// Account management
var mod = {
    name: "bk_data",
    controls: {
        region: { type: "string" },
        pool: { type: "string" },
    },
};
module.exports = mod;

// Create API endpoints and routes
mod.configureWeb = function(options, callback)
{
    api.registerControlParams(mod.controls);
    this.configureDataAPI();
    callback()
}

// API for full access to all tables
mod.configureDataAPI = function()
{
    // Return table columns
    api.app.all(/^\/data\/columns\/?([a-z_0-9]+)?$/, function(req, res) {
        var options = api.getOptions(req);
        if (req.params[0]) {
            return res.json(db.getColumns(req.params[0], options));
        }
        // Cache columns and return, only the current region
        delete options.region;
{'fraction_non_alphanumeric': 0.15741626794258373, 'fraction_numerical': 0.007655502392344498, 'mean_word_length': 2.7743682310469313, 'pattern_counts': {'":': 0, '<': 7, '<?xml version=': 0, '>': 7, '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': '1157018', 'n_tokens_mistral': 699, 'n_tokens_neox': 684, 'n_words': 181}