Skip to Content
Ai LogQuestionnaire trim + add cough + labeled AI-suggestions UI (backend + portal)

Questionnaire trim + labeled suggestions (backend gateway + physician portal)

Backend/portal half of the Round-2 client UX. The rn_dermadetect half is a separate PR.

Questionnaire trim

Cut the symptom questionnaire to what the model actually uses (Stream-3 ablation) plus the non-visual history the clinicians value:

  • Dropped (visual and/or unused by the trimmed model): bleeding, size, shape, elevation, swelling, color, pus (+ its pus_color AUTO row), fever.exists, fever.is_24h, hair_loss.exists, hair_loss.type.
  • Added: cough (boolean; the deployed model consumes cough — ~+0.6 top-1 — but the app never asked it). Folded onto the existing combined-boolean screen alongside vesicle, so no new step.
  • Un-gated vesicle: was gated on elevation is above; since elevation is dropped, vesicle is now unconditional.
  • Kept: age/gender (prefilled), duration, location + photos, texture, distribution, vesicle, itch, pain (+type), pregnancy, free-text.

Files

  • src/api_gateway/src/core/next_question/question_flow.csv — authoritative served schema (the apps fetch this via GET /api/ai/question_schema). 41 questions now.
  • src/api_gateway/physician_portal/src/features/assessment/engine/fallbackSchema.ts — offline fallback, kept in sync.
  • src/api_gateway/physician_portal/src/pages/DiagnosisPage.tsx — combined-bool list → vesicle + cough.
  • src/api_gateway/src/schemas/anamnesis.py — the dropped fields were required here (validates /red_flags + /triage bodies). Made optional so the apps don’t 422 once they stop sending them; added cough.

Note / follow-up: dropping fever and bleeding removes those inputs from red-flag evaluation (they’ll read as absent). If any red-flag rule depended on them it silently stops firing — worth a review pass on the red-flag rules.

Labeled AI-suggestions UI (physician CaseDetailPage)

Replaced the raw confidence % + bar in the “Differential Diagnosis” list with tier-driven labels (this is the dermatologist’s view, not the patient’s):

  • The top highlight_count predictions are Recommended (confident tier) or Possible (possible tier); the rest are Alternate.
  • Refer tier shows a low-confidence notice above the list and highlights nothing (all Alternate).

tier/confidence/highlight_count added to the DiagnosisResult type. These come from the serving PRs (#110 merged, #112 open); the UI degrades gracefully if they’re absent (everything renders as Alternate).

Verification

  • Served schema: 41 questions, no dropped keys leak, cough present, vesicle unconditional.
  • Backend: next_question + anamnesis tests pass (37); two schema tests repointed off the dropped bleeding/swelling examples. Ruff clean.
  • Portal: tsc -b clean.

Do-after

  • rn_dermadetect gets the same trim + labeled review screen (separate PR).
  • Re-fit tier thresholds (PR #114 brief) so the labels’ Confident/Possible/Refer split matches production.
Last updated on