<commit_before>(function(){
    var drawnItems = new L.FeatureGroup();
    var map;
    var geojson = null;
    var results = null;
    var resp;
    var endpoint = 'http://wopr.datamade.us';
    function template_cache(tmpl_name, tmpl_data){
        if ( !template_cache.tmpl_cache ) {
            template_cache.tmpl_cache = {};
        }

        if ( ! template_cache.tmpl_cache[tmpl_name] ) {
            var tmpl_dir = '/js/templates';
            var tmpl_url = tmpl_dir + '/' + tmpl_name + '.html?2';

            var tmpl_string;
            $.ajax({
                url: tmpl_url,
                method: 'GET',
                async: false,
                success: function(data) {
                    tmpl_string = data;
                }
            });

            template_cache.tmpl_cache[tmpl_name] = _.template(tmpl_string);
        }

        return template_cache.tmpl_cache[tmpl_name](tmpl_data);
    }
    var ErrorView = Backbone.View.extend({
        initialize: function(){
            this.render()
        },
        render: function(){
            this.$el.html(template_cache('modalTemplate', this.model));
            this.$el.modal();
            return this;
        }
    });
    var QueryView = Backbone.View.extend({
        initialize: function(){
            this.render()
        },
        render: function(){
            var query = this.attributes.query;
            this.$el.html(template_cache('queryTemplate', {query: query}));
        }
    })
    var ChartView = Backbone.View.extend({
        events: {
            'click .data-download': 'fetchDownload',
        },
        render: function(){
            this.$el.html(template_cache('chartTemplate', this.model));
            return this;
        },
        addData: function(data){
            var el = this.model['el'];
            var name = this.model['objects']['dataset_name'];
            var agg = this.model.query.agg;
            var iteration = this.model.iteration;
            ChartHelper.create(el, name, 'City of Chicago', agg, data, iteration);
        },
        fetchDownload: function(e){
            if ($(e.target).parent().parent().hasClass('detail')){
                var path = 'detail';
            } else {
                var path = 'master';
                this.model.query['dataset_name'] = $(e.target).attr('id').split('-')[0];
                this.model.query['datatype'] = $(e.target).attr('id').split('-')[1];
            }
            var url = endpoint + '/api/' + path + '/?' + $.param(this.model.query);
            window.open(url, '_blank');
        }
    });
    var ExploreView = Backbone.View.extend({
        events: {
            'click .refine': 'refineQuery'
        },
        render: function(){
            var dataset = this.attributes.base_query['dataset_name']
            var self = this;
            $.when(this.getFields(dataset)).then(
                function(fields){
                    self.$el.html(template_cache('exploreForm', {
                        fields: fields
                    }));
                    self.queryView = new QueryView({
                        el: '#query',
                        attributes: {
                            query: self.attributes.base_query
                        }
                    });
                    self.delegateEvents();
                }
            )
            return this;
        },
        refineQuery: function(e){
            var refined = this.$el.find('textarea').val();
            var refined_query = parseParams(refined);
            var query = $.extend(refined_query, this.attributes.base_query);
            var dataset_name = this.attributes.base_query['dataset_name'];
            this.attributes.parent.charts[dataset_name].undelegateEvents();
            this.attributes.parent.charts[dataset_name].$el.empty();
            if (typeof this.refine !== 'undefined'){
                this.refine.undelegateEvents();
                this.refine.$el.empty();
            }
            var self = this;
            this.$el.spin('large');
            $.when(this.getData(query)).then(
                function(data){
                    self.$el.spin(false);<commit_msg>Fixed the fields display<commit_after>(function(){
    var drawnItems = new L.FeatureGroup();
    var map;
    var geojson = null;
    var results = null;
    var resp;
    var endpoint = 'http://wopr.datamade.us';
    function template_cache(tmpl_name, tmpl_data){
        if ( !template_cache.tmpl_cache ) {
            template_cache.tmpl_cache = {};
        }

        if ( ! template_cache.tmpl_cache[tmpl_name] ) {
            var tmpl_dir = '/js/templates';
            var tmpl_url = tmpl_dir + '/' + tmpl_name + '.html?2';

            var tmpl_string;
            $.ajax({
                url: tmpl_url,
                method: 'GET',
                async: false,
                success: function(data) {
                    tmpl_string = data;
                }
            });

            template_cache.tmpl_cache[tmpl_name] = _.template(tmpl_string);
        }

        return template_cache.tmpl_cache[tmpl_name](tmpl_data);
    }
    var ErrorView = Backbone.View.extend({
        initialize: function(){
            this.render()
        },
        render: function(){
            this.$el.html(template_cache('modalTemplate', this.model));
            this.$el.modal();
            return this;
        }
    });
    var QueryView = Backbone.View.extend({
        initialize: function(){
            this.render()
        },
        render: function(){
            var query = this.attributes.query;
            this.$el.html(template_cache('queryTemplate', {query: query}));
        }
    })
    var ChartView = Backbone.View.extend({
        events: {
            'click .data-download': 'fetchDownload',
        },
        render: function(){
            this.$el.html(template_cache('chartTemplate', this.model));
            return this;
        },
        addData: function(data){
            var el = this.model['el'];
            var name = this.model['objects']['dataset_name'];
            var agg = this.model.query.agg;
            var iteration = this.model.iteration;
            ChartHelper.create(el, name, 'City of Chicago', agg, data, iteration);
        },
        fetchDownload: function(e){
            if ($(e.target).parent().parent().hasClass('detail')){
                var path = 'detail';
            } else {
                var path = 'master';
                this.model.query['dataset_name'] = $(e.target).attr('id').split('-')[0];
                this.model.query['datatype'] = $(e.target).attr('id').split('-')[1];
            }
            var url = endpoint + '/api/' + path + '/?' + $.param(this.model.query);
            window.open(url, '_blank');
        }
    });
    var ExploreView = Backbone.View.extend({
        events: {
            'click .refine': 'refineQuery'
        },
        render: function(){
            var dataset = this.attributes.base_query['dataset_name']
            var self = this;
            $.when(this.getFields(dataset)).then(
                function(fields){
                    self.$el.html(template_cache('exploreForm', {
                        fields: fields.objects
                    }));
                    self.queryView = new QueryView({
                        el: '#query',
                        attributes: {
                            query: self.attributes.base_query
                        }
                    });
                    self.delegateEvents();
                }
            )
            return this;
        },
        refineQuery: function(e){
            var refined = this.$el.find('textarea').val();
            var refined_query = parseParams(refined);
            var query = $.extend(refined_query, this.attributes.base_query);
            var dataset_name = this.attributes.base_query['dataset_name'];
            this.attributes.parent.charts[dataset_name].undelegateEvents();
            this.attributes.parent.charts[dataset_name].$el.empty();
            if (typeof this.refine !== 'undefined'){
                this.refine.undelegateEvents();
                this.refine.$el.empty();
            }
            var self = this;
            this.$el.spin('large');
            $.when(this.getData(query)).then(
                function(data){
                    self.$el.spin(false);
{'fraction_non_alphanumeric': 0.13482746353610814, 'fraction_numerical': 0.000711490572749911, 'mean_word_length': 1.5093722106515919, 'pattern_counts': {'":': 0, '<': 3, '<?xml version=': 0, '>': 3, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 6, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '4344413', 'n_tokens_mistral': 2290, 'n_tokens_neox': 2213, 'n_words': 396}