feat: Phase 4 — five-step wizard UI with R-only badges and data-path …#8
Merged
Conversation
…split Pre-work (data path split): - UserInputs.censusDataPath now exclusively for unit-level census microdata - UserInputs.areaDataPath added for area-level direct estimates + auxiliaries - codegen.ts buildTokenMap updated: AREA_DATA uses areaDataPath, CENSUS_DATA uses censusDataPath (previously both shared the same field) - codegen.test.ts: FH_INPUTS updated to use areaDataPath Wizard UI (src/wizard/): - WizardContext.tsx — WizardState + useReducer with 12 action types; RESET action - Tooltip.tsx — hover tooltip component + InfoIcon (? badge) - Step1Import.tsx — CSV upload via papaparse (drag-and-drop + click), manual row-by-row entry, preview table with remove; validates ≥1 variable - Step2Roles.tsx — role/type dropdowns per variable; auto-suggests roles from variable name/type (weight, area-id, coordinate, direct-est, direct-var); validates exactly 1 target, ≥1 area-id, ≥1 auxiliary; role legend with tooltips - Step3Availability.tsx — checkboxes for all 9 DataAvailability flags with plain-language labels and tooltips; target-type radio (continuous/binary/ proportion/count/poverty/unknown); Stata version number input - Step4Methods.tsx — ranked method cards calling recommend(); badges: Area-level, Unit-level, Model-assisted, Bayesian, Robust, Spatial, R only (always visible), Stata v14 workaround; expandable Why this method? panel; single selection + optional comparison; R-only badge is immediate (not in expandable panel) - Step5Generate.tsx — variable summary; data path overrides (survey, census, area); nSimulations/mseMethod overrides; code preview in <pre> blocks; Download R button (always enabled); Stata button disabled for R-only methods (hb-fh, m-quantile, mqgwr, reblup, hb-unit) replaced by plain-language note; yellow fallback banner when usedFallback - Wizard.tsx — top progress bar (5 steps), Back/Next navigation, Start over; validation-gated Next button; replaces App.tsx placeholder isROnly utility: entry.stataCommand.startsWith((no) — covers all 5 R-only methods (hb-fh, m-quantile, mqgwr, reblup, hb-unit) without hardcoding IDs. E2E smoke test (e2e/wizard.spec.ts): - Uploads test-codebook.csv (7 variables including target, area-id, auxiliaries, weight, direct-est, direct-var) - Assigns roles via dropdown interaction - Ticks availability flags (microdata, area aggregates, weights, census auxiliaries) - Verifies FH-EBLUP card is present in the recommendation list - Selects FH-EBLUP and advances to Step 5 - Triggers R script download and asserts filename ends in .R All checks pass: - npm run build PASS - npm run lint PASS (0 warnings) - npm test PASS (430 unit tests) - playwright test e2e/wizard.spec.ts PASS (1/1) Co-Authored-By: Claude Sonnet 4.6 <noreply@anthropic.com>
The lockfile had two missing closing braces (papaparse and undici-types entries) plus a depth imbalance that caused JSON.parse to fail, making npm ci abort with "lockfileVersion >= 1 required". Regenerated cleanly with npm install. Co-Authored-By: Claude Sonnet 4.6 <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.
…split
Pre-work (data path split):
Wizard UI (src/wizard/):
isROnly utility: entry.stataCommand.startsWith((no) — covers all 5 R-only methods (hb-fh, m-quantile, mqgwr, reblup, hb-unit) without hardcoding IDs.
E2E smoke test (e2e/wizard.spec.ts):
All checks pass: