<commit_before><!-- profile.html - Partial view for properties on each patient -->

{% extends "base.html" %}
{% block title %}Patient Profile{% endblock %}
{% block page_header %}

    <div class="page-header">
        <h1>{{ patient.first_name }} {{ patient.last_name }}
            <small class="text-muted half-size">Patient Since {{ patient.date_joined.strftime('%m/%d/%Y') }}</small>
        </h1>
    </div>
    <style type="text/css">
        p {
            overflow-wrap: break-word;
            word-wrap: break-word;
        }
    </style>
{% endblock %}


{% block content %}

    <script src="{{ url_for('static', filename='js/vis.js') }}"></script>
    <script src="{{ url_for('static', filename='js/FitBitGraphing.js') }}"></script>
    <link href="{{ url_for('static', filename='css/vis.css') }}" rel="stylesheet" type="text/css"/>

    <div class="row bottom-buffer">
        <div class="col-md-6">
            <h4><span class="label label-primary">All-Time Average Resting Heart Rate:</span> <span class="badge">{{ resting }}</span></h4>
            <h4><span class="label label-primary">Date Last Worn:</span> <span class="badge">{{ last_worn }}</span></h4>
        </div>
        <div class="col-md-6">
            <h4><span class="label label-primary">Steps Average:</span> <span class="badge">{{ patient.steps_average() }}</span></h4>
            <h4><span class="label label-primary">Steps Today:</span> <span class="badge">{{ patient.steps_today() }}</span></h4>
        </div>
    </div>

    {% include "patient_alerts_partial.html" %}

    <!-- Navigation tabs -->
    <ul class="nav nav-tabs" id="myTab" data-tabs="tabs">
        <li class="active"><a href="#graphs" data-toggle="tab">Graphs</a></li>
        <li><a href="#notes" data-toggle="tab">Notes</a></li>
        <li><a href="#config" data-toggle="tab">Settings</a></li>
        <li><a href="#history" data-toggle="tab">History</a></li>
    </ul>

    <!-- 1. GRAPHING TAB CONTENT -->
    <div class="tab-content top-buffer">

        <div class="tab-pane active" id="graphs">
            <h3>Heart Rate History <small>bpm / time</small></h3>
            <button class="btn btn-default" id="toggle-real-HR"><span class="glyphicon glyphicon-stats"></span> Toggle Raw Data</button>
            <button class="btn btn-default" id="toggle-smooth-HR"><span class="glyphicon glyphicon-signal"></span> Toggle Smoothed Data</button>
            <div class="top-buffer" id="HR_visualization"></div>
            <br>
            <h3>Activity History <small># steps / time</small></h3>
            <div class="bottom-buffer" id="STEP_visualization"></div>
        </div>


        <!-- 2. PATIENT NOTES CONTENT -->
        {% include "patients/patient_notes_pane.html" %}


        <!-- 3. SETTINGS TAB CONTENT (Alert Config, Remove Patient & Export Buttons) -->
        <div class="tab-pane" id="config">

            <p><strong>TODO: FORM HERE TO CREATE & EDIT "PatientConfig" settings</strong></p>

            <div class="col-md-6">
                <div class="panel panel-primary">
                    <script src="{{ url_for('static', filename='js/bootstrap-datepicker.min.js') }}"></script>
                    <link href="{{ url_for('static', filename='css/bootstrap-datepicker.css') }}" rel="stylesheet">

                    <div class="panel-heading"><span class="glyphicon glyphicon-signal"></span> Data Export</div>
                    <div class="panel-body">Select a date range below for the desired data interval.
                        </br></br>

                        <div class="form-group">
                            <div class="input-group date">
                                <input placeholder="Start Date" type="text" class="form-control" id="startDate">
                        <span class="input-group-addon">
                            <span class="glyphicon glyphicon-calendar"></span>
                        </span>
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="input-group date">
                                <input placeholder="End Date" type="text" class="form-control" id="endDate">
                        <span class="input-group-addon">
                            <span class="glyphicon glyphicon-calendar"></span>
                        </span>
                            </div>
                        </div>

                        <button class="btn btn-primary" type="button" id="submit-export">
                            <span class="glyphicon glyphicon-circle-arrow-down" aria-hidden="true"></span>
                            Export data
                        </button>
                    </div>
                </div>
            </div>

            <div class="col-md-6">
                <div class="panel panel-warning">
                    <div class="panel-heading"><span class="glyphicon glyphicon-danger"></span> Remove Patient</div>
                    <div class="panel-body">
                        <button type="button" class="btn btn-danger" data-toggle="modal" data-target="#removeModal">
                            <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
                            Remove Patient from My Dashboard
                        </button>
                    </div>
                </div>
            </div>

        </div>

        <!-- 4. All alerts (read and unread) -->
        <div class="tab-pane active" id="history">
            <h3>Alerts History</h3>
            <ul class="list-group">
            {% for alert in all_alerts %}
                <li class="list-group-item">{{ alert }}</li>
            {% endfor %}
            </ul>
        </div>


    </div> <!-- /tab-content -->

    {% include "remove_patient_modal.html" %}


    <!-- Date picker for exporting data -->
    <script type="text/javascript">
        $('.input-group.date').datepicker({
            format: "yyyy-mm-dd",
            todayBtn: "linked",
            clearBtn: true
        });

        $('#submit-export').click(function() {
            var begin = $( "input#startDate" ).val();
            var end = $( "input#startDate" ).val();
            console.log("Begin: " + begin);
            console.log("End: " + end);
            window.location = '/dashboard/' + "{{ patient.id }}" + '/export/' + begin + '/' + end;
        });
    </script>


    {# Populate the graph #}
    <script type="text/javascript">
        // Receive heartRateData from server-side into client-side JS object.
        var heartRateData = {{ HRdata | tojson }};
        var averageHeartRate = {{ HRaverage | tojson }};
        var stepsData = {{ StepsData | tojson }};
        var start = "{{ start }}";
        var end = "{{ end }}";

        FitBitGraphing(heartRateData, averageHeartRate, stepsData, start, end);
    </script>

{% endblock %}<commit_msg>View for Patient Config input form<commit_after><!-- profile.html - Partial view for properties on each patient -->

{% extends "base.html" %}
{% block title %}Patient Profile{% endblock %}
{% block page_header %}

    <div class="page-header">
        <h1>{{ patient.first_name }} {{ patient.last_name }}
            <small class="text-muted half-size">Patient Since {{ patient.date_joined.strftime('%m/%d/%Y') }}</small>
        </h1>
    </div>
    <style type="text/css">
        p {
            overflow-wrap: break-word;
            word-wrap: break-word;
        }
    </style>
{% endblock %}


{% block content %}

    <script src="{{ url_for('static', filename='js/vis.js') }}"></script>
    <script src="{{ url_for('static', filename='js/FitBitGraphing.js') }}"></script>
    <link href="{{ url_for('static', filename='css/vis.css') }}" rel="stylesheet" type="text/css"/>

    <div class="row bottom-buffer">
        <div class="col-md-6">
            <h4><span class="label label-primary">All-Time Average Resting Heart Rate:</span> <span class="badge">{{ resting }}</span></h4>
            <h4><span class="label label-primary">Date Last Worn:</span> <span class="badge">{{ last_worn }}</span></h4>
        </div>
        <div class="col-md-6">
            <h4><span class="label label-primary">Steps Average:</span> <span class="badge">{{ patient.steps_average() }}</span></h4>
            <h4><span class="label label-primary">Steps Today:</span> <span class="badge">{{ patient.steps_today() }}</span></h4>
        </div>
    </div>

    {% include "patient_alerts_partial.html" %}

    <!-- Navigation tabs -->
    <ul class="nav nav-tabs" id="myTab" data-tabs="tabs">
        <li class="active"><a href="#graphs" data-toggle="tab">Graphs</a></li>
        <li><a href="#notes" data-toggle="tab">Notes</a></li>
        <li><a href="#config" data-toggle="tab">Settings</a></li>
        <li><a href="#history" data-toggle="tab">History</a></li>
    </ul>

    <!-- 1. GRAPHING TAB CONTENT -->
    <div class="tab-content top-buffer">

        <div class="tab-pane active" id="graphs">
            <h3>Heart Rate History <small>bpm / time</small></h3>
            <button class="btn btn-default" id="toggle-real-HR"><span class="glyphicon glyphicon-stats"></span> Toggle Raw Data</button>
            <button class="btn btn-default" id="toggle-smooth-HR"><span class="glyphicon glyphicon-signal"></span> Toggle Smoothed Data</button>
            <div class="top-buffer" id="HR_visualization"></div>
            <br>
            <h3>Activity History <small># steps / time</small></h3>
            <div class="bottom-buffer" id="STEP_visualization"></div>
        </div>


        <!-- 2. PATIENT NOTES CONTENT -->
        {% include "patients/patient_notes_pane.html" %}


        <!-- 3. SETTINGS TAB CONTENT (Alert Config, Remove Patient & Export Buttons) -->
        <div class="tab-pane" id="config">

            <div class="col-md-12 bottom-buffer">
                <div class="panel panel-primary">
                    <div class="panel-heading"><span class="glyphicon glyphicon-bell"></span> Patient Alert Settings</div>

                    <div class="panel-body">

                        <p>Please configure minimum and maximum thresholds for this patient's activity and heart rate data.
                            You will receive alerts if the patient's data deviates from this range.
                        </p>

                        <div class="form-group">

                            <div class="col-md-3 bottom-buffer">
                                <label for="minHR">Minimum Heart Rate</label>
                                <div class="input-group">
                                  <input type="number" min="30" max="250" step="5" class="form-control" id="minHR" placeholder="e.g. 55" aria-describedby="minHR-addon">
                                  <span class="input-group-addon" id="minHR-addon"> BPM</span>
                                </div>
                            </div>

                            <div class="col-md-3 bottom-buffer">
                                <label for="minHR-time">Min HR - Time Interval</label>
                                <div class="input-group">
                                  <input type="number" min="1" max="1000" step="5" class="form-control" id="minHR-time" placeholder="10 min" aria-describedby="minHR-addon">
                                  <span class="input-group-addon" id="minHR-addon"> minutes</span>
                                </div>
                            </div>

                            <div class="col-md-3 bottom-buffer">
                                <label for="maxHR">Maximum Heart Rate</label>
                                <div class="input-group">
                                  <input type="number" min="30" max="250" step="5" class="form-control" id="maxHR" placeholder="e.g. 150" aria-describedby="maxHR-addon">
                                  <span class="input-group-addon" id="maxHR-addon"> BPM</span>
                                </div>
                            </div>

                            <div class="col-md-3 bottom-buffer">
                                <label for="maxHR-time">Max HR - Time Interval</label>
                                <div class="input-group">
                                  <input type="number" min="1" max="1000" step="5" class="form-control" id="maxHR-time" placeholder="15 min" aria-describedby="minHR-addon">
                                  <span class="input-group-addon" id="minHR-addon"> minutes</span>
                                </div>
                            </div>

                            <hr style="width: 100%; color: #337AB7; height: 1px; background-color:#337AB7;" />

                            <div class="col-md-3 bottom-buffer">
                                <label for="minSteps">Minimum Step Count</label>
                                <div class="input-group">
                                  <input type="number" min="0" step="50" class="form-control" id="minSteps" placeholder="e.g. 500" aria-describedby="minSteps-addon">
                                  <span class="input-group-addon" id="minSteps-addon"> steps</span>
                                </div>
                            </div>

                            <div class="col-md-3 bottom-buffer">
                                <label for="minSteps-time">Min Steps - Time Interval</label>
                                <div class="input-group">
                                  <input type="number" min="1" max="1000" step="5" class="form-control" id="maxSteps-time" placeholder="15 min" aria-describedby="minHR-addon">
                                  <span class="input-group-addon" id="minHR-addon"> minutes</span>
                                </div>
                            </div>

                            <div class="col-md-3 bottom-buffer">
                                <label for="maxSteps-times">Maximum Step Count</label>
                                <div class="input-group">
                                  <input type="number" min="0" step="50" class="form-control" id="maxSteps-time" placeholder="e.g. 10000" aria-describedby="maxSteps-addon">
                                  <span class="input-group-addon" id="maxSteps-addon"> steps</span>
                                </div>
                            </div>

                            <div class="col-md-3 bottom-buffer">
                                <label for="maxHR-time">Min Steps - Time Interval</label>
                                <div class="input-group">
                                  <input type="number" min="1" max="1000" step="5" class="form-control" id="maxHR-time" placeholder="10 min" aria-describedby="minHR-addon">
                                  <span class="input-group-addon" id="minHR-addon"> minutes</span>
                                </div>
                            </div>

                            <div class="col-md-6">
                                <button class="btn btn-success" type="button" id="submit-export">
                                <span class="glyphicon glyphicon-circle-arrow-down" aria-hidden="true"></span>
                                    Save Settings
                                </button>
                            </div>
                        </div>
                    </div>
                </div>
            </div>

            <!-- TODO: Refactor out this date picker / data export functionality into partial view. -->
            <div class="col-md-6">
                <div class="panel panel-primary">
                    <script src="{{ url_for('static', filename='js/bootstrap-datepicker.min.js') }}"></script>
                    <link href="{{ url_for('static', filename='css/bootstrap-datepicker.css') }}" rel="stylesheet">

                    <div class="panel-heading"><span class="glyphicon glyphicon-signal"></span> Data Export</div>
                    <div class="panel-body">

                        <p>Select a date range below for the desired data interval.</p>

                        <div class="form-group">
                            <div class="input-group date">
                                <input placeholder="Start Date" type="text" class="form-control" id="startDate">
                        <span class="input-group-addon">
                            <span class="glyphicon glyphicon-calendar"></span>
                        </span>
                            </div>
                        </div>

                        <div class="form-group">
                            <div class="input-group date">
                                <input placeholder="End Date" type="text" class="form-control" id="endDate">
                        <span class="input-group-addon">
                            <span class="glyphicon glyphicon-calendar"></span>
                        </span>
                            </div>
                        </div>

                        <button class="btn btn-primary" type="button" id="submit-export">
                            <span class="glyphicon glyphicon-circle-arrow-down" aria-hidden="true"></span>
                            Export data
                        </button>
                    </div>
                </div>
            </div>

            <div class="col-md-6">
                <div class="panel panel-warning">
                    <div class="panel-heading"><span class="glyphicon glyphicon-danger"></span> Remove Patient</div>
                    <div class="panel-body">
                        <button type="button" class="btn btn-danger" data-toggle="modal" data-target="#removeModal">
                            <span class="glyphicon glyphicon-remove" aria-hidden="true"></span>
                            Remove Patient from My Dashboard
                        </button>
                    </div>
                </div>
            </div>

        </div>

        <!-- 4. All alerts (read and unread) -->
        <div class="tab-pane active" id="history">
            <h3>Alerts History</h3>
            <ul class="list-group">
            {% for alert in all_alerts %}
                <li class="list-group-item">{{ alert }}</li>
            {% endfor %}
            </ul>
        </div>


    </div> <!-- /tab-content -->

    {% include "remove_patient_modal.html" %}


    <!-- Date picker for exporting data -->
    <script type="text/javascript">
        $('.input-group.date').datepicker({
            format: "yyyy-mm-dd",
            todayBtn: "linked",
            clearBtn: true
        });

        $('#submit-export').click(function() {
            var begin = $( "input#startDate" ).val();
            var end = $( "input#startDate" ).val();
            console.log("Begin: " + begin);
            console.log("End: " + end);
            window.location = '/dashboard/' + "{{ patient.id }}" + '/export/' + begin + '/' + end;
        });
    </script>


    {# Populate the graph #}
    <script type="text/javascript">
        // Receive heartRateData from server-side into client-side JS object.
        var heartRateData = {{ HRdata | tojson }};
        var averageHeartRate = {{ HRaverage | tojson }};
        var stepsData = {{ StepsData | tojson }};
        var start = "{{ start }}";
        var end = "{{ end }}";

        FitBitGraphing(heartRateData, averageHeartRate, stepsData, start, end);
    </script>

{% endblock %}
{'fraction_non_alphanumeric': 0.1572601334017445, 'fraction_numerical': 0.006875320677270395, 'mean_word_length': 1.5826156088511991, 'pattern_counts': {'":': 0, '<': 419, '<?xml version=': 0, '>': 419, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 18, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '3733762', 'n_tokens_mistral': 5517, 'n_tokens_neox': 5088, 'n_words': 1124}