Add title and description metadata for source names#651
Conversation
Introduces `SourceMetadata` Pydantic model to allow human-readable titles and descriptions for data sources (detectors, monitors, timeseries). Key changes: - Add `SourceMetadata` model with `title` and `description` fields - Add `source_metadata` dict field to `Instrument` class - Add `get_source_title()` and `get_source_description()` helper methods - Wire instrument config through dashboard layer for title lookup - Update source selector widgets to display titles instead of internal names - Update plot cell toolbars to use source titles - Add DREAM instrument source metadata as example The title lookup falls back to the source name when no metadata is defined, ensuring backwards compatibility. Closes #604 Prompt: Please read #604 and then think about how this could be accomplished. Where would titles be defined? How can the frontend app access them? Developer a deep understanding, then get back to me with brief thoughts idea, do not spell out a full solution yet. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
The source title metadata was not being used consistently in the UI: - WorkflowStatusWidget config toolbar displayed raw source_name - Plot config modal (step 3 wizard) showed source names instead of titles Fix by: - Add get_source_title() to JobOrchestrator for widget access - Update WorkflowStatusWidget._create_config_toolbar() to use titles - Add instrument_config parameter to PlotConfigurationAdapter - Add get_source_title() to PlotConfigurationAdapter - Add instrument_config property to PlotOrchestrator - Pass instrument_config through PlotConfigModal to the adapter Prompt: The addition of source titles in this branch works in some cases, but misses in others. In particular: - The WorkflowStatusWidget still shows source_name directly instead of title - The plot config modal (step 3 in wizard) still shows source names. Co-Authored-By: Claude Opus 4.5 <noreply@anthropic.com>
nvaytet
left a comment
There was a problem hiding this comment.
I didn't see the source description being used for tooltips. Did I miss something?
| self.instrument_module = get_config(self._instrument) | ||
| self.processor_factory = instrument_registry[self._instrument].workflow_factory | ||
| self.instrument_config = instrument_registry[self._instrument] |
There was a problem hiding this comment.
Unrelated to this PR, but slightly weird that the result of get_config() is stored as instrument_module, while the instrument_config comes from using getitem on instrument_registry.
I'm just saying that the naming could lead someone reading the code that there is a mistake?
There was a problem hiding this comment.
Yes, get_config should probably be renamed.
Currently only one I think: There is a tooltip icon in the toolbar of a plot (the header row). |
I meant I couldn't see |
Oh, sorry I misunderstood you, I thought you meant the title not being used in tooltips. Indeed, we currently do not display the description field anyway. |
Summary
Introduces
SourceMetadataPydantic model to allow human-readable titles and descriptions for data sources (detectors, monitors, timeseries). This addresses the UX issue where internal identifiers likeendcap_forward_detectorare displayed in the UI instead of user-friendly names.SourceMetadatamodel withtitleanddescriptionfields toInstrumentclassThe title lookup falls back to the source name when no metadata is defined, ensuring backwards compatibility.
Closes #604
Example
Test plan
SourceMetadatamodel and lookup methods🤖 Generated with Claude Code