Skip to content

feat: Phase 4 — five-step wizard UI with R-only badges and data-path …#8

Merged
bakodramane merged 3 commits into
mainfrom
phase/4-wizard-ui
Jun 4, 2026
Merged

feat: Phase 4 — five-step wizard UI with R-only badges and data-path …#8
bakodramane merged 3 commits into
mainfrom
phase/4-wizard-ui

Conversation

@bakodramane

Copy link
Copy Markdown
Owner

…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
     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)

bakodramane and others added 3 commits June 3, 2026 22:46
…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>
@bakodramane bakodramane merged commit 338e682 into main Jun 4, 2026
2 checks passed
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.

1 participant