Instead of omitting items, show them under a catch-all tree item "[KEY NOT FOUND]"
Motivation and Context
If you're looking to group items by a metadata key, I think you'd expect every item in the database to be represented. If you were to group the database by a field and then search for an item, it might just not exist if its metadata didn't feature that field.
In reality this was inspired by the logger spam when switching between views. Currently ATEF is the only real user of this model view, I think this is a better way to handle missing metadata.
Sidebar: I considered modifying get_happi_entry_value to pass null/None values from the database through, but in the end this can be grouped together with missing keys without loss of information. I do think raising a ValueError there is a bit overkill, since happi containers missing a key is a bit overkill. In the end this is the smallest change that solves my current problem.
How Has This Been Tested?
interactively, primarily using the ATEF Happi viewer.
Where Has This Been Documented?
This PR
old: (item disappears when grouped)
new:
Pre-merge checklist
[x] Code works interactively
[x] Code contains descriptive docstrings, including context and API
[ ] New/changed functions and methods are covered in the test suite where possible
[x] Test suite passes locally
[x] Test suite passes on GitHub Actions
[x] Ran docs/pre-release-notes.sh and created a pre-release documentation page
[x] Pre-release docs include context, functional descriptions, and contributors as appropriate
Description
Motivation and Context
If you're looking to group items by a metadata key, I think you'd expect every item in the database to be represented. If you were to group the database by a field and then search for an item, it might just not exist if its metadata didn't feature that field.
In reality this was inspired by the logger spam when switching between views. Currently ATEF is the only real user of this model view, I think this is a better way to handle missing metadata.
Sidebar: I considered modifying
get_happi_entry_value
to pass null/None values from the database through, but in the end this can be grouped together with missing keys without loss of information. I do think raising a ValueError there is a bit overkill, since happi containers missing a key is a bit overkill. In the end this is the smallest change that solves my current problem.How Has This Been Tested?
interactively, primarily using the ATEF Happi viewer.
Where Has This Been Documented?
This PR
old: (item disappears when grouped)
new:
Pre-merge checklist
docs/pre-release-notes.sh
and created a pre-release documentation page