<commit_before>(function() {
  'use strict';
  angular.module('civic.events')
    .directive('browseGrid', browseGrid)
    .controller('BrowseGridController', BrowseGridController);

  // @ngInject
  function browseGrid() {
    var directive = {
      restrict: 'E',
      replace: true,
      scope: {
        mode: '=',
        page: '='
      },
      templateUrl: 'app/views/browse/directives/browseGrid.tpl.html',
      controller: 'BrowseGridController'
    };
    return directive;
  }

  // @ngInject
  function BrowseGridController($scope,
                                $state,
                                $window,
                                $location,
                                uiGridConstants,
                                Datatables,
                                _) {
    var ctrl = $scope.ctrl = {};

    var pageCount = 25;
    var maxRows = ctrl.maxRows = pageCount;

    // declare ui paging/sorting/filtering vars
    ctrl.mode = $scope.mode;
    ctrl.totalItems = Number();
    ctrl.page = $scope.page;
    ctrl.count= Number();

    ctrl.filters = [];

    if(ctrl.mode !== 'evidence_items' && ctrl.mode !== 'assertions') {
      ctrl.sorting = [{
        field: 'evidence_item_count',
        direction: 'desc'
      }];
    } else {
      ctrl.sorting = [{
        field: 'id',
        direction: 'asc'
      }];
    }

    $scope.$watch('ctrl.totalItems', function() {
      ctrl.totalPages = Math.ceil(ctrl.totalItems / pageCount);
    });

    ctrl.gridOptions = {
      enablePaginationControls: false,

      useExternalFiltering: true,
      useExternalSorting: true,
      useExternalPaging: true,

      paginationPageSizes: [maxRows],
      paginationPageSize: maxRows,
      minRowsToShow: maxRows + 1,

      enableHorizontalScrollbar: uiGridConstants.scrollbars.NEVER,
      enableVerticalScrollbar: uiGridConstants.scrollbars.NEVER,

      enableFiltering: true,
      enableColumnMenus: false,
      enableSorting: true,
      enableRowSelection: true,
      enableRowHeaderSelection: false,
      multiSelect: false,
      modifierKeysToMultiSelect: false,
      noUnselect: true,
      rowTemplate: 'app/views/browse/directives/browseGridRow.tpl.html'
    };

    // set up column defs and data transforms for each mode
    var modeColumnDefs = {
      'assertions': [
        {
          name: 'id',
          displayName: 'AID',
          visible: true,
          width: '7%',
          type: 'number',
          enableSorting: true,
          enableFiltering: true,
          cellTemplate: 'app/views/events/common/genericHighlightCell.tpl.html',
          filter: {
            condition: uiGridConstants.filter.CONTAINS
          }
        },
        {
          name: 'gene_name',
          enableFiltering: true,
          allowCellFocus: false,
          cellTemplate: 'app/views/events/common/genericHighlightCell.tpl.html',
          filter: {
            condition: uiGridConstants.filter.CONTAINS
          }
        },
        {
          name: 'variant_name',
          enableFiltering: true,
          allowCellFocus: false,
          cellTemplate: 'app/views/events/common/genericHighlightCell.tpl.html',
          filter: {
            condition: uiGridConstants.filter.CONTAINS
          }
        },
        {
          name: 'disease',
          enableFiltering: true,
          allowCellFocus: false,
          cellTemplate: 'app/views/events/common/genericHighlightCell.tpl.html',
          filter: {
            condition: uiGridConstants.filter.CONTAINS
          }
        },
        {
          name: 'status',
          enableFiltering: true,
          allowCellFocus: false,
          cellTemplate: 'app/views/events/common/genericHighlightCell.tpl.html',
          type: 'string',
          sort: {
            direction: uiGridConstants.DESC
          },
          filter: {
            condition: uiGridConstants.filter.CONTAINS
          }
        },
      ],
      'evidence_items': [
        {
          name: 'id',
          displayName: 'EID',
          visible: true,
          type: 'number',
          enableSorting: true,
          enableFiltering: true,
          headerTooltip: 'Evidence ID',
          headerCellTemplate: 'app/views/events/common/evidenceGridTooltipHeader.tpl.html',<commit_msg>browse grid assertions now show additional information/icons<commit_after>(function() {
  'use strict';
  angular.module('civic.events')
    .directive('browseGrid', browseGrid)
    .controller('BrowseGridController', BrowseGridController);

  // @ngInject
  function browseGrid() {
    var directive = {
      restrict: 'E',
      replace: true,
      scope: {
        mode: '=',
        page: '='
      },
      templateUrl: 'app/views/browse/directives/browseGrid.tpl.html',
      controller: 'BrowseGridController'
    };
    return directive;
  }

  // @ngInject
  function BrowseGridController($scope,
                                $state,
                                $window,
                                $location,
                                uiGridConstants,
                                Datatables,
                                _) {
    var ctrl = $scope.ctrl = {};

    var pageCount = 25;
    var maxRows = ctrl.maxRows = pageCount;

    // declare ui paging/sorting/filtering vars
    ctrl.mode = $scope.mode;
    ctrl.totalItems = Number();
    ctrl.page = $scope.page;
    ctrl.count= Number();

    ctrl.filters = [];

    if(ctrl.mode !== 'evidence_items' && ctrl.mode !== 'assertions') {
      ctrl.sorting = [{
        field: 'evidence_item_count',
        direction: 'desc'
      }];
    } else {
      ctrl.sorting = [{
        field: 'id',
        direction: 'asc'
      }];
    }

    $scope.$watch('ctrl.totalItems', function() {
      ctrl.totalPages = Math.ceil(ctrl.totalItems / pageCount);
    });

    ctrl.gridOptions = {
      enablePaginationControls: false,

      useExternalFiltering: true,
      useExternalSorting: true,
      useExternalPaging: true,

      paginationPageSizes: [maxRows],
      paginationPageSize: maxRows,
      minRowsToShow: maxRows + 1,

      enableHorizontalScrollbar: uiGridConstants.scrollbars.NEVER,
      enableVerticalScrollbar: uiGridConstants.scrollbars.NEVER,

      enableFiltering: true,
      enableColumnMenus: false,
      enableSorting: true,
      enableRowSelection: true,
      enableRowHeaderSelection: false,
      multiSelect: false,
      modifierKeysToMultiSelect: false,
      noUnselect: true,
      rowTemplate: 'app/views/browse/directives/browseGridRow.tpl.html'
    };

    // set up column defs and data transforms for each mode
    var modeColumnDefs = {
      'assertions': [
        {
          name: 'id',
          displayName: 'AID',
          visible: true,
          width: '7%',
          type: 'number',
          enableSorting: true,
          enableFiltering: true,
          cellTemplate: 'app/views/events/common/genericHighlightCell.tpl.html',
          filter: {
            condition: uiGridConstants.filter.CONTAINS
          }
        },
        {
          name: 'gene_name',
          displayName: 'GENE',
          enableFiltering: true,
          allowCellFocus: false,
          headerTooltip: 'Gene Entrez Name',
          headerCellTemplate: 'app/views/events/common/evidenceGridTooltipHeader.tpl.html',
          cellTemplate: 'app/views/events/common/evidenceGridGeneCell.tpl.html',
          filter: {
            condition: uiGridConstants.filter.CONTAINS
          },
          width: '6%'
        },
        {
          name: 'variant_name',
          displayName: 'VARIANT',
          enableFiltering: true,
          allowCellFocus: false,
          headerTooltip: 'Variant Name',
          headerCellTemplate: 'app/views/events/common/evidenceGridTooltipHeader.tpl.html',
          cellTemplate: 'app/views/events/common/evidenceGridVariantCell.tpl.html',
          filter: {
            condition: uiGridConstants.filter.CONTAINS
          },
          width: '8%'
        },
        {
          name: 'summary',
          displayName: 'SUMM',
          headerTooltip: 'Summary',
          headerCellTemplate: 'app/views/events/common/evidenceGridTooltipHeader.tpl.html',
          enableFiltering: true,
          allowCellFocus: false,
          cellTemplate: 'app/views/events/common/evidenceGridEvidenceCell.tpl.html',
          filter: {
            condition: uiGridConstants.filter.CONTAINS
          }
        },
        {
          name: 'disease',
          displayName: 'DIS',
          headerTooltip: 'Disease',
          headerCellTemplate: 'app/views/events/common/evidenceGridTooltipHeader.tpl.html',
          enableFiltering: true,
          allowCellFocus: false,
          cellTemplate: 'app/views/events/common/evidenceGridDiseaseCell.tpl.html',
          filter: {
            condition: uiGridConstants.filter.CONTAINS
          }
        },
        {
          name: 'drugs',
          displayName: 'DRUGS',
          headerTooltip: 'Drugs',
          headerCellTemplate: 'app/views/events/common/evidenceGridTooltipHeader.tpl.html',
          enableFiltering: true,
          allowCellFocus: false,
          cellTemplate: 'app/views/events/common/evidenceGridDrugCell.tpl.html',
          filter: {
            condition: uiGridConstants.filter.CONTAINS
          }
        },
        {
          name: 'evidence_type',
          displayName: 'AT',
          headerTooltip: 'Assertion Type',
          enableFiltering: true,
          allowCellFocus: false,
          headerCellTemplate: 'app/views/events/common/evidenceGridTooltipHeader.tpl.html',
          filter: {
            type: uiGridConstants.filter.SELECT,
            term: null,
            disableCancelFilterButton: false,
            selectOptions: [
              {
                value: null,
                label: '--'
              },
              {
                value: 'Predictive',
                label: 'Predictive'
              },
              {
                value: 'Diagnostic',
                label: 'Diagnostic'
              },
              {
                value: 'Prognostic',
                label: 'Prognostic'
              },
              {
                value: 'Predisposing',
                label: 'Predisposing'
              }
            ]
          },
          width: '6%',
          minWidth: 50,
          cellTemplate: 'app/views/events/common/evidenceGridTypeCell.tpl.html'
        },
        {
          name: 'evidence_direction',
          displayName: 'AD',
          headerTooltip: 'Assertion Direction',
          cellTemplate: 'app/views/events/common/evidenceDirectionCell.tpl.html',
          headerCellTemplate: 'app/views/events/common/evidenceGridTooltipHeader.tpl.html',
          allowCellFocus: false,
          filter: {
            type: uiGridConstants.filter.SELECT,
            term: null,
            disableCancelFilterButton: false,
            selectOptions: [
              { value: null, label: '--' },
              { value: 'Supports', label: 'Supports' },
              { value: 'Does Not Support', label: 'Does not Support' }
            ]
          },
          width: '6%',
          minWidth: 50
        },
        {
          name: 'clinical_significance',
          displayName: 'CS',
          headerTooltip: 'Clinical Significance',
          headerCellTemplate: 'app/views/events/common/evidenceGridTooltipHeader.tpl.html',
          allowCellFocus: false,
          filter: {
            type: uiGridConstants.filter.SELECT,
            term: null,
            disableCancelFilterButton: false,
            selectOptions: [
              { value: null, label: '--' },
              { value: 'Sensitivity', label: 'Sensitivity' },
              { value: 'Resistance or Non-Response', label: 'Resistance or Non-Response' },
              { value: 'Better Outcome', label: 'Better Outcome' },
              { value: 'Poor Outcome', label: 'Poor Outcome' },
              { value: 'Positive', label: 'Positive' },
              { value: 'Negative', label: 'Negative' },
              { value: 'Adverse Response', label: 'Adverse Response' },
              { value: 'N/A', label: 'N/A' }
            ]
          },
          width: '6%',
          minWidth: 50,
          cellTemplate: 'app/views/events/common/evidenceGridClinicalSignificanceCell.tpl.html'
        },
        {
          name: 'evidence_item_count',
          width: '8%',
          displayName: 'Evidence',
          sort: {
            direction: uiGridConstants.DESC
          },
          enableFiltering: false,
          allowCellFocus: false,
          filter: {
            condition: uiGridConstants.filter.CONTAINS
          }
        },
        {
          name: 'status',
          enableFiltering: true,
          allowCellFocus: false,
          cellTemplate: 'app/views/events/common/genericHighlightCell.tpl.html',
          type: 'string',
          sort: {
            direction: uiGridConstants.DESC
          },
          filter: {
            condition: uiGridConstants.filter.CONTAINS
          }
        },
      ],
      'evidence_items': [
        {
          name: 'id',
          displayName: 'EID',
          visible: true,
          type: 'number',
          enableSorting: true,
          enableFiltering: true,
          headerTooltip: 'Evidence ID',
          headerCellTemplate: 'app/views/events/common/evidenceGridTooltipHeader.tpl.html',
{'fraction_non_alphanumeric': 0.10847759863288506, 'fraction_numerical': 0.0014859945018203433, 'mean_word_length': 1.700100300902708, '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': 0, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '519638', 'n_tokens_mistral': 3744, 'n_tokens_neox': 3649, 'n_words': 664}