Process: Anything not finished in the current change belongs here. Do not rely on memory or chat for follow-ups.
- Simplify uses a high
max_output_tokens(8192) so long clinical notes are not cut off mid-sentence. Earlier default was 1000 and truncated the model response. - If check-similarity JSON is incomplete on very long texts, raise
max_output_tokensin_generatefor that route (currently 900).
- Theme toggle in the nav (persists
doctortalk-themeinlocalStorage, respectsprefers-color-schemeon first visit). Legacymedbridge-themeis migrated once. -
data-theme="dark"/"light"on<html>with CSS variables instatic/css/style.css. - Optional polish: theme-colored chart fills in
app.jscanvas helpers (drawHeat,drawFlagList) whendata-themeis light. - Optional: sync
<meta name="color-scheme">with the active theme for form controls.
- Obtain the canonical DEFT source (paper, supplement, or author release) and confirm redistribution terms.
- Normalize to an internal table or file, for example
{ term, plain_phrase, notes }.
- Build a matcher over clinician input (exact phrase, then fuzzy or n-gram fallbacks).
- Inject a compact DEFT block into the simplify system prompt (cap rows to a token budget).
- Log which DEFT rows were attached per request (audit trail).
Existing: FlaggedWord, Session.word_frequencies, Session.hover_times, comprehension, level.
- Formalize a patient context object from the DB (top flagged terms, weighted by
word_frequencies, trend from sessions). - Append Patient context to the Gemini system prompt (same route as today’s
history_ctx, but structured and bounded). - Optional later: store accepted simplify pairs and retrieve similar past lines (embedding search).
- Keep a single simplify entrypoint:
system + DEFT_RETRIEVED + PATIENT_CONTEXT + user text. - Version prompts in code or config for reproducibility.
- Sentence-split original and simplified text with the same rules.
- Align sentences (greedy or DP by cosine similarity).
- Load medicalai/ClinicalBERT (or a clinical sentence embedding model) via
transformers, mean-pool hidden states, compute cosine similarity per pair. - Aggregate (mean and min) and return alongside optional Gemini narrative check.
- Add
torch/transformersto the project and cache the model in process.
- UI copy: distinguish embedding similarity from LLM self-judgment and from “clinical safety”.
- Feature-flag heavy models so dev machines can run UI without GPU.