Skip to content

Commit

Permalink
Merge pull request #203 from VisLab/develop
Browse files Browse the repository at this point in the history
Fixed schema list ordering issue #199
  • Loading branch information
VisLab authored Jul 23, 2024
2 parents 9857565 + a20cdac commit 6b78c00
Show file tree
Hide file tree
Showing 4 changed files with 22 additions and 8 deletions.
5 changes: 3 additions & 2 deletions hedweb/templates/hed-tools-home.html
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,14 @@ <h4>HED online tools summary</h4>
The following table summarizes the available online tools. The tools are organized around the
types of data that the tools handle. The Actions refer to the types of actions that can be performed on the
data through the online tools. Each action is linked to its corresponding documentation to provide additional
information.</p>
information. <strong>NEW: an experimental <a href="http://ctagger.hed.tools">CTagger</a>
online annotation tool is now available</strong>.</p>



<table class="table table-striped table-hover">
<thead>
<tr><th scope="col">Data type<br/>(linked to form></th><th scope="col">Action<br/>(linked to docs)</th><th scope="col">Description</th>
<tr><th scope="col">Data type<br/>(form link)</th><th scope="col">Action<br/>(docs link)</th><th scope="col">Description</th>
</thead>
<tr class="table-active">
<td><a href="{{ url_for('route_blueprint.render_events_form') }}"><strong>Events</strong></a></td>
Expand Down
1 change: 1 addition & 0 deletions hedweb/templates/layout.html
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,7 @@
aria-haspopup="true" aria-expanded="false">Quick links</a>
<div class="dropdown-menu">
<a class="dropdown-item" href="https://www.hedtags.org/display_hed.html">HED schema browser</a>
<a class="dropdown-item" href="http://ctagger.hed.tools/">CTagger interactive annotation</a>
<a class="dropdown-item" href="https://www.hedtags.org">HED homepage</a>
<a class="dropdown-item" href="https://github.com/hed-standard">HED on GitHub</a>
<a class="dropdown-item" href="https://www.youtube.com/playlist?list=PLeII6cRFsP6L5S6icwRrJp0DHkhOHtbp-">HED on YouTube</a>
Expand Down
7 changes: 3 additions & 4 deletions hedweb/web_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -18,12 +18,11 @@

def convert_hed_versions(hed_info):
hed_list = []
standard_list = hed_info['schema_version_list'].get(None, [])
for key, key_list in hed_info['schema_version_list'].items():
if key is None:
hed_list = hed_list + key_list
else:
if key is not None:
hed_list = hed_list + [key + '_' + element for element in key_list]
return {'schema_version_list': hed_list}
return {'schema_version_list': standard_list + hed_list}


def file_extension_is_valid(filename, accepted_extensions=None):
Expand Down
17 changes: 15 additions & 2 deletions tests/test_web_util.py
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,21 @@

class Test(TestWebBase):

def test_convert_hed_versions(self):
from hedweb.web_util import convert_hed_versions
no_none = {'schema_version_list': {'score': ['1.0.0', '2.0.0']}}
no_none_list = convert_hed_versions(no_none)
self.assertTrue(no_none_list['schema_version_list'] == ['score_1.0.0', 'score_2.0.0'])
just_none = {'schema_version_list': {None: ['8.0.0', '8.1.0']}}
just_none_list = convert_hed_versions(just_none)
self.assertTrue(just_none_list['schema_version_list'] == ['8.0.0', '8.1.0'])
just_blank = {'schema_version_list': {'': ['9.0.0', '9.1.0']}}
just_blank_list = convert_hed_versions(just_blank)
self.assertTrue(just_blank_list['schema_version_list'] == ['_9.0.0', '_9.1.0'])
test_all = {'schema_version_list': {'score': ['1.0.0', '2.0.0'], None: ['8.0.0', '8.1.0']}}
test_all_list = convert_hed_versions(test_all)
self.assertTrue(test_all_list['schema_version_list'] == ['8.0.0', '8.1.0', 'score_1.0.0', 'score_2.0.0'])

def test_form_has_file(self):
from hedweb.web_util import form_has_file
with self.app.test as _:
Expand Down Expand Up @@ -241,7 +256,6 @@ def test_get_hed_schema_from_pull_down_empty(self):

def test_get_hed_schema_from_pull_down_version(self):
from hed.schema import HedSchema
from hedweb.constants import base_constants as bc
from hedweb.web_util import get_hed_schema_from_pull_down
with self.app.test:
environ = create_environ(data={bc.SCHEMA_VERSION: '8.0.0'})
Expand All @@ -252,7 +266,6 @@ def test_get_hed_schema_from_pull_down_version(self):

def test_get_hed_schema_from_pull_down_other(self):
from hed.schema import HedSchema
from hedweb.constants import base_constants as bc
from hedweb.web_util import get_hed_schema_from_pull_down
with self.app.test:
schema_path = os.path.join(os.path.dirname(os.path.abspath(__file__)), 'data/HED8.0.0.xml')
Expand Down

0 comments on commit 6b78c00

Please sign in to comment.