Skip to content

Add messages#70

Merged
CodyCBakerPhD merged 74 commits intomainfrom
add_messages_2
Sep 26, 2025
Merged

Add messages#70
CodyCBakerPhD merged 74 commits intomainfrom
add_messages_2

Conversation

@CodyCBakerPhD
Copy link
Copy Markdown
Collaborator

Main infrastructure along with tests and a couple small examples specific to the participants model (more to follow)

@CodyCBakerPhD CodyCBakerPhD self-assigned this Sep 10, 2025
Comment thread src/nwb2bids/_messages/_inspection_message.py Outdated
Comment thread src/nwb2bids/_converters/_dataset_converter.py Outdated
Comment thread src/nwb2bids/_command_line_interface/_main.py Outdated
additional_metadata_file_path=additional_metadata_file_path,
)

if messages is not None:
Copy link
Copy Markdown
Collaborator Author

@CodyCBakerPhD CodyCBakerPhD Sep 10, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QUESTION: should we add a --save-messages flag to save a .json dump of the messages in the home folder (like a log file)?

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

TBH I think these files will be so small we should just save them automatically (both a human-readable text output and JSON format) indexed by the input conditions (+/- unique identifier of content)

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUGGESTION FROM YARIK: Yes, just save them, treat like 'log files'

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be done in a follow-up

@CodyCBakerPhD
Copy link
Copy Markdown
Collaborator Author

From discussion

nwb2bids should attempt to 'sanitize' fields in an attempt to 'harmonize' from NWB to BIDS as much as possible; these messages should inform the user that this occurred and offer a flag --no-sanitize to suppress this process

Examples of sanitization:

Philosophy is, if sanitization is requested, always try to force things through as much as possible, but if we hit a limit, complain.

By default, no sanitization.

@CodyCBakerPhD
Copy link
Copy Markdown
Collaborator Author

Heudiconv uses a two-step process for editing (with suggestions via sanitization?) where basic metadata is extracted, version to be written to BIDS is written as a <>.edit.txt file that a user manually modifies using any text/table editor GUI or CLI.

Comment thread src/nwb2bids/_messages/_inspection_message.py Outdated
Comment thread src/nwb2bids/bids_models/_bids_session_metadata.py Outdated
Comment on lines +75 to +79
text = (
f"{len(messages)} suggestion for improvement was found during conversion."
if len(messages) == 1
else f"{len(messages)} suggestions for improvement were found during conversion."
)
Copy link
Copy Markdown
Collaborator Author

@CodyCBakerPhD CodyCBakerPhD Sep 11, 2025

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

QUESTION: right now this is the only notification that anything was less than perfect during the nwb2bids 'conversion'

Should we:

  1. always printout an aggregated summary here? (akin to a much smaller and more specific version of BIDS validator or NWB Inspector)

Or

  1. should there merely be instructions for viewing the full content? (such as, "To see these suggestions, call nwb2bids inspect [paths]" after calling nwb2bids convert [paths])

Copy link
Copy Markdown
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

might be worth following bids-validator output structure for structure...

agreed to be concise and point to potentially "vast" lists of records + logs

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

SUGGESTION FROM YARIK: notify user after call to nwb2bids convert that suggestions were discovered and can be seen at a certain file or printed using a certain command, similar to how DANDI-CLI notifies about log file at the end

Copy link
Copy Markdown
Collaborator Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This will be done in a follow-up

Comment thread src/nwb2bids/_converters/_session_converter.py Outdated
@CodyCBakerPhD CodyCBakerPhD marked this pull request as ready for review September 11, 2025 19:30
@CodyCBakerPhD
Copy link
Copy Markdown
Collaborator Author

@candleindark Ready for first round of review

Future PRs would expand the number of messages as well as allow automatic sanitization

If you could also provide idea/feedback on the comments about 'QUESTIONS' some of those may also belong to follow up PRs since this is substantial as-is

Comment thread src/nwb2bids/_core/_convert_nwb_dataset.py Outdated
Comment thread src/nwb2bids/_converters/_dataset_converter.py
Comment thread src/nwb2bids/_converters/_dataset_converter.py Outdated
Comment thread src/nwb2bids/_converters/_dataset_converter.py Outdated
Comment thread src/nwb2bids/_converters/_dataset_converter.py Outdated
Comment thread src/nwb2bids/_converters/_dataset_converter.py Outdated
Comment thread src/nwb2bids/_converters/_dataset_converter.py Outdated
CodyCBakerPhD and others added 4 commits September 24, 2025 14:03
Co-authored-by: Isaac To <candleindark@users.noreply.github.com>
Co-authored-by: Isaac To <candleindark@users.noreply.github.com>
@CodyCBakerPhD
Copy link
Copy Markdown
Collaborator Author

@candleindark Addressed comments

Comment thread src/nwb2bids/_converters/_dandi_utils.py Outdated
Comment thread src/nwb2bids/_converters/_dandi_utils.py Outdated
Comment thread src/nwb2bids/_converters/_dandi_utils.py Outdated
Comment thread src/nwb2bids/bids_models/_base_metadata_model.py Outdated
Comment thread src/nwb2bids/bids_models/_bids_session_metadata.py Outdated
Comment thread src/nwb2bids/bids_models/_bids_session_metadata.py
Comment thread src/nwb2bids/bids_models/_bids_session_metadata.py
Comment thread src/nwb2bids/bids_models/_bids_session_metadata.py Outdated
@CodyCBakerPhD CodyCBakerPhD merged commit def5347 into main Sep 26, 2025
23 checks passed
@CodyCBakerPhD CodyCBakerPhD deleted the add_messages_2 branch September 26, 2025 05:34
@github-actions
Copy link
Copy Markdown
Contributor

🧹 Documentation preview for PR #70 has been removed.

github-actions Bot added a commit that referenced this pull request Sep 26, 2025
@CodyCBakerPhD CodyCBakerPhD added the enhancement New feature or request label Nov 5, 2025
@codecov
Copy link
Copy Markdown

codecov Bot commented Nov 5, 2025

Codecov Report

❌ Patch coverage is 84.51613% with 48 lines in your changes missing coverage. Please review.
✅ Project coverage is 87.34%. Comparing base (2790761) to head (cc77f4d).
⚠️ Report is 96 commits behind head on main.

Files with missing lines Patch % Lines
src/nwb2bids/_converters/_dataset_converter.py 81.92% 15 Missing ⚠️
src/nwb2bids/_inspection/_inspection_result.py 76.78% 13 Missing ⚠️
src/nwb2bids/_command_line_interface/_main.py 0.00% 7 Missing ⚠️
src/nwb2bids/_converters/_dandi_utils.py 61.11% 7 Missing ⚠️
src/nwb2bids/bids_models/_base_metadata_model.py 83.33% 2 Missing ⚠️
src/nwb2bids/bids_models/_participant.py 93.10% 2 Missing ⚠️
src/nwb2bids/bids_models/_bids_session_metadata.py 96.96% 1 Missing ⚠️
src/nwb2bids/bids_models/_events.py 66.66% 1 Missing ⚠️
Additional details and impacted files

Impacted file tree graph

@@            Coverage Diff             @@
##             main      #70      +/-   ##
==========================================
- Coverage   89.27%   87.34%   -1.94%     
==========================================
  Files          19       24       +5     
  Lines         541      885     +344     
==========================================
+ Hits          483      773     +290     
- Misses         58      112      +54     
Flag Coverage Δ
unittests 87.34% <84.51%> (-1.94%) ⬇️

Flags with carried forward coverage won't be shown. Click here to find out more.

Files with missing lines Coverage Δ
src/nwb2bids/__init__.py 100.00% <100.00%> (ø)
src/nwb2bids/_converters/_base_converter.py 88.00% <100.00%> (ø)
src/nwb2bids/_converters/_session_converter.py 89.81% <100.00%> (+2.18%) ⬆️
src/nwb2bids/_core/_convert_nwb_dataset.py 100.00% <100.00%> (ø)
src/nwb2bids/bids_models/_channels.py 80.95% <100.00%> (-13.65%) ⬇️
src/nwb2bids/bids_models/_dataset_description.py 95.45% <100.00%> (ø)
src/nwb2bids/bids_models/_electrodes.py 95.45% <100.00%> (+1.51%) ⬆️
src/nwb2bids/bids_models/_model_globals.py 100.00% <100.00%> (ø)
src/nwb2bids/bids_models/_probes.py 100.00% <100.00%> (ø)
src/nwb2bids/bids_models/_bids_session_metadata.py 92.77% <96.96%> (ø)
... and 7 more
🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

enhancement New feature or request

Projects

Status: Done

Development

Successfully merging this pull request may close these issues.

3 participants