<commit_before>{% extends "base_visualize.html" %}
{% set active_page = 'rollingwindow' %}

{% block head %}
<script type="text/javascript" src="{{ url_for('static', filename='js/d3.v3.min.js') }}?ver={{version}}"></script>
<!-- javascript that formats options and graph -->
<script type="text/javascript" src="{{ url_for('static', filename='js/scripts_rwanalysis.js') }}?ver={{version}}"></script> 
<script type="text/javascript">
	var dataLines = {{ data|default(0) }};
	var xAxisLabel = "{{xAxisLabel}}";
	var yAxisLabel = "{{yAxisLabel}}";
	var legendLabels = "{{legendLabels[0].decode("utf-8", "replace")}}";
	legendLabels = legendLabels.split("#");
	noDots = {{ 'true' if session['rwoption']['hideDots'] else 'false' }};
	BandW = {{ 'true' if session['rwoption']['BWoutput'] else 'false' }};
</script>
{% endblock %}

{% block title %}visualizer{% endblock %} 


{% block options %}
<legend>Rolling Window Options <div style="margin: 0 10px; float: right; width: 125px;" class="bttn bttn-action ITMtrigger video-dialog" data-slug="rolling-window-analysis-video">Watch the Video</div></legend>
<div>
	<legend style="width: 300px;">Select Active File:</legend>
	<input type="hidden" value="{{ request.form['filetorollinganalyze'] }}" id="filetorollinganalyze"/>
	<div id="rwFileselect" style="overflow:auto; width: 300px; float: left; max-height: 125px;">
		{% for fileID, label in labels.items() %}
			<label>{{label}} 
				<input type="radio" class="minifilepreview" {{ 'checked' if fileID|unicode == session['rwoption']['filetorollinganalyze'] or loop.first }} name="filetorollinganalyze" id="{{fileID}}_selector" value="{{fileID}}">
			</label>
		{%- endfor %}
		{% if labels|len == 0 %}
			<span id="no-labels">No Documents are Selected</span>
		{%- endif %}
	</div>
	
	<fieldset class="rwanalysisradiosdiv" style="position: relative; top: -55px; float: left;">
		<legend>Type of Count:</legend>
		<label class="radio has-tooltip" for="rollingaverage" id="radioaverage">
			<input type="radio" checked name="counttype" value="average" id="rollingaverage" data-toggle="radio" />
			<span>Rolling Average</span>
			<span class="icon-help tooltip rolling-window small" data-tooltip="Measures the number of times the input appears in the window, divided by the overall size of the window"></span>
		</label>
		<label class="radio has-tooltip" for="rollingratio" id="radioratio">
			<input type="radio" {{ "checked" if session['rwoption']["counttype"] == "ratio" }} name="counttype" value="ratio" id="rollingratio" data-toggle="radio"/>
			<span>Rolling Ratio</span>
			<span class="icon-help tooltip rolling-window small" data-tooltip="Measures the value of the first input divided by the sum of the first and second inputs."></span>
		</label>
	</fieldset>

	<fieldset class="rwanalysisradiosdiv" style="float: left; position: relative; top: -55px; left: -20px;">
		<legend>Unit of Window:</legend>
		<label class="radio" for="windowletter" id="radiowindowletter">
			<input type="radio" checked name="windowtype" value="letter" id="windowletter" data-toggle="radio">in window of Letters
		</label>
		<label class="radio" for="windowword" id="radiowindowword">
			<input type="radio" {{ "checked" if session['rwoption']["windowtype"] == "word" }} name="windowtype" value="word" id="windowword" data-toggle="radio" />in window of Words
		</label>
		<label class="radio" for="windowline" id="radiowindowline">
			<input type="radio" {{ "checked" if session['rwoption']["windowtype"] == "line" }} name="windowtype" value="line" id="windowline" data-toggle="radio" />in window of Lines
		</label>
	</fieldset>

	<fieldset class="rwanalysisradiosdiv" style="float: left; position: relative; top: -55px; left: -40px;">
		<legend>Unit of Token:</legend>
		<label class="radio" for="inputstring" id="radioinputletter">
			<input type="radio" checked name="inputtype" value="string" id="inputstring" data-toggle="radio"/>of String(s)
			<span class="icon-help tooltip rolling-window small" data-tooltip="A string can be of any length."></span>
		</label>
		<label class="radio" for="inputword" id="radioinputword">
			<input type="radio" {{ "checked" if session['rwoption']["inputtype"] == "word" }} name="inputtype" value="word" id="inputword" data-toggle="radio" />of Word(s)
		</label>
		<label class="radio" for="inputregex" id="radioinputregex">
			<input type="radio" {{ "checked" if session['rwoption']["inputtype"] == "regex" }} name="inputtype" value="regex" id="inputregex" data-toggle="radio" />RegEx
			<span class="icon-help tooltip rolling-window small" data-tooltip="Regular Expressions (RegEx) can be used as the input."></span>
		</label>
	</fieldset>

	<fieldset class="rwanalysisradiosdiv" style="width: 250px; float: left; position: relative; top: -55px; left: -25px;" id="rolling-analysis-inputs">
		<legend>Enter Values:</legend>
		<label id="rollinginputlabel" style="padding-bottom: 6px">Search Token:
			<span class="icon-help tooltip rolling-window small" data-tooltip="Up to six inputs, divided by commas."></span>
			<br>
			<input type="text" name="rollingsearchword" class="rollinginput" id="rollingsearchword" value="{{ session['rwoption']['rollingsearchword'] }}">
			<span class="rollingsearchwordoptdiv {{ 'hidden' if session['rwoption']['counttype'] != 'ratio' }}" > <hr>
				<input type="text" name="rollingsearchwordopt" class="rollinginput" id="rollingsearchwordopt" value="{{ session['rwoption']['rollingsearchwordopt'] }}">
			</span>
			
		</label>
		<label for="rollingwindowsize" style="padding-bottom: 6px">Size of Rolling Window:
			<input type="number" min="1" name="rollingwindowsize" id="rollingwindowsize" value="{{ session['rwoption']['rollingwindowsize'] }}">
		</label>
		<label class="milestoneCheckbox">
			Document has Milestones<input type="checkbox" class="milestoneCheckbox" name="rollinghasmilestone" id="rollinghasmilestone" {{ "checked" if session['rwoption']['rollinghasmilestone']}} style="text-align: left;" onclick="updateMSopt()">
			<span class="icon-help tooltip rolling-window small" data-tooltip="Search the file for all instances of a specified string and plot a vertical dividing line at those location"></span>
		</label>
		<span class="rollingmilestoneopt" id="rollingmilestoneopt" name="rollingmilestoneopt" >Milestone delimeter:
			<input type="text" name="rollingmilestonetype" id="rollingmilestonetype" value="{{ session['rwoption']['rollingmilestonetype'] }}" style="width: 92px">
		</span>
	</fieldset>

	<fieldset class="rwanalysisradiosdiv" style="position: relative; top: -55px; left: -12px;">
		<legend>Display Options:</legend>
		<label>Hide individual points<input type="checkbox" name="hideDots" id="hideDots" {{ 'checked' if session['rwoption']['hideDots'] }}></label>
		<label>Black and White only<input type="checkbox" name="BWoutput" id="BWoutput" {{ 'checked' if session['rwoption']['BWoutput'] }}></label>
	</fieldset>
</div>
{% endblock %}

{% block results %}
{% if rwadatagenerated %}
<div id="rwagraphlabel">{{graphTitle}}</div>
<div id="rwagraphdiv" class="hidden">{{ rwadatagenerated }}</div> 
<label>Download:</label>
<input type="submit" class="bttn bttn-action" id="generateRWmatrix" name="get-RW-plot" value="Graph Data"/>
<input type="submit" class="bttn bttn-action" id="generateRWmatrix" name="get-RW-data" value="CSV Matrix"/>
<div class="bttn bttn-action" id="svg-Chrome" href="#">SVG (Chrome)</div>
<a id="svg-Other" href="#" target="_blank">SVG (other browsers)</a>

<div id="rwagraphdiv" class="infobox">
	<p></p>
</div>
{% endif %}
{% endblock %}


{% block submit %}
<input type="submit" class="bttn bttn-action" name="rollinganalyze" value="Get Graph"/><commit_msg>Added some highlighting and minor gui tweaks to RWA<commit_after>{% extends "base_visualize.html" %}
{% set active_page = 'rollingwindow' %}

{% block head %}
<script type="text/javascript" src="{{ url_for('static', filename='js/d3.v3.min.js') }}?ver={{version}}"></script>
<!-- javascript that formats options and graph -->
<script type="text/javascript" src="{{ url_for('static', filename='js/scripts_rwanalysis.js') }}?ver={{version}}"></script> 
<script type="text/javascript">
	var dataLines = {{ data|default(0) }};
	var xAxisLabel = "{{xAxisLabel}}";
	var yAxisLabel = "{{yAxisLabel}}";
	var legendLabels = "{{legendLabels[0].decode("utf-8", "replace")}}";
	legendLabels = legendLabels.split("#");
	noDots = {{ 'true' if session['rwoption']['hideDots'] else 'false' }};
	BandW = {{ 'true' if session['rwoption']['BWoutput'] else 'false' }};
</script>
{% endblock %}

{% block title %}visualizer{% endblock %} 


{% block options %}
<legend>Rolling Window Options <div style="margin: 0 10px; float: right; width: 125px;" class="bttn bttn-action ITMtrigger video-dialog" data-slug="rolling-window-analysis-video">Watch the Video</div></legend>
<div>
	<legend style="width: 300px;">Select Active File:</legend>
	<input type="hidden" value="{{ request.form['filetorollinganalyze'] }}" id="filetorollinganalyze"/>
	<div id="rwFileselect" style="overflow:auto; width: 300px; float: left; max-height: 125px;">
		{% for fileID, label in labels.items() %}
			<label>{{label}} 
				<input type="radio" class="minifilepreview" {{ 'checked' if fileID|unicode == session['rwoption']['filetorollinganalyze'] or loop.first }} name="filetorollinganalyze" id="{{fileID}}_selector" value="{{fileID}}">
			</label>
		{%- endfor %}
		{% if labels|len == 0 %}
			<span id="no-labels">No Documents are Selected</span>
		{%- endif %}
	</div>
	
	<fieldset class="rwanalysisradiosdiv" style="position: relative; top: -55px; float: left;">
		<legend>Type of Count:</legend>
		<label class="radio has-tooltip" for="rollingaverage" id="radioaverage">
			<input type="radio" checked name="counttype" value="average" id="rollingaverage" data-toggle="radio" />
			<span>Rolling Average</span>
			<span class="icon-help tooltip rolling-window small" data-tooltip="Measures the number of times the input appears in the window, divided by the overall size of the window"></span>
		</label>
		<label class="radio has-tooltip" for="rollingratio" id="radioratio">
			<input type="radio" {{ "checked" if session['rwoption']["counttype"] == "ratio" }} name="counttype" value="ratio" id="rollingratio" data-toggle="radio"/>
			<span>Rolling Ratio</span>
			<span class="icon-help tooltip rolling-window small" data-tooltip="Measures the value of the first input divided by the sum of the first and second inputs."></span>
		</label>
	</fieldset>

	<fieldset class="rwanalysisradiosdiv" style="float: left; position: relative; top: -55px; left: -20px;">
		<legend>Unit of Window:</legend>
		<label class="radio" for="windowletter" id="radiowindowletter">
			<input type="radio" checked name="windowtype" value="letter" id="windowletter" data-toggle="radio">in window of Letters
		</label>
		<label class="radio" for="windowword" id="radiowindowword">
			<input type="radio" {{ "checked" if session['rwoption']["windowtype"] == "word" }} name="windowtype" value="word" id="windowword" data-toggle="radio" />in window of Words
		</label>
		<label class="radio" for="windowline" id="radiowindowline">
			<input type="radio" {{ "checked" if session['rwoption']["windowtype"] == "line" }} name="windowtype" value="line" id="windowline" data-toggle="radio" />in window of Lines
		</label>
	</fieldset>

	<fieldset class="rwanalysisradiosdiv" style="float: left; position: relative; top: -55px; left: -40px;">
		<legend>Unit of Token:</legend>
		<label class="radio" for="inputstring" id="radioinputletter">
			<input type="radio" checked name="inputtype" value="string" id="inputstring" data-toggle="radio"/>of String(s)
			<span class="icon-help tooltip rolling-window small" data-tooltip="A string can be of any length."></span>
		</label>
		<label class="radio" for="inputword" id="radioinputword">
			<input type="radio" {{ "checked" if session['rwoption']["inputtype"] == "word" }} name="inputtype" value="word" id="inputword" data-toggle="radio" />of Word(s)
		</label>
		<label class="radio" for="inputregex" id="radioinputregex">
			<input type="radio" {{ "checked" if session['rwoption']["inputtype"] == "regex" }} name="inputtype" value="regex" id="inputregex" data-toggle="radio" />RegEx
			<span class="icon-help tooltip rolling-window small" data-tooltip="Regular Expressions (RegEx) can be used as the input."></span>
		</label>
	</fieldset>


	<legend style="position: relative; top: -50px; width: 260px;">Enter Values:</legend>
	<fieldset class="rwanalysisradiosdiv" style="background-color: #efefef; width: 250px; height:  float: left; position: relative; top: -65px; padding: 25px 5px 10px;" id="rolling-analysis-inputs">
		<label id="rollinginputlabel" style="padding-bottom: 6px">Search Token:
			<span class="icon-help tooltip rolling-window small" data-tooltip="Up to six inputs, divided by commas."></span>
			<br>
			<input type="text" name="rollingsearchword" class="rollinginput" id="rollingsearchword" value="{{ session['rwoption']['rollingsearchword'] }}">
			<span class="rollingsearchwordoptdiv {{ 'hidden' if session['rwoption']['counttype'] != 'ratio' }}" > <hr>
				<input type="text" name="rollingsearchwordopt" class="rollinginput" id="rollingsearchwordopt" value="{{ session['rwoption']['rollingsearchwordopt'] }}">
			</span>
			
		</label>
		<label for="rollingwindowsize" style="padding-bottom: 6px">Size of Rolling Window:
			<input type="number" min="1" name="rollingwindowsize" id="rollingwindowsize" value="{{ session['rwoption']['rollingwindowsize'] }}">
		</label>
		<label class="milestoneCheckbox">
			Document has Milestones<input type="checkbox" class="milestoneCheckbox" name="rollinghasmilestone" id="rollinghasmilestone" {{ "checked" if session['rwoption']['rollinghasmilestone']}} style="text-align: left;" onclick="updateMSopt()">
			<span class="icon-help tooltip rolling-window small" data-tooltip="Search the file for all instances of a specified string and plot a vertical dividing line at those location"></span>
		</label>
		<span class="rollingmilestoneopt" id="rollingmilestoneopt" name="rollingmilestoneopt" >Milestone delimeter:
			<input type="text" name="rollingmilestonetype" id="rollingmilestonetype" value="{{ session['rwoption']['rollingmilestonetype'] }}" style="width: 92px">
		</span>
	</fieldset>

	<fieldset class="rwanalysisradiosdiv" style="position: relative; top: -105px; left: 0px;">
		<legend>Display Options:</legend>
		<label>Hide individual points<input type="checkbox" name="hideDots" id="hideDots" {{ 'checked' if session['rwoption']['hideDots'] or not rwadatagenerated  }}></label>
		<label>Black and White only<input type="checkbox" name="BWoutput" id="BWoutput" {{ 'checked' if session['rwoption']['BWoutput'] }}></label>
	</fieldset>
</div>
{% endblock %}

{% block results %}
{% if rwadatagenerated %}
<div id="rwagraphlabel">{{graphTitle}}</div>
<div id="rwagraphdiv" class="hidden">{{ rwadatagenerated }}</div> 
<label>Download:</label>
<input type="submit" class="bttn bttn-action" id="generateRWmatrix" name="get-RW-plot" value="Graph Data"/>
<input type="submit" class="bttn bttn-action" id="generateRWmatrix" name="get-RW-data" value="CSV Matrix"/>
<div class="bttn bttn-action" id="svg-Chrome" href="#">SVG (Chrome)</div>
<a id="svg-Other" href="#" target="_blank">SVG (other browsers)</a>

<div id="rwagraphdiv" class="infobox">
	<p></p>
</div>
{% endif %}
{% endblock %}


{% block submit %}
<input type="submit" class="bttn bttn-action" name="rollinganalyze" value="Get Graph"/>
{'fraction_non_alphanumeric': 0.1869803416048985, 'fraction_numerical': 0.006574282951981953, 'mean_word_length': 6.535696940262263, 'pattern_counts': {'":': 0, '<': 249, '<?xml version=': 0, '>': 249, 'https://': 0, 'lorem ipsum': 0, 'www.': 0, 'xml': 0}, 'pii_count': 0, 'substrings_counts': 0, 'word_list_counts': {'cursed_substrings.json': 2, 'profanity_word_list.json': 0, 'sexual_word_list.json': 0, 'zh_pornsignals.json': 0}}
{'dir': 'git-commits-cleaned', 'id': '208987', 'n_tokens_mistral': 5293, 'n_tokens_neox': 4821, 'n_words': 1205}