Skip to content

owid-catalog v1.0.1: ResponseSet ergonomics (.items, .to_dict(), .to_frame(all_fields=))#5718

Merged
lucasrodes merged 12 commits intomasterfrom
refactor-responseset-ergonomics
Feb 26, 2026
Merged

owid-catalog v1.0.1: ResponseSet ergonomics (.items, .to_dict(), .to_frame(all_fields=))#5718
lucasrodes merged 12 commits intomasterfrom
refactor-responseset-ergonomics

Conversation

@lucasrodes
Copy link
Member

@lucasrodes lucasrodes commented Feb 26, 2026

Summary

  • Rename ResponseSet.results.items to eliminate the redundant results.results access pattern
  • Add .to_dict() method that returns [item.model_dump() for item in self.items] — useful for serializing search results into AI/LLM context windows. Use it results.to_dict()
  • Add all_fields parameter to .to_frame() to temporarily override display mode (basic vs all fields) without mutating instance state
  • Bump version to v1.0.1 with changelog entry

Test plan

  • make check passes (format, lint, typecheck)
  • All 89 tests in test_client.py pass (including 2 new tests for all_fields)
  • Grep confirms no remaining self.results or ResponseSet(results= references

🤖 Generated with Claude Code

/schedule

@owidbot
Copy link
Contributor

owidbot commented Feb 26, 2026

Quick links (staging server):

Site Dev Site Preview Admin Wizard Docs

Login: ssh owid@staging-site-refactor-responseset-ergonom

chart-diff: ✅ No charts for review.
data-diff: ✅ No differences found

Automatically updated datasets matching excess_mortality|covid|fluid|flunet|country_profile|garden/ihme_gbd/2019/gbd_risk are not included

Edited: 2026-02-26 09:41:42 UTC
Execution time: 9.46 seconds

Rename the redundant `.results` attribute to `.items` and add a
`.to_dict()` method for easy serialization to plain dicts (useful
for AI/LLM context windows).

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@lucasrodes lucasrodes changed the title 🔨 owid-catalog: ResponseSet ergonomics owid-catalog: ResponseSet ergonomics (.items, .to_dict()) Feb 26, 2026
lucasrodes and others added 4 commits February 26, 2026 11:49
Allow users to pass `advanced=True/False` to `.to_frame()` to
temporarily override the instance `_ui_advanced` setting without
mutating it.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@lucasrodes lucasrodes changed the title owid-catalog: ResponseSet ergonomics (.items, .to_dict()) owid-catalog v1.0.1: ResponseSet ergonomics (.items, .to_dict(), .to_frame(all_fields=)) Feb 26, 2026
@lucasrodes lucasrodes marked this pull request as ready for review February 26, 2026 10:56
@lucasrodes lucasrodes requested a review from Marigold February 26, 2026 10:56
Copy link
Collaborator

@Marigold Marigold left a comment

Choose a reason for hiding this comment

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

nice!


@property
def results(self) -> list[T]:
"""Deprecated: use ``.items`` instead."""
Copy link
Collaborator

Choose a reason for hiding this comment

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

How about just removing it? I don't think we need to keep it backward compatible so early after release.

Copy link
Member Author

Choose a reason for hiding this comment

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

technically it's a breaking change, but sure, we can drop it

@github-actions
Copy link

Merge Schedule
Scheduled to be merged the next time the merge action is scheduled via the cron expressions

@lucasrodes lucasrodes merged commit 269cf4e into master Feb 26, 2026
5 checks passed
@lucasrodes lucasrodes deleted the refactor-responseset-ergonomics branch February 26, 2026 13:24
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.

3 participants