ncbo/bioportal_web_ui

View on GitHub
app/views/annotatorplus/index.html.haml

Summary

Maintainability
Test Coverage
- @title = "Annotator Plus"

%head
  = javascript_include_tag "bp_annotatorplus"

%div.row
  %div.col
    %h2.mt-3 Annotator +
    %p
      = t('annotator.index.intro').html_safe
      = link_to(Rails.configuration.settings.links[:help_annotator],id: "annotator-help",
                "aria-label": "View annotator help") do
        %i.fa.fa-question-circle.fa-lg{"aria-hidden": "true"}
%div.row
  %div.col
    %form
      %div.mb-3
        = text_area_tag("annotation_text", nil, rows: 10, class: "form-control",
                        placeholder: "Enter or paste text to be annotated", "aria-describedby": "annotateTextHelpBlock")
        %div#annotateTextHelpBlock.form-text
          %a#insert_text_link{href: "javascript:void(0);", class: 'link-secondary'} insert sample text

      %div.mb-4
        %a#advancedOptionsLink{href: "javascript:void(0);"} Show advanced options >>

      %div#advanced-options-container
        %div.mb-3
          %div.form-check.form-check-inline
            = check_box_tag("longest_only", "all", false, class: "form-check-input")
            %label.form-check-label{for: "longest_only"} Match longest only

          %div.form-check.form-check-inline
            = check_box_tag("whole_word_only", "all", false, class: "form-check-input")
            %label.form-check-label{for: "whole_word_only"} Match partial words

          %div.form-check.form-check-inline
            = check_box_tag("mappings", "all", false, id: "mappings_all", class: "form-check-input")
            %label.form-check-label{for: "mappings_all"} Include mappings

          %div.form-check.form-check-inline
            = check_box_tag("exclude_numbers", "all", false, class: "form-check-input")
            %label.form-check-label{for: "exclude_numbers"} Exclude numbers

          %div.form-check.form-check-inline
            = check_box_tag("exclude_synonyms", "all", false, class: "form-check-input")
            %label.form-check-label{for: "exclude_synonyms"} Exclude synonyms

        %div.mb-3
          %label.form-label{for: "ontology_ontologyId"} Select ontologies
          = select_tag("ontology_ontologyId", options_from_collection_for_select(@annotator_ontologies, :acronym, lambda { |ont| "#{ont.name} (#{ont.acronym})" }), |
              multiple: true, class: "form-select", "aria-describedby": "selectOntologiesHelpBlock") |
          %div#selectOntologiesHelpBlock.form-text Start typing to select ontologies or leave blank to use all

        - if @sem_type_ont
          %div.mb-3
            %label.form-label{for: "semantic_types"} Select UMLS semantic types
            = select_tag("semantic_types", options_for_select(@semantic_types_for_select), multiple: "true",
                         class: "form-select", "aria-describedby": "selectSemanticTypesHelpBlock")
            %div#selectSemanticTypesHelpBlock.form-text
              Start typing to select UMLS semantic types or leave blank to use all

          %div.mb-3
            %label.form-label{for: "semantic_groups"} Select UMLS semantic groups
            = select_tag("semantic_groups", options_for_select(@semantic_groups_for_select), multiple: "true",
                         class: "form-select", "aria-describedby": "selectSemanticGroupsHelpBlock")
            %div#selectSemanticGroupsHelpBlock.form-text
              Start typing to select UMLS semantic groups or leave blank to use all

        %div.mb-3
          %label.form-label{for: "class_hierarchy_max_level"} Include ancestors up to level:
          - options = [["none", 0], *(1..10).map {|i| [i, i]}, ["all", 999]]
          = select_tag("class_hierarchy_max_level", options_for_select(options, 0), class: "form-select")

        %div.mb-3
          %label.form-label{for: "score"} Include score:
          - options = [["none", ""], ["old", "old"], ["cvalue", "cvalue"], ["cvalueh", "cvalueh"]]
          = select_tag(:score, options_for_select(options, 0), class: "form-select",
                       "aria-describedby": "includeScoreHelpBlock")
          %div#includeScoreHelpBlock.form-text
            Score annotations following the previous 2009 NCBO measure (old) or the C-Value measure (cvalue). If
            hierarchy expansion is used, then prefer cvalueh.

        %div.mb-3
          %label.form-label{for: "score_threshold"} Filter by score threshold:
          = number_field_tag(:score_threshold, 0, id: "score_threshold", class: "form-control",
                             "aria-describedby": "scoreThresholdHelpBlock")
          %div#scoreThresholdHelpBlock.form-text Specify the minimum score value for annotations

        %div.mb-3
          %label.form-label{for: "confidence_threshold"} Filter confidence threshold:
          = number_field_tag(:confidence_threshold, 0, min: 0, max: 100, id: "confidence_threshold",
                             class: "form-control", "aria-describedby": "confidenceThresholdHelpBlock")
          %div#confidenceThresholdHelpBlock.form-text
            Specify the minimum position in the scoring distribution (between 1 and 100)

        - if @recognizers.length > 1
          %div.mb-3
            %label.form-label{for: "recognizer"} Entity recognizer:
            - default_recognizer = @recognizers.include?("mgrep") ? "mgrep" : @recognizers.first
            = select_tag("recognizer", options_for_select(@recognizers.map {|r| [r, r]}, default_recognizer),
                         class: "form-select")

        %div.mb-3
          %div.form-check
            = check_box_tag("negation", :all, false, class: "form-check-input")
            %label.form-check-label{for: "negation"} Detect negation
            %div#negationHelp.form-text Detect if a concept has been negated (affirmed, negated, possible)

          %div.form-check
            = check_box_tag("experiencer", :all, false, class: "form-check-input")
            %label.form-check-label{for: "experiencer"} Detect experiencer
            %div#experiencerHelp.form-text Detect who experienced the each identified concept (patient, other)

          %div.form-check
            = check_box_tag("temporality", :all, false, class: "form-check-input")
            %label.form-check-label{for: "temporality"} Detect temporality
            %div#temporalityHelp.form-text Detect when the annotated concept occurred (recent, historical, hypothetical)

      %div.mb-4
        = tag.input(value: 'Get annotations', type: "button", id: "annotator_button", class: "btn btn-primary")
        %span.annotator_spinner
          %img{src: asset_path('spinners/spinner_000000_16px.gif')}/
        %span#annotator_error.annotator_error

%div.row
  %div.col
    #annotations_container
      #result_counts
      %h4 Annotations
      #filter_list{:style => "font-size: 9pt; color: gray; display: none; clear: both; margin: -15px 0 5px"}
        %span#filter_title> Results are filtered by:
        \ 
        %span#filter_names
      #results_error{:style => "color: red; margin-bottom: 7px;"}
      %table#annotations.zebra{:style => "min-width: 700px; width: 100%;"}
        %thead
          %tr
            %th
              Class
              %span.popup_container
                %span.bp_popup_link_container
                  %a#filter_classes.bp_popup_link{:href => "javascript:void(0);"} filter
                %div#classes_filter_list.bp_popup_list
            %th
              Ontology
              %span.popup_container
                %span.bp_popup_link_container
                  %a#filter_ontologies.bp_popup_link{:href => "javascript:void(0);"} filter
                %div#ontology_filter_list.bp_popup_list
            %th{class: "match_type"}
              Type
              %span.popup_container
                %span.bp_popup_link_container
                  %a#filter_match_type.bp_popup_link{:href => "javascript:void(0);"} filter
                %div#match_type_filter_list.bp_popup_list
            %th UMLS Sem Type
            %th{class: "match_context"} Context
            %th
              Matched Class
              %span.popup_container
                %span.bp_popup_link_container
                  %a#filter_matched_classes.bp_popup_link{:href => "javascript:void(0);"} filter
                %div#matched_classes_filter_list.bp_popup_list
            %th
              Matched Ontology
              %span.popup_container
                %span.bp_popup_link_container
                  %a#filter_matched_ontologies.bp_popup_link{:href => "javascript:void(0);"} filter
                %div#matched_ontology_filter_list.bp_popup_list
            %th Score
            %th Negation
            %th Experiencer
            %th Temporality
        %tbody
      %div.my-3
        %b Format results as:
      %div.my-3
        %span#download_links_tabdelimited.link_button.ui_button
        %span#download_links_json.link_button.ui_button
        %span#download_links_rdf.link_button.ui_button
        %span#download_links_text.link_button.ui_button
        -# %span#download_links_xml.link_button.ui_button
      %div.mt-3
        Reproduce these results using the
        %span#annotator_parameters
      %div.mb-4
        Additional parameters explained at
        = link_to('Annotator API documentation', "#{$REST_URL}/documentation#nav_annotator", target: "_blank")