Skip to content

Commit

Permalink
Exclude few files and apply pre-commit throughout (#412)
Browse files Browse the repository at this point in the history
* Remove requirement for python 3.9 to be used in pre-commit

AFAIK this is entirely not needed and in general just complicates
use of pre-commit on systems which no longer (for years) have 3.9
readily available

* Exclude .map and .svg files from pre-commit consideration

* [DATALAD RUNCMD] Run pre-commit run --all (Closes #411)

=== Do not change lines below ===
{
 "chain": [],
 "cmd": "pre-commit run --all || :",
 "exit": 0,
 "extra_inputs": [],
 "inputs": [],
 "outputs": [],
 "pwd": "."
}
^^^ Do not change lines above ^^^
  • Loading branch information
yarikoptic authored Oct 23, 2024
1 parent 6dcdb95 commit 7b6a029
Show file tree
Hide file tree
Showing 69 changed files with 644 additions and 563 deletions.
1 change: 1 addition & 0 deletions .pre-commit-config.yaml
Original file line number Diff line number Diff line change
@@ -1,3 +1,4 @@
exclude: \.(map|svg)$
repos:
- repo: https://github.com/pre-commit/pre-commit-hooks
rev: v2.3.0
Expand Down
16 changes: 8 additions & 8 deletions neuvue_project/.ebextensions/django.config
Original file line number Diff line number Diff line change
@@ -1,17 +1,17 @@
option_settings:
aws:elasticbeanstalk:application:environment:
DJANGO_SETTINGS_MODULE: "neuvue.settings"
option_settings:
aws:elasticbeanstalk:application:environment:
DJANGO_SETTINGS_MODULE: "neuvue.settings"
PYTHONPATH: "/var/app/current:$PYTHONPATH"
aws:elasticbeanstalk:container:python:
WSGIPath: neuvue.wsgi:application
NumProcesses: 3
aws:elasticbeanstalk:container:python:
WSGIPath: neuvue.wsgi:application
NumProcesses: 3
NumThreads: 20
aws:elasticbeanstalk:environment:proxy:staticfiles:
/static: static

container_commands:
01_collectstatic:
command: "source /var/app/venv/*/bin/activate && python3 manage.py collectstatic --noinput"
02_migrate:
command: "source /var/app/venv/*/bin/activate && python3 manage.py migrate"
leader_only: true
leader_only: true
2 changes: 1 addition & 1 deletion neuvue_project/.ebextensions/https.config
Original file line number Diff line number Diff line change
Expand Up @@ -18,4 +18,4 @@ Resources:
StatusCode: HTTP_301
Type: redirect
Port: 80
Protocol: HTTP
Protocol: HTTP
2 changes: 1 addition & 1 deletion neuvue_project/.ebextensions/packages.config
Original file line number Diff line number Diff line change
Expand Up @@ -2,4 +2,4 @@ packages:
yum:
python3-devel: []
mariadb105-devel.x86_64: []
graphviz: []
graphviz: []
2 changes: 1 addition & 1 deletion neuvue_project/.platform/nginx.config
Original file line number Diff line number Diff line change
@@ -1,3 +1,3 @@
container_commands:
01_reload_nginx:
command: "service nginx reload"
command: "service nginx reload"
2 changes: 1 addition & 1 deletion neuvue_project/.platform/nginx/conf.d/proxy.conf
Original file line number Diff line number Diff line change
Expand Up @@ -4,4 +4,4 @@ client_body_timeout 300;
send_timeout 300;
proxy_connect_timeout 300;
proxy_read_timeout 300;
proxy_send_timeout 300;
proxy_send_timeout 300;
28 changes: 19 additions & 9 deletions neuvue_project/dashboard/views.py
Original file line number Diff line number Diff line change
Expand Up @@ -325,10 +325,14 @@ def post(self, request, *args, **kwargs):
sieve=sieve,
select=["assignee", "status", "duration", "metadata", "closed", "opened"],
)
task_df['n_operation_ids'] = task_df['metadata'].apply(lambda x: len(x.get('operation_ids')) if isinstance(x.get('operation_ids'), list) else 0)
task_has_edits = True if any(task_df['n_operation_ids'].to_list()) else False
task_df["n_operation_ids"] = task_df["metadata"].apply(
lambda x: len(x.get("operation_ids"))
if isinstance(x.get("operation_ids"), list)
else 0
)
task_has_edits = True if any(task_df["n_operation_ids"].to_list()) else False

if bool((namespace in decision_namespaces) & (len(task_df)>0)):
if bool((namespace in decision_namespaces) & (len(task_df) > 0)):
import plotly.express as px
from plotly.subplots import make_subplots

Expand All @@ -343,14 +347,20 @@ def post(self, request, *args, **kwargs):
horizontal_spacing=0.02,
)

namespace_submission_method = Namespaces.objects.get(display_name=display_name).submission_method
decision_types = ForcedChoiceButton.objects.filter(set_name=namespace_submission_method).values_list('display_name','submission_value')

namespace_submission_method = Namespaces.objects.get(
display_name=display_name
).submission_method
decision_types = ForcedChoiceButton.objects.filter(
set_name=namespace_submission_method
).values_list("display_name", "submission_value")

color_count = 0
for namespace_display_name, submission_value in decision_types:
decision_counts = {}
for assignee in users:
decision_counts[assignee] = len(task_df[task_df["decision"] == submission_value])
decision_counts[assignee] = len(
task_df[task_df["decision"] == submission_value]
)

x = list(decision_counts.keys())
y = list(decision_counts.values())
Expand Down Expand Up @@ -388,7 +398,7 @@ def post(self, request, *args, **kwargs):
"Username",
"Total Duration (h)",
"Avg Closed Duration (m)",
"Avg Duration (m)"
"Avg Duration (m)",
]
if task_has_edits:
columns.extend(["Average Edits", "Total Edits"])
Expand Down Expand Up @@ -453,7 +463,7 @@ def post(self, request, *args, **kwargs):
"fig_time": fig_time.to_html(),
}

if bool((namespace in decision_namespaces) & (len(task_df)>0)):
if bool((namespace in decision_namespaces) & (len(task_df) > 0)):
context["fig_decision"] = fig_decision.to_html()

return render(request, "report.html", context)
Expand Down
2 changes: 1 addition & 1 deletion neuvue_project/neuvue/settings.py
Original file line number Diff line number Diff line change
Expand Up @@ -204,7 +204,7 @@
LOGIN_URL = "index"
LOGIN_REDIRECT_URL = "/tasks"
LOGOUT_REDIRECT_URL = "/"
SOCIALACCOUNT_LOGIN_ON_GET = True
SOCIALACCOUNT_LOGIN_ON_GET = True

# Needed for NeuroGlancer Popups
SECURE_CROSS_ORIGIN_OPENER_POLICY = None
Expand Down
2 changes: 1 addition & 1 deletion neuvue_project/requirements.txt
Original file line number Diff line number Diff line change
Expand Up @@ -98,4 +98,4 @@ urllib3==1.26.18
wcwidth==0.1.9
webcolors==1.13
zipp==3.18.1
./deps/neuvue-client
./deps/neuvue-client
2 changes: 1 addition & 1 deletion neuvue_project/requirements.txt.general
Original file line number Diff line number Diff line change
Expand Up @@ -19,4 +19,4 @@ pandas
Pillow
plotly
requests
./deps/neuvue-client
./deps/neuvue-client
2 changes: 1 addition & 1 deletion neuvue_project/requirements.txt.old
Original file line number Diff line number Diff line change
Expand Up @@ -79,4 +79,4 @@ typing-extensions==3.10.0.2
urllib3==1.26.7
wcwidth==0.1.9
websocket-client==0.59.0
./deps/neuvue-client
./deps/neuvue-client
2 changes: 1 addition & 1 deletion neuvue_project/templates/404.html
Original file line number Diff line number Diff line change
Expand Up @@ -163,4 +163,4 @@
canvas { outline: none; border: none; }
</style>

{% endblock %}
{% endblock %}
26 changes: 13 additions & 13 deletions neuvue_project/templates/about.html
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
<h1 class="pt-5 pb-3" aria-level="1"> About Us </h1>

<p>
We are a team of research scientists and engineers from the Johns Hopkins Applied Physics
We are a team of research scientists and engineers from the Johns Hopkins Applied Physics
Laboratory that developed NeuVue with the help of a friendly <em>axon</em>olotl!
</p>

Expand All @@ -25,21 +25,21 @@ <h1 class="pt-5 pb-3" aria-level="1"> About Us </h1>
</div>

<p>
NeuVue is a software platform created for large-scale proofreading of machine segmentation and neural
circuit reconstruction in high-resolution electron microscopy connectomics datasets. NeuVue provides an
intuitive interface for proofreaders to collaboratively view, annotate, and edit segmentation and
NeuVue is a software platform created for large-scale proofreading of machine segmentation and neural
circuit reconstruction in high-resolution electron microscopy connectomics datasets. NeuVue provides an
intuitive interface for proofreaders to collaboratively view, annotate, and edit segmentation and
connectivity data.
NeuVue has everything you need for a high-throughput proofreading workflow! Analytical dashboards, data
visualization tools, and simple API enables stakeholders real-time access to proofreading progress at an
individual proofreader level as well as global reconstruction quality insights. NeuVue is intentionally
agnostic to the underlying data management backend and can be easily deployed in an AWS environment.
Proofreaders can work with powerful streamlined tools for splitting and merging connectivity data in
dense nano-scale reconstruction better than ever before.

NeuVue has everything you need for a high-throughput proofreading workflow! Analytical dashboards, data
visualization tools, and simple API enables stakeholders real-time access to proofreading progress at an
individual proofreader level as well as global reconstruction quality insights. NeuVue is intentionally
agnostic to the underlying data management backend and can be easily deployed in an AWS environment.
Proofreaders can work with powerful streamlined tools for splitting and merging connectivity data in
dense nano-scale reconstruction better than ever before.
</p>

<p class="fw-bold">
This research was enabled by the IARPA Machine Intelligence from Cortical Networks (MICrONS) program.
This research was enabled by the IARPA Machine Intelligence from Cortical Networks (MICrONS) program.
<a class="text-secondary-color-activated" href="https://www.iarpa.gov/research-programs/microns">Learn more about MICrONS.</a>
</p>

Expand Down Expand Up @@ -88,4 +88,4 @@ <h2 class="pt-5 pb-3"> Contact Us </h2>
</div>
</div>
<script src="https://cdn.jsdelivr.net/npm/bootstrap@5.1.3/dist/js/bootstrap.bundle.min.js" integrity="sha384-ka7Sk0Gln4gmtz2MlQnikT1wXgYsOg+OMhuP+IlRH9sENBO0LRn5q+8nbTov4+1p" crossorigin="anonymous"></script>
{% endblock %}
{% endblock %}
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ <h3 class="d-flex flex-row bd-highlight mb-3 text-white">
<div>
<div id="action-buttons" class="container-fluid">
<form id="taskPatchForm" action="" method="POST" class="form-inline float-start" >{% csrf_token %}

<input type="hidden" name="username" value="{{username}}" />
<input type="hidden" name="namespace" value="{{namespace}}" />
<label class="m-2"> Assign </label>
Expand All @@ -64,13 +64,13 @@ <h3 class="d-flex flex-row bd-highlight mb-3 text-white">
<button type="button" id="distribute-button" form="taskPatchForm" name="selected_action" value="distribute" class="btn btn-primary" >
Distribute Tasks
</button>

</form>
</div>
<br><br>
<hr>
<hr>
</div>

{% endif %}
<table id="summary-table" class="table table-striped table-hover">
<thead>
Expand Down Expand Up @@ -130,7 +130,7 @@ <h3 class="d-flex flex-row bd-highlight mb-3 text-white">
// Perform download
$('#summary-table').table2csv('download', {'filename': filename});

});
});
// button is clicked
if ("{{group}}" === "unassigned") {
const distributeButton = document.getElementById("distribute-button");
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -119,13 +119,13 @@ <h3 class="d-flex flex-row bd-highlight mb-3 text-white">
<td>{{taskrow.closed}}</td>
<td>{{taskrow.duration}}</td>
{% if taskrow.tags %}
<td class='userTags'>
<span
data-bs-toggle="tooltip"
data-bs-placement="right"
<td class='userTags'>
<span
data-bs-toggle="tooltip"
data-bs-placement="right"
data-bs-html="true"
title="{{taskrow.tags|join:", "}}" >
{{ taskrow.tags.0 }}
{{ taskrow.tags.0 }}
</span>
</td>
{% else %}
Expand All @@ -142,7 +142,7 @@ <h3 class="d-flex flex-row bd-highlight mb-3 text-white">
</div>

</div>
<div id="hiddenSelectedTable" style="visibility: none;">
<div id="hiddenSelectedTable" style="visibility: none;">
</div>

<!-- Confirm action modals -->
Expand Down Expand Up @@ -213,13 +213,13 @@ <h3 class="d-flex flex-row bd-highlight mb-3 text-white">
$('#summary-table input[name=selected_tasks]').each(function(){
if ($(this).is(':checkbox') && !$(this).is(":checked")) {
$(this).prop( "checked", true );
}
}
})
} else {
$('#summary-table input[name=selected_tasks]').each(function(ele){
if ($(this).is(':checkbox') && $(this).is(":checked")) {
$(this).prop( "checked", false );
}
}
})
}
});
Expand All @@ -239,7 +239,7 @@ <h3 class="d-flex flex-row bd-highlight mb-3 text-white">
// Otherwise, download only the tasks that were selected
} else {
let filteredTable = $('#summary-table').clone()[0] // make a copy of the visible table to edit and export
filteredTable.id = 'userSelectedTable';
filteredTable.id = 'userSelectedTable';
const selectedRows = $( '#summary-table' ).find( 'tbody' ) // select table body and
.find( 'tr' ) // select all rows that has
.has( 'input[type=checkbox]:checked' ); // checked checkbox element
Expand Down
15 changes: 7 additions & 8 deletions neuvue_project/templates/admin_dashboard/dashboard.html
Original file line number Diff line number Diff line change
Expand Up @@ -37,25 +37,25 @@ <h3 class="text-white"> Admin Dashboard</h3>
</select>

</div>

<div class="form-group my-3">
<label class="text-white" for="groupSelect">Group</label>
<select name="group" class="form-select" id="groupSelect" placeholder="Select one" required="true">
<option value="" selected disabled>Please select</option>
{% for group_opt in all_groups %}
<option>{{group_opt}} </option>
{% endfor %}
</select>
</select>
</div>

<div class="form-group d-flex my-4">
<input type="submit" class="btn btn-primary" value="Submit">
<div id="submit-spinner-tab1" class="text-white ms-3 mt-2"></div>

{% if error %}
<small id="errormessage" class="form-text text-danger"> {{error}} </small>
{% endif %}

</div>
</form>
</div>
Expand All @@ -70,17 +70,17 @@ <h3 class="text-white"> Admin Dashboard</h3>
{% for user_opt in all_users %}
<option>{{user_opt}} </option>
{% endfor %}
</select>
</select>
</div>

<div class="form-group d-flex my-4">
<input type="submit" class="btn btn-primary" value="Submit">
<div id="submit-spinner-tab2" class="text-white ms-3 mt-2"></div>

{% if error %}
<small id="errormessage" class="form-text text-danger"> {{error}} </small>
{% endif %}

</div>
</form>
</div>
Expand All @@ -106,4 +106,3 @@ <h3 class="text-white"> Admin Dashboard</h3>

</script>
{% endblock %}

4 changes: 2 additions & 2 deletions neuvue_project/templates/base.html
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
<link rel="preconnect" href="https://fonts.googleapis.com">
<link rel="preconnect" href="https://fonts.gstatic.com" crossorigin>
<link href="https://fonts.googleapis.com/css2?family=Fira+Mono:wght@400;500&family=Montserrat:wght@500;700&family=Open+Sans:wght@400;600&display=swap" rel="stylesheet">
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"/>
<link rel="stylesheet" href="https://cdnjs.cloudflare.com/ajax/libs/font-awesome/5.15.3/css/all.min.css"/>
<link rel="apple-touch-icon" sizes="180x180" href="{% static 'favicon/apple-touch-icon.png' %}">
<link rel="icon" type="image/png" sizes="32x32" href="{% static 'favicon/favicon-32x32.png' %}">
<link rel="icon" type="image/png" sizes="16x16" href="{% static 'favicon/favicon-16x16.png' %}">
Expand Down Expand Up @@ -50,7 +50,7 @@
</li>

{% endif%}

{% if request.user|in_group:"AuthorizedUsers"%}

<li class="nav-item">
Expand Down
4 changes: 2 additions & 2 deletions neuvue_project/templates/getting-started.html
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@
var scrollLocation = headers[headerIndex]
} else {
var scrollLocation = document.getElementsByClassName('getting-started-content')[0];
}
}
scrollLocation.scrollIntoView({behavior: "smooth", block: "start", inline: "nearest"});
}

</script>
{% endblock %}
{% endblock %}
2 changes: 1 addition & 1 deletion neuvue_project/templates/index.html
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ <h1 class="index-title-text mt-4 my-1">Welcome to NeuVue</h1>
</div>
</div>
</div>
<div class="index-card-column">
<div class="index-card-column">
</div>
</div>
</div>
Expand Down
Loading

0 comments on commit 7b6a029

Please sign in to comment.