Repository navigation
UK v3 cleanup: household builder inputs - #1371
Merged
Merged
Conversation
- Leave the _before_lsr twin of a basic builder field out of the v3 picker (employment_income_before_lsr beside employment_income), US and UK. - Prefer the curated description of a featured input over the model's documentation, which carries dataset and developer notes. - Leave UK dataset-only inputs out of the picker: imputed wealth totals, LCFS spending categories, NHS visit counts, transport usage series and similar. - Show UK builder dependants as "your first child" in v3 (display only; person keys are unchanged). - Start a UK household in a Scotland, Wales or Northern Ireland report in that nation: region, capital local authority and its BRMA. - Give v3 household inputs accessible names from their labels. Shared components (HouseholdBuilderForm, VariableRow, VariableInput) only gain opt-in props that v3 passes; v2 renders as before. Co-Authored-By: Claude Opus 5.5 <noreply@anthropic.com>
|
The latest updates on your projects. Learn more about Vercel for GitHub.
|
This branch was successfully deployed
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 changes
All changes are in the v3 report's household section. The shared builder components (
HouseholdBuilderForm,VariableRow,VariableInput) only gain opt-in props, which the v3 section passes. v2 does not pass them, so v2 renders as before.models/Household.tsand the feature flags are not changed.No duplicate "Employment income" in the picker.
employment_income_before_lsrwas listed as "Employment income" beside the basicemployment_incomefield. The builder sets the basic field, which the model takes in place of its formula, so the twin changed nothing. The newtwinsABasicInputleaves out a*_before_lsrinput when its stem is a basic person field. This applies to US and UK (both listemployment_incomeas a basic input). The USself_employment_income_before_lsrstays:self_employment_incomeis not a US input or a basic field, so it is the only US self-employment input (it is also a featured tile).Curated descriptions come first.
householdInputDescriptionOf(andhouseholdInputDescription) now return our description for a featured input, else the model's documentation. The model's text forcouncil_tax,is_disabled_for_benefitsandproperty_incomecarries dataset and developer notes.UK dataset-only inputs are left out of the picker (new
UK_DATASET_INPUTS, UK only):capital_gains_before_response,gross_financial_wealth,net_financial_wealth,corporate_wealth,full_rate_vat_expenditure_rate,cumulative_residential_rent,cumulative_non_residential_rent, the 12 LCFS*_consumptioncategories (withhealth_consumption),a_and_e_visits,admitted_patient_visits,outpatient_visits,rail_usage,bus_in_london_trips,other_local_bus_trips,ebr_energy_bills_credit_eligible.electricity_consumption,gas_consumptionanddomestic_energy_consumptionstay. The UK "Health" topic is now empty, so it does not show.UK children read as children. In v3 UK, the builder shows "Your first child" and "Add variable to your first child". The person keys stay "your first dependent", so saved households, payloads and v2 are unchanged. The new
personDisplayNameOfprop onHouseholdBuilderFormchanges only the name shown.A UK nation report's household starts in that nation.
HouseholdImpactSectionnow readsregion. Forcountry/scotland,country/walesandcountry/ni(alsocountry/northern_ireland), the new household gets the nation'sregion, the capital'slocal_authority, and the BRMA that contains it:SCOTLAND,CITY_OF_EDINBURGH,LOTHIANWALES,CARDIFF,CARDIFFNORTHERN_IRELAND,BELFAST,BELFASTEngland, UK-wide, constituency and local authority reports keep the model's defaults: England has no single region, and a mapping from a constituency to an LA and a BRMA is not simple. The analytics count of non-default inputs uses the same start, so the prefilled place is not counted. US behaviour is unchanged.
Accessible names. The household inputs had no name of their own; a screen reader read the placeholder "Enter ". With the new
labelInputsprop, each input gets anaria-label: "Employment income, you" for a person's input, "Rent" for a household's, and "Marital status" for the marital status select. This covers text, number, select and switch inputs.Not changed
/us/build(800px and 600px wide) and on/uk/buildwith the UK v3 shell on locally (600px), I typed into a rate field and clicked "Nationwide" / "UK-wide" once. The picker opened every time.NumberInputcommits on each keystroke. On blur it only sets the "saved" check, which changes no layout around the trigger, so I found no blur/focus race in the code. A repro (browser, width, which field) is needed before a fix.libs/flagship/householdRun.ts: open draft v3 household section: US and UK households with SPM geography, calculation provenance and UK input suggestions #1338 already removesFlagshipHouseholdInput,buildHouseholdPayload,runFlagshipHouseholdanddescribeHouseholdInput. This PR leaves them alone to avoid duplicate work.Overlaps
HouseholdImpactSection.tsx(SPM geography, provenance,loadParameterDependencies(countryId)). The two PRs edit different hunks: herenewHousehold, theregionprop,variableFilterand two builder props. The section's test stand-in also changes in both. Whichever merges second needs a small rebase.models/Household.ts. This PR does not.Tests
householdVariableGroups.test.ts: each UK dataset-only input is left out. Energy consumption inputs stay. The UK rule does not apply to the US.twinsABasicInput: a twin of a basic field is a twin;self_employment_income_before_lsrwithout a basic field is kept.householdPickerInputs.test.ts: a featured input with model documentation shows our description (UKcouncil_tax, UStip_income). An input that is not featured shows the model's documentation.HouseholdBuilderForm.test.tsx:labelInputsnames each input ("Employment income, you", "Rent", "Marital status"). Without it, no input has anaria-label, as before.personDisplayNameOfrenames a person but keeps the key. Without it, "Your first dependent" shows, as before.HouseholdImpactSection.test.tsx: UK passes the child name andlabelInputs. The US keeps "dependent". Scotland, Wales and NI reports start the household there. Nationwide, England and constituency reports keep the defaults.vitestoncomponents/household,components/flagship,libs/flagship,models,integration/householdandpathways: 147 files, 1,809 tests pass.tsc --noEmit, ESLint (on the touched files,--max-warnings 0) andprettier --checkpass.🤖 Generated with Claude Code