pcdshub / happi

Heuristic Access to Positions of Photon Instruments
https://pcdshub.github.io/happi/master
Other
13 stars 29 forks source link

GUI/MNT: let HappiDeviceTreeView include items where key is not found #310

Closed tangkong closed 1 year ago

tangkong commented 1 year ago

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)

image

new:

image

Pre-merge checklist