<commit_before>- @title = "#{@variable.name.upcase} - #{@dataset.slug.upcase} Variables"

= render 'variables/header'

.row{ style: 'margin-bottom: 20px' }
  .col-sm-3.hidden-xs
    = render 'variables/menu'
  .col-sm-9
    %h1.variable-header.brand= @variable.display_name

    - if @variable.known_issues.present?
      .alert.alert-danger{ role: 'alert' }
        %strong KNOWN ISSUES
        Please be sure to check the
        = link_to 'known issues', known_issues_dataset_variable_path(@dataset, @variable, v: params[:v]), class: 'alert-link'
        before using this variable in analysis.

    %table.table.table-borderless{ style: 'margin-top: 20px;' }
      %col{ width: '1px' }
      %col
      - if @variable.description.present?
        %tr
          %td{ style: 'font-weight: bold' } Description
          %td.variable-description= simple_markdown_no_lists @variable.description

      - if @variable.calculation.present?
        %tr
          %td{ style: 'font-weight: bold' } Calculation
          %td
            .variable-calculation= calculation_helper @variable

      - if @variable.units.present?
        %tr
          %td{ style: 'font-weight: bold' } Units
          %td
            %code= @variable.units

      - if @variable.domain
        %tr
          %td{ style: 'font-weight: bold' }
            Domain
          %td
            %div{ style: 'margin-bottom: 10px' }
              %code= @variable.domain.name
            %ul.list-unstyled
              - @variable.domain.options.each do |option|
                %li= "#{option['value']}: #{option['display_name']}"

      - if @variable.variable_type.present?
        %tr
          %td{ style: 'font-weight: bold' } Type
          %td
            %code= @variable.variable_type

      - if @variable.variable_type == 'integer' || @variable.variable_type == 'numeric'
        %tr.hidden-xs
          %td{ style: 'font-weight: bold' } Stats
          %td{ style: 'padding-top: 0' }
            %table.table.table-fixed.table-borderless
              %thead
                %tr
                  %th N
                  %th Mean
                  %th StdDev
                  %th Median
                  %th Min
                  %th Max
                  %th Unknown
                  %th Total
              %tbody
                %tr
                  %td= @variable.stats_n
                  %td= '%0.1f' % @variable.stats_mean if @variable.stats_mean
                  %td= '± %0.1f' % @variable.stats_stddev if @variable.stats_stddev
                  %td= '%0.1f' % @variable.stats_median if @variable.stats_median
                  %td
                    - if @variable.variable_type == 'numeric' && @variable.stats_min
                      = '%0.1f' % @variable.stats_min
                    - else
                      = @variable.stats_min
                  %td
                    - if @variable.variable_type == 'numeric' && @variable.stats_max
                      = '%0.1f' % @variable.stats_max
                    - else
                      = @variable.stats_max
                  %td= @variable.stats_unknown
                  %td= @variable.stats_total


    - json = JSON.parse(@variable.spout_stats) rescue json = nil
    #charts-info{ style: 'display:hidden', data: { charts: "#{json.to_json}" } }

    - charts = []
    - charts = json['charts'].keys.collect { |k| [k.titleize, k] } if json.is_a?(Hash) && json['charts'].is_a?(Hash)
    - chart = charts.first unless chart

    - if charts.size > 0
      #chart-container{ style: 'min-width: 200px; max-width: 800px; height: 400px; margin: 0 auto 20px auto' }

.visible-xs= render 'variables/menu'

- if false
  - content_for :call_to_action do
    .call-to-action
      .call-to-action-header
        Ready to begin your analysis?
      .call-to-action-body
        .center{ style: 'margin-top:20px;margin-bottom:20px' }
          = link_to 'Download Dataset', files_dataset_path(@dataset, path: 'datasets'), class: 'btn btn-lg btn-call-to-action'
        %p.center{ style: 'margin-top:50px;' }
          Email us at<commit_msg>Replaced stats with general histogram table<commit_after>- @title = "#{@variable.name.upcase} - #{@dataset.slug.upcase} Variables"

= render 'variables/header'

.row{ style: 'margin-bottom: 20px' }
  .col-sm-3.hidden-xs
    = render 'variables/menu'
  .col-sm-9
    %h1.variable-header.brand= @variable.display_name

    - if @variable.known_issues.present?
      .alert.alert-danger{ role: 'alert' }
        %strong KNOWN ISSUES
        Please be sure to check the
        = link_to 'known issues', known_issues_dataset_variable_path(@dataset, @variable, v: params[:v]), class: 'alert-link'
        before using this variable in analysis.

    %table.table.table-borderless{ style: 'margin-top: 20px;' }
      %col{ width: '1px' }
      %col
      - if @variable.description.present?
        %tr
          %td{ style: 'font-weight: bold' } Description
          %td.variable-description= simple_markdown_no_lists @variable.description

      - if @variable.calculation.present?
        %tr
          %td{ style: 'font-weight: bold' } Calculation
          %td
            .variable-calculation= calculation_helper @variable

      - if @variable.units.present?
        %tr
          %td{ style: 'font-weight: bold' } Units
          %td
            %code= @variable.units

      - if @variable.domain
        %tr
          %td{ style: 'font-weight: bold' }
            Domain
          %td
            %div{ style: 'margin-bottom: 10px' }
              %code= @variable.domain.name
            %ul.list-unstyled
              - @variable.domain.options.each do |option|
                %li= "#{option['value']}: #{option['display_name']}"

      - if @variable.variable_type.present?
        %tr
          %td{ style: 'font-weight: bold' } Type
          %td
            %code= @variable.variable_type

      - if false
        - if @variable.variable_type == 'integer' || @variable.variable_type == 'numeric'
          %tr.hidden-xs
            %td{ style: 'font-weight: bold' } Stats
            %td{ style: 'padding-top: 0' }
              %table.table.table-fixed.table-borderless
                %thead
                  %tr
                    %th N
                    %th Mean
                    %th StdDev
                    %th Median
                    %th Min
                    %th Max
                    %th Unknown
                    %th Total
                %tbody
                  %tr
                    %td= @variable.stats_n
                    %td= '%0.1f' % @variable.stats_mean if @variable.stats_mean
                    %td= '± %0.1f' % @variable.stats_stddev if @variable.stats_stddev
                    %td= '%0.1f' % @variable.stats_median if @variable.stats_median
                    %td
                      - if @variable.variable_type == 'numeric' && @variable.stats_min
                        = '%0.1f' % @variable.stats_min
                      - else
                        = @variable.stats_min
                    %td
                      - if @variable.variable_type == 'numeric' && @variable.stats_max
                        = '%0.1f' % @variable.stats_max
                      - else
                        = @variable.stats_max
                    %td= @variable.stats_unknown
                    %td= @variable.stats_total


    - json = JSON.parse(@variable.spout_stats) rescue json = nil
    #charts-info{ style: 'display:hidden', data: { charts: "#{json.to_json}" } }

    - charts = []
    - charts = json['charts'].keys.collect { |k| [k.titleize, k] } if json.is_a?(Hash) && json['charts'].is_a?(Hash)
    - chart = charts.first unless chart

    - if charts.size > 0
      #chart-container{ style: 'min-width: 200px; max-width: 800px; height: 400px; margin: 0 auto 20px auto' }

    - if json && json['tables']
      - (json['tables'] || []).each do |key, tables|
        %div{ style: 'display:none', data: { chart_name: key } }
          - [tables].flatten.each do |table|
            - if table.is_a? Hash
              %h3.brand.center= table['title']
              %h5.center= table['subtitle']
              .table-responsive
                %table.table.table-hover
                  %thead
                    - (table['headers'] || []).each do |headers|
                      %tr
                        - headers.each do |cell|
                          = render 'variables/table_cell', cell: cell, type: :th
                  %tfoot
                    - (table['footers'] || []).each do |footers|
                      %tr
                        - footers.each do |cell|
                          = render 'variables/table_cell', cell: cell, type: :td
                  %tbody
                    - (table['rows'] || []).each do |rows|
                      %tr
                        - rows.each do |cell|
                          = render 'variables/table_cell', cell: cell, type: :td

.visible-xs= render 'variables/menu'

- if false
  - content_for :call_to_action do
    .call-to-action
      .call-to-action-header
        Ready to begin your analysis?
      .call-to-action-body
        .center{ style: 'margin-top:20px;margin-bottom:20px' }
          = link_to 'Download Dataset', files_dataset_path(@dataset, path: 'datasets'), class: 'btn btn-lg btn-call-to-action'
        %p.center{ style: 'margin-top:50px;' }
          Email us at
{'fraction_non_alphanumeric': 0.1282132993414064, 'fraction_numerical': 0.008710431272572764, 'mean_word_length': 1.5681942171303873, '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': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '1060535', 'n_tokens_mistral': 2884, 'n_tokens_neox': 2709, 'n_words': 621}