<commit_before>{% extends "core/base.html" %}

{% load staticfiles %}
{% load url_tags %}
{% load humanize %}

{% block title %}
<title>FDA Drug Monitor - Enforcement Reports</title>
{% endblock %}

{% block header %}
    {% include 'core/header.html' with search_header='enforcements'%}
{% endblock header %}

{% block main %}
<main>
	<div class="wrapper page-header fda-enforcement-reports">
		<div class="content">
            <h1 class="margin-bottom-quad">Enforcement Reports</h1>
            <p>Select a state from the map below or enter a state into the search above
                to view current related information.  Click to view state data in
                <a href="#" id="state-list-trigger">table format</a>.</p>

            <p>Search by Drug Names to find all enforcement reports for a given drug.</p>
	    </div>
	</div>

    <div class="wrapper body">
		<div class="content">
            <div id="stateList" style="display:none;">
                <!-- browse list -->
                {% include 'core/browse.html' with search_url='search_enforcements' show_count=True %}
            </div>

            <!-- highcharts map -->
            <div id="map" style="height:700px; min-width:310px; max-width:100%; margin:0 auto"></div>

        </div>
    </div>
</main>
{% endblock %}

{% block extra_js %}
<script src="{% static "highmaps-1.1.6/modules/map.js" %}"></script>
<script src="{% static "highmaps-1.1.6/modules/data.js" %}"></script>
<script src="{% static "highmaps-1.1.6/mapdata/countries/us/us-all.js" %}"></script>

<script>

    // get data for enforcement map
    var enforcementData = [
        {% for result in terms %}
            {"term": "{{ result.term }}", "count": {{ result.count }}}
            {% if not forloop.last %},{% endif %}
        {% endfor %}
    ];

    $(enforcementData).each(function() {
        var dataItem = this;
        $(stateCounts).each(function() {
           if (this.code == dataItem.term.toUpperCase()) {
               this.value = dataItem.count;
           }
        });
    });

    $(function() {
        var map_color = '23, 105, 170';
        $('#map').highcharts('Map', {
            credits: {
                enabled: false
            },
            chart: {
                style: {
                    fontFamily: '"Roboto","Helvetica Neue",Helvetica,Arial,sans-serif'
                }
            },
            title: {
                text: 'Enforcement Reports By State'
            },
            legend: {
                layout: 'horizontal',
                borderWidth: 0,
                backgroundColor: 'rgba(255, 255, 255, 0.85)',
                floating: true,
                verticalAlign: 'top',
                y: 25,
                labelFormatter: function () {
                    if (this.to === 0) {
                        return '0';
                    }
                    else {
                        return (this.from || '<') + ' - ' + (this.to || '>');
                    }
                }
            },
            mapNavigation: {
                enabled: true
            },
            colorAxis: {
                dataClasses: [{
                    to: 0,
                    color: '#9E9E9E'
                },
                {
                    from: 1,
                    to: 3,<commit_msg>added chart text<commit_after>{% extends "core/base.html" %}

{% load staticfiles %}
{% load url_tags %}
{% load humanize %}

{% block title %}
<title>FDA Drug Monitor - Enforcement Reports</title>
{% endblock %}

{% block header %}
    {% include 'core/header.html' with search_header='enforcements'%}
{% endblock header %}

{% block main %}
<main>
	<div class="wrapper page-header fda-enforcement-reports">
		<div class="content">
            <h1 class="margin-bottom-quad">Enforcement Reports</h1>
            <p>Select a state from the map below or enter a state into the search above
                to view current related information.  Click to view state data in
                <a href="#" id="state-list-trigger">table format</a>.</p>

            <p>Search by Drug Names to find all enforcement reports for a given drug.</p>
	    </div>
	</div>

    <div class="wrapper body">
		<div class="content">
            <div id="stateList" style="display:none;">
                <!-- browse list -->
                {% include 'core/browse.html' with search_url='search_enforcements' show_count=True %}
            </div>

            <!-- highcharts map -->
            <div id="map" style="height:700px; min-width:310px; max-width:100%; margin:0 auto"></div>

        </div>
    </div>
</main>
{% endblock %}

{% block extra_js %}
<script src="{% static "highmaps-1.1.6/modules/map.js" %}"></script>
<script src="{% static "highmaps-1.1.6/modules/data.js" %}"></script>
<script src="{% static "highmaps-1.1.6/mapdata/countries/us/us-all.js" %}"></script>

<script>

    // get data for enforcement map
    var enforcementData = [
        {% for result in terms %}
            {"term": "{{ result.term }}", "count": {{ result.count }}}
            {% if not forloop.last %},{% endif %}
        {% endfor %}
    ];

    $(enforcementData).each(function() {
        var dataItem = this;
        $(stateCounts).each(function() {
           if (this.code == dataItem.term.toUpperCase()) {
               this.value = dataItem.count;
           }
        });
    });

    $(function() {
        var map_color = '23, 105, 170';
        $('#map').highcharts('Map', {
            credits: {
                enabled: false
            },
            chart: {
                style: {
                    fontFamily: '"Roboto","Helvetica Neue",Helvetica,Arial,sans-serif'
                }
            },
            title: {
                text: 'Enforcement Reports By State'
            },
            subtitle: {
                text: 'Click legend to filter states by count',
                style: {
                    fontStyle: 'italic'
                }
            },
            legend: {
                layout: 'horizontal',
                borderWidth: 0,
                backgroundColor: 'rgba(255, 255, 255, 0.85)',
                floating: true,
                verticalAlign: 'top',
                y: 45,
                labelFormatter: function () {
                    if (this.to === 0) {
                        return '0';
                    }
                    else {
                        return (this.from || '<') + ' - ' + (this.to || '>');
                    }
                }
            },
            mapNavigation: {
                enabled: true
            },
            colorAxis: {
                dataClasses: [{
                    to: 0,
                    color: '#9E9E9E'
                },
                {
                    from: 1,
                    to: 3,
{'fraction_non_alphanumeric': 0.14797485012428718, 'fraction_numerical': 0.015206901593800263, 'mean_word_length': 1.4507345037620925, 'pattern_counts': {'":': 4, '<': 71, '<?xml version=': 0, '>': 71, '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': '6075451', 'n_tokens_mistral': 2102, 'n_tokens_neox': 1855, 'n_words': 453}