<commit_before><% content_for :head do %>
<%= javascript_include_tag 'widgets/patient_table.js'%>
  <script type="text/javascript">
function llog(x) {window.console.log(x)}    
    
    var popHealth = popHealth || {};
    var sort = "_id";
    var offset = 0;
    var limit = 50;
    var display_type= "denominator";
    var effective_date = <%=Time.gm(2010, 9, 19).to_i%>;
    var measure_id= '<%=params[:id] %>';
    var sub_id=<%= "'#{params[:sub_id]}'" || 'null' %>;
    var sort_ascending = true;
    
    popHealth.drawPctChart = function(data) {
        var elem = "#mcp";
        var percent = data.denominator > 0 ? (data.numerator/data.denominator).toFixed(2)*100 : 0;
        var numeratorWidth = (data.numerator/<%= @patient_count %>).toFixed(2)*100;
        var denominatorWidth = data.denominator > 0 ? ((data.denominator - data.numerator)/<%= @patient_count %>).toFixed(2)*100 : 0;
        
        $(elem).find("#numeratorValue").text(data.numerator);
        $(elem).find("#denominatorValue").text(data.denominator);
        $(elem).find("#measurePopulationPercentage").text(percent + "%");
        
        $(elem).find(".barNumerator").css("width", numeratorWidth + "%");
        $(elem).find(".barDenominator").css("width", denominatorWidth + "%");

        $("#outcomeExclusionMarker").text(data.exceptions + " exclusion" + (data.exceptions = 1 ? "s":""));
        $("#eligibleCount").text(data.denominator);
        $("#outcomeCount").text(data.numerator);
    }
    
    
    popHealth.renderMeasureJSON = function(data) {
        var measure = data;
        $.getJSON("<%= measure_result_url(@definition['id'], @definition['sub_id']) %>",popHealth.drawPctChart);
        $("#measureTitleText").text(data.name);
        $("#measureDescText").text(data.description);
    }
    
    
    popHealth.reloadTable = function(data){
       var url = "/measures/measure_patients/"+measure_id;
        if (sub_id){
          url += "/"+sub_id
        }
          $.ajax({ url:  url,
                     data: {sort:sort, sort_order:(sort_ascending? 'asc' :'desc' ) , offset:offset, limit:limit, type:display_type, effective_date:effective_date },
                     type:"GET",
                     dataType: 'html',
                     success: function(res){
                       $('#patientTableContainer').html(res);
                     },
                     error: function(xhr, err) {
                      alert("need to do something about this");
                     }
                   });
    }
    
    
    popHealth.sortPatientTable = function(field){
       sort = field;
       popHealth.reloadTable();
    }
    
    
    $(document).ready(function() {
    
    //$.getJSON("json/bp.json",popHealth.renderMeasureJSON);
    $.getJSON("<%= measure_definition_url(@definition['id'], @definition['sub_id']) %>",popHealth.renderMeasureJSON);
    
    $("#measurementPeriodEndDate").val(new Date().format("mm/dd/yyyy"));
    $("#btnSaveNewMeasure").click(popHealth.saveNewMeasure);
    $("#btnReturnToDash").click(popHealth.returnToDash);
    $("#measurementPeriodStartDate, #measurementPeriodEndDate").calendricalDate({usa:true});
    
    
    $('input[name=patientGroup]').change(function(){
       //$('#patientTableContainer').patient_table.displayNumerator();
       if(this.id == "num"){
         display_type = "numerator";
       }else if(this.id == "den"){
           display_type = "denominator";
       }else{
           display_type = "antinumerator";
       }
       popHealth.reloadTable();
    });
    
    
    //$('#patientTableContainer').patientTable({measure_id:'<%=params[:id] %>',sub_id:<%=params[:sub_id] || 'null' %>,effective_date:<%=Time.gm(2010, 9, 19).to_i%>});
    
    popHealth.reloadTable();
    
});



 
  var results = <%=@result.to_json.html_safe %>;
  </script>
<commit_msg>Wiring up the exclusions button<commit_after><% content_for :head do %>
<%= javascript_include_tag 'widgets/patient_table.js'%>
  <script type="text/javascript">
function llog(x) {window.console.log(x)}    
    
    var popHealth = popHealth || {};
    var sort = "_id";
    var offset = 0;
    var limit = 50;
    var display_type= "denominator";
    var effective_date = <%=Time.gm(2010, 9, 19).to_i%>;
    var measure_id= '<%=params[:id] %>';
    var sub_id=<%= "'#{params[:sub_id]}'" || 'null' %>;
    var sort_ascending = true;
    
    popHealth.drawPctChart = function(data) {
        var elem = "#mcp";
        var percent = data.denominator > 0 ? (data.numerator/data.denominator).toFixed(2)*100 : 0;
        var numeratorWidth = (data.numerator/<%= @patient_count %>).toFixed(2)*100;
        var denominatorWidth = data.denominator > 0 ? ((data.denominator - data.numerator)/<%= @patient_count %>).toFixed(2)*100 : 0;
        
        $(elem).find("#numeratorValue").text(data.numerator);
        $(elem).find("#denominatorValue").text(data.denominator);
        $(elem).find("#measurePopulationPercentage").text(percent + "%");
        
        $(elem).find(".barNumerator").css("width", numeratorWidth + "%");
        $(elem).find(".barDenominator").css("width", denominatorWidth + "%");

        $("#outcomeExclusionMarker").text(data.exceptions + " exclusion" + (data.exceptions = 1 ? "s":""));
        $("#eligibleCount").text(data.denominator);
        $("#outcomeCount").text(data.numerator);
    }
    
    
    popHealth.renderMeasureJSON = function(data) {
        var measure = data;
        $.getJSON("<%= measure_result_url(@definition['id'], @definition['sub_id']) %>",popHealth.drawPctChart);
        $("#measureTitleText").text(data.name);
        $("#measureDescText").text(data.description);
    }
    
    
    popHealth.reloadTable = function(data){
       var url = "/measures/measure_patients/"+measure_id;
        if (sub_id){
          url += "/"+sub_id
        }
          $.ajax({ url:  url,
                     data: {sort:sort, sort_order:(sort_ascending? 'asc' :'desc' ) , offset:offset, limit:limit, type:display_type, effective_date:effective_date },
                     type:"GET",
                     dataType: 'html',
                     success: function(res){
                       $('#patientTableContainer').html(res);
                     },
                     error: function(xhr, err) {
                      alert("need to do something about this");
                     }
                   });
    }
    
    
    popHealth.sortPatientTable = function(field){
       sort = field;
       popHealth.reloadTable();
    }
    
    
    $(document).ready(function() {
    
    //$.getJSON("json/bp.json",popHealth.renderMeasureJSON);
    $.getJSON("<%= measure_definition_url(@definition['id'], @definition['sub_id']) %>",popHealth.renderMeasureJSON);
    
    $("#measurementPeriodEndDate").val(new Date().format("mm/dd/yyyy"));
    $("#btnSaveNewMeasure").click(popHealth.saveNewMeasure);
    $("#btnReturnToDash").click(popHealth.returnToDash);
    $("#measurementPeriodStartDate, #measurementPeriodEndDate").calendricalDate({usa:true});
    
    
    $('input[name=patientGroup]').change(function(){
       //$('#patientTableContainer').patient_table.displayNumerator();
       if(this.id == "num"){
         display_type = "numerator";
       } else if(this.id == "den"){
           display_type = "denominator";
       } else if(this.id == "exc"){
           display_type = "exclusion";
       } else {
           display_type = "antinumerator";
       }
       popHealth.reloadTable();
    });
    
    
    //$('#patientTableContainer').patientTable({measure_id:'<%=params[:id] %>',sub_id:<%=params[:sub_id] || 'null' %>,effective_date:<%=Time.gm(2010, 9, 19).to_i%>});
    
    popHealth.reloadTable();
    
});



 
  var results = <%=@result.to_json.html_safe %>;
  </script>

{'fraction_non_alphanumeric': 0.18031314168377824, 'fraction_numerical': 0.008726899383983572, 'mean_word_length': 2.6881211547562707, 'pattern_counts': {'":': 2, '<': 33, '<?xml version=': 0, '>': 37, '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': '7041336', 'n_tokens_mistral': 2487, 'n_tokens_neox': 2357, 'n_words': 349}