Skip to content

Remove metadata interface#989

Open
mtauraso wants to merge 4 commits into
mainfrom
mtauraso-remove-metadata-interface
Open

Remove metadata interface#989
mtauraso wants to merge 4 commits into
mainfrom
mtauraso-remove-metadata-interface

Conversation

@mtauraso

@mtauraso mtauraso commented Jul 17, 2026

Copy link
Copy Markdown
Member

Removes the Metadata interface from datasets, Includes a quick fix to the only remaining consumer (visualizev1) so it uses the get_ interface for everything.

@codecov

codecov Bot commented Jul 17, 2026

Copy link
Copy Markdown

Codecov Report

❌ Patch coverage is 33.33333% with 26 lines in your changes missing coverage. Please review.
✅ Project coverage is 65.63%. Comparing base (09af5e1) to head (a1aa1d2).

Files with missing lines Patch % Lines
src/hyrax/verbs/visualize.py 7.14% 26 Missing ⚠️
Additional details and impacted files
@@            Coverage Diff             @@
##             main     #989      +/-   ##
==========================================
- Coverage   65.79%   65.63%   -0.17%     
==========================================
  Files          85       85              
  Lines        8178     8113      -65     
==========================================
- Hits         5381     5325      -56     
+ Misses       2797     2788       -9     

☔ View full report in Codecov by Harness.
📢 Have feedback on the report? Share it here.

🚀 New features to boost your workflow:
  • ❄️ Test Analytics: Detect flaky tests, report on failures, and find test suite problems.
  • 📦 JS Bundle Analysis: Save yourself from yourself by tracking and limiting bundle sizes in JS merges.

@mtauraso
mtauraso requested a review from drewoldag July 17, 2026 20:08
@mtauraso mtauraso self-assigned this Jul 17, 2026
@mtauraso
mtauraso marked this pull request as ready for review July 17, 2026 20:08
Copilot AI review requested due to automatic review settings July 17, 2026 20:08

Copilot AI left a comment

Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Pull request overview

This PR removes the legacy dataset metadata-table interface (metadata() / metadata_fields()) from HyraxDataset and updates remaining call sites (notably visualize) and tests to rely on getter-based (get_*) / DataProvider field access instead.

Changes:

  • Removed metadata-table plumbing from HyraxDataset, InferenceDataset, and DataProvider, plus related config entries.
  • Updated multiple datasets to call the new HyraxDataset.__init__(config) signature and added an explicit get_object_id() where needed.
  • Updated tests and visualize to avoid the removed metadata APIs.

Reviewed changes

Copilot reviewed 15 out of 15 changed files in this pull request and generated 3 comments.

Show a summary per file
File Description
tests/hyrax/test_inference_dataset.py Removes metadata-ordering assertions now that metadata API is gone.
tests/hyrax/test_fits_image_dataset.py Updates field assertions to use fields() rather than metadata_fields().
tests/hyrax/test_downloaded_lsst_dataset.py Switches metadata lookups to get_object_id().
tests/hyrax/test_data_provider.py Updates expectations after removing metadata plumbing from DataProvider.
src/hyrax/verbs/visualize.py Replaces metadata API usage with per-index field fetching via DataProvider.
src/hyrax/hyrax_default_config.toml Removes random-dataset metadata_fields config entry.
src/hyrax/datasets/random/hyrax_random_dataset.py Drops metadata table construction and calls new super().__init__(config).
src/hyrax/datasets/lsst_dataset.py Updates super().__init__ call and adds get_object_id().
src/hyrax/datasets/kafka_stream_dataset.py Updates super().__init__ call to new signature.
src/hyrax/datasets/inference_dataset.py Removes metadata overrides.
src/hyrax/datasets/hsc_dataset.py Fixes super().__init__ call to avoid positional arg confusion.
src/hyrax/datasets/fits_image_dataset.py Removes metadata preparation and uses new super().__init__(config).
src/hyrax/datasets/dataset_registry.py Removes metadata-table interface and simplifies HyraxDataset.__init__.
src/hyrax/datasets/data_provider.py Removes metadata aggregation APIs/fields from DataProvider.
GETITEM_REFACTOR_PLAN.md Adds design/implementation plan documenting the broader refactor direction.

Comment on lines +592 to +598
def _available_fields(self) -> set[str]:
"""Return the set of all field names available across all datasets in the data provider."""
all_fields = set()
for field_list in self.data_provider.fields().values():
all_fields.update(field_list)
all_fields.add("object_id")
return all_fields
Comment on lines +600 to +624
def _fetch_fields(self, indices, fields) -> dict[str, list]:
"""Fetch specific fields for a list of indices from the data provider.

Parameters
----------
indices : list of int
Indices to fetch data for.
fields : list of str
Field names to extract.

Returns
-------
dict[str, np.ndarray]
Mapping of field name to array of values across all indices.
"""
import numpy as np

result = {field: [] for field in fields}
primary_name = self.data_provider.primary_dataset
for idx in indices:
sample = self.data_provider[idx]
data = sample.get(primary_name, {})
for field in fields:
result[field].append(data.get(field))
return {field: np.array(values) for field, values in result.items()}
raw_filenames = fetched[self.filename_column_name]

filenames = [f.decode("utf-8") for f in raw_filenames]
filenames = [str(f) for f in raw_filenames]
Comment thread src/hyrax/datasets/fits_image_dataset.py
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants