Skip to content

Commit

Permalink
run precommit
Browse files Browse the repository at this point in the history
  • Loading branch information
dxenes1 committed Oct 23, 2024
1 parent cab89d3 commit bdeb22e
Show file tree
Hide file tree
Showing 10 changed files with 50 additions and 27 deletions.
4 changes: 2 additions & 2 deletions .codespellrc
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
[codespell]
# Ref: https://github.com/codespell-project/codespell#using-a-config-file
skip = .git*,*.svg,package-lock.json,*.css,*-min.*,.codespellrc,*.bundle.*,*.map
skip = .git*,*.svg,package-lock.json,*.css,*-min.*,.codespellrc,*.bundle.*,*.map, *.js
check-hidden = true
# ignore-regex =
# ignore-regex =
# some favorite albeit unfortunate variable names
ignore-words-list = te
1 change: 0 additions & 1 deletion .pre-commit-config.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -14,4 +14,3 @@ repos:
rev: v2.3.0
hooks:
- id: codespell

6 changes: 5 additions & 1 deletion neuvue_project/neuvue/urls.py
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,11 @@
path("tasks/", TaskView.as_view(), name="tasks"),
path("getting-started/", GettingStartedView.as_view(), name="getting-started"),
path("workspace/<str:namespace>", WorkspaceView.as_view(), name="workspace"),
path("spelunker-workspace/<str:namespace>", WorkspaceView.as_view(), name="spelunker-workspace"),
path(
"spelunker-workspace/<str:namespace>",
WorkspaceView.as_view(),
name="spelunker-workspace",
),
path("admin/", admin.site.urls),
path("__debug__/", include("debug_toolbar.urls")),
path("accounts/", include("allauth.urls")),
Expand Down
8 changes: 4 additions & 4 deletions neuvue_project/templates/tasks.html
Original file line number Diff line number Diff line change
Expand Up @@ -42,9 +42,9 @@
<span class="sr-only header-box-text">Toggle Dropdown</span>
</button>
{% if context.ng_host == "spelunker" %}
<span class="header-button header-outline rightBorderRounded" onclick="document.location='{% url 'spelunker-workspace' namespace=namespace %}'">
<span class="header-button header-outline rightBorderRounded" onclick="document.location='{% url 'spelunker-workspace' namespace=namespace %}'">
{% else %}
<span class="header-button header-outline rightBorderRounded" onclick="document.location='{% url 'workspace' namespace=namespace %}'">
<span class="header-button header-outline rightBorderRounded" onclick="document.location='{% url 'workspace' namespace=namespace %}'">
{% endif %}
<button class="header-box-text"
onclick="triggerLoadingSpinner('{{namespace}}NgSpinner')">
Expand Down Expand Up @@ -82,10 +82,10 @@
</div>
{% else %}
{% if context.ng_host == "spelunker" %}
<div class="header-sizing header-outline rightBorderRounded" onclick="document.location='{% url 'spelunker-workspace' namespace=namespace %}'">
<div class="header-sizing header-outline rightBorderRounded" onclick="document.location='{% url 'spelunker-workspace' namespace=namespace %}'">
{% else %}
<div class="header-sizing header-outline rightBorderRounded" onclick="document.location='{% url 'workspace' namespace=namespace %}'">
{% endif %}
{% endif %}
<button class="header-box-text"
onclick="triggerLoadingSpinner('{{namespace}}NgSpinner')">
<div id='{{namespace}}NgSpinner'>
Expand Down
2 changes: 1 addition & 1 deletion neuvue_project/templates/workspace.html
Original file line number Diff line number Diff line change
Expand Up @@ -285,7 +285,7 @@
<script type="text/javascript" src="{% static 'workspace/main.bundle.js' %}"></script>
{% endif %}

<script type="text/javascript">
<script type="text/javascript">

// initialize Tagify on the above input node reference
let input = document.querySelector('input[name="tags"]'),
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,25 @@
class Migration(migrations.Migration):

dependencies = [
('workspace', '0021_alter_namespace_ng_host'),
("workspace", "0021_alter_namespace_ng_host"),
]

operations = [
migrations.AlterField(
model_name='namespace',
name='ng_host',
field=models.CharField(choices=[('neuvue', 'NeuVue Legacy'), ('spelunker', 'Spelunker Native'), ('https://neuroglancer.bossdb.io', 'neuroglancer.bossdb.io'), ('https://spelunker.cave-explorer.org/', 'spelunker.cave-explorer.org')], default='neuvue', max_length=100),
model_name="namespace",
name="ng_host",
field=models.CharField(
choices=[
("neuvue", "NeuVue Legacy"),
("spelunker", "Spelunker Native"),
("https://neuroglancer.bossdb.io", "neuroglancer.bossdb.io"),
(
"https://spelunker.cave-explorer.org/",
"spelunker.cave-explorer.org",
),
],
default="neuvue",
max_length=100,
),
),
]
5 changes: 3 additions & 2 deletions neuvue_project/workspace/models.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,8 +42,9 @@ class NeuroglancerHost(models.TextChoices):
NEUVUE = "neuvue", _("NeuVue Legacy")
SPELUNKER = "spelunker", _("Spelunker Native")
BOSSDB = "https://neuroglancer.bossdb.io", _("neuroglancer.bossdb.io")
#CLIO = "https://clio-ng.janelia.org", _("clio-ng.janelia.org")
SPELUNKER_URL = "https://spelunker.cave-explorer.org/", _("spelunker.cave-explorer.org")
SPELUNKER_URL = "https://spelunker.cave-explorer.org/", _(
"spelunker.cave-explorer.org"
)


class ForcedChoiceButtonGroup(models.Model):
Expand Down
8 changes: 7 additions & 1 deletion neuvue_project/workspace/neuroglancer.py
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,13 @@
ChainedStateBuilder,
)

from .models import Namespace, NeuroglancerLinkType, PcgChoices, ImageChoices, NeuroglancerHost
from .models import (
Namespace,
NeuroglancerLinkType,
PcgChoices,
ImageChoices,
NeuroglancerHost,
)


logging.basicConfig(level=logging.DEBUG)
Expand Down
16 changes: 8 additions & 8 deletions neuvue_project/workspace/static/getting_started.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,8 @@ Clicking on the blue row header for a task type will expand it to show a table w

The pending table will show tasks for that task type ordered by descending priority level. The number in the tab after "Pending" show how many pending tasks are available. The columns are described below:

* **Task ID** - The unique identifier for this task. Useful for referencing task to NeuVue admins or developers as well as for inspecting the task in the "Inspect Task" page. Click on the task ID in this table will redirect you to the "Inspect Task" page for the task ID you clicked on.
* **Seg ID** - The unique identifier for the neuron in the volume that is the primary target for this proofreading task. Seg IDs will sometimes be repeated across many tasks or even users. Seg IDs also change after edits so a seg ID listed in the task page may be outdated by the time a user opens that task. More info here.
* **Task ID** - The unique identifier for this task. Useful for referencing task to NeuVue admins or developers as well as for inspecting the task in the "Inspect Task" page. Click on the task ID in this table will redirect you to the "Inspect Task" page for the task ID you clicked on.
* **Seg ID** - The unique identifier for the neuron in the volume that is the primary target for this proofreading task. Seg IDs will sometimes be repeated across many tasks or even users. Seg IDs also change after edits so a seg ID listed in the task page may be outdated by the time a user opens that task. More info here.
* **Created** - EST Datetime of creation for this task.
* **Priority** - Numerical priority of this task. Higher priority means that task will be provided to the user earlier in the queue. Skipping a task reduces the task priority by 1.
* **Status** - Current status of the task. Four possible statuses: "open", "pending", "closed", "errored". Only "open" and "pending" tasks are shown in this table.
Expand All @@ -47,9 +47,9 @@ The closed tab is slightly different than the pending tab. This table is sorted
In addition to the task tables, you will also see buttons on the right side of the task type headers. These buttons are described below:


* **Start Proofreading** - This button exists for all task types with pending tasks available and assigned to you. Click this will navigate you to the Workspace page, where the next task will automatically be queued up and displayed.
* **Add More Tasks** - Available for some task types only. Clicking this will allow additional tasks to be assigned to your user in cases where you deplete your queue or would like fresh tasks to work on. The number of tasks added to your user depends on the task type and there are certain limits set on how many tasks can be assigned to one user at a time.
* **Remove Skipped Tasks** - Available for some task types only. Clicking this will remove all tasks that have been skipped once or more from your queue permanently.
* **Start Proofreading** - This button exists for all task types with pending tasks available and assigned to you. Click this will navigate you to the Workspace page, where the next task will automatically be queued up and displayed.
* **Add More Tasks** - Available for some task types only. Clicking this will allow additional tasks to be assigned to your user in cases where you deplete your queue or would like fresh tasks to work on. The number of tasks added to your user depends on the task type and there are certain limits set on how many tasks can be assigned to one user at a time.
* **Remove Skipped Tasks** - Available for some task types only. Clicking this will remove all tasks that have been skipped once or more from your queue permanently.

From this point you can begin proofreading by deciding on which task types you would like to work on and then clicking "Start Proofreading" for that task type. This will navigate you to the workspace page, which is the main interface for proofreading work.

Expand Down Expand Up @@ -89,7 +89,7 @@ Here is a great instructional video on how to operate Neuroglancer for basic nav

<iframe width="560" height="315" src="https://www.youtube.com/embed/TwBTyWWnbxc" title="YouTube video player" frameborder="0" allow="accelerometer; autoplay; clipboard-write; encrypted-media; gyroscope; picture-in-picture" allowfullscreen></iframe>

[This cheatsheet](https://docs.google.com/document/d/1eypqJ9iI1GlWSPMTZQo9oDCLEahye6oYo_CuhS_5QTA/edit?usp=sharing) (credit to flywire.ai) has additional useful information that's specific to this proofreading effort!
[This cheatsheet](https://docs.google.com/document/d/1eypqJ9iI1GlWSPMTZQo9oDCLEahye6oYo_CuhS_5QTA/edit?usp=sharing) (credit to flywire.ai) has additional useful information that's specific to this proofreading effort!


## Additional Pages and Tools
Expand All @@ -107,7 +107,7 @@ The inspect task page has a similar layout to the workspace except it does not c
<img src="https://i.imgur.com/a29xKER.png" alt="Synapse Viewer Page" width="800"/>


The synapse viewer page is a visualization tool which means it can be accessed by any user with a valid root ID. It displays all presynaptic and postsynaptic locations for a valid root ID or multiple IDs. The pre and post annotations for each root ID are placed in an individual Neuroglancer layer so colors and sizes can be independently set. The sidebar displays information of on the number of connections for each root ID. This information can be copied or downloaded with the buttons below the table in the sidebar as well. To use the synaptic viewer, copy the list of root IDs (comma-separated) you want to visualize and paste them in the input box at app.neuvue.io/synapse.
The synapse viewer page is a visualization tool which means it can be accessed by any user with a valid root ID. It displays all presynaptic and postsynaptic locations for a valid root ID or multiple IDs. The pre and post annotations for each root ID are placed in an individual Neuroglancer layer so colors and sizes can be independently set. The sidebar displays information of on the number of connections for each root ID. This information can be copied or downloaded with the buttons below the table in the sidebar as well. To use the synaptic viewer, copy the list of root IDs (comma-separated) you want to visualize and paste them in the input box at app.neuvue.io/synapse.

Be aware that visualizing more than 10 root IDs at a time in the synpase viewer may cause Neuroglancer or your browser to crash!

Expand Down Expand Up @@ -138,7 +138,7 @@ We recommend you do not refresh your browser when on the workspace page. This ca

### Is there an undo for Neuroglancer?

Yes, on the top right there will be an "undo/redo" arrow buttons that can be used to undo layer/ID selects, pans, zooms, and any changes to the Neuroglancer state. ** However, you cannot undo direct edits (i.e. splits/merges). ** To undo these, you can do the inverse operation for the undo, such as merging two accidentally split IDs or splitting two accidentally merged IDs.
Yes, on the top right there will be an "undo/redo" arrow buttons that can be used to undo layer/ID selects, pans, zooms, and any changes to the Neuroglancer state. ** However, you cannot undo direct edits (i.e. splits/merges). ** To undo these, you can do the inverse operation for the undo, such as merging two accidentally split IDs or splitting two accidentally merged IDs.

### How do I stop Neuroglancer from lagging/slowing down?

Expand Down
7 changes: 4 additions & 3 deletions neuvue_project/workspace/views/workspace.py
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,8 @@ def get(self, request, namespace=None, **kwargs):
# This hacky solution works.
if namespace in settings.STATIC_NG_FILES:
return redirect(
f"/static/{request.path.split('/')[1]}/{namespace}", content_type="application/javascript"
f"/static/{request.path.split('/')[1]}/{namespace}",
content_type="application/javascript",
)

session_task_count = request.session.get("session_task_count", 0)
Expand Down Expand Up @@ -178,14 +179,14 @@ def get(self, request, namespace=None, **kwargs):
# NOTE: State configs are only applied to neuvue NG states. If using an iframe or Spelunker
# url, we just load it as is.
if namespace_obj.ng_host in [NeuroglancerHost.NEUVUE]:
#TODO: Apply middleauth config to spelunker states
# TODO: Apply middleauth config to spelunker states
context["ng_state"] = apply_state_config(
context["ng_state"], str(request.user)
)
context["ng_state"] = refresh_ids(context["ng_state"], namespace)

elif namespace_obj.ng_host in [NeuroglancerHost.SPELUNKER]:
#TODO: Add Spelunker NG configuration here
# TODO: Add Spelunker NG configuration here
pass
else:
context["ng_url"] = construct_url_from_existing(
Expand Down

0 comments on commit bdeb22e

Please sign in to comment.