feat(catalog): real catalog display names#477
Draft
mrosseel wants to merge 1 commit into
Draft
Conversation
Make a readable catalog name a first-class data field so the UI can show e.g. "Collinder 24" sourced from data instead of a hardcoded code->name map. - Schema: add a `name TEXT` column to the catalogs table and to ObjectsDatabase.insert_catalog(). - Write path: catalog_import_utils.insert_catalog() gains a display_name param; all ~21 loader call sites now pass a readable name (Collinder, Herschel, Lynga, Caldwell, Barnard, Sharpless, Abell, Arp, Harris, SAC Asterisms/Doubles/Red Stars, Bright Stars, etc.). - Read path: expose `name` on the in-memory Catalog / CatalogBase, populated from get_catalogs_dict(); falls back to None (UI uses the code) for virtual or legacy catalogs. - Migration: pre-built databases shipped without the column get it backfilled on startup (ALTER TABLE + UPDATE by catalog_code), idempotent and race-safe. - Bump CACHE_VERSION to 2 since the cached Catalog/catalogs_info shape changed. Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
What
Make a readable catalog name a first-class data field so the UI can show e.g.
Collinder 24sourced from data instead of a hardcoded code→name map. Today thecatalogstable only hascatalog_code,max_sequence, and a long free-textdesc, so the UI falls back to codes (Col 24,H 244).Changes
db/objects_db.py): add aname TEXTcolumn to thecatalogsCREATE TABLE and toObjectsDatabase.insert_catalog().catalog_imports/catalog_import_utils.insert_catalog()gains adisplay_nameparam. All ~21 loader call sites now pass a readable name (NGC, IC, Messier, Caldwell, Herschel, Collinder, TAAS 200, SAC Asterisms/Doubles/Red Stars, Bright Stars, Extragalactic Globular Clusters, RASC Double Stars, Barnard, Sharpless, Abell, Arp, TLK Variable Stars, Washington Double Star, Harris, Lynga).nameon the in-memoryCatalog/CatalogBase, populated fromget_catalogs_dict(). Falls back toNone(UI uses the code) for virtual catalogs (planets, comets) and legacy rows.astro_data/pifinder_objects.dbis a pre-built binary without this column. A one-time, idempotent migration runs on startup (ObjectsDatabase.__init__): ifnameis missing it doesALTER TABLE catalogs ADD COLUMN name TEXTthenUPDATEs each row bycatalog_codefrom a canonical map, so existing installs get names without a full re-import. The migration is race-safe (catches duplicate-column on concurrent startup) and a no-op once applied.CACHE_VERSIONto 2 since the cachedCatalog/catalogs_infoshape changed.The shipped binary DB is intentionally not modified in this PR — names are applied at runtime by the migration (verified: all 21 catalogs backfill correctly).
Consumer note
Step 5 of the original task was a one-line change in
object_details._other_catalog_descriptionsto build the section label from the catalog name (falling back to the code). That method is part of an as-yet-unmerged observing-list feature and does not exist onbrickbots/main, so it is not included here. Once it lands, the change is simply: look up the catalog name viacatalogs.get_catalog_by_code(code).nameand renderf"{name} {sequence}", falling back to the code whennameisNone.Testing
ruff check+ruff format --check: clean.pytest tests/test_catalog_cache.py tests/test_catalog_data.py: 11 passed.🤖 Generated with Claude Code