From fc3c58e4ebbb25de950c75d183645debb3473299 Mon Sep 17 00:00:00 2001 From: Daniel Date: Mon, 23 Mar 2026 23:45:09 +0100 Subject: [PATCH] Expand ROS/PE: pertinent negatives for WNL, clinical descriptions for abnormal MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit - WNL/Normal systems now expand to 1-3 specific pertinent negatives instead of just "WNL" — varies each time, relates to chief complaint and differential (e.g., Skin: "no rash, no petechiae, no bruising" instead of "WNL") - Abnormal systems: AI expands physician's brief note into clinical description favoring most common presentation, adds only 1-2 related pertinent negatives (e.g., "pimples on face" → "inflammatory papules on bilateral cheeks...") - Format function now passes system domain details for context - Rules applied to well visit (full + short) and sick visit prompts --- public/js/shadess.js | 11 ++++++++-- src/utils/prompts.js | 48 ++++++++++++++++++++++++++++++++++++++------ 2 files changed, 51 insertions(+), 8 deletions(-) diff --git a/public/js/shadess.js b/public/js/shadess.js index ef5f6bf..5cc9c97 100644 --- a/public/js/shadess.js +++ b/public/js/shadess.js @@ -500,8 +500,15 @@ if (!status) return; hasAny = true; var note = dataObj[sys.key + '_note'] || ''; - var statusLabel = status === 'wnl' ? 'WNL' : status === 'abnormal' ? 'Abnormal' : 'Not reviewed'; - lines.push(' ' + sys.label + ': ' + statusLabel + (note ? ' — ' + note : '')); + if (status === 'wnl') { + // WNL — tell AI to expand with pertinent negatives, include domain details for context + lines.push(' ' + sys.label + ': NORMAL [domain: ' + sys.detail + ']'); + } else if (status === 'abnormal') { + // Abnormal — user's note is the finding; AI should expand/describe it + lines.push(' ' + sys.label + ': ABNORMAL' + (note ? ' — ' + note : '') + ' [domain: ' + sys.detail + ']'); + } else { + lines.push(' ' + sys.label + ': Not reviewed'); + } }); return hasAny ? lines.join('\n') : ''; }; diff --git a/src/utils/prompts.js b/src/utils/prompts.js index 6063ab0..a578555 100644 --- a/src/utils/prompts.js +++ b/src/utils/prompts.js @@ -14,6 +14,39 @@ CRITICAL RULES FOR ALL OUTPUTS: - Use plain numbered lists (1. 2. 3.) or plain line breaks for structure, never markdown bullets `; +const ROS_PE_RULES = ` +REVIEW OF SYSTEMS AND PHYSICAL EXAM EXPANSION RULES: +When ROS or PE data is provided with NORMAL or ABNORMAL status: + +For NORMAL systems: +- Do NOT simply write "WNL" or "within normal limits" — expand each into 1-3 specific pertinent negatives +- Vary the negatives each time; do not repeat the same boilerplate +- Choose negatives that are clinically relevant to the patient's age, chief complaint, and what you would want to rule out +- Examples: + ENT: NORMAL → "Ears: TMs clear bilaterally, no effusion. Nose: no congestion, no rhinorrhea. Throat: no erythema, no exudates." + Skin: NORMAL → "No rash, no petechiae, no bruising." + Respiratory: NORMAL → "No cough reported, no wheezing, no shortness of breath." + Cardiovascular: NORMAL → "No chest pain, no palpitations." +- For Physical Exam NORMAL systems, describe a brief normal exam finding: + General: NORMAL → "Well-appearing, alert, interactive, in no acute distress." + Chest/Lungs: NORMAL → "Clear to auscultation bilaterally, no wheezes, no crackles, no retractions, good air movement." + Abdomen: NORMAL → "Soft, non-tender, non-distended, normoactive bowel sounds, no organomegaly." + Skin: NORMAL → "Warm, dry, intact. No rashes, no lesions, no petechiae." + +For ABNORMAL systems: +- Use the physician's note as the primary finding +- Expand the finding into a brief, professional clinical description favoring the MOST COMMON presentation +- Add only 1-2 closely related pertinent negatives that help narrow the differential — do not be generous with negatives +- Examples: + Skin: ABNORMAL — "pimples on face" → "Skin: multiple inflammatory papules on bilateral cheeks and forehead, consistent with acne vulgaris. No comedones, no cysts." + Lungs: ABNORMAL — "wheezing bilaterally" → "Chest/Lungs: bilateral expiratory wheezing throughout, no decreased air entry, no retractions." + ENT: ABNORMAL — "red throat" → "Throat: posterior pharyngeal erythema without exudates. Tonsils mildly enlarged, no asymmetry." +- If the physician later provides clarification (e.g. "it's pustular"), update accordingly +- Always favor the most common/likely presentation for the described finding + +For NOT REVIEWED systems: simply state "Not reviewed" or "Not examined" +`; + const PROMPTS = { // ======================== HPI ======================== @@ -217,11 +250,12 @@ Keep clinical and concise — this will be pasted into the encounter note.`, // ======================== WELL VISIT NOTE ======================== wellVisitNote: `You are an expert pediatric physician generating a complete well child visit encounter note. ${CORE_RULES} +${ROS_PE_RULES} Sections required: Chief Complaint: Interval History: (development, growth, behavior, school/activities, diet, sleep, safety since last visit — from transcript if provided) -Review of Systems: (pertinent only; use physician ROS template if provided under PHYSICIAN TEMPLATES) -Physical Examination: (use physician exam template if provided; include vital signs and measurements given) +Review of Systems: (expand each system per ROS/PE rules above — never just write "WNL") +Physical Examination: (expand each system per ROS/PE rules above — describe specific normal or abnormal findings; include vital signs and measurements given) Growth Assessment: (if vitals/measurements provided: comment on growth velocity and percentile trends. For ages ≥2, include BMI percentile and weight classification per AAP 2023 guidelines: - Underweight: BMI <5th %ile - Healthy Weight: 5th to <85th %ile @@ -250,26 +284,28 @@ Rules: wellVisitShort: `You are an expert pediatric physician. Generate a brief well child visit note (SOAP style). Keep concise. ${CORE_RULES} +${ROS_PE_RULES} S: Well child visit, brief interval history, parent concerns -O: Vitals/measurements provided, exam findings (use template if provided). Include growth assessment and BMI classification for ages ≥2. +O: Vitals/measurements provided. ROS: expand each system with specific pertinent negatives (never just "WNL"). PE: describe specific normal/abnormal findings per system. Include growth assessment and BMI classification for ages ≥2. A: Well child, age-appropriate development, growth status, any additional diagnoses P: Feeding/nutrition guidance discussed, vaccines, screenings, anticipatory guidance, follow-up`, // ======================== SICK VISIT NOTE ======================== sickVisitNote: `You are an expert pediatrician. Generate a concise, professional sick visit note from the provided data. ${CORE_RULES} +${ROS_PE_RULES} Include: Chief Complaint: History of Present Illness: (from transcript/dictation — onset, duration, associated symptoms, pertinent negatives) -Review of Systems: (from ROS data — document both positive and negative findings for each system reviewed) -Physical Examination: (from PE data — document normal and abnormal findings; state "not examined" where applicable) +Review of Systems: (expand each system per ROS/PE rules — NORMAL systems get 1-3 specific pertinent negatives relevant to the chief complaint and differential diagnosis, ABNORMAL systems use the physician's notes expanded into clinical language) +Physical Examination: (expand each system per ROS/PE rules — NORMAL systems get a brief specific normal exam description, ABNORMAL systems use the physician's notes expanded with the most common presentation in mind. Keep abnormal expansion concise — add at most 1-2 closely related pertinent negatives) Assessment and Plan: - List diagnoses with ICD-10 codes - Treatments and medications prescribed (if mentioned) - Follow-up instructions - Return precautions -Format as a structured clinical note. Be factual. Only include information explicitly provided. Do not fabricate clinical data.` +Format as a structured clinical note. Be factual. Do not fabricate clinical data.` }; // ── DB override support ────────────────────────────────────────────────────