Source code for ccat_workflow_manager.grouping.presets
"""Curated filter preset templates for the frontend.
Presets are data dicts — no code changes needed to add new presets.
"""
PRESETS = {
"chai_by_source_line": {
"name": "CHAI: by source + line",
"description": "Groups CHAI data by source and spectral line",
"filter_rules": [
{"table": "RawDataPackage", "column": "state", "operator": "eq", "value": "archived"},
],
"group_by": ["Source.name", "ObsUnit.line_id"],
},
"chai_by_source_line_obsconfig": {
"name": "CHAI: by source + line + obs config",
"description": "Groups CHAI data by source, line, and observation configuration",
"filter_rules": [
{"table": "RawDataPackage", "column": "state", "operator": "eq", "value": "archived"},
],
"group_by": ["Source.name", "ObsUnit.line_id", "ObsUnit.observation_configuration_id"],
},
"primecam_by_source_obsmode": {
"name": "PrimeCam: by source + obs mode",
"description": "Groups PrimeCam data by source and observation mode",
"filter_rules": [
{"table": "RawDataPackage", "column": "state", "operator": "eq", "value": "archived"},
],
"group_by": ["Source.name", "ObsUnit.obs_mode_id"],
},
}
[docs]
def get_preset(name: str) -> dict:
"""Get a preset by name."""
return PRESETS.get(name)
[docs]
def list_presets() -> list:
"""List all available presets."""
return [
{"key": key, "name": preset["name"], "description": preset["description"]}
for key, preset in PRESETS.items()
]