Skip to content

Add variable labels from OpenFisca - #244

Merged
anth-volk merged 3 commits into
mainfrom
add-variable-labels
Mar 11, 2026
Merged

anth-volk merged 3 commits into
mainfrom
add-variable-labels

Conversation

@anth-volk

Copy link
Copy Markdown
Contributor

Fixes #243

Summary

  • Add label: str | None = None to the Variable Pydantic model
  • Extract labels via getattr(var_obj, "label", None) in US and UK model loading
  • Add fixtures (variable_label_fixtures.py) and 15 tests covering model, extraction, and integration

Test plan

  • TestVariableLabelField — Variable model accepts/defaults label
  • TestLabelExtraction — getattr pattern handles present, missing, empty labels
  • TestUSVariableLabels — US model variables have labels, >50% coverage
  • TestUKVariableLabels — UK model variables have labels, >50% coverage

🤖 Generated with Claude Code

Base automatically changed from app-v2-migration to main March 5, 2026 18:53
@anth-volk
anth-volk marked this pull request as ready for review March 5, 2026 19:05
@anth-volk
anth-volk requested a review from SakshiKekre March 5, 2026 19:05

@nwoodruff-co nwoodruff-co 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.

Does this have other bits in it's not meant to?

@anth-volk

Copy link
Copy Markdown
Contributor Author

It for sure does, thanks for flagging @nwoodruff-co

anth-volk and others added 2 commits March 11, 2026 21:09
OpenFisca variables have a `label` class attribute with human-readable
names (e.g. "Employment income"). This adds `label: str | None = None`
to the Variable model and extracts it via `getattr(var_obj, "label", None)`
in both US and UK model loading. Includes unit and integration tests.

Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@anth-volk
anth-volk force-pushed the add-variable-labels branch from 10f1e70 to 5811c7a Compare March 11, 2026 20:25
Co-Authored-By: Claude Opus 4.6 <noreply@anthropic.com>
@anth-volk
anth-volk merged commit c685e29 into main Mar 11, 2026
4 checks passed
@anth-volk
anth-volk deleted the add-variable-labels branch March 11, 2026 20:34
MaxGhenis added a commit that referenced this pull request Oct 16, 2026
Round 8 of #635: GitHub records a retarget it makes itself, when a pull
request's base branch is merged and deleted, as an
AutomaticBaseChangeSucceededEvent, which a query for
BASE_REF_CHANGED_EVENT alone misses (live: #244). The base-change query
now asks for both, so a pull request automatically retargeted to main is
counted like one a person retargeted. The GraphQL fake now answers only
for the event types a query asks for, and new cases cover an automatic
retarget of the candidate's own and of a closed pull request; dropping
either event type from the query fails a test.

Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
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.

Add variable labels from OpenFisca to Variable model

2 participants