<commit_before>var validator = require('validator');

module.exports = function(sequelize, DataTypes) {
    var Visualization = sequelize.define('Visualization', {
        data: 'JSON',
        name: DataTypes.STRING,
        description: DataTypes.TEXT,
        type: DataTypes.STRING,
        images: DataTypes.ARRAY(DataTypes.STRING)
    }, {
        classMethods: {
            associate: function(models) {
                 // associations can be defined here
                 Visualization.belongsTo(models.Session);
            },
            getNamedObjectForVisualization: function(vid, name) {
                name = validator.escape(name);
                return sequelize
                    .query('SELECT data->\'' + name + '\'' + ' AS ' + name + ' FROM "Visualizations" WHERE id=' + vid);
            },

            getNamedObjectAtIndexForVisualization: function(vid, name, index) {
                
                name = validator.escape(name);<commit_msg>add options to data model<commit_after>var validator = require('validator');

module.exports = function(sequelize, DataTypes) {
    var Visualization = sequelize.define('Visualization', {
        data: 'JSON',
        options: 'JSON',
        name: DataTypes.STRING,
        description: DataTypes.TEXT,
        type: DataTypes.STRING,
        images: DataTypes.ARRAY(DataTypes.STRING)
    }, {
        classMethods: {
            associate: function(models) {
                 // associations can be defined here
                 Visualization.belongsTo(models.Session);
            },
            getNamedObjectForVisualization: function(vid, name) {
                name = validator.escape(name);
                return sequelize
                    .query('SELECT data->\'' + name + '\'' + ' AS ' + name + ' FROM "Visualizations" WHERE id=' + vid);
            },

            getNamedObjectAtIndexForVisualization: function(vid, name, index) {
                
                name = validator.escape(name);
{'fraction_non_alphanumeric': 0.11071967790639155, 'fraction_numerical': 0.0, 'mean_word_length': 1.9451851851851851, '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': '7219078', 'n_tokens_mistral': 506, 'n_tokens_neox': 495, 'n_words': 107}