Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
8 changes: 4 additions & 4 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -16,12 +16,12 @@ jobs:
run: |
if [[ "${{ github.event_name }}" == 'push' && "${{ github.ref }}" == 'refs/heads/master' ]]; then
# Push to master branch
echo 'matrix=["3.8", "3.9", "3.10", "3.11"]' >> $GITHUB_OUTPUT
echo 'matrix=["3.9", "3.10", "3.11", "3.12", "3.13"]' >> $GITHUB_OUTPUT
elif [[ "${{ github.event_name }}" == 'pull_request' && "${{ github.event.pull_request.base.ref }}" == 'master' ]]; then
# PR to master branch
echo 'matrix=["3.8", "3.9", "3.10", "3.11"]' >> $GITHUB_OUTPUT
echo 'matrix=["3.9", "3.10", "3.11", "3.12", "3.13"]' >> $GITHUB_OUTPUT
else
echo 'matrix=["3.9", "3.11"]' >> $GITHUB_OUTPUT
echo 'matrix=["3.9", "3.13"]' >> $GITHUB_OUTPUT
fi

build:
Expand Down Expand Up @@ -51,7 +51,7 @@ jobs:
# Install dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade --upgrade-strategy eager pip
python -m pip install --upgrade pip
pip install -r requirements.txt
pip install -r docs/requirements.txt

Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci_cov.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ jobs:
strategy:
matrix:
platform: [ubuntu-latest]
python-version: [ "3.9" ]
python-version: [ "3.12" ]

runs-on: ${{ matrix.platform }}

Expand All @@ -46,7 +46,7 @@ jobs:
# Install dependencies
- name: Install dependencies
run: |
python -m pip install --upgrade --upgrade-strategy eager pip
python -m pip install --upgrade pip
pip install flake8 coverage -r requirements.txt -r docs/requirements.txt

# Run flake8
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/ci_windows.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
matrix:
platform: [windows-latest]
python-version: ["3.10"]
python-version: ["3.9", "3.10", "3.11", "3.12", "3.13""]

runs-on: ${{ matrix.platform }}

Expand All @@ -32,7 +32,7 @@ jobs:

- name: Install dependencies
run: |
python -m pip install --upgrade --upgrade-strategy eager pip
python -m pip install --upgrade pip
pip install -r requirements.txt

- name: Test with unittest
Expand Down
88 changes: 44 additions & 44 deletions .github/workflows/test_installer.yaml
Original file line number Diff line number Diff line change
@@ -1,44 +1,44 @@
on:
push:
branches: ["develop"]
pull_request:
branches: ["develop"]

jobs:
build:
runs-on: ubuntu-latest

strategy:
matrix:
python-version: ["3.8", "3.11"]

steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}

- name: Create work directory
run: |
mkdir workdir
echo "WORKDIR=$(pwd)/workdir" >> $GITHUB_OUTPUT

- name: Create and activate virtual environment
run: |
cd $WORKDIR
python -m venv .venv
source .venv/bin/activate

- name: Install package
run: |
cd $WORKDIR
source .venv/bin/activate
python -m pip install --upgrade pip
pip install $GITHUB_WORKSPACE

- name: Run post-installation test
run: |
cd $WORKDIR
source .venv/bin/activate
python -c "from hed.models.hed_string import HedString; print('Import test passed.')"
on:
push:
branches: ["develop"]
pull_request:
branches: ["develop"]
jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
python-version: ["3.9", "3.11"]
steps:
- uses: actions/checkout@v4
- name: Set up Python ${{ matrix.python-version }}
uses: actions/setup-python@v5
with:
python-version: ${{ matrix.python-version }}
- name: Create work directory
run: |
mkdir workdir
echo "WORKDIR=$(pwd)/workdir" >> $GITHUB_OUTPUT
- name: Create and activate virtual environment
run: |
cd $WORKDIR
python -m venv .venv
source .venv/bin/activate
- name: Install package
run: |
cd $WORKDIR
source .venv/bin/activate
python -m pip install --upgrade pip
pip install $GITHUB_WORKSPACE
- name: Run post-installation test
run: |
cd $WORKDIR
source .venv/bin/activate
python -c "from hed.models.hed_string import HedString; print('Import test passed.')"
20 changes: 10 additions & 10 deletions docs/requirements.txt
Original file line number Diff line number Diff line change
@@ -1,12 +1,12 @@
defusedxml>=0.7.1
inflect>=6.0.5
jsonschema>=4.17.3
numpy>=1.21.6
openpyxl>=3.1.0
pandas>=1.3.5
portalocker>=2.7.0
inflect>=7.5.0
jsonschema>=4.23.0
numpy==2.0.2
openpyxl>=3.1.5
pandas>=2.2.3
portalocker>=3.1.1
semantic-version>=2.10.0
myst-parser>=1.0.0
Sphinx>=5.2.2
sphinx_rtd_theme>=1.0.0
wordcloud==1.9.4
myst-parser==3.0.1
Sphinx==7.4.7
sphinx_rtd_theme>=3.0.2
wordcloud>=1.9.4
66 changes: 57 additions & 9 deletions hed/errors/error_messages.py
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,18 @@

from hed.errors.error_reporter import hed_error, hed_tag_error
from hed.errors.error_types import (ValidationErrors, SidecarErrors, ErrorSeverity, DefinitionErrors,
TemporalErrors, ColumnErrors)
TemporalErrors, ColumnErrors, TagQualityErrors)

def get_tag_list_str(tag_list):
""" Return a string representation of a list of tags.

Parameters:
tag_list (list): A list of tags to convert to a string.

Returns:
str: A string representation of the list of tags.
"""
return "[" + ', '.join([str(tag) for tag in tag_list]) + "]"


@hed_tag_error(ValidationErrors.UNITS_INVALID)
Expand Down Expand Up @@ -109,9 +120,9 @@ def val_error_duplicate_reserved_tag(tag, group):


@hed_error(ValidationErrors.HED_RESERVED_TAG_GROUP_ERROR, actual_code=ValidationErrors.TAG_GROUP_ERROR)
def val_error_group_for_reserved_tag(group, group_count):
def val_error_group_for_reserved_tag(group, group_count, tag_list):
return (f'The number of non-def-expand subgroups for group "{group}" is {group_count}, "'
f'which does not meet reserved tag requirements."')
f'which does not meet reserved tags {get_tag_list_str(tag_list)} requirements."')


@hed_error(ValidationErrors.PARENTHESES_MISMATCH)
Expand Down Expand Up @@ -211,8 +222,8 @@ def val_error_extra_slashes_spaces(tag, problem_tag):


@hed_error(ValidationErrors.SIDECAR_KEY_MISSING, default_severity=ErrorSeverity.WARNING)
def val_error_sidecar_key_missing(invalid_keys, category_keys):
return f"Category keys '{invalid_keys}' do not exist in column. Valid keys are: {category_keys}"
def val_error_sidecar_key_missing(invalid_keys, category_keys, column_name):
return f"Category keys {invalid_keys} do not exist in sidecar for column '{column_name}'. Valid keys are: {category_keys}"


@hed_error(ValidationErrors.TSV_COLUMN_MISSING, actual_code=ValidationErrors.SIDECAR_KEY_MISSING,
Expand Down Expand Up @@ -338,8 +349,7 @@ def def_error_no_group_tags(def_name):

@hed_error(DefinitionErrors.WRONG_NUMBER_GROUPS, actual_code=ValidationErrors.DEFINITION_INVALID)
def def_error_wrong_number_groups(def_name, tag_list):
tag_list_strings = [str(tag) for tag in tag_list]
return f"Too many group tags found in definition for {def_name}. Expected 1, found: {tag_list_strings}"
return f"Too many group tags found in definition for {def_name}. Expected 1, found: {get_tag_list_str(tag_list)}"


@hed_error(DefinitionErrors.WRONG_NUMBER_TAGS, actual_code=ValidationErrors.DEFINITION_INVALID)
Expand All @@ -350,9 +360,8 @@ def def_error_wrong_number_tags(def_name, tag_list):

@hed_error(DefinitionErrors.WRONG_NUMBER_PLACEHOLDER_TAGS, actual_code=ValidationErrors.DEFINITION_INVALID)
def def_error_wrong_placeholder_count(def_name, expected_count, tag_list):
tag_list_strings = [str(tag) for tag in tag_list]
return f"Incorrect number placeholders or placeholder tags found in definition for {def_name}. " + \
f"Expected {expected_count}, found: {tag_list_strings}"
f"Expected {expected_count}, found: {get_tag_list_str(tag_list)}"


@hed_error(DefinitionErrors.DUPLICATE_DEFINITION, actual_code=ValidationErrors.DEFINITION_INVALID)
Expand Down Expand Up @@ -462,3 +471,42 @@ def nested_column_ref(column_name, ref_column):
@hed_error(ColumnErrors.MALFORMED_COLUMN_REF, actual_code=SidecarErrors.SIDECAR_BRACES_INVALID)
def malformed_column_ref(column_name, index, symbol):
return f"Column {column_name} has a malformed column reference. Improper symbol {symbol} found at index {index}."


@hed_error(TagQualityErrors.MISSING_EVENT_TYPE, default_severity=ErrorSeverity.WARNING,
actual_code=TagQualityErrors.MISSING_EVENT_TYPE)
def missing_event_type(string, line):
return f"The HED string '{string}' at line {line} has no Event type."


@hed_error(TagQualityErrors.IMPROPER_EVENT_GROUPS, default_severity=ErrorSeverity.WARNING,
actual_code=TagQualityErrors.IMPROPER_EVENT_GROUPS)
def improper_event_groups(event_types, string, line):
return f"The HED string '{string}' at line {line} has multiple events [{event_types}] but is improperly " + \
f"parenthesized so the other tags cannot be uniquely associated with an event."


@hed_error(TagQualityErrors.MISSING_TASK_ROLE, default_severity=ErrorSeverity.WARNING,
actual_code=TagQualityErrors.MISSING_TASK_ROLE)
def missing_task_role(event_type, string, line):
return f"The HED string '{string}' at line {line} with event {event_type} has no Task-event-role type tag."


@hed_error(TagQualityErrors.AMBIGUOUS_TAG_GROUPING, default_severity=ErrorSeverity.WARNING,
actual_code=TagQualityErrors.AMBIGUOUS_TAG_GROUPING)
def ambiguous_tag_grouping(tag_list, string, line):
return f"The HED string '{string}' at line {line} has ambiguously grouped tags {get_tag_list_str(tag_list)}and needs parentheses."


@hed_error(TagQualityErrors.MISSING_SENSORY_PRESENTATION, default_severity=ErrorSeverity.WARNING,
actual_code=TagQualityErrors.MISSING_SENSORY_PRESENTATION)
def missing_sensory_presentation(string, line):
return f"The HED string '{string}' at line {line} is a Sensory-event but does not have a sensory presentation " + \
f"modality tag such as Visual-presentation or Auditory-presentation."


@hed_error(TagQualityErrors.MISSING_ACTION_TAG, default_severity=ErrorSeverity.WARNING,
actual_code=TagQualityErrors.MISSING_ACTION_TAG)
def missing_action_tag(string, line):
return f"The HED string '{string}' at line {line} is an Agent-action event but does not any Action tags " + \
f"such as Move or Perform."
Loading
Loading