<commit_before>!!! 5

%html
  %head
    %title Criminal Case Search

    %script{ src: "/jquery-1.10.2.min.js" }

    %script{ src: "/bootstrap/js/bootstrap.min.js" }
    %link{ type: "text/css", rel: "stylesheet", href: "/bootstrap/css/bootstrap.min.css" }

    %script{ src: "/app.js" }
    %link{ type: "text/css", rel: "stylesheet", href: "/css/app.css" }

    :plain
      <meta http-equiv="X-UA-Compatible" content="IE=edge" >

  %body
    .navbar.navbar-inverse.navbar-static-top
      .navbar-inner
        .container-fluid
          %button.btn.btn-navbar{ type: "button", "data-toggle" => "collapse", "data-target" => ".nav-collapse"}
            %span.icon-bar
            %span.icon-bar
            %span.icon-bar
          %a.brand{ href: "#"}
            %img{ src: "/images/logo.png", alt: "Criminal Case Search" }

    - container :fluid do
      .row-fluid
        %span.span3
          .well.datashare-filter
            %form{action: "/"}
              %fieldset

                %fieldset.secondary
                  .pull-right
                    %a.btn{href: "/"} Reset
                    %button.btn.btn-primary{ type: "submit"} Search

                %fieldset.secondary
                  %legend.top Borough

                  = build_checkbox_field("borough", "B", "Bronx", :selected => true)
                  = build_checkbox_field("borough", "K", "Brooklyn", :selected => true)
                  = build_checkbox_field("borough", "M", "Manhattan", :selected => true)
                  = build_checkbox_field("borough", "Q", "Queens", :selected => true)
                  = build_checkbox_field("borough", "S", "Staten Island", :selected => true)

                  .btn-group
                    %button.btn.inline.btn-mini.select-all All
                    %button.btn.inline.btn-mini.clear-all Clear

              %fieldset.secondary
                %legend.top Top Charge

                %fieldset.tertiary
                  %legend Severity

                  = build_radio_field("top_charge", "A", "All", :selected => true)
                  = build_radio_field("top_charge", "VF", "Violent Felony")
                  = build_radio_field("top_charge", "F", "Non-Violent Felony")
                  = build_radio_field("top_charge", "M", "Misdemeanor")
                  = build_radio_field("top_charge", "VI", "Violation/Infraction")

                %fieldset.tertiary
                  %legend Type

                  = build_checkbox_field("include_charge", "D", "Drug Offense", :selected => true)
                  = build_checkbox_field("include_charge", "MA", "Misdemeanor Assault", :selected => true)
                  = build_checkbox_field("include_charge", "CC", "Criminal Contempt", :selected => true)
                  = build_checkbox_field("include_charge", "SO", "Sex Offense", :selected => true)
                  = build_checkbox_field("include_charge", "A", "All Other Offenses", :selected => true)

                  .btn-group
                    %button.btn.inline.btn-mini.select-all All
                    %button.btn.inline.btn-mini.clear-all Clear

              %fieldset.secondary
                %legend.top Age
                
                .age-selector
                  .horiz-box
                    %label{ for: "min_age" } Min. Age
                    %input{ type: "number", name: "filter[min_age]", min: "16", max: "100", value: params[:filter][:min_age] || 16, id: "min_age" }
                  .horiz-box
                    %label{ for: "max_age" } Max. Age
                    %input{ type: "number", name: "filter[max_age]", min: "16", max: "100", value: params[:filter][:max_age] || 100 }

              %fieldset.secondary
                %legend.top Sex
                
                .formify.btn-group{ data: { toggle: "buttons-radio", name: "sex" } }
                  %button.btn{ type: "button", data: { value: "A", selected: true_if(params[:filter][:sex], ["A", nil]) } } All
                  %button.btn{ type: "button", data: { value: "M", selected: true_if(params[:filter][:sex], "M")} } Male
                  %button.btn{ type: "button", data: { value: "F", selected: true_if(params[:filter][:sex], "F")} } Female

              %fieldset.secondary
                %legend.top Criminal History

                %fieldset.tertiary
                  %legend Number of Prior Convictions

                  .input-append
                    %input.span3{ type: "number", value: params[:filter][:number_of_prior_convictions] || "0", min: "0", name: "filter[number_of_prior_convictions]"  }
                    .btn-group.dropdown-form
                      %button.btn.dropdown-toggle{ data: { toggle: "dropdown" } }
                        %span.dropdown-main-text
                          or more
                        %span.caret
                      %ul.dropdown-menu
                        %li
                          %a.dropdown-opt{ data: { value: "more" } }
                            or more
                        %li
                          %a.dropdown-opt{ data: { value: "fewer" } }
                            or fewer
                      %input{ class: "dropdown-input",
                              type:  "hidden",
                              name:  "filter[prior_conviction_bounds]",
                              value: params[:filter][:prior_conviction_bounds] || "more" }

                %fieldset.tertiary
                  %legend Severity of Prior Convictions
                  
                  .double-up
                    %span.title Violent Felony
                    = triple_select :severity, :violent_felony
                  
                  .double-up
                    %span.title Nonviolent Felony
                    = triple_select :severity, :felony

                  .double-up
                    %span.title Misdemeanor
                    = triple_select :severity, :misdemeanor

                  .double-up
                    %span.title All Other
                    = triple_select :severity, :other

                %fieldset.tertiary
                  %legend Type of Prior Convictions

                  = build_checkbox_field("prior_convictions", "D", "Drug Offense", :selected => true)
                  = build_checkbox_field("prior_convictions", "MA", "Misdemeanor Assault", :selected => true)
                  = build_checkbox_field("prior_convictions", "CC", "Criminal Contempt", :selected => true)
                  = build_checkbox_field("prior_convictions", "SO", "Sex Offense", :selected => true)
                  = build_checkbox_field("prior_convictions", "A", "All Other Offenses", :selected => true)

                  .btn-group
                    %button.btn.inline.btn-mini.select-all All
                    %button.btn.inline.btn-mini.clear-all Clear                

                %fieldset.tertiary.horizontal
                  %legend Has other open cases?
                  = triple_select("open_cases")

                %fieldset.tertiary.horizontal
                  %legend Has failed to appear on a previous case?
                  = triple_select("failed_to_appear")
                  -# %fieldset.tertiary
                  -#   %legend CJA Score

                  -#   = build_checkbox_field("cja_score", "x", "x")
                  -#   = build_checkbox_field("cja_score", "x", "x")
                  -#   = build_checkbox_field("cja_score", "x", "x")

                  -# .btn-group
                  -#   %button.btn.inline.btn-mini.select-all All
                  -#   %button.btn.inline.btn-mini.clear-all Clear

              %fieldset.secondary
                %legend Case Status

                %fieldset.tertiary
                  %legend Has case been arraigned?

                  = triple_select("arraigned")

                %fieldset.tertiary
                  %legend Was bail/remand set on defendant?

                  = triple_select("bail_set")

                %fieldset.tertiary
                  %legend Next Court Appearance Date

                  #next-appearance-date.formify.btn-group.btn-group-vertical{ data: { toggle: "buttons-radio", name: "next_court_date" } }
                    %button.btn{ type: "button", data: { value: "any", selected: true_if(params[:filter][:next_court_date], ["any", nil]) } } All
                    %button.btn{ type: "button", data: { value: "today", selected: true_if(params[:filter][:next_court_date], "today") } } Today
                    %button.btn{ type: "button", data: { value: "tomorrow", selected: true_if(params[:filter][:next_court_date], "tomorrow") } } Tomorrow
                    %button.btn{ type: "button", data: { value: "7-day", selected: true_if(params[:filter][:next_court_date], "7-day") } } Next 7 Days
              %fieldset

                %fieldset.secondary
                  .pull-right
                    %a.btn{href: "/"} Reset
                    %button.btn.btn-primary{ type: "submit"} Search

        .span9
          #results-header.row-fluid
            .span4
              .control-text
                Sort by:
              .btn-group
                %button.btn.dropdown-toggle{ data: { toggle: "dropdown" } }
                  = params[:filter][:sort] || "Next Court Date"
                  %span.caret
                %ul.dropdown-menu
                  %li
                    %a{href: current_uri_with_query_params(filter: {sort: "Next Court Date"})} Next Court Date
                  %li
                    %a{href: current_uri_with_query_params(filter: {sort: "Next Court Part"})} Next Court Part
                  %li
                    %a{href: current_uri_with_query_params(filter: {sort: "Defendant Name"})} Defendant Name
                  %li
                    %a{href: current_uri_with_query_params(filter: {sort: "Top Charge"})} Top Charge
                  %li
                    %a{href: current_uri_with_query_params(filter: {sort: "Number of Prior Convictions"})} Number of Prior Convictions
            .span3
              .control-text
                %span.results             
                  Found
                  %span.total-results= @incidents.total_entries
                  matching incidents.
            .span2
              .control-text
                %a{href: current_uri_with_query_params(format: :csv)} Export CSV

          .row-fluid
            = yield
<commit_msg>Standardize spelling of Nonviolent. #111<commit_after>!!! 5

%html
  %head
    %title Criminal Case Search

    %script{ src: "/jquery-1.10.2.min.js" }

    %script{ src: "/bootstrap/js/bootstrap.min.js" }
    %link{ type: "text/css", rel: "stylesheet", href: "/bootstrap/css/bootstrap.min.css" }

    %script{ src: "/app.js" }
    %link{ type: "text/css", rel: "stylesheet", href: "/css/app.css" }

    :plain
      <meta http-equiv="X-UA-Compatible" content="IE=edge" >

  %body
    .navbar.navbar-inverse.navbar-static-top
      .navbar-inner
        .container-fluid
          %button.btn.btn-navbar{ type: "button", "data-toggle" => "collapse", "data-target" => ".nav-collapse"}
            %span.icon-bar
            %span.icon-bar
            %span.icon-bar
          %a.brand{ href: "#"}
            %img{ src: "/images/logo.png", alt: "Criminal Case Search" }

    - container :fluid do
      .row-fluid
        %span.span3
          .well.datashare-filter
            %form{action: "/"}
              %fieldset

                %fieldset.secondary
                  .pull-right
                    %a.btn{href: "/"} Reset
                    %button.btn.btn-primary{ type: "submit"} Search

                %fieldset.secondary
                  %legend.top Borough

                  = build_checkbox_field("borough", "B", "Bronx", :selected => true)
                  = build_checkbox_field("borough", "K", "Brooklyn", :selected => true)
                  = build_checkbox_field("borough", "M", "Manhattan", :selected => true)
                  = build_checkbox_field("borough", "Q", "Queens", :selected => true)
                  = build_checkbox_field("borough", "S", "Staten Island", :selected => true)

                  .btn-group
                    %button.btn.inline.btn-mini.select-all All
                    %button.btn.inline.btn-mini.clear-all Clear

              %fieldset.secondary
                %legend.top Top Charge

                %fieldset.tertiary
                  %legend Severity

                  = build_radio_field("top_charge", "A", "All", :selected => true)
                  = build_radio_field("top_charge", "VF", "Violent Felony")
                  = build_radio_field("top_charge", "F", "Nonviolent Felony")
                  = build_radio_field("top_charge", "M", "Misdemeanor")
                  = build_radio_field("top_charge", "VI", "Violation/Infraction")

                %fieldset.tertiary
                  %legend Type

                  = build_checkbox_field("include_charge", "D", "Drug Offense", :selected => true)
                  = build_checkbox_field("include_charge", "MA", "Misdemeanor Assault", :selected => true)
                  = build_checkbox_field("include_charge", "CC", "Criminal Contempt", :selected => true)
                  = build_checkbox_field("include_charge", "SO", "Sex Offense", :selected => true)
                  = build_checkbox_field("include_charge", "A", "All Other Offenses", :selected => true)

                  .btn-group
                    %button.btn.inline.btn-mini.select-all All
                    %button.btn.inline.btn-mini.clear-all Clear

              %fieldset.secondary
                %legend.top Age
                
                .age-selector
                  .horiz-box
                    %label{ for: "min_age" } Min. Age
                    %input{ type: "number", name: "filter[min_age]", min: "16", max: "100", value: params[:filter][:min_age] || 16, id: "min_age" }
                  .horiz-box
                    %label{ for: "max_age" } Max. Age
                    %input{ type: "number", name: "filter[max_age]", min: "16", max: "100", value: params[:filter][:max_age] || 100 }

              %fieldset.secondary
                %legend.top Sex
                
                .formify.btn-group{ data: { toggle: "buttons-radio", name: "sex" } }
                  %button.btn{ type: "button", data: { value: "A", selected: true_if(params[:filter][:sex], ["A", nil]) } } All
                  %button.btn{ type: "button", data: { value: "M", selected: true_if(params[:filter][:sex], "M")} } Male
                  %button.btn{ type: "button", data: { value: "F", selected: true_if(params[:filter][:sex], "F")} } Female

              %fieldset.secondary
                %legend.top Criminal History

                %fieldset.tertiary
                  %legend Number of Prior Convictions

                  .input-append
                    %input.span3{ type: "number", value: params[:filter][:number_of_prior_convictions] || "0", min: "0", name: "filter[number_of_prior_convictions]"  }
                    .btn-group.dropdown-form
                      %button.btn.dropdown-toggle{ data: { toggle: "dropdown" } }
                        %span.dropdown-main-text
                          or more
                        %span.caret
                      %ul.dropdown-menu
                        %li
                          %a.dropdown-opt{ data: { value: "more" } }
                            or more
                        %li
                          %a.dropdown-opt{ data: { value: "fewer" } }
                            or fewer
                      %input{ class: "dropdown-input",
                              type:  "hidden",
                              name:  "filter[prior_conviction_bounds]",
                              value: params[:filter][:prior_conviction_bounds] || "more" }

                %fieldset.tertiary
                  %legend Severity of Prior Convictions
                  
                  .double-up
                    %span.title Violent Felony
                    = triple_select :severity, :violent_felony
                  
                  .double-up
                    %span.title Nonviolent Felony
                    = triple_select :severity, :felony

                  .double-up
                    %span.title Misdemeanor
                    = triple_select :severity, :misdemeanor

                  .double-up
                    %span.title All Other
                    = triple_select :severity, :other

                %fieldset.tertiary
                  %legend Type of Prior Convictions

                  = build_checkbox_field("prior_convictions", "D", "Drug Offense", :selected => true)
                  = build_checkbox_field("prior_convictions", "MA", "Misdemeanor Assault", :selected => true)
                  = build_checkbox_field("prior_convictions", "CC", "Criminal Contempt", :selected => true)
                  = build_checkbox_field("prior_convictions", "SO", "Sex Offense", :selected => true)
                  = build_checkbox_field("prior_convictions", "A", "All Other Offenses", :selected => true)

                  .btn-group
                    %button.btn.inline.btn-mini.select-all All
                    %button.btn.inline.btn-mini.clear-all Clear                

                %fieldset.tertiary.horizontal
                  %legend Has other open cases?
                  = triple_select("open_cases")

                %fieldset.tertiary.horizontal
                  %legend Has failed to appear on a previous case?
                  = triple_select("failed_to_appear")
                  -# %fieldset.tertiary
                  -#   %legend CJA Score

                  -#   = build_checkbox_field("cja_score", "x", "x")
                  -#   = build_checkbox_field("cja_score", "x", "x")
                  -#   = build_checkbox_field("cja_score", "x", "x")

                  -# .btn-group
                  -#   %button.btn.inline.btn-mini.select-all All
                  -#   %button.btn.inline.btn-mini.clear-all Clear

              %fieldset.secondary
                %legend Case Status

                %fieldset.tertiary
                  %legend Has case been arraigned?

                  = triple_select("arraigned")

                %fieldset.tertiary
                  %legend Was bail/remand set on defendant?

                  = triple_select("bail_set")

                %fieldset.tertiary
                  %legend Next Court Appearance Date

                  #next-appearance-date.formify.btn-group.btn-group-vertical{ data: { toggle: "buttons-radio", name: "next_court_date" } }
                    %button.btn{ type: "button", data: { value: "any", selected: true_if(params[:filter][:next_court_date], ["any", nil]) } } All
                    %button.btn{ type: "button", data: { value: "today", selected: true_if(params[:filter][:next_court_date], "today") } } Today
                    %button.btn{ type: "button", data: { value: "tomorrow", selected: true_if(params[:filter][:next_court_date], "tomorrow") } } Tomorrow
                    %button.btn{ type: "button", data: { value: "7-day", selected: true_if(params[:filter][:next_court_date], "7-day") } } Next 7 Days
              %fieldset

                %fieldset.secondary
                  .pull-right
                    %a.btn{href: "/"} Reset
                    %button.btn.btn-primary{ type: "submit"} Search

        .span9
          #results-header.row-fluid
            .span4
              .control-text
                Sort by:
              .btn-group
                %button.btn.dropdown-toggle{ data: { toggle: "dropdown" } }
                  = params[:filter][:sort] || "Next Court Date"
                  %span.caret
                %ul.dropdown-menu
                  %li
                    %a{href: current_uri_with_query_params(filter: {sort: "Next Court Date"})} Next Court Date
                  %li
                    %a{href: current_uri_with_query_params(filter: {sort: "Next Court Part"})} Next Court Part
                  %li
                    %a{href: current_uri_with_query_params(filter: {sort: "Defendant Name"})} Defendant Name
                  %li
                    %a{href: current_uri_with_query_params(filter: {sort: "Top Charge"})} Top Charge
                  %li
                    %a{href: current_uri_with_query_params(filter: {sort: "Number of Prior Convictions"})} Number of Prior Convictions
            .span3
              .control-text
                %span.results             
                  Found
                  %span.total-results= @incidents.total_entries
                  matching incidents.
            .span2
              .control-text
                %a{href: current_uri_with_query_params(format: :csv)} Export CSV

          .row-fluid
            = yield

{'fraction_non_alphanumeric': 0.12364767831498324, 'fraction_numerical': 0.0031115366203925323, 'mean_word_length': 1.4831807916319981, 'pattern_counts': {'":': 0, '<': 5, '<?xml version=': 0, '>': 41, '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': '195874', 'n_tokens_mistral': 6056, 'n_tokens_neox': 5491, 'n_words': 1176}