pediatric-ai-scribe-v3/public/app/assets/HospitalCourse-CzXNLHTv.js
Daniel aab8376fa1 chore(verify): drop vanilla-era test + linter; rebuild React bundle
The verify pipeline carried two scripts whose targets no longer
exist after the vanilla deletion at commit 25a9c4c:

  test/calc-math.test.js  — required public/js/calc-math.js (gone);
    every assertion is now covered by shared/clinical/
    calculators.test.ts (vitest).
  scripts/lint-references.js — scans public/js/*.js for DOM id
    references and checks each target exists in public/components/
    *.html. Those trees are gone; TypeScript + knip + vite build
    cover the equivalent dead-reference class for the React tree.

package.json:
  • `verify` drops `test:node` and `lint:refs`; now runs
    typecheck + vitest + knip + client vite build.
  • `test:node` script removed (test/ directory empty).

public/app/assets/ — fresh vite build so the bundle hashes match
the current source (new chunks for ByVisitAge, Cms, DxPicker,
EditableResult, LabsList, Milestones, OutputActions, Recorder,
Shadess, SlideEditor, VisitNote — all features landed in the
preceding commits).

Verified locally on node 20: tsc + 9 test files / 177 tests pass,
knip finds nothing, vite builds 35 chunks, client bundle is 343 kB
initial / 106 kB gzipped (Cms is the biggest lazy chunk at 402 kB
due to Tiptap/ProseMirror).
2026-04-24 05:46:59 +02:00

3 lines
No EOL
11 KiB
JavaScript

import{i as e,n as t,t as n}from"./jsx-runtime-ByY1xr43.js";import{c as r,i}from"./index-C9wKWOAN.js";import{n as a,t as o}from"./EditableResult-DaHQp1Pv.js";import{n as s,t as c}from"./LabsList-CVygta6B.js";import{t as l}from"./Recorder-DdXTjnSC.js";var u=e(t(),1),d=n(),f=`rounded-md border border-input bg-background px-2 py-1 text-sm`;function p({title:e,date:t,onDateChange:n,content:r,onContentChange:i,placeholder:a,moduleName:o,onRemove:s,children:c,testId:p}){let[m,h]=(0,u.useState)(``),[g,_]=(0,u.useState)(null),v=m||r;return(0,d.jsxs)(`div`,{className:`rounded-lg border border-border bg-card p-3 space-y-2`,"data-testid":p,children:[(0,d.jsxs)(`div`,{className:`flex items-center gap-2 flex-wrap`,children:[(0,d.jsx)(`strong`,{className:`text-sm`,children:e}),(0,d.jsx)(`input`,{type:`date`,value:t,onChange:e=>n(e.target.value),className:f+` w-40`}),c,s&&(0,d.jsx)(`button`,{type:`button`,onClick:s,className:`ml-auto text-xs text-destructive hover:text-red-700`,title:`Remove`,children:`🗑`})]}),(0,d.jsx)(l,{module:o,onTranscript:(e,t)=>{i(r?r+(t.appended?`
`:``)+e:e),h(``),_(null)},onInterim:e=>h(e?r?r+`
`+e:e:``),onError:e=>_(e)}),g&&(0,d.jsx)(`div`,{className:`text-sm text-destructive`,children:g}),(0,d.jsx)(`textarea`,{className:f+` w-full min-h-[120px] font-mono text-sm`,placeholder:a||`Paste or type the note…`,value:v,onChange:e=>{i(e.target.value),h(``)}})]})}var m=`inline-flex items-center gap-1 rounded-md border border-amber-400 bg-amber-50 text-amber-900 px-3 py-1.5 text-xs font-medium hover:bg-amber-100 disabled:opacity-50`;function h({currentDraft:e,notes:t,disabled:n}){let[r,i]=(0,u.useState)(!1),[a,o]=(0,u.useState)(null),[s,c]=(0,u.useState)(null);async function l(){i(!0),c(null),o(null);try{let n=await(await fetch(`/api/hospital-course-clarify`,{method:`POST`,credentials:`include`,headers:{"Content-Type":`application/json`},body:JSON.stringify({currentDraft:e,notes:t})})).json();if(!n.success)throw Error(n.error||`Request failed`);o(n.questions)}catch(e){c(e.message)}finally{i(!1)}}return(0,d.jsxs)(`div`,{className:`space-y-2`,"data-testid":`clarify-bar`,children:[(0,d.jsx)(`button`,{type:`button`,onClick:l,disabled:r||n,className:m,"data-testid":`clarify-run`,children:r?`⌛ Asking…`:`❓ What's Missing?`}),s&&(0,d.jsx)(`div`,{className:`text-sm text-destructive`,children:s}),a&&(0,d.jsx)(`div`,{className:`rounded-md border border-amber-200 bg-amber-50 dark:bg-amber-950/30 p-3 whitespace-pre-wrap text-sm`,children:a})]})}var g=`hospital`;function _(){return{date:``,type:`progress-attending`,content:``}}var v=`w-full rounded-md border border-input bg-background px-3 py-2 text-sm`,y=`rounded-md border border-input bg-background px-2 py-1 text-sm`;function b(){let[e,t]=(0,u.useState)(``),[n,l]=(0,u.useState)(``),[f,m]=(0,u.useState)(``),[b,x]=(0,u.useState)(``),[S,C]=(0,u.useState)(`floor`),[w,T]=(0,u.useState)(``),[E,D]=(0,u.useState)(`auto`),[O,k]=(0,u.useState)(``),[A,j]=(0,u.useState)(``),[M,N]=(0,u.useState)(``),[P,F]=(0,u.useState)(``),[I,L]=(0,u.useState)(``),[R,z]=(0,u.useState)([_()]),[B,V]=(0,u.useState)([s()]),[H,U]=(0,u.useState)(``),[W,G]=(0,u.useState)(null),K=r({mutationFn:e=>i.post(`/api/generate-hospital-course`,e),onSuccess:e=>G({hospitalCourse:e.hospitalCourse,format:e.format||`auto`})});function q(e,t){z(n=>n.map((n,r)=>r===e?{...n,...t}:n))}function J(){z(e=>[...e,_()])}function Y(e){z(t=>t.filter((t,n)=>n!==e))}function X(e){e.preventDefault(),G(null);let t=R.filter(e=>e.content.trim());t.length!==0&&K.mutate({notes:t,edNote:M.trim()?{date:O,content:M,labs:A}:void 0,hAndP:I.trim()?{date:P,content:I}:void 0,labs:B.filter(e=>e.values.trim()),patientAge:n,patientGender:f,pmh:b,setting:S,los:w?parseInt(w):void 0,formatPreference:E,additionalInstructions:H||void 0})}function Z(){G(null),l(``),m(``),x(``),C(`floor`),T(``),D(`auto`),k(``),j(``),N(``),F(``),L(``),z([_()]),V([s()]),U(``)}let Q=JSON.stringify({edNote:{date:O,labs:A,content:M},hAndP:{date:P,content:I},notes:R,labs:B});return(0,d.jsxs)(`div`,{className:`max-w-4xl mx-auto p-6 space-y-4`,children:[(0,d.jsxs)(`header`,{children:[(0,d.jsx)(`h1`,{className:`text-2xl font-semibold`,children:`Hospital Course Generator`}),(0,d.jsx)(`p`,{className:`text-sm text-muted-foreground`,children:`Upload ED note, H&P, progress notes, labs → AI generates an organized hospital course (prose, day-by-day, or organ-system format).`})]}),(0,d.jsx)(a,{type:g,label:e,setLabel:t,transcript:Q,generatedNote:W?.hospitalCourse||``,partialData:{age:n,gender:f,pmh:b,setting:S,los:w,format:E,additionalInstructions:H},onLoad:e=>{try{let t=e.transcript?JSON.parse(e.transcript):null;t?.edNote&&(k(t.edNote.date||``),j(t.edNote.labs||``),N(t.edNote.content||``)),t?.hAndP&&(F(t.hAndP.date||``),L(t.hAndP.content||``)),Array.isArray(t?.notes)&&t.notes.length&&z(t.notes),Array.isArray(t?.labs)&&t.labs.length&&V(t.labs)}catch{}G(e.generated_note?{hospitalCourse:e.generated_note,format:`auto`}:null);try{let t=e.partial_data?JSON.parse(e.partial_data):null;t?.age&&l(t.age),t?.gender&&m(t.gender),t?.pmh&&x(t.pmh),t?.setting&&C(t.setting),t?.los&&T(t.los),t?.format&&D(t.format),t?.additionalInstructions&&U(t.additionalInstructions)}catch{}t(e.label||``)},onClear:Z}),(0,d.jsxs)(`form`,{onSubmit:X,className:`space-y-4`,children:[(0,d.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,d.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,d.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Age`}),(0,d.jsx)(`input`,{className:v,value:n,onChange:e=>l(e.target.value)})]}),(0,d.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,d.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Gender`}),(0,d.jsxs)(`select`,{className:v,value:f,onChange:e=>m(e.target.value),children:[(0,d.jsx)(`option`,{value:``,children:`Select`}),(0,d.jsx)(`option`,{children:`Male`}),(0,d.jsx)(`option`,{children:`Female`})]})]}),(0,d.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,d.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Unit`}),(0,d.jsxs)(`select`,{className:v,value:S,onChange:e=>C(e.target.value),children:[(0,d.jsx)(`option`,{value:`floor`,children:`General Floor`}),(0,d.jsx)(`option`,{value:`picu`,children:`PICU`}),(0,d.jsx)(`option`,{value:`nicu`,children:`NICU`}),(0,d.jsx)(`option`,{value:`psych`,children:`Psych/Behavioral`})]})]})]}),(0,d.jsxs)(`div`,{className:`grid grid-cols-3 gap-3`,children:[(0,d.jsxs)(`label`,{className:`flex flex-col gap-1 col-span-2`,children:[(0,d.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`PMH`}),(0,d.jsx)(`input`,{className:v,placeholder:`e.g. Asthma, hypothyroidism`,value:b,onChange:e=>x(e.target.value)})]}),(0,d.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,d.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`LOS (days)`}),(0,d.jsx)(`input`,{className:v,type:`number`,min:1,value:w,onChange:e=>T(e.target.value)})]})]}),(0,d.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,d.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Format`}),(0,d.jsxs)(`select`,{className:v,value:E,onChange:e=>D(e.target.value),children:[(0,d.jsx)(`option`,{value:`auto`,children:`Auto (infer from setting + LOS)`}),(0,d.jsx)(`option`,{value:`prose`,children:`Prose summary`}),(0,d.jsx)(`option`,{value:`dayByDay`,children:`Day-by-day`}),(0,d.jsx)(`option`,{value:`organSystem`,children:`Organ-system (ICU)`})]})]}),(0,d.jsx)(p,{title:`🚑 ED Note (before admission)`,date:O,onDateChange:k,content:M,onContentChange:N,placeholder:`Paste or type ED note here…`,moduleName:`hospital-ed`,testId:`hc-ed-card`,children:(0,d.jsx)(`input`,{type:`text`,value:A,onChange:e=>j(e.target.value),placeholder:`ED Labs (e.g. WBC 15, BMP normal…)`,className:y+` flex-1 min-w-[180px]`})}),(0,d.jsx)(p,{title:`📋 H&P (Admission Note)`,date:P,onDateChange:F,content:I,onContentChange:L,placeholder:`Paste or type H&P here…`,moduleName:`hospital-hp`,testId:`hc-hp-card`}),(0,d.jsxs)(`div`,{className:`space-y-2`,children:[(0,d.jsxs)(`div`,{className:`flex items-center justify-between`,children:[(0,d.jsx)(`strong`,{className:`text-sm`,children:`📝 Progress Notes`}),(0,d.jsx)(`button`,{type:`button`,onClick:J,className:`rounded-md border border-border bg-background px-3 py-1.5 text-xs font-medium hover:bg-muted`,children:`+ Add progress note`})]}),R.map((e,t)=>(0,d.jsx)(p,{title:`Progress Note #`+(t+1),date:e.date,onDateChange:e=>q(t,{date:e}),content:e.content,onContentChange:e=>q(t,{content:e}),placeholder:`Paste or type note…`,moduleName:`hospital-progress-`+t,onRemove:R.length>1?()=>Y(t):void 0,testId:`hc-progress-`+t,children:(0,d.jsxs)(`select`,{value:e.type,onChange:e=>q(t,{type:e.target.value}),className:y,children:[(0,d.jsx)(`option`,{value:`progress-attending`,children:`Progress — Attending`}),(0,d.jsx)(`option`,{value:`progress-resident`,children:`Progress — Resident`}),(0,d.jsx)(`option`,{value:`progress-np`,children:`Progress — NP/PA`}),(0,d.jsx)(`option`,{value:`consult`,children:`Consult Note`}),(0,d.jsx)(`option`,{value:`procedure`,children:`Procedure Note`}),(0,d.jsx)(`option`,{value:`discharge-summary`,children:`Discharge Summary`})]})},t))]}),(0,d.jsxs)(`div`,{className:`rounded-lg border border-border bg-card p-3 space-y-2`,children:[(0,d.jsx)(`strong`,{className:`text-sm`,children:`🧪 Labs`}),(0,d.jsx)(c,{value:B,onChange:V,placeholder:`e.g. WBC 12.5, H/H 10.2/31, BMP: Na 138, K 3.5`,testIdPrefix:`hc-labs`})]}),(0,d.jsxs)(`label`,{className:`flex flex-col gap-1`,children:[(0,d.jsx)(`span`,{className:`text-xs font-semibold uppercase tracking-wider text-muted-foreground`,children:`Additional instructions (optional)`}),(0,d.jsx)(`textarea`,{className:v+` min-h-[60px] text-sm`,value:H,onChange:e=>U(e.target.value),placeholder:`e.g. 'Focus on respiratory course', 'Patient was transferred from outside hospital'`})]}),K.error&&(0,d.jsx)(`div`,{className:`text-sm text-destructive`,children:K.error.message}),(0,d.jsx)(`button`,{type:`submit`,disabled:K.isPending||R.every(e=>!e.content.trim()),className:`rounded-md bg-primary text-primary-foreground px-4 py-2 text-sm font-medium disabled:opacity-50`,children:K.isPending?`Generating…`:`✨ Generate Hospital Course`})]}),W&&(0,d.jsxs)(d.Fragment,{children:[(0,d.jsx)(o,{text:W.hospitalCourse,onChange:e=>G({hospitalCourse:e,format:W.format}),section:null,title:`Hospital Course (`+W.format+`)`,exportLabel:`hospital-course`,exportType:`hospital-course`,sourceContext:JSON.stringify(R.map(e=>e.content))}),(0,d.jsx)(h,{currentDraft:W.hospitalCourse,notes:R.filter(e=>e.content.trim())})]})]})}export{b as default};