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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
(function(){const e=document.createElement("link").relList;if(e&&e.supports&&e.supports("modulepreload"))return;for(const r of document.querySelectorAll('link[rel="modulepreload"]'))i(r);new MutationObserver(r=>{for(const s of r)if(s.type==="childList")for(const o of s.addedNodes)o.tagName==="LINK"&&o.rel==="modulepreload"&&i(o)}).observe(document,{childList:!0,subtree:!0});function t(r){const s={};return r.integrity&&(s.integrity=r.integrity),r.referrerPolicy&&(s.referrerPolicy=r.referrerPolicy),r.crossOrigin==="use-credentials"?s.credentials="include":r.crossOrigin==="anonymous"?s.credentials="omit":s.credentials="same-origin",s}function i(r){if(r.ep)return;r.ep=!0;const s=t(r);fetch(r.href,s)}})();class N{constructor(){this.mediaRecorder=null,this.audioChunks=[],this.stream=null,this.isRecording=!1}async start(){if(this.isRecording)throw new Error("Already recording");try{this.stream=await navigator.mediaDevices.getUserMedia({audio:!0});const e=this.getRecorderOptions();this.mediaRecorder=new MediaRecorder(this.stream,e),this.audioChunks=[],this.mediaRecorder.ondataavailable=t=>{t.data.size>0&&this.audioChunks.push(t.data)},this.mediaRecorder.start(1e3),this.isRecording=!0,console.log("Audio recording started")}catch(e){throw console.error("Error accessing microphone:",e),new Error(`Failed to access microphone: ${e.message}`)}}async stop(){if(!this.isRecording)throw new Error("Not recording");return new Promise((e,t)=>{this.mediaRecorder.onstop=async()=>{try{await this.stopStream();const i=new Blob(this.audioChunks,{type:this.mediaRecorder.mimeType});this.audioChunks=[],this.isRecording=!1,console.log("Audio recording stopped"),e(i)}catch(i){t(i)}};try{this.mediaRecorder.stop()}catch(i){t(i)}})}async stopStream(){if(this.stream){const e=this.stream.getTracks();for(const t of e)t.stop();this.stream=null}}getRecorderOptions(){return{mimeType:this.getSupportedMimeType(),audioBitsPerSecond:128e3}}getSupportedMimeType(){const e=["audio/webm;codecs=opus","audio/webm","audio/ogg;codecs=opus","audio/ogg","audio/mp4","audio/mpeg"];for(const t of e)if(MediaRecorder.isTypeSupported(t))return t;return""}async checkPermission(){try{return(await navigator.permissions.query({name:"microphone"})).state}catch{try{const t=await navigator.mediaDevices.getUserMedia({audio:!0});return await this.stopStream(),"granted"}catch{return"denied"}}}}class B{constructor(){this.recognition=null,this.isInitialized=!1,this.isTranscribing=!1,this.onTranscriptCallback=null,this.finalTranscript="",this.interimTranscript=""}async initialize(){if(!this.isInitialized){console.log("Initializing STT (Web Speech API)...");try{const e=window.SpeechRecognition||window.webkitSpeechRecognition;if(!e)throw new Error("Speech recognition not supported in this browser. Please use Chrome, Edge, or Safari.");this.recognition=new e,this.recognition.continuous=!0,this.recognition.interimResults=!0,this.recognition.lang="en-US",this.recognition.maxAlternatives=1,this.isInitialized=!0,console.log("STT initialized successfully (Web Speech API)")}catch(e){throw console.error("Failed to initialize STT:",e),e}}}async startLiveTranscription(e){return this.isInitialized||await this.initialize(),this.onTranscriptCallback=e,this.finalTranscript="",this.interimTranscript="",this.isTranscribing=!0,console.log("Starting live transcription..."),new Promise((t,i)=>{this.recognition.onresult=r=>{let s="";for(let n=r.resultIndex;n<r.results.length;n++){const a=r.results[n][0].transcript;r.results[n].isFinal?this.finalTranscript+=a+" ":(s+=a,this.interimTranscript=s)}const o=this.finalTranscript+s;this.onTranscriptCallback&&this.onTranscriptCallback(o)},this.recognition.onerror=r=>{console.error("Speech recognition error:",r.error),r.error==="not-allowed"?i(new Error("Microphone permission denied. Please allow microphone access.")):r.error==="no-speech"?console.log("No speech detected yet..."):i(new Error(`Speech recognition error: ${r.error}`))},this.recognition.onend=()=>{if(this.isTranscribing)try{this.recognition.start()}catch{console.log("Recognition stopped")}},this.recognition.onstart=()=>{console.log("Recognition started"),t()};try{this.recognition.start()}catch(r){i(r)}})}async stopLiveTranscription(){return this.isTranscribing=!1,new Promise(e=>{this.recognition.onend=()=>{console.log("Recognition stopped"),e()};try{this.recognition.stop()}catch{e()}})}async getFinalTranscript(){return this.finalTranscript.trim()}async transcribe(e){return this.finalTranscript.trim()||"No transcript available"}}const $="modulepreload",z=function(l,e){return new URL(l,e).href},P={},L=function(e,t,i){let r=Promise.resolve();if(t&&t.length>0){const o=document.getElementsByTagName("link"),n=document.querySelector("meta[property=csp-nonce]"),a=(n==null?void 0:n.nonce)||(n==null?void 0:n.getAttribute("nonce"));r=Promise.allSettled(t.map(c=>{if(c=z(c,i),c in P)return;P[c]=!0;const d=c.endsWith(".css"),u=d?'[rel="stylesheet"]':"";if(!!i)for(let p=o.length-1;p>=0;p--){const m=o[p];if(m.href===c&&(!d||m.rel==="stylesheet"))return}else if(document.querySelector(`link[href="${c}"]${u}`))return;const h=document.createElement("link");if(h.rel=d?"stylesheet":$,d||(h.as="script"),h.crossOrigin="",h.href=c,a&&h.setAttribute("nonce",a),document.head.appendChild(h),d)return new Promise((p,m)=>{h.addEventListener("load",p),h.addEventListener("error",()=>m(new Error(`Unable to preload CSS for ${c}`)))})}))}function s(o){const n=new Event("vite:preloadError",{cancelable:!0});if(n.payload=o,window.dispatchEvent(n),!n.defaultPrevented)throw o}return r.then(o=>{for(const n of o||[])n.status==="rejected"&&s(n.reason);return e().catch(s)})};class A{constructor(e={}){this.model=null,this.tokenizer=null,this.isInitialized=!1,this.isModelLoading=!1,this.initializationPromise=null,this.modelConfig={modelId:e.modelId||"LiquidAI/LFM2.5-1.2B-Instruct-ONNX",modelFileName:e.modelFileName||"model",subfolder:e.subfolder||"onnx",dtype:e.dtype||"q4",preferredDevice:e.preferredDevice||"webgpu",requiresWebGPU:e.requiresWebGPU||!1,maxTokens:e.maxTokens||2048,temperature:e.temperature??.1,topP:e.topP??.9,repetitionPenalty:e.repetitionPenalty??1.1,...e},this.onProgress=e.onProgress||(()=>{})}async initialize(){if(!this.isInitialized){if(this.initializationPromise)return this.initializationPromise;this.initializationPromise=this.initializeGenerator();try{await this.initializationPromise}finally{this.initializationPromise=null}}}async initializeGenerator(){this.isModelLoading=!0,this.onProgress(10,"Importing transformers library...");try{const{pipeline:e,env:t}=await L(async()=>{const{pipeline:r,env:s}=await import("./transformers.web-BJrd5lgs.js");return{pipeline:r,env:s}},[],import.meta.url);if(t.allowLocalModels=!1,t.backends.onnx.wasm&&(t.backends.onnx.wasm.numThreads=1,t.backends.onnx.wasm.wasmPaths="https://cdn.jsdelivr.net/npm/onnxruntime-web/dist/"),!(typeof navigator<"u"&&!!navigator.gpu))throw new Error("WebGPU is required for the Liquid AI browser model.");this.onProgress(30,"Downloading model..."),this.generator=await e("text-generation",this.modelConfig.modelId,{dtype:this.modelConfig.dtype,device:this.modelConfig.preferredDevice,progress_callback:r=>{if(r.status!=="progress")return;const s=Number.isFinite(r.progress)?r.progress:0,o=r.file??"model";this.onProgress(Math.max(30,Math.min(90,30+Math.floor(s*.6))),`Downloading model: ${o}... ${Math.round(s)}%`)}}),this.onProgress(100,"Model loaded successfully!"),this.isInitialized=!0,console.log(`ONNX LLM Engine initialized with ${this.modelConfig.modelId}`)}catch(e){throw console.error("Model initialization failed:",e),new Error(`Failed to load model: ${e.message}`)}finally{this.isModelLoading=!1}}async generate(e,t={}){this.isInitialized||await this.initialize();const{maxNewTokens:i=t.maxNewTokens||1024,temperature:r=t.temperature||this.modelConfig.temperature,topP:s=t.topP||this.modelConfig.topP,doSample:o=t.doSample??!0,stopTokens:n=t.stopTokens||[],onProgress:a=null,progressMessage:c="Generating response",progressRange:d=[0,100]}=t;try{let u;if(a){const{TextStreamer:p}=await L(async()=>{const{TextStreamer:S}=await import("./transformers.web-BJrd5lgs.js");return{TextStreamer:S}},[],import.meta.url),[m,x]=d;let w=0,T=0;a(m,`${c}...`),u=new p(this.generator.tokenizer,{skip_prompt:!0,skip_special_tokens:!1,token_callback_function:()=>{if(w+=1,w===1||w-T>=12||w===i){T=w;const S=Math.min(w/Math.max(i,1),.98),C=m+Math.floor((x-m)*S);a(C,`${c} (${w} tokens)`)}}})}let h=(await this.generator(e,{max_new_tokens:i,temperature:r,top_p:s,do_sample:o,return_full_text:!1,...u?{streamer:u}:{}}))[0].generated_text;for(const p of n){const m=h.indexOf(p);m!==-1&&(h=h.substring(0,m))}return a&&a(d[1],`${c} complete`),h.trim()}catch(u){throw console.error("Generation failed:",u),new Error(`Text generation failed: ${u.message}`)}}async generateJson(e,t={}){const i=this.buildJsonPrompt(e,t),r=await this.generate(i,{temperature:.3,maxNewTokens:2048});try{const s=r.match(/\{[\s\S]*\}/);if(s)return JSON.parse(s[0]);throw new Error("No valid JSON found in response")}catch(s){return console.error("JSON parsing error:",s),this.parseStructuredText(r)}}buildJsonPrompt(e,t){return`<|im_start|>system
|
| 2 |
+
You are a medical data extraction assistant. Extract structured information from medical consultation transcripts.
|
| 3 |
+
Always respond with valid JSON only. No markdown, no explanations, just the JSON object.
|
| 4 |
+
<|im_end|>
|
| 5 |
+
<|im_start|>user
|
| 6 |
+
${e}
|
| 7 |
+
|
| 8 |
+
Required schema:
|
| 9 |
+
${JSON.stringify(t,null,2)}
|
| 10 |
+
<|im_end|>
|
| 11 |
+
<|im_start|>assistant
|
| 12 |
+
`}parseStructuredText(e){const t={},i=e.split(`
|
| 13 |
+
`);let r=null;for(const s of i){const o=s.trim();if(!o)continue;const n=o.match(/^([A-Za-z_]+)\s*[:\-]\s*(.+)$/);n?(r=n[1],t[r]=n[2]):r&&(t[r]+=" "+o)}return t}isReady(){return this.isInitialized}getModelInfo(){return{modelId:this.modelConfig.modelId,isInitialized:this.isInitialized,isLoading:this.isModelLoading,maxTokens:this.modelConfig.maxTokens}}async dispose(){this.generator&&(await this.generator.dispose(),this.generator=null),this.isInitialized=!1,this.isModelLoading=!1,this.initializationPromise=null,console.log("Model disposed from memory")}}const D={"LiquidAI/LFM2.5-1.2B-Instruct-ONNX":{modelId:"LiquidAI/LFM2.5-1.2B-Instruct-ONNX",subfolder:"onnx",modelFileName:"model",dtype:"q4",preferredDevice:"webgpu",requiresWebGPU:!1},"Xenova/Qwen2.5-1.5B-Instruct":{modelId:"onnx-community/Qwen2.5-1.5B-Instruct",subfolder:"onnx",modelFileName:"model",dtype:"q4",preferredDevice:"webgpu"},"Xenova/Phi-3-mini-4k-instruct":{modelId:"Xenova/Phi-3-mini-4k-instruct",subfolder:"onnx",modelFileName:"model",dtype:"q4",preferredDevice:"webgpu"},"Xenova/TinyLlama-1.1B-chat":{modelId:"Xenova/TinyLlama-1.1B-Chat-v1.0",subfolder:"onnx",modelFileName:"model",dtype:"q4",preferredDevice:"webgpu"}};function q(l){return l==="keyword"?null:D[l]||{modelId:l,subfolder:"onnx",modelFileName:"model",dtype:"q4",preferredDevice:"webgpu"}}class F{constructor(){this.isInitialized=!1,this.llm=null,this.useLLM=!0,this.currentModel="LiquidAI/LFM2.5-1.2B-Instruct-ONNX",this.maxDirectTranscriptChars=6e3,this.maxChunkChars=3200}async initialize(e,t=null){if(t&&t!==this.currentModel&&(this.currentModel=t,this.isInitialized=!1),this.isInitialized)return;console.log("Initializing Medical Extractor..."),this.useLLM=!0;const i=q(this.currentModel),r=typeof navigator<"u"&&!!navigator.gpu;if(i!=null&&i.requiresWebGPU&&!r)throw new Error(`${this.currentModel} requires WebGPU. No non-LLM fallback is enabled.`);try{this.llm=new A({...i,maxTokens:2048,temperature:.1,onProgress:(s,o)=>{e&&e(s,o)}}),await this.llm.initialize(),console.log(`LLM Engine ready with model: ${(i==null?void 0:i.modelId)||this.currentModel}`)}catch(s){throw this.llm=null,this.isInitialized=!1,new Error(`LLM initialization failed for ${this.currentModel}: ${s.message}`)}this.isInitialized=!0,console.log("Medical Extractor initialized successfully")}async dispose(){this.llm&&(await this.llm.dispose(),this.llm=null),this.isInitialized=!1,console.log("Medical Extractor disposed")}async extract(e,t=null){this.isInitialized||await this.initialize(),console.log("Extracting medical data...");try{if(!this.llm||!this.llm.isReady())throw new Error("LLM is not ready. Report generation is LLM-only.");console.log("Using LLM for extraction..."),this.reportProgress(t,5,"Preparing clinical extraction...");const i=await this.extractUsingLLM(e,t);return this.reportProgress(t,100,"Structured report ready"),console.log("Medical data extracted successfully"),i}catch(i){throw console.error("Extraction error:",i),new Error(`Medical data extraction failed: ${i.message}`)}}async extractUsingLLM(e,t=null){if(this.shouldBatchTranscript(e))return this.reportProgress(t,10,"Long transcript detected. Processing in batches..."),this.extractUsingBatchedLLM(e,t);const i=this.buildMedicalPrompt(e);this.reportProgress(t,15,"Generating structured extraction...");const r=await this.generateStructuredMedicalData(i,e,{onProgress:t,progressRange:[15,72],progressMessage:"Generating structured extraction"});return this.reportProgress(t,76,"Validating narrative sections..."),this.ensureClinicalNarratives(e,r,t,[76,98])}async extractUsingBatchedLLM(e,t=null){console.log("Transcript exceeds direct context budget. Processing in batches...");const i=this.chunkTranscript(e),r=[];for(const[n,a]of i.entries())try{const c=15+Math.floor(n/i.length*50),d=15+Math.floor((n+1)/i.length*50),u=this.buildMedicalPrompt(a,`This is segment ${n+1} of ${i.length} from a longer consultation. Extract only the facts explicitly present in this segment.`);this.reportProgress(t,c,`Analyzing transcript batch ${n+1} of ${i.length}...`);const g=await this.generateStructuredMedicalData(u,a,{maxNewTokens:1400,onProgress:t,progressRange:[c,Math.max(c+1,d-2)],progressMessage:`Generating batch ${n+1} of ${i.length}`});r.push(g)}catch(c){throw new Error(`Chunk ${n+1}/${i.length} extraction failed: ${c.message}`)}this.reportProgress(t,68,"Merging extracted batches...");const s=this.mergePartialResults(r),o=await this.consolidateNarratives(r,s,e,t,[72,88]);return this.reportProgress(t,90,"Finalizing combined clinical note..."),this.ensureClinicalNarratives(e,{incident_record:o.incident_record||s.incident_record||"",prescription:s.prescription||[],lab_recommendations:s.lab_recommendations||[],radiology_recommendations:s.radiology_recommendations||[],treatment_plan:o.treatment_plan||s.treatment_plan||"",diet_advice:s.diet_advice||[],summary:o.summary||s.summary||""},t,[90,98])}buildMedicalPrompt(e,t=""){return`<|im_start|>system
|
| 14 |
+
You are an expert medical consultation assistant. Extract structured medical information from the consultation transcript.
|
| 15 |
+
|
| 16 |
+
IMPORTANT RULES:
|
| 17 |
+
1. Respond with valid JSON only - no markdown, no explanations, no code fences
|
| 18 |
+
2. Extract only information explicitly mentioned in the transcript
|
| 19 |
+
3. Use professional medical terminology
|
| 20 |
+
4. For medication names, use generic names unless brand name is specifically mentioned
|
| 21 |
+
5. If a field is not mentioned, use empty string [] or "" as appropriate
|
| 22 |
+
6. incident_record, treatment_plan, and summary should be detailed paragraphs
|
| 23 |
+
7. prescription should be an array of objects with exact structure: [{"drug": "", "dose": "", "frequency": "", "duration": ""}]
|
| 24 |
+
8. Never copy speaker labels, direct dialogue, or first-person / second-person wording into narrative fields
|
| 25 |
+
|
| 26 |
+
JSON STRUCTURE REQUIRED:
|
| 27 |
+
{
|
| 28 |
+
"incident_record": "Detailed paragraph including: chief complaint, history of present illness, symptoms, duration, onset",
|
| 29 |
+
"prescription": [
|
| 30 |
+
{"drug": "medication name", "dose": "e.g., 500mg", "frequency": "e.g., twice daily", "duration": "e.g., 5 days"}
|
| 31 |
+
],
|
| 32 |
+
"lab_recommendations": ["Complete Blood Count", "Fasting Blood Sugar", ...],
|
| 33 |
+
"radiology_recommendations": ["Chest X-ray", "CT Scan", ...],
|
| 34 |
+
"treatment_plan": "Detailed paragraph explaining the treatment approach, primary interventions, and management strategy",
|
| 35 |
+
"diet_advice": ["Specific dietary recommendation 1", "Specific dietary recommendation 2", ...],
|
| 36 |
+
"summary": "Comprehensive summary covering: patient presentation, key findings, assessment, and plan"
|
| 37 |
+
}
|
| 38 |
+
|
| 39 |
+
EXAMPLES:
|
| 40 |
+
- For doses: use formats like "500mg", "10mg", "5ml"
|
| 41 |
+
- For frequency: use "once daily", "twice daily", "three times daily", "every 8 hours", "as needed"
|
| 42 |
+
- For duration: use "5 days", "1 week", "2 weeks", "until completion"
|
| 43 |
+
- For labs: use specific test names like "Complete Blood Count (CBC)", "Fasting Blood Sugar", "Lipid Profile"
|
| 44 |
+
- For radiology: use specific studies like "Chest X-ray", "CT Scan abdomen", "MRI brain"
|
| 45 |
+
${t?`
|
| 46 |
+
ADDITIONAL INSTRUCTION:
|
| 47 |
+
${t}`:""}
|
| 48 |
+
<|im_end|>
|
| 49 |
+
<|im_start|>user
|
| 50 |
+
Please analyze this medical consultation transcript and extract structured medical data:
|
| 51 |
+
|
| 52 |
+
TRANSCRIPT:
|
| 53 |
+
${e}
|
| 54 |
+
|
| 55 |
+
Provide the extracted information as JSON following the structure above.
|
| 56 |
+
<|im_end|>
|
| 57 |
+
<|im_start|>assistant
|
| 58 |
+
`}buildConsolidationPrompt(e){return`<|im_start|>system
|
| 59 |
+
You are an expert medical documentation assistant. You will be given structured outputs extracted from multiple transcript segments of the same consultation.
|
| 60 |
+
|
| 61 |
+
IMPORTANT RULES:
|
| 62 |
+
1. Respond with valid JSON only
|
| 63 |
+
2. Merge overlapping details into one coherent clinical note
|
| 64 |
+
3. Do not invent facts that are not present in the partial extractions
|
| 65 |
+
4. Write incident_record, treatment_plan, and summary as polished clinical prose
|
| 66 |
+
5. Do not include raw dialogue, speaker labels, or question-and-answer phrasing
|
| 67 |
+
|
| 68 |
+
JSON STRUCTURE REQUIRED:
|
| 69 |
+
{
|
| 70 |
+
"incident_record": "",
|
| 71 |
+
"treatment_plan": "",
|
| 72 |
+
"summary": ""
|
| 73 |
+
}
|
| 74 |
+
<|im_end|>
|
| 75 |
+
<|im_start|>user
|
| 76 |
+
Combine the following partial consultation extractions into one coherent final narrative:
|
| 77 |
+
|
| 78 |
+
${JSON.stringify(e,null,2)}
|
| 79 |
+
<|im_end|>
|
| 80 |
+
<|im_start|>assistant
|
| 81 |
+
`}buildRepairPrompt(e){return`<|im_start|>system
|
| 82 |
+
You are a medical data extraction assistant. Convert the provided model output into valid JSON only.
|
| 83 |
+
|
| 84 |
+
IMPORTANT RULES:
|
| 85 |
+
1. Respond with valid JSON only
|
| 86 |
+
2. If a field is missing, leave it as an empty string or empty array
|
| 87 |
+
3. Do not add information that is not present in the supplied output
|
| 88 |
+
|
| 89 |
+
JSON STRUCTURE REQUIRED:
|
| 90 |
+
{
|
| 91 |
+
"incident_record": "",
|
| 92 |
+
"prescription": [
|
| 93 |
+
{"drug": "", "dose": "", "frequency": "", "duration": ""}
|
| 94 |
+
],
|
| 95 |
+
"lab_recommendations": [],
|
| 96 |
+
"radiology_recommendations": [],
|
| 97 |
+
"treatment_plan": "",
|
| 98 |
+
"diet_advice": [],
|
| 99 |
+
"summary": ""
|
| 100 |
+
}
|
| 101 |
+
<|im_end|>
|
| 102 |
+
<|im_start|>user
|
| 103 |
+
Repair this model output into valid JSON:
|
| 104 |
+
|
| 105 |
+
${e}
|
| 106 |
+
<|im_end|>
|
| 107 |
+
<|im_start|>assistant
|
| 108 |
+
`}buildClinicalRewritePrompt(e,t){return`<|im_start|>system
|
| 109 |
+
You are an expert clinical documentation assistant. Rewrite the extracted consultation data into polished clinical documentation.
|
| 110 |
+
|
| 111 |
+
IMPORTANT RULES:
|
| 112 |
+
1. Respond with valid JSON only
|
| 113 |
+
2. incident_record, treatment_plan, and summary must be formal clinical prose
|
| 114 |
+
3. Do not include raw dialogue, speaker labels, questions, or transcript snippets
|
| 115 |
+
4. Convert clinician advice and warning signs into appropriate clinical plan wording
|
| 116 |
+
5. Preserve prescription, lab_recommendations, radiology_recommendations, and diet_advice unless they conflict with the transcript
|
| 117 |
+
6. Use only facts explicitly supported by the transcript
|
| 118 |
+
|
| 119 |
+
JSON STRUCTURE REQUIRED:
|
| 120 |
+
{
|
| 121 |
+
"incident_record": "",
|
| 122 |
+
"prescription": [
|
| 123 |
+
{"drug": "", "dose": "", "frequency": "", "duration": ""}
|
| 124 |
+
],
|
| 125 |
+
"lab_recommendations": [],
|
| 126 |
+
"radiology_recommendations": [],
|
| 127 |
+
"treatment_plan": "",
|
| 128 |
+
"diet_advice": [],
|
| 129 |
+
"summary": ""
|
| 130 |
+
}
|
| 131 |
+
<|im_end|>
|
| 132 |
+
<|im_start|>user
|
| 133 |
+
Transcript:
|
| 134 |
+
${e}
|
| 135 |
+
|
| 136 |
+
Current extraction:
|
| 137 |
+
${JSON.stringify(t,null,2)}
|
| 138 |
+
|
| 139 |
+
Rewrite the narrative fields so they read like a clinical note and summary, not a transcript.
|
| 140 |
+
<|im_end|>
|
| 141 |
+
<|im_start|>assistant
|
| 142 |
+
`}parseLLMResponse(e){try{const i=e.replace(/```json\n?/g,"").replace(/```\n?/g,"").trim().match(/\{[\s\S]*\}/);if(i){const r=JSON.parse(i[0]);return this.validateAndNormalize(r)}return console.warn("No JSON found in LLM response"),{}}catch(t){return console.error("Failed to parse LLM JSON response:",t),console.log("Response was:",e),{}}}async generateStructuredMedicalData(e,t,i={}){const r=await this.llm.generate(e,{maxNewTokens:i.maxNewTokens||2048,temperature:.1,onProgress:i.onProgress,progressRange:i.progressRange,progressMessage:i.progressMessage||"Generating structured extraction"});let s=this.parseLLMResponse(r);if(this.isEmptyExtraction(s)){const o=this.createSubRange(i.progressRange,.82,.98);this.reportProgress(i.onProgress,o[0],"Repairing model output..."),s=await this.repairStructuredMedicalData(r,i.onProgress,o)}if(this.isEmptyExtraction(s))throw new Error("LLM returned an empty structured extraction");return this.validateAndNormalize(s)}validateAndNormalize(e){return{incident_record:this.ensureString(e.incident_record),prescription:this.ensureArray(e.prescription).map(i=>({drug:this.ensureString(i==null?void 0:i.drug),dose:this.ensureString(i==null?void 0:i.dose),frequency:this.ensureString(i==null?void 0:i.frequency),duration:this.ensureString(i==null?void 0:i.duration)})).filter(i=>i.drug),lab_recommendations:this.ensureArray(e.lab_recommendations).filter(Boolean),radiology_recommendations:this.ensureArray(e.radiology_recommendations).filter(Boolean),treatment_plan:this.ensureString(e.treatment_plan),diet_advice:this.ensureArray(e.diet_advice).filter(Boolean),summary:this.ensureString(e.summary)}}ensureString(e){return typeof e=="string"?e.trim():e==null?"":String(e).trim()}ensureArray(e){return Array.isArray(e)?e:e==null?[]:[e]}isEmptyExtraction(e){return e?!e.incident_record&&(!e.prescription||e.prescription.length===0)&&(!e.lab_recommendations||e.lab_recommendations.length===0)&&(!e.radiology_recommendations||e.radiology_recommendations.length===0)&&!e.treatment_plan&&(!e.diet_advice||e.diet_advice.length===0)&&!e.summary:!0}async repairStructuredMedicalData(e,t=null,i=[0,100]){try{const r=await this.llm.generate(this.buildRepairPrompt(e),{maxNewTokens:1200,temperature:.1,onProgress:t,progressRange:i,progressMessage:"Repairing structured output"});return this.parseLLMResponse(r)}catch(r){return console.warn("Failed to repair malformed LLM response:",r),{}}}async ensureClinicalNarratives(e,t,i=null,r=[0,100]){var c,d,u,g;const s=this.validateAndNormalize(t);if(!this.hasTranscriptLikeNarratives(s))return this.reportProgress(i,r[1],"Clinical note validated"),s;this.reportProgress(i,r[0],"Rewriting transcript-style output into clinical prose...");const o=await this.llm.generate(this.buildClinicalRewritePrompt(e,s),{maxNewTokens:1600,temperature:.1,onProgress:i,progressRange:r,progressMessage:"Rewriting clinical narrative"});let n=this.parseLLMResponse(o);if(this.isEmptyExtraction(n)){const h=this.createSubRange(r,.8,.98);n=await this.repairStructuredMedicalData(o,i,h)}const a=this.validateAndNormalize({incident_record:n.incident_record||s.incident_record,prescription:(c=n.prescription)!=null&&c.length?n.prescription:s.prescription,lab_recommendations:(d=n.lab_recommendations)!=null&&d.length?n.lab_recommendations:s.lab_recommendations,radiology_recommendations:(u=n.radiology_recommendations)!=null&&u.length?n.radiology_recommendations:s.radiology_recommendations,treatment_plan:n.treatment_plan||s.treatment_plan,diet_advice:(g=n.diet_advice)!=null&&g.length?n.diet_advice:s.diet_advice,summary:n.summary||s.summary});if(this.hasTranscriptLikeNarratives(a))throw new Error("LLM returned transcript-style dialogue instead of clinical prose");return this.reportProgress(i,r[1],"Clinical note finalized"),a}reportProgress(e,t,i){typeof e=="function"&&e(Math.max(0,Math.min(100,t)),i)}createSubRange(e=[0,100],t=0,i=1){const[r,s]=e,o=Math.max(0,s-r);return[r+Math.floor(o*t),r+Math.floor(o*i)]}hasTranscriptLikeNarratives(e){return[e.incident_record,e.treatment_plan,e.summary].some(t=>this.isTranscriptLikeNarrative(t))}isTranscriptLikeNarrative(e){const t=this.ensureString(e);if(!t)return!1;const i=/\b(?:doctor|patient|nurse|clinician|caregiver)\s*:/i.test(t),r=t.includes("?"),s=/\b(?:i|my|me|mine|you|your|yours)\b/i.test(t),o=t.split(`
|
| 143 |
+
`).map(n=>n.trim()).filter(Boolean).some(n=>/^[A-Za-z][A-Za-z ]{1,20}:\s/.test(n));return i||r||s||o}shouldBatchTranscript(e){return e.length>this.maxDirectTranscriptChars}chunkTranscript(e){const t=e.split(/\n\s*\n/).map(s=>s.trim()).filter(Boolean),i=[];let r="";for(const s of t){if(s.length>this.maxChunkChars){const n=this.splitLargeBlock(s);for(const a of n)r&&(i.push(r.trim()),r=""),i.push(a.trim());continue}const o=r?`${r}
|
| 144 |
+
|
| 145 |
+
${s}`:s;o.length>this.maxChunkChars?(i.push(r.trim()),r=s):r=o}return r.trim()&&i.push(r.trim()),i.length>0?i:this.splitLargeBlock(e)}splitLargeBlock(e){const t=e.match(/[^.!?]+[.!?]*/g)||[e],i=[];let r="";for(const s of t){const o=s.trim();if(!o)continue;if(o.length>this.maxChunkChars){r.trim()&&(i.push(r.trim()),r="");for(let a=0;a<o.length;a+=this.maxChunkChars)i.push(o.slice(a,a+this.maxChunkChars).trim());continue}const n=r?`${r} ${o}`:o;n.length>this.maxChunkChars?(i.push(r.trim()),r=o):r=n}return r.trim()&&i.push(r.trim()),i.filter(Boolean)}mergePartialResults(e){const t={incident_record:"",prescription:[],lab_recommendations:[],radiology_recommendations:[],treatment_plan:"",diet_advice:[],summary:""},i=[],r=[],s=[],o=new Set;return e.forEach(n=>{n.incident_record&&i.push(n.incident_record),n.treatment_plan&&r.push(n.treatment_plan),n.summary&&s.push(n.summary),(n.prescription||[]).forEach(a=>{const c=[this.ensureString(a.drug).toLowerCase(),this.ensureString(a.dose).toLowerCase(),this.ensureString(a.frequency).toLowerCase(),this.ensureString(a.duration).toLowerCase()].join("|");!o.has(c)&&a.drug&&(o.add(c),t.prescription.push({drug:this.ensureString(a.drug),dose:this.ensureString(a.dose),frequency:this.ensureString(a.frequency),duration:this.ensureString(a.duration)}))}),t.lab_recommendations=this.mergeUniqueStrings(t.lab_recommendations,n.lab_recommendations||[]),t.radiology_recommendations=this.mergeUniqueStrings(t.radiology_recommendations,n.radiology_recommendations||[]),t.diet_advice=this.mergeUniqueStrings(t.diet_advice,n.diet_advice||[])}),t.incident_record=this.combineNarrativeSections(i),t.treatment_plan=this.combineNarrativeSections(r),t.summary=this.combineNarrativeSections(s),t}async consolidateNarratives(e,t,i,r=null,s=[0,100]){if(!this.llm||e.length<=1)return this.reportProgress(r,s[1],"Batch merge complete"),{incident_record:t.incident_record,treatment_plan:t.treatment_plan,summary:t.summary};try{this.reportProgress(r,s[0],"Consolidating batched extraction...");const o=await this.llm.generate(this.buildConsolidationPrompt(e),{maxNewTokens:1400,temperature:.1,onProgress:r,progressRange:s,progressMessage:"Consolidating batch results"}),n=this.parseLLMResponse(o);return this.reportProgress(r,s[1],"Batch consolidation complete"),{incident_record:n.incident_record||t.incident_record||"",treatment_plan:n.treatment_plan||t.treatment_plan||"",summary:n.summary||t.summary||""}}catch(o){return console.warn("Narrative consolidation failed, using merged partial narratives:",o),{incident_record:t.incident_record||"",treatment_plan:t.treatment_plan||"",summary:t.summary||""}}}mergeUniqueStrings(e,t){const i=new Map(e.map(r=>[r.toLowerCase(),r]));return t.forEach(r=>{const s=this.ensureString(r);if(!s)return;const o=s.toLowerCase();i.has(o)||i.set(o,s)}),[...i.values()]}combineNarrativeSections(e){return this.mergeUniqueStrings([],e).join(`
|
| 146 |
+
|
| 147 |
+
`)}extractExplicitFallback(e){const t=e.toLowerCase();return{incident_record:this.extractExplicitNarrative(e,["complain","complains","presents","history","reports","pain","fever","cough"])||e.trim(),prescription:this.extractPrescriptionFromTranscript(e),lab_recommendations:this.extractLabs(t),radiology_recommendations:this.extractRadiology(t),treatment_plan:this.extractExplicitNarrative(e,["prescribed","advised","recommended","started on","take","plan","follow"]),diet_advice:this.extractDietAdviceFromTranscript(e),summary:this.extractExplicitNarrative(e,["assessment","diagnosis","impression","plan","recommended"])||e.trim()}}extractExplicitNarrative(e,t){const r=e.split(new RegExp("(?<=[.!?])\\s+")).map(s=>s.trim()).filter(Boolean).filter(s=>{const o=s.toLowerCase();return t.some(n=>o.includes(n))});return this.mergeUniqueStrings([],r).join(" ")}extractPrescriptionFromTranscript(e){const t=["paracetamol","ibuprofen","amoxicillin","azithromycin","metformin","lisinopril","atorvastatin","omeprazole","acetaminophen"],i=["once daily","twice daily","three times daily","four times daily","daily","bid","tid","qid","prn","every 8 hours","every 12 hours"],r=/\b\d+\s*(?:day|days|week|weeks|month|months)\b/i,s=/\b\d+(?:\.\d+)?\s?(?:mg|mcg|g|ml)\b/i,o=e.split(new RegExp("(?<=[.!?])\\s+|\\n+")).map(c=>c.trim()).filter(Boolean),n=[],a=new Set;return o.forEach(c=>{var x,w;const d=c.toLowerCase(),u=t.find(T=>d.includes(T));if(!u)return;const g=((x=c.match(s))==null?void 0:x[0])||"",h=i.find(T=>d.includes(T))||"",p=((w=c.match(r))==null?void 0:w[0])||"",m=[u,g.toLowerCase(),h.toLowerCase(),p.toLowerCase()].join("|");a.has(m)||(a.add(m),n.push({drug:this.capitalize(u),dose:g,frequency:h,duration:p}))}),n}extractDietAdviceFromTranscript(e){return this.extractAdviceSentences(e,["diet","avoid","fluid","water","hydrate","meal","eat","rest","sleep","exercise"])}extractAdviceSentences(e,t){const i=e.split(new RegExp("(?<=[.!?])\\s+|\\n+")).map(r=>r.trim()).filter(Boolean);return this.mergeUniqueStrings([],i.filter(r=>{const s=r.toLowerCase();return t.some(o=>s.includes(o))}))}generateIncidentMarkdown(e,t){const i=[],r=this.extractChiefComplaint(e);r&&(i.push("**Chief Complaint:**"),i.push(r),i.push(""));const s=this.extractHistory(e);s&&(i.push("**History of Present Illness:**"),i.push(s),i.push(""));const o=this.extractSymptoms(e);o.length>0&&(i.push("**Symptoms:**"),o.forEach(a=>i.push(`- ${a}`)),i.push(""));const n=this.extractDuration(e);return n&&(i.push(`**Duration:** ${n}`),i.push("")),i.length===0?e:i.join(`
|
| 148 |
+
`)}generateTreatmentMarkdown(e,t){const i=[],r=this.extractPrimaryTreatment(e);r&&(i.push("**Primary Treatment:**"),i.push(r),i.push("")),t.prescription&&t.prescription.length>0&&(i.push("**Medications Prescribed:**"),t.prescription.forEach(n=>{i.push(`- **${n.drug}** (${n.dose})`),i.push(` - Frequency: ${n.frequency}`),i.push(` - Duration: ${n.duration}`)}),i.push(""));const s=this.extractFollowUp(e);s&&(i.push("**Follow-up:**"),i.push(s),i.push(""));const o=this.extractLifestyle(e);return o.length>0&&(i.push("**Lifestyle Recommendations:**"),o.forEach(n=>i.push(`- ${n}`))),i.join(`
|
| 149 |
+
`)}generateSummaryMarkdown(e,t){const i=[];i.push("**Consultation Summary**"),i.push("");const r=this.extractPresentation(e);i.push(`**Presentation:** ${r}`),i.push("");const s=this.extractFindings(e);s.length>0&&(i.push("**Key Findings:**"),s.forEach(a=>i.push(`- ${a}`)),i.push(""));const o=this.extractAssessment(e);i.push(`**Assessment:** ${o}`),i.push("");const n=this.extractPlan(e);return i.push(`**Plan:** ${n}`),i.join(`
|
| 150 |
+
`)}extractUsingKeywords(e){const t=e.toLowerCase();return{incident_record:e,prescription:this.extractPrescription(t),lab_recommendations:this.extractLabs(t),radiology_recommendations:this.extractRadiology(t),treatment_plan:e,diet_advice:this.extractDietAdvice(t),summary:e}}extractChiefComplaint(e){const t=[/complain[s]?\s+(?:of\s+)?(.+?)(?:\n|\.|,)/i,/patient\s+presents?\s+with\s+(.+?)(?:\n|\.|,)/i,/came\s+for\s+(.+?)(?:\n|\.|,)/i];for(const i of t){const r=e.match(i);if(r)return this.capitalize(r[1].trim())}return null}extractHistory(e){const t=["history of","has been experiencing","reports","states","mentioned"],r=e.split(/[.!?]+/).filter(s=>t.some(o=>s.toLowerCase().includes(o)));return r.length>0?r.join(". ").trim():null}extractSymptoms(e){const t=["pain","fever","cough","headache","nausea","vomiting","fatigue","weakness","dizziness","shortness of breath","chest pain","abdominal pain","rash","swelling","constipation","diarrhea","sore throat","congestion"],i=[];return t.forEach(r=>{if(e.toLowerCase().includes(r)){const s=this.getSymptomContext(e,r);i.push(s)}}),[...new Set(i)]}getSymptomContext(e,t){const i=e.split(/[.!?]+/);for(const r of i)if(r.toLowerCase().includes(t))return r.trim();return this.capitalize(t)}extractDuration(e){const t=[/(\d+\s+(?:days?|weeks?|months?|years?))/i,/since\s+(.+?)(?:\n|\.|,)/i,/for\s+(?:the\s+past\s+)?(\d+\s+(?:days?|weeks?|months?))/i];for(const i of t){const r=e.match(i);if(r)return r[1]||r[0]}return null}extractPrescription(e){const t=[];return[{name:"paracetamol",dose:["500mg","650mg","1g"],freq:["TID","QID","PRN"]},{name:"ibuprofen",dose:["400mg","600mg","800mg"],freq:["TID","PRN"]},{name:"amoxicillin",dose:["250mg","500mg"],freq:["TID","Q8H"]},{name:"azithromycin",dose:["250mg","500mg"],freq:["Daily","QD"]},{name:"metformin",dose:["500mg","850mg","1000mg"],freq:["BID","TID"]},{name:"lisinopril",dose:["5mg","10mg","20mg"],freq:["Daily","QD"]},{name:"atorvastatin",dose:["10mg","20mg","40mg"],freq:["Daily","QHS"]},{name:"omeprazole",dose:["20mg","40mg"],freq:["Daily","BID","PRN"]}].forEach(s=>{e.includes(s.name)&&t.push({drug:this.capitalize(s.name),dose:s.dose[0]||"As prescribed",frequency:s.freq[0]||"As directed",duration:this.extractDuration(e)||"As prescribed"})}),["antibiotic","painkiller","analgesic"].forEach(s=>{e.includes(s)&&t.push({drug:this.capitalize(s),dose:"As prescribed",frequency:"As directed",duration:"As prescribed"})}),t}extractLabs(e){const t=[];return[{name:"Complete Blood Count (CBC)",keywords:["cbc","complete blood count","blood count","hemoglobin"]},{name:"Fasting Blood Sugar",keywords:["fasting blood sugar","fbs","fasting glucose","hba1c"]},{name:"Lipid Profile",keywords:["lipid profile","cholesterol","triglycerides","ldl","hdl"]},{name:"Thyroid Function Test",keywords:["thyroid","tsh","t3","t4"]},{name:"Liver Function Test",keywords:["liver function","lft","sgot","sgpt","alt","ast"]},{name:"Kidney Function Test",keywords:["kidney function","kft","creatinine","urea","bun"]},{name:"Urinalysis",keywords:["urine","urinalysis","routine urine"]},{name:"Chest X-ray",keywords:["chest xray","chest x-ray","cxr"]}].forEach(r=>{r.keywords.some(s=>e.includes(s))&&t.push(r.name)}),t.length>0?[...new Set(t)]:[]}extractRadiology(e){const t=[];return[{name:"Chest X-ray",keywords:["chest xray","chest x-ray","cxr","chest film"]},{name:"CT Scan",keywords:["ct scan","computed tomography"]},{name:"MRI",keywords:["mri","magnetic resonance"]},{name:"Ultrasound",keywords:["ultrasound","sonography","usg"]},{name:"ECG/EKG",keywords:["ecg","ekg","electrocardiogram"]},{name:"Echocardiogram",keywords:["echo","echocardiogram","2d echo"]},{name:"X-ray",keywords:["x-ray","xray"]}].forEach(r=>{r.keywords.some(s=>e.includes(s))&&t.push(r.name)}),[...new Set(t)]}extractDietAdvice(e){const t=[];return(e.includes("diabetes")||e.includes("sugar")||e.includes("diabetic"))&&(t.push("Avoid sugary foods and drinks"),t.push("Monitor carbohydrate intake"),t.push("Eat regular, balanced meals")),(e.includes("blood pressure")||e.includes("hypertension")||e.includes("bp"))&&(t.push("Reduce salt intake"),t.push("Avoid processed and canned foods"),t.push("Increase potassium-rich foods")),(e.includes("weight")||e.includes("obese")||e.includes("overweight"))&&(t.push("Follow a calorie-controlled diet"),t.push("Increase physical activity"),t.push("Limit high-fat foods")),(e.includes("constipation")||e.includes("digestive"))&&(t.push("Increase fiber intake"),t.push("Drink plenty of water"),t.push("Include fruits and vegetables")),(e.includes("acidity")||e.includes("gerd")||e.includes("reflux"))&&(t.push("Avoid spicy and oily foods"),t.push("Eat smaller, frequent meals"),t.push("Don't lie down immediately after eating")),t.length>0?[...new Set(t)]:[]}extractPrimaryTreatment(e){const t=["prescribed","advised","recommended","started on","give","take","administer","treatment"],i=e.split(/[.!?]+/);for(const r of i)if(t.some(s=>r.toLowerCase().includes(s)))return r.trim();return""}extractFollowUp(e){const t=[/follow[- ]?up\s+(?:after\s+)?(\d+\s+(?:days?|weeks?))/i,/review\s+(?:after\s+)?(\d+\s+(?:days?|weeks?))/i,/come\s+back\s+(?:if|when)/i];for(const i of t){const r=e.match(i);if(r)return r[0]}return""}extractLifestyle(e){return this.extractAdviceSentences(e,["rest","exercise","activity","stress","sleep"])}extractPresentation(e){const t=e.split(/[.!?]+/)[0];return t?t.trim():"Patient presented for consultation"}extractFindings(e){const t=[];return e.split(/[.!?]+/).forEach(r=>{const s=r.toLowerCase();(s.includes("examination")||s.includes("revealed")||s.includes("showed")||s.includes("normal"))&&t.push(r.trim())}),t.slice(0,5)}extractAssessment(e){const t=["diagnosis","assessment","impression","conclusion"],i=e.split(/[.!?]+/);for(const r of i)if(t.some(s=>r.toLowerCase().includes(s)))return r.trim();return""}extractPlan(e){return this.extractPrimaryTreatment(e)}capitalize(e){return e.charAt(0).toUpperCase()+e.slice(1)}}function R(l){return String(l??"").replace(/\r\n?/g,`
|
| 151 |
+
`)}function y(l){return R(l).replace(/&/g,"&").replace(/</g,"<").replace(/>/g,">").replace(/"/g,""").replace(/'/g,"'")}function v(l){let e=y(l);return e=e.replace(/`([^`]+)`/g,"<code>$1</code>"),e=e.replace(/\*\*([^*]+)\*\*/g,"<strong>$1</strong>"),e=e.replace(/__([^_]+)__/g,"<strong>$1</strong>"),e=e.replace(/(^|[^\*])\*([^*\n]+)\*(?!\*)/g,"$1<em>$2</em>"),e=e.replace(/(^|[^_])_([^_\n]+)_(?!_)/g,"$1<em>$2</em>"),e}function _(l,{emptyHtml:e=""}={}){const t=R(l).trim();if(!t)return e;const i=t.split(`
|
| 152 |
+
`),r=[];let s=[],o=null;const n=()=>{if(s.length===0)return;const d=s.map(u=>v(u.trim())).join("<br>");r.push(`<p>${d}</p>`),s=[]},a=()=>{if(!o)return;const d=o.items.map(u=>`<li>${u.join("<br>")}</li>`).join("");r.push(`<${o.type}>${d}</${o.type}>`),o=null},c=d=>{(!o||o.type!==d)&&(a(),o={type:d,items:[]})};return i.forEach(d=>{const u=d.trimEnd(),g=u.trim();if(!g){n(),a();return}const h=g.match(/^(#{1,4})\s+(.*)$/);if(h){n(),a();const x=Math.min(h[1].length+2,6);r.push(`<h${x}>${v(h[2].trim())}</h${x}>`);return}const p=u.match(/^\s*[-*+]\s+(.*)$/);if(p){n(),c("ul"),o.items.push([v(p[1].trim())]);return}const m=u.match(/^\s*\d+\.\s+(.*)$/);if(m){n(),c("ol"),o.items.push([v(m[1].trim())]);return}if(o&&/^\s{2,}\S/.test(u)&&o.items.length>0){o.items[o.items.length-1].push(v(g));return}a(),s.push(g)}),n(),a(),r.join("")}class O{constructor(){this.statusIndicator=document.getElementById("statusIndicator"),this.statusText=document.getElementById("statusText"),this.activityProgress=document.getElementById("activityProgress"),this.activityProgressText=document.getElementById("activityProgressText"),this.activityProgressFill=document.getElementById("activityProgressFill"),this.startBtn=document.getElementById("startBtn"),this.stopBtn=document.getElementById("stopBtn"),this.printBtn=document.getElementById("printBtn"),this.audioPlayer=document.getElementById("audioPlayer"),this.widgets={transcript:document.getElementById("transcriptWidget"),incident:document.getElementById("incidentWidget"),prescription:document.getElementById("prescriptionWidget"),lab:document.getElementById("labWidget"),radiology:document.getElementById("radiologyWidget"),treatment:document.getElementById("treatmentWidget"),diet:document.getElementById("dietWidget"),summary:document.getElementById("summaryWidget")}}setStatus(e,t){this.statusIndicator.className=`status-indicator ${e}`,this.statusText.textContent=t}setActivityProgress(e,t){this.activityProgress&&this.activityProgress.classList.remove("hidden"),this.activityProgressFill&&(this.activityProgressFill.style.width=`${Math.max(0,Math.min(100,e))}%`),this.activityProgressText&&(this.activityProgressText.textContent=t)}clearActivityProgress(){this.activityProgress&&this.activityProgress.classList.add("hidden"),this.activityProgressFill&&(this.activityProgressFill.style.width="0%"),this.activityProgressText&&(this.activityProgressText.textContent="")}enableControls(e){this.startBtn.disabled=!e,this.stopBtn.disabled=!0}enableStopButton(e){this.stopBtn.disabled=!e,this.startBtn.disabled=e}enablePrintButton(e){this.printBtn&&(this.printBtn.disabled=!e)}showAudioPlayer(e){if(this.audioPlayer&&e){const t=URL.createObjectURL(e);this.audioPlayer.src=t,this.audioPlayer.style.display="block"}}hideAudioPlayer(){this.audioPlayer&&(this.audioPlayer.pause(),this.audioPlayer.removeAttribute("src"),this.audioPlayer.load(),this.audioPlayer.style.display="none")}updateTranscript(e){this.widgets.transcript&&(this.widgets.transcript.innerHTML=e)}updateDashboard(e){this.setWidgetHTML(this.widgets.incident,e.incident_record||"No incident record available"),this.renderPrescription(e.prescription||[]),this.renderList(this.widgets.lab,e.lab_recommendations||[]),this.renderList(this.widgets.radiology,e.radiology_recommendations||[]),this.setWidgetHTML(this.widgets.treatment,e.treatment_plan||"No treatment plan available"),this.renderList(this.widgets.diet,e.diet_advice||[]),this.setWidgetHTML(this.widgets.summary,e.summary||"No summary available")}setWidgetHTML(e,t){if(!t||t.trim()==="")e.innerHTML='<div class="placeholder">No information available</div>';else{const i=this.formatAsHTML(t);e.innerHTML=i}}formatAsHTML(e){return _(e)}renderPrescription(e){const t=this.widgets.prescription;if(!e||e.length===0){t.innerHTML='<div class="placeholder">No prescriptions prescribed</div>';return}const i=document.createElement("table");i.innerHTML=`
|
| 153 |
+
<thead>
|
| 154 |
+
<tr>
|
| 155 |
+
<th>Drug</th>
|
| 156 |
+
<th>Dose</th>
|
| 157 |
+
<th>Frequency</th>
|
| 158 |
+
<th>Duration</th>
|
| 159 |
+
</tr>
|
| 160 |
+
</thead>
|
| 161 |
+
<tbody>
|
| 162 |
+
${e.map(r=>`
|
| 163 |
+
<tr>
|
| 164 |
+
<td>${y(r.drug||"")}</td>
|
| 165 |
+
<td>${y(r.dose||"")}</td>
|
| 166 |
+
<td>${y(r.frequency||"")}</td>
|
| 167 |
+
<td>${y(r.duration||"")}</td>
|
| 168 |
+
</tr>
|
| 169 |
+
`).join("")}
|
| 170 |
+
</tbody>
|
| 171 |
+
`,t.innerHTML="",t.appendChild(i)}renderList(e,t){if(!t||t.length===0){e.innerHTML='<div class="placeholder">None recommended</div>';return}const i=document.createElement("ul");t.forEach(r=>{const s=document.createElement("li");s.innerHTML=v(r),i.appendChild(s)}),e.innerHTML="",e.appendChild(i)}escapeHtml(e){return y(e)}showError(e){alert(`Error: ${e}`)}}const U="medscribe-sessions",W=1,b="sessions";class H{constructor(){this.db=null}async initialize(){return new Promise((e,t)=>{const i=indexedDB.open(U,W);i.onerror=()=>t(i.error),i.onsuccess=()=>{this.db=i.result,e()},i.onupgradeneeded=r=>{const s=r.target.result;s.objectStoreNames.contains(b)||s.createObjectStore(b,{keyPath:"id",autoIncrement:!0}).createIndex("date","date",{unique:!1})}})}async saveSession(e){this.db||await this.initialize();const t={date:new Date().toISOString(),transcript:e.transcript,medicalData:e.medicalData};return new Promise((i,r)=>{const n=this.db.transaction([b],"readwrite").objectStore(b).add(t);n.onsuccess=()=>i(n.result),n.onerror=()=>r(n.error)})}async getAllSessions(){return this.db||await this.initialize(),new Promise((e,t)=>{const s=this.db.transaction([b],"readonly").objectStore(b).getAll();s.onsuccess=()=>e(s.result),s.onerror=()=>t(s.error)})}async deleteSession(e){return this.db||await this.initialize(),new Promise((t,i)=>{const o=this.db.transaction([b],"readwrite").objectStore(b).delete(e);o.onsuccess=()=>t(),o.onerror=()=>i(o.error)})}async clearAll(){return this.db||await this.initialize(),new Promise((e,t)=>{const s=this.db.transaction([b],"readwrite").objectStore(b).clear();s.onsuccess=()=>e(),s.onerror=()=>t(s.error)})}}class j{static printReport(e,t,i={}){const r=window.open("","_blank"),s=new Date().toLocaleDateString();r.document.write(`
|
| 172 |
+
<!DOCTYPE html>
|
| 173 |
+
<html>
|
| 174 |
+
<head>
|
| 175 |
+
<title>Medical Consultation Report - ${s}</title>
|
| 176 |
+
<style>
|
| 177 |
+
* { margin: 0; padding: 0; box-sizing: border-box; }
|
| 178 |
+
body {
|
| 179 |
+
font-family: 'Times New Roman', serif;
|
| 180 |
+
font-size: 12pt;
|
| 181 |
+
line-height: 1.6;
|
| 182 |
+
color: #000;
|
| 183 |
+
max-width: 800px;
|
| 184 |
+
margin: 0 auto;
|
| 185 |
+
padding: 40px 20px;
|
| 186 |
+
}
|
| 187 |
+
header {
|
| 188 |
+
text-align: center;
|
| 189 |
+
border-bottom: 2px solid #000;
|
| 190 |
+
padding-bottom: 20px;
|
| 191 |
+
margin-bottom: 30px;
|
| 192 |
+
}
|
| 193 |
+
header h1 {
|
| 194 |
+
font-size: 24pt;
|
| 195 |
+
margin-bottom: 10px;
|
| 196 |
+
}
|
| 197 |
+
header .info {
|
| 198 |
+
font-size: 11pt;
|
| 199 |
+
color: #333;
|
| 200 |
+
}
|
| 201 |
+
.section {
|
| 202 |
+
margin-bottom: 25px;
|
| 203 |
+
page-break-inside: avoid;
|
| 204 |
+
}
|
| 205 |
+
.section h2 {
|
| 206 |
+
font-size: 14pt;
|
| 207 |
+
border-bottom: 1px solid #ccc;
|
| 208 |
+
padding-bottom: 5px;
|
| 209 |
+
margin-bottom: 10px;
|
| 210 |
+
}
|
| 211 |
+
.section p, .section li {
|
| 212 |
+
margin-bottom: 8px;
|
| 213 |
+
}
|
| 214 |
+
.section h3, .section h4, .section h5, .transcript-content h3, .transcript-content h4, .transcript-content h5 {
|
| 215 |
+
font-size: 12pt;
|
| 216 |
+
margin: 10px 0 8px;
|
| 217 |
+
}
|
| 218 |
+
table {
|
| 219 |
+
width: 100%;
|
| 220 |
+
border-collapse: collapse;
|
| 221 |
+
margin: 10px 0;
|
| 222 |
+
}
|
| 223 |
+
table th, table td {
|
| 224 |
+
border: 1px solid #000;
|
| 225 |
+
padding: 8px;
|
| 226 |
+
text-align: left;
|
| 227 |
+
}
|
| 228 |
+
table th {
|
| 229 |
+
background: #f0f0f0;
|
| 230 |
+
font-weight: bold;
|
| 231 |
+
}
|
| 232 |
+
ul {
|
| 233 |
+
margin-left: 20px;
|
| 234 |
+
}
|
| 235 |
+
.transcript {
|
| 236 |
+
page-break-before: always;
|
| 237 |
+
}
|
| 238 |
+
.transcript h2 {
|
| 239 |
+
font-size: 14pt;
|
| 240 |
+
margin-bottom: 15px;
|
| 241 |
+
}
|
| 242 |
+
.transcript-content {
|
| 243 |
+
font-size: 10pt;
|
| 244 |
+
line-height: 1.8;
|
| 245 |
+
}
|
| 246 |
+
.transcript-content p,
|
| 247 |
+
.transcript-content li {
|
| 248 |
+
margin-bottom: 8px;
|
| 249 |
+
}
|
| 250 |
+
code {
|
| 251 |
+
font-family: 'Courier New', monospace;
|
| 252 |
+
font-size: 0.95em;
|
| 253 |
+
background: #f2f4f7;
|
| 254 |
+
padding: 1px 4px;
|
| 255 |
+
border-radius: 3px;
|
| 256 |
+
}
|
| 257 |
+
@media print {
|
| 258 |
+
body { padding: 0; }
|
| 259 |
+
.section { page-break-inside: avoid; }
|
| 260 |
+
}
|
| 261 |
+
</style>
|
| 262 |
+
</head>
|
| 263 |
+
<body>
|
| 264 |
+
<header>
|
| 265 |
+
<h1>Medical Consultation Report</h1>
|
| 266 |
+
<div class="info">
|
| 267 |
+
${i.clinic?`<p><strong>Clinic:</strong> ${this.escapeHtml(i.clinic)}</p>`:""}
|
| 268 |
+
${i.name?`<p><strong>Doctor:</strong> ${this.escapeHtml(i.name)}</p>`:""}
|
| 269 |
+
<p><strong>Date:</strong> ${s}</p>
|
| 270 |
+
</div>
|
| 271 |
+
</header>
|
| 272 |
+
|
| 273 |
+
${this.renderSection("Incident Record",e.incident_record)}
|
| 274 |
+
${this.renderPrescription(e.prescription)}
|
| 275 |
+
${this.renderListSection("Lab Recommendations",e.lab_recommendations)}
|
| 276 |
+
${this.renderListSection("Radiology Recommendations",e.radiology_recommendations)}
|
| 277 |
+
${this.renderSection("Treatment Plan",e.treatment_plan)}
|
| 278 |
+
${this.renderListSection("Diet Advice",e.diet_advice)}
|
| 279 |
+
${this.renderSection("Consultation Summary",e.summary)}
|
| 280 |
+
|
| 281 |
+
<div class="transcript">
|
| 282 |
+
<h2>Full Transcript</h2>
|
| 283 |
+
<div class="transcript-content">${this.escapeHtml(t)}</div>
|
| 284 |
+
</div>
|
| 285 |
+
|
| 286 |
+
<script>
|
| 287 |
+
window.onload = function() {
|
| 288 |
+
window.print();
|
| 289 |
+
window.onafterprint = function() {
|
| 290 |
+
window.close();
|
| 291 |
+
};
|
| 292 |
+
};
|
| 293 |
+
<\/script>
|
| 294 |
+
</body>
|
| 295 |
+
</html>
|
| 296 |
+
`),r.document.close()}static renderSection(e,t){return!t||t.trim()===""?"":`
|
| 297 |
+
<div class="section">
|
| 298 |
+
<h2>${e}</h2>
|
| 299 |
+
${_(t)}
|
| 300 |
+
</div>
|
| 301 |
+
`}static renderPrescription(e){return!e||e.length===0?"":`
|
| 302 |
+
<div class="section">
|
| 303 |
+
<h2>Prescription</h2>
|
| 304 |
+
<table>
|
| 305 |
+
<thead>
|
| 306 |
+
<tr>
|
| 307 |
+
<th>Drug</th>
|
| 308 |
+
<th>Dose</th>
|
| 309 |
+
<th>Frequency</th>
|
| 310 |
+
<th>Duration</th>
|
| 311 |
+
</tr>
|
| 312 |
+
</thead>
|
| 313 |
+
<tbody>
|
| 314 |
+
${e.map(t=>`
|
| 315 |
+
<tr>
|
| 316 |
+
<td>${y(t.drug||"")}</td>
|
| 317 |
+
<td>${y(t.dose||"")}</td>
|
| 318 |
+
<td>${y(t.frequency||"")}</td>
|
| 319 |
+
<td>${y(t.duration||"")}</td>
|
| 320 |
+
</tr>
|
| 321 |
+
`).join("")}
|
| 322 |
+
</tbody>
|
| 323 |
+
</table>
|
| 324 |
+
</div>
|
| 325 |
+
`}static renderListSection(e,t){return!t||t.length===0?"":`
|
| 326 |
+
<div class="section">
|
| 327 |
+
<h2>${e}</h2>
|
| 328 |
+
<ul>
|
| 329 |
+
${t.map(i=>`<li>${v(i)}</li>`).join("")}
|
| 330 |
+
</ul>
|
| 331 |
+
</div>
|
| 332 |
+
`}static escapeHtml(e){return y(e)}}const J="LiquidAI/LFM2.5-1.2B-Instruct-ONNX";class G{constructor(){this.ui=new O,this.recorder=new N,this.stt=new B,this.extractor=new F,this.history=new H,this.isRecording=!1,this.audioBlob=null,this.liveTranscript="",this.finalTranscript="",this.currentMedicalData=null,this.extractorInitPromise=null,this.isExtractorReady=!1,this.extractorInitError=null,this.isGeneratingReport=!1,this.loadingOverlay=document.getElementById("loadingOverlay"),this.progressFill=document.getElementById("progressFill"),this.progressText=document.getElementById("progressText"),this.recordingWave=document.getElementById("recordingWave"),this.manualInputSection=document.getElementById("manualInputSection"),this.manualTextInput=document.getElementById("manualTextInput"),this.toggleManualBtn=document.getElementById("toggleManualBtn"),this.clearManualTextBtn=document.getElementById("clearManualTextBtn")}updateProgress(e,t){this.progressFill&&(this.progressFill.style.width=`${e}%`),this.progressText&&(this.progressText.textContent=t)}hideLoadingScreen(){this.loadingOverlay&&this.loadingOverlay.classList.add("hidden")}startExtractorWarmup(){return this.isExtractorReady?Promise.resolve():this.extractorInitPromise?this.extractorInitPromise:(this.extractorInitError=null,this.extractorInitPromise=this.extractor.initialize((e,t)=>{this.updateProgress(70+Math.floor(e*.3),t),this.isGeneratingReport&&(this.ui.setActivityProgress(5+Math.floor(e*.2),t),this.ui.setStatus("processing",t)),this.isRecording||this.ui.setStatus("ready",`Voice capture ready. ${t}`)},J).then(()=>{this.isExtractorReady=!0,this.isRecording||this.ui.setStatus("ready","Ready to start consultation")}).catch(e=>{throw this.extractorInitError=e,this.isRecording||this.ui.setStatus("error",`AI model failed to initialize: ${e.message}`),e}).finally(()=>{this.isExtractorReady||(this.extractorInitPromise=null)}),this.extractorInitPromise)}async ensureExtractorReady(e="Preparing AI model for report generation..."){this.isExtractorReady||(this.ui.setStatus("processing",e),await this.startExtractorWarmup())}async initialize(){this.updateProgress(30,"Initializing Speech Recognition...");try{await this.stt.initialize(),this.updateProgress(65,"Loading session history..."),await this.history.initialize(),this.updateProgress(100,"Voice capture ready. AI model will continue loading in the background."),setTimeout(()=>this.hideLoadingScreen(),500),this.ui.setStatus("ready","Voice capture ready. AI model downloading in background."),this.ui.enableControls(!0),this.startExtractorWarmup().catch(e=>{console.error("Background model initialization error:",e)})}catch(e){console.error("Initialization error:",e),this.updateProgress(0,`Error: ${e.message}`),this.ui.setStatus("error",`Error: ${e.message}`)}}async startConsultation(){try{this.startExtractorWarmup().catch(e=>{console.error("Background model initialization error:",e)}),this.isRecording=!0,this.audioBlob=null,this.liveTranscript="",this.finalTranscript="",this.setManualInputVisible(!1),this.ui.hideAudioPlayer(),this.recordingWave&&this.recordingWave.classList.add("active"),this.ui.setStatus("recording","Recording in progress"),this.ui.enableControls(!1),this.ui.updateTranscript('<div class="placeholder">Listening. Start speaking to capture the consultation transcript.</div>'),await this.recorder.start(),await this.stt.startLiveTranscription(e=>{this.liveTranscript=e,this.ui.updateTranscript(`<div class="transcript-live">${this.formatTranscript(e)}</div>`)}),this.ui.enableStopButton(!0)}catch(e){console.error("Error starting recording:",e),this.ui.setStatus("error",`Error: ${e.message}`),this.isRecording=!1,this.recordingWave&&this.recordingWave.classList.remove("active"),this.ui.enableControls(!0)}}async endConsultation(){try{this.ui.setStatus("processing","Finalizing the session..."),await this.stt.stopLiveTranscription(),this.audioBlob=await this.recorder.stop(),this.isRecording=!1,this.recordingWave&&this.recordingWave.classList.remove("active"),this.finalTranscript=await this.stt.getFinalTranscript(),this.updateManualText(this.finalTranscript,{overwrite:!0}),await this.generateReportFromTranscript(this.finalTranscript,{showAudioPlayer:!0,successMessage:"Report generated successfully"})}catch(e){console.error("Error processing consultation:",e),this.ui.setStatus("error",`Error: ${e.message}`),this.recordingWave&&this.recordingWave.classList.remove("active"),this.ui.enableControls(!0)}}formatTranscript(e){return _(e,{emptyHtml:'<div class="placeholder">No transcript available</div>'})}setManualInputVisible(e){var t;this.manualInputSection&&this.manualInputSection.classList.toggle("active",e),this.toggleManualBtn&&(this.toggleManualBtn.textContent=e?"Hide Manual Entry":"Manual Entry"),e&&(this.updateManualText(this.finalTranscript||this.liveTranscript),(t=this.manualTextInput)==null||t.focus())}updateManualText(e,{overwrite:t=!1}={}){this.manualTextInput&&(t||!this.manualTextInput.value.trim())&&(this.manualTextInput.value=e||"")}async generateReportFromTranscript(e,t={}){const{showAudioPlayer:i=!1,successMessage:r="Report generated successfully"}=t,s=e.trim();let o=!1;this.isGeneratingReport=!0,this.ui.enableControls(!1),this.ui.enablePrintButton(!1),this.ui.setActivityProgress(4,"Preparing report generation...");try{await this.ensureExtractorReady("Preparing AI model for report generation..."),this.ui.setStatus("processing","Extracting medical data..."),this.ui.setActivityProgress(22,"Analyzing transcript..."),this.finalTranscript=s,this.liveTranscript=s,i&&this.audioBlob?this.ui.showAudioPlayer(this.audioBlob):(this.audioBlob=null,this.ui.hideAudioPlayer());const n=await this.extractor.extract(s,(a,c)=>{const d=25+Math.floor(a*.75);this.ui.setActivityProgress(d,c),this.ui.setStatus("processing",c)});this.currentMedicalData=n,this.ui.setActivityProgress(95,"Saving consultation report..."),this.ui.updateTranscript(`<div class="transcript-live">${this.formatTranscript(s)}</div>`),this.ui.updateDashboard(n),await this.history.saveSession({transcript:s,medicalData:n}),this.ui.setActivityProgress(100,"Report ready"),this.ui.setStatus("ready",r),this.ui.enableControls(!0),this.ui.enablePrintButton(!0),o=!0}catch(n){throw this.ui.setActivityProgress(100,"Report generation failed"),n}finally{this.isGeneratingReport=!1,o&&window.setTimeout(()=>this.ui.clearActivityProgress(),800)}}printReport(){if(!this.currentMedicalData){alert("No report to print. Please complete a consultation first.");return}j.printReport(this.currentMedicalData,this.finalTranscript,{})}}const f=new G;document.getElementById("startBtn").addEventListener("click",()=>f.startConsultation());document.getElementById("stopBtn").addEventListener("click",()=>f.endConsultation());var E;(E=document.getElementById("printBtn"))==null||E.addEventListener("click",()=>f.printReport());var M;(M=document.getElementById("toggleManualBtn"))==null||M.addEventListener("click",()=>{var e;const l=(e=f.manualInputSection)==null?void 0:e.classList.contains("active");f.setManualInputVisible(!l)});var k;(k=document.getElementById("processTextBtn"))==null||k.addEventListener("click",async()=>{var e;const l=((e=document.getElementById("manualTextInput"))==null?void 0:e.value)||"";if(!l.trim()){alert("Please enter a consultation transcript first.");return}try{await f.generateReportFromTranscript(l,{successMessage:"Report generated successfully from manual text"})}catch(t){console.error("Error processing text:",t),f.ui.setStatus("error",`Error: ${t.message}`),f.ui.showError(t.message)}});var I;(I=document.getElementById("clearManualTextBtn"))==null||I.addEventListener("click",()=>{f.manualTextInput&&(f.manualTextInput.value="",f.manualTextInput.focus())});f.initialize();
|
assets/ort-wasm-simd-threaded.jsep-B0T3yYHD.wasm
ADDED
|
@@ -0,0 +1,3 @@
|
|
|
|
|
|
|
|
|
|
|
|
|
| 1 |
+
version https://git-lfs.github.com/spec/v1
|
| 2 |
+
oid sha256:c46655e8a94afc45338d4cb2b840475f88e5012d524509916e505079c00bfa39
|
| 3 |
+
size 21596019
|
assets/transformers.web-BJrd5lgs.js
ADDED
|
The diff for this file is too large to render.
See raw diff
|
|
|
index.html
CHANGED
|
@@ -1,19 +1,813 @@
|
|
| 1 |
-
<!
|
| 2 |
-
<html>
|
| 3 |
-
|
| 4 |
-
|
| 5 |
-
|
| 6 |
-
|
| 7 |
-
|
| 8 |
-
|
| 9 |
-
|
| 10 |
-
|
| 11 |
-
|
| 12 |
-
|
| 13 |
-
|
| 14 |
-
|
| 15 |
-
|
| 16 |
-
|
| 17 |
-
|
| 18 |
-
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|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
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
|
| 19 |
</html>
|
|
|
|
| 1 |
+
<!DOCTYPE html>
|
| 2 |
+
<html lang="en">
|
| 3 |
+
<head>
|
| 4 |
+
<meta charset="UTF-8">
|
| 5 |
+
<meta name="viewport" content="width=device-width, initial-scale=1.0">
|
| 6 |
+
<title>MedScribe - AI Medical Scribe for Doctors</title>
|
| 7 |
+
<style>
|
| 8 |
+
* {
|
| 9 |
+
margin: 0;
|
| 10 |
+
padding: 0;
|
| 11 |
+
box-sizing: border-box;
|
| 12 |
+
}
|
| 13 |
+
|
| 14 |
+
:root {
|
| 15 |
+
--primary: #1d4ed8;
|
| 16 |
+
--primary-dark: #1e40af;
|
| 17 |
+
--primary-soft: #dbeafe;
|
| 18 |
+
--success: #0f766e;
|
| 19 |
+
--danger: #b42318;
|
| 20 |
+
--warning: #b54708;
|
| 21 |
+
--background: #f4f7fb;
|
| 22 |
+
--surface: #ffffff;
|
| 23 |
+
--surface-alt: #f8fafc;
|
| 24 |
+
--surface-strong: #e2e8f0;
|
| 25 |
+
--text: #0f172a;
|
| 26 |
+
--text-secondary: #475569;
|
| 27 |
+
--border: #d7e0ea;
|
| 28 |
+
--shadow: 0 10px 30px rgb(15 23 42 / 0.06);
|
| 29 |
+
--shadow-lg: 0 18px 48px rgb(15 23 42 / 0.10);
|
| 30 |
+
}
|
| 31 |
+
|
| 32 |
+
body {
|
| 33 |
+
font-family: 'IBM Plex Sans', 'Segoe UI', sans-serif;
|
| 34 |
+
background:
|
| 35 |
+
radial-gradient(circle at top left, #eff6ff 0, transparent 28%),
|
| 36 |
+
linear-gradient(180deg, #f8fbff 0%, var(--background) 100%);
|
| 37 |
+
color: var(--text);
|
| 38 |
+
line-height: 1.5;
|
| 39 |
+
min-height: 100vh;
|
| 40 |
+
}
|
| 41 |
+
|
| 42 |
+
/* Loading Screen */
|
| 43 |
+
.loading-overlay {
|
| 44 |
+
position: fixed;
|
| 45 |
+
inset: 0;
|
| 46 |
+
background: linear-gradient(180deg, #f8fbff 0%, #eef4fb 100%);
|
| 47 |
+
display: flex;
|
| 48 |
+
align-items: center;
|
| 49 |
+
justify-content: center;
|
| 50 |
+
z-index: 9999;
|
| 51 |
+
transition: opacity 0.5s ease;
|
| 52 |
+
}
|
| 53 |
+
|
| 54 |
+
.loading-overlay.hidden {
|
| 55 |
+
opacity: 0;
|
| 56 |
+
pointer-events: none;
|
| 57 |
+
}
|
| 58 |
+
|
| 59 |
+
.loading-content {
|
| 60 |
+
text-align: center;
|
| 61 |
+
color: var(--text);
|
| 62 |
+
background: rgb(255 255 255 / 0.88);
|
| 63 |
+
border: 1px solid rgb(215 224 234 / 0.9);
|
| 64 |
+
border-radius: 24px;
|
| 65 |
+
box-shadow: var(--shadow-lg);
|
| 66 |
+
padding: 40px 36px;
|
| 67 |
+
min-width: min(520px, 90vw);
|
| 68 |
+
backdrop-filter: blur(12px);
|
| 69 |
+
}
|
| 70 |
+
|
| 71 |
+
.loading-spinner {
|
| 72 |
+
width: 60px;
|
| 73 |
+
height: 60px;
|
| 74 |
+
border: 4px solid rgb(29 78 216 / 0.12);
|
| 75 |
+
border-top-color: var(--primary);
|
| 76 |
+
border-radius: 50%;
|
| 77 |
+
animation: spin 1s linear infinite;
|
| 78 |
+
margin: 0 auto 24px;
|
| 79 |
+
}
|
| 80 |
+
|
| 81 |
+
@keyframes spin {
|
| 82 |
+
to { transform: rotate(360deg); }
|
| 83 |
+
}
|
| 84 |
+
|
| 85 |
+
.loading-content h1 {
|
| 86 |
+
font-size: 2.25rem;
|
| 87 |
+
font-weight: 700;
|
| 88 |
+
margin-bottom: 10px;
|
| 89 |
+
letter-spacing: -0.03em;
|
| 90 |
+
}
|
| 91 |
+
|
| 92 |
+
.loading-content p {
|
| 93 |
+
font-size: 1rem;
|
| 94 |
+
color: var(--text-secondary);
|
| 95 |
+
margin-bottom: 28px;
|
| 96 |
+
}
|
| 97 |
+
|
| 98 |
+
.progress-bar {
|
| 99 |
+
background: #e6edf7;
|
| 100 |
+
border-radius: 10px;
|
| 101 |
+
height: 8px;
|
| 102 |
+
overflow: hidden;
|
| 103 |
+
margin-bottom: 16px;
|
| 104 |
+
}
|
| 105 |
+
|
| 106 |
+
.progress-fill {
|
| 107 |
+
background: linear-gradient(90deg, var(--primary) 0%, #3b82f6 100%);
|
| 108 |
+
height: 100%;
|
| 109 |
+
width: 0%;
|
| 110 |
+
transition: width 0.3s ease;
|
| 111 |
+
border-radius: 10px;
|
| 112 |
+
}
|
| 113 |
+
|
| 114 |
+
.progress-text {
|
| 115 |
+
font-size: 0.9rem;
|
| 116 |
+
color: var(--text-secondary);
|
| 117 |
+
}
|
| 118 |
+
|
| 119 |
+
/* Main Container */
|
| 120 |
+
.container {
|
| 121 |
+
max-width: 1320px;
|
| 122 |
+
margin: 0 auto;
|
| 123 |
+
padding: 32px 24px 48px;
|
| 124 |
+
}
|
| 125 |
+
|
| 126 |
+
/* Header */
|
| 127 |
+
.header {
|
| 128 |
+
padding: 8px 0 28px;
|
| 129 |
+
margin-bottom: 20px;
|
| 130 |
+
}
|
| 131 |
+
|
| 132 |
+
.header h1 {
|
| 133 |
+
font-size: clamp(2.4rem, 5vw, 3.2rem);
|
| 134 |
+
font-weight: 700;
|
| 135 |
+
color: var(--text);
|
| 136 |
+
margin-bottom: 10px;
|
| 137 |
+
letter-spacing: -0.04em;
|
| 138 |
+
}
|
| 139 |
+
|
| 140 |
+
.header p {
|
| 141 |
+
max-width: 760px;
|
| 142 |
+
font-size: 1rem;
|
| 143 |
+
color: var(--text-secondary);
|
| 144 |
+
margin: 0;
|
| 145 |
+
}
|
| 146 |
+
|
| 147 |
+
/* Status Bar */
|
| 148 |
+
.status-bar {
|
| 149 |
+
background: var(--surface);
|
| 150 |
+
border: 1px solid var(--border);
|
| 151 |
+
border-radius: 20px;
|
| 152 |
+
padding: 18px 22px;
|
| 153 |
+
margin-bottom: 18px;
|
| 154 |
+
display: flex;
|
| 155 |
+
align-items: center;
|
| 156 |
+
gap: 16px;
|
| 157 |
+
box-shadow: var(--shadow);
|
| 158 |
+
}
|
| 159 |
+
|
| 160 |
+
.status-indicator {
|
| 161 |
+
width: 12px;
|
| 162 |
+
height: 12px;
|
| 163 |
+
border-radius: 50%;
|
| 164 |
+
background: var(--text-secondary);
|
| 165 |
+
flex-shrink: 0;
|
| 166 |
+
}
|
| 167 |
+
|
| 168 |
+
.status-indicator.ready { background: var(--success); }
|
| 169 |
+
.status-indicator.recording {
|
| 170 |
+
background: var(--danger);
|
| 171 |
+
animation: pulse 1.5s ease-in-out infinite;
|
| 172 |
+
}
|
| 173 |
+
.status-indicator.processing { background: var(--warning); }
|
| 174 |
+
|
| 175 |
+
@keyframes pulse {
|
| 176 |
+
0%, 100% { opacity: 1; transform: scale(1); }
|
| 177 |
+
50% { opacity: 0.7; transform: scale(1.2); }
|
| 178 |
+
}
|
| 179 |
+
|
| 180 |
+
.status-text {
|
| 181 |
+
flex: 1;
|
| 182 |
+
font-size: 0.95rem;
|
| 183 |
+
font-weight: 500;
|
| 184 |
+
}
|
| 185 |
+
|
| 186 |
+
.activity-progress {
|
| 187 |
+
background: rgb(255 255 255 / 0.82);
|
| 188 |
+
border: 1px solid rgb(215 224 234 / 0.9);
|
| 189 |
+
border-radius: 16px;
|
| 190 |
+
padding: 14px 18px;
|
| 191 |
+
margin: -2px 0 18px;
|
| 192 |
+
box-shadow: var(--shadow);
|
| 193 |
+
backdrop-filter: blur(10px);
|
| 194 |
+
}
|
| 195 |
+
|
| 196 |
+
.activity-progress.hidden {
|
| 197 |
+
display: none;
|
| 198 |
+
}
|
| 199 |
+
|
| 200 |
+
.activity-progress-text {
|
| 201 |
+
font-size: 0.88rem;
|
| 202 |
+
color: var(--text-secondary);
|
| 203 |
+
margin-bottom: 10px;
|
| 204 |
+
}
|
| 205 |
+
|
| 206 |
+
.activity-progress .progress-bar {
|
| 207 |
+
margin-bottom: 0;
|
| 208 |
+
height: 7px;
|
| 209 |
+
}
|
| 210 |
+
|
| 211 |
+
/* Controls */
|
| 212 |
+
.controls {
|
| 213 |
+
display: flex;
|
| 214 |
+
gap: 12px;
|
| 215 |
+
justify-content: flex-start;
|
| 216 |
+
margin-bottom: 22px;
|
| 217 |
+
flex-wrap: wrap;
|
| 218 |
+
padding: 18px 20px;
|
| 219 |
+
background: rgb(255 255 255 / 0.76);
|
| 220 |
+
border: 1px solid rgb(215 224 234 / 0.9);
|
| 221 |
+
border-radius: 18px;
|
| 222 |
+
box-shadow: var(--shadow);
|
| 223 |
+
backdrop-filter: blur(10px);
|
| 224 |
+
}
|
| 225 |
+
|
| 226 |
+
button {
|
| 227 |
+
padding: 14px 22px;
|
| 228 |
+
font-size: 0.95rem;
|
| 229 |
+
font-weight: 600;
|
| 230 |
+
border: 1px solid transparent;
|
| 231 |
+
border-radius: 12px;
|
| 232 |
+
cursor: pointer;
|
| 233 |
+
transition: background 0.2s ease, border-color 0.2s ease, color 0.2s ease, box-shadow 0.2s ease;
|
| 234 |
+
font-family: inherit;
|
| 235 |
+
box-shadow: none;
|
| 236 |
+
}
|
| 237 |
+
|
| 238 |
+
button:hover:not(:disabled) {
|
| 239 |
+
transform: none;
|
| 240 |
+
box-shadow: 0 8px 18px rgb(15 23 42 / 0.08);
|
| 241 |
+
}
|
| 242 |
+
|
| 243 |
+
button:disabled {
|
| 244 |
+
opacity: 0.45;
|
| 245 |
+
cursor: not-allowed;
|
| 246 |
+
box-shadow: none;
|
| 247 |
+
}
|
| 248 |
+
|
| 249 |
+
.btn-primary {
|
| 250 |
+
background: linear-gradient(180deg, #2563eb 0%, var(--primary) 100%);
|
| 251 |
+
color: white;
|
| 252 |
+
}
|
| 253 |
+
|
| 254 |
+
.btn-danger {
|
| 255 |
+
background: #fff5f5;
|
| 256 |
+
border-color: #fecaca;
|
| 257 |
+
color: var(--danger);
|
| 258 |
+
}
|
| 259 |
+
|
| 260 |
+
.btn-danger:hover:not(:disabled) {
|
| 261 |
+
background: #fee2e2;
|
| 262 |
+
}
|
| 263 |
+
|
| 264 |
+
.btn-secondary {
|
| 265 |
+
background: var(--surface);
|
| 266 |
+
color: var(--text);
|
| 267 |
+
border-color: var(--border);
|
| 268 |
+
}
|
| 269 |
+
|
| 270 |
+
.btn-secondary:hover:not(:disabled) {
|
| 271 |
+
background: var(--surface-alt);
|
| 272 |
+
}
|
| 273 |
+
|
| 274 |
+
.btn-outline {
|
| 275 |
+
background: var(--primary-soft);
|
| 276 |
+
color: var(--primary-dark);
|
| 277 |
+
border-color: #bfdbfe;
|
| 278 |
+
}
|
| 279 |
+
|
| 280 |
+
.btn-outline:hover:not(:disabled) {
|
| 281 |
+
background: #cfe1ff;
|
| 282 |
+
}
|
| 283 |
+
|
| 284 |
+
.action-note {
|
| 285 |
+
display: inline-flex;
|
| 286 |
+
align-items: center;
|
| 287 |
+
padding: 12px 14px;
|
| 288 |
+
border-radius: 12px;
|
| 289 |
+
background: var(--surface-alt);
|
| 290 |
+
border: 1px solid var(--border);
|
| 291 |
+
color: var(--text-secondary);
|
| 292 |
+
font-size: 0.9rem;
|
| 293 |
+
font-weight: 500;
|
| 294 |
+
}
|
| 295 |
+
|
| 296 |
+
.control-group {
|
| 297 |
+
display: flex;
|
| 298 |
+
gap: 12px;
|
| 299 |
+
flex-wrap: wrap;
|
| 300 |
+
align-items: center;
|
| 301 |
+
}
|
| 302 |
+
|
| 303 |
+
.panel-label {
|
| 304 |
+
display: inline-flex;
|
| 305 |
+
align-items: center;
|
| 306 |
+
gap: 8px;
|
| 307 |
+
padding: 8px 12px;
|
| 308 |
+
border-radius: 999px;
|
| 309 |
+
background: var(--primary-soft);
|
| 310 |
+
color: var(--primary-dark);
|
| 311 |
+
font-size: 0.8rem;
|
| 312 |
+
font-weight: 700;
|
| 313 |
+
letter-spacing: 0.04em;
|
| 314 |
+
text-transform: uppercase;
|
| 315 |
+
margin-bottom: 14px;
|
| 316 |
+
}
|
| 317 |
+
|
| 318 |
+
.panel-label::before {
|
| 319 |
+
content: '';
|
| 320 |
+
width: 8px;
|
| 321 |
+
height: 8px;
|
| 322 |
+
border-radius: 999px;
|
| 323 |
+
background: var(--primary);
|
| 324 |
+
}
|
| 325 |
+
|
| 326 |
+
.intro-card {
|
| 327 |
+
display: grid;
|
| 328 |
+
grid-template-columns: minmax(0, 1.8fr) minmax(280px, 0.9fr);
|
| 329 |
+
gap: 16px;
|
| 330 |
+
margin-bottom: 18px;
|
| 331 |
+
}
|
| 332 |
+
|
| 333 |
+
.intro-panel,
|
| 334 |
+
.summary-panel {
|
| 335 |
+
background: rgb(255 255 255 / 0.82);
|
| 336 |
+
border: 1px solid rgb(215 224 234 / 0.9);
|
| 337 |
+
border-radius: 22px;
|
| 338 |
+
padding: 24px;
|
| 339 |
+
box-shadow: var(--shadow);
|
| 340 |
+
backdrop-filter: blur(10px);
|
| 341 |
+
}
|
| 342 |
+
|
| 343 |
+
.intro-panel h2,
|
| 344 |
+
.summary-panel h2 {
|
| 345 |
+
font-size: 1.45rem;
|
| 346 |
+
margin-bottom: 10px;
|
| 347 |
+
letter-spacing: -0.02em;
|
| 348 |
+
}
|
| 349 |
+
|
| 350 |
+
.intro-panel p,
|
| 351 |
+
.summary-panel p {
|
| 352 |
+
color: var(--text-secondary);
|
| 353 |
+
margin-bottom: 16px;
|
| 354 |
+
}
|
| 355 |
+
|
| 356 |
+
.summary-panel dl {
|
| 357 |
+
display: grid;
|
| 358 |
+
gap: 14px;
|
| 359 |
+
}
|
| 360 |
+
|
| 361 |
+
.summary-panel dt {
|
| 362 |
+
font-size: 0.78rem;
|
| 363 |
+
color: var(--text-secondary);
|
| 364 |
+
text-transform: uppercase;
|
| 365 |
+
letter-spacing: 0.06em;
|
| 366 |
+
margin-bottom: 4px;
|
| 367 |
+
font-weight: 700;
|
| 368 |
+
}
|
| 369 |
+
|
| 370 |
+
.summary-panel dd {
|
| 371 |
+
margin: 0;
|
| 372 |
+
font-size: 1rem;
|
| 373 |
+
font-weight: 600;
|
| 374 |
+
color: var(--text);
|
| 375 |
+
}
|
| 376 |
+
|
| 377 |
+
@media (max-width: 960px) {
|
| 378 |
+
.intro-card {
|
| 379 |
+
grid-template-columns: 1fr;
|
| 380 |
+
}
|
| 381 |
+
}
|
| 382 |
+
|
| 383 |
+
@media (max-width: 640px) {
|
| 384 |
+
.container {
|
| 385 |
+
padding: 20px 16px 36px;
|
| 386 |
+
}
|
| 387 |
+
|
| 388 |
+
.controls {
|
| 389 |
+
padding: 14px;
|
| 390 |
+
}
|
| 391 |
+
|
| 392 |
+
button {
|
| 393 |
+
width: 100%;
|
| 394 |
+
justify-content: center;
|
| 395 |
+
}
|
| 396 |
+
}
|
| 397 |
+
|
| 398 |
+
/* Dashboard */
|
| 399 |
+
.dashboard {
|
| 400 |
+
display: grid;
|
| 401 |
+
grid-template-columns: repeat(2, 1fr);
|
| 402 |
+
gap: 18px;
|
| 403 |
+
margin-bottom: 24px;
|
| 404 |
+
}
|
| 405 |
+
|
| 406 |
+
@media (max-width: 1024px) {
|
| 407 |
+
.dashboard {
|
| 408 |
+
grid-template-columns: 1fr;
|
| 409 |
+
}
|
| 410 |
+
}
|
| 411 |
+
|
| 412 |
+
.widget {
|
| 413 |
+
background: var(--surface);
|
| 414 |
+
border: 1px solid var(--border);
|
| 415 |
+
border-radius: 20px;
|
| 416 |
+
padding: 24px;
|
| 417 |
+
box-shadow: var(--shadow);
|
| 418 |
+
transition: border-color 0.2s ease, box-shadow 0.2s ease;
|
| 419 |
+
}
|
| 420 |
+
|
| 421 |
+
.widget.full-width {
|
| 422 |
+
grid-column: 1 / -1;
|
| 423 |
+
}
|
| 424 |
+
|
| 425 |
+
.widget h3 {
|
| 426 |
+
font-size: 1.25rem;
|
| 427 |
+
font-weight: 700;
|
| 428 |
+
margin-bottom: 12px;
|
| 429 |
+
color: var(--text);
|
| 430 |
+
display: flex;
|
| 431 |
+
align-items: center;
|
| 432 |
+
gap: 8px;
|
| 433 |
+
letter-spacing: -0.02em;
|
| 434 |
+
}
|
| 435 |
+
|
| 436 |
+
.widget-header {
|
| 437 |
+
display: flex;
|
| 438 |
+
align-items: center;
|
| 439 |
+
justify-content: space-between;
|
| 440 |
+
gap: 12px;
|
| 441 |
+
margin-bottom: 16px;
|
| 442 |
+
}
|
| 443 |
+
|
| 444 |
+
.widget-header h3 {
|
| 445 |
+
margin-bottom: 0;
|
| 446 |
+
}
|
| 447 |
+
|
| 448 |
+
.btn-small {
|
| 449 |
+
padding: 10px 14px;
|
| 450 |
+
font-size: 0.85rem;
|
| 451 |
+
}
|
| 452 |
+
|
| 453 |
+
.manual-input-panel {
|
| 454 |
+
display: none;
|
| 455 |
+
margin-top: 18px;
|
| 456 |
+
padding-top: 18px;
|
| 457 |
+
border-top: 1px solid var(--border);
|
| 458 |
+
}
|
| 459 |
+
|
| 460 |
+
.manual-input-panel.active {
|
| 461 |
+
display: block;
|
| 462 |
+
}
|
| 463 |
+
|
| 464 |
+
.manual-input-panel p {
|
| 465 |
+
margin-bottom: 12px;
|
| 466 |
+
color: var(--text-secondary);
|
| 467 |
+
}
|
| 468 |
+
|
| 469 |
+
.manual-textarea {
|
| 470 |
+
width: 100%;
|
| 471 |
+
min-height: 220px;
|
| 472 |
+
padding: 16px;
|
| 473 |
+
background: var(--surface-alt);
|
| 474 |
+
border: 1px solid var(--border);
|
| 475 |
+
border-radius: 12px;
|
| 476 |
+
color: var(--text);
|
| 477 |
+
font-family: inherit;
|
| 478 |
+
font-size: 1rem;
|
| 479 |
+
line-height: 1.6;
|
| 480 |
+
resize: vertical;
|
| 481 |
+
}
|
| 482 |
+
|
| 483 |
+
.manual-actions {
|
| 484 |
+
display: flex;
|
| 485 |
+
gap: 12px;
|
| 486 |
+
margin-top: 16px;
|
| 487 |
+
flex-wrap: wrap;
|
| 488 |
+
}
|
| 489 |
+
|
| 490 |
+
.widget h3::before {
|
| 491 |
+
content: '';
|
| 492 |
+
width: 4px;
|
| 493 |
+
height: 24px;
|
| 494 |
+
background: linear-gradient(180deg, var(--primary) 0%, #60a5fa 100%);
|
| 495 |
+
border-radius: 2px;
|
| 496 |
+
}
|
| 497 |
+
|
| 498 |
+
.widget-content {
|
| 499 |
+
color: var(--text-secondary);
|
| 500 |
+
line-height: 1.7;
|
| 501 |
+
max-height: 400px;
|
| 502 |
+
overflow-y: auto;
|
| 503 |
+
}
|
| 504 |
+
|
| 505 |
+
.widget-content p {
|
| 506 |
+
margin-bottom: 12px;
|
| 507 |
+
}
|
| 508 |
+
|
| 509 |
+
.placeholder {
|
| 510 |
+
color: var(--text-secondary);
|
| 511 |
+
font-style: italic;
|
| 512 |
+
opacity: 0.8;
|
| 513 |
+
}
|
| 514 |
+
|
| 515 |
+
/* Transcript Widget */
|
| 516 |
+
#transcriptWidget {
|
| 517 |
+
font-size: 1rem;
|
| 518 |
+
}
|
| 519 |
+
|
| 520 |
+
.transcript-live {
|
| 521 |
+
animation: fadeIn 0.3s ease;
|
| 522 |
+
}
|
| 523 |
+
|
| 524 |
+
@keyframes fadeIn {
|
| 525 |
+
from { opacity: 0; transform: translateY(-10px); }
|
| 526 |
+
to { opacity: 1; transform: translateY(0); }
|
| 527 |
+
}
|
| 528 |
+
|
| 529 |
+
/* Tables */
|
| 530 |
+
table {
|
| 531 |
+
width: 100%;
|
| 532 |
+
border-collapse: collapse;
|
| 533 |
+
margin-top: 16px;
|
| 534 |
+
background: var(--surface-alt);
|
| 535 |
+
border-radius: 14px;
|
| 536 |
+
overflow: hidden;
|
| 537 |
+
}
|
| 538 |
+
|
| 539 |
+
table th, table td {
|
| 540 |
+
padding: 14px 16px;
|
| 541 |
+
text-align: left;
|
| 542 |
+
border-bottom: 1px solid var(--border);
|
| 543 |
+
}
|
| 544 |
+
|
| 545 |
+
table th {
|
| 546 |
+
background: #eff6ff;
|
| 547 |
+
font-weight: 600;
|
| 548 |
+
color: var(--text);
|
| 549 |
+
text-transform: uppercase;
|
| 550 |
+
font-size: 0.78rem;
|
| 551 |
+
letter-spacing: 0.08em;
|
| 552 |
+
}
|
| 553 |
+
|
| 554 |
+
table tr:last-child td {
|
| 555 |
+
border-bottom: none;
|
| 556 |
+
}
|
| 557 |
+
|
| 558 |
+
table tbody tr:hover {
|
| 559 |
+
background: #f8fbff;
|
| 560 |
+
}
|
| 561 |
+
|
| 562 |
+
/* Lists */
|
| 563 |
+
ul {
|
| 564 |
+
list-style: none;
|
| 565 |
+
padding: 0;
|
| 566 |
+
}
|
| 567 |
+
|
| 568 |
+
li {
|
| 569 |
+
padding: 12px 16px;
|
| 570 |
+
margin-bottom: 8px;
|
| 571 |
+
background: var(--surface-alt);
|
| 572 |
+
border-radius: 10px;
|
| 573 |
+
border-left: 3px solid #93c5fd;
|
| 574 |
+
transition: border-color 0.2s ease, background 0.2s ease;
|
| 575 |
+
}
|
| 576 |
+
|
| 577 |
+
li:hover {
|
| 578 |
+
border-left-color: var(--primary);
|
| 579 |
+
background: #f8fbff;
|
| 580 |
+
}
|
| 581 |
+
|
| 582 |
+
/* Audio Player */
|
| 583 |
+
audio {
|
| 584 |
+
width: 100%;
|
| 585 |
+
margin-top: 16px;
|
| 586 |
+
border-radius: 12px;
|
| 587 |
+
background: var(--surface-alt);
|
| 588 |
+
}
|
| 589 |
+
|
| 590 |
+
/* Recording Animation */
|
| 591 |
+
.recording-wave {
|
| 592 |
+
display: none;
|
| 593 |
+
align-items: center;
|
| 594 |
+
gap: 4px;
|
| 595 |
+
height: 40px;
|
| 596 |
+
}
|
| 597 |
+
|
| 598 |
+
.recording-wave.active {
|
| 599 |
+
display: flex;
|
| 600 |
+
}
|
| 601 |
+
|
| 602 |
+
.wave-bar {
|
| 603 |
+
width: 4px;
|
| 604 |
+
height: 100%;
|
| 605 |
+
background: var(--danger);
|
| 606 |
+
border-radius: 2px;
|
| 607 |
+
animation: wave 1.2s ease-in-out infinite;
|
| 608 |
+
}
|
| 609 |
+
|
| 610 |
+
.wave-bar:nth-child(1) { animation-delay: 0s; }
|
| 611 |
+
.wave-bar:nth-child(2) { animation-delay: 0.1s; }
|
| 612 |
+
.wave-bar:nth-child(3) { animation-delay: 0.2s; }
|
| 613 |
+
.wave-bar:nth-child(4) { animation-delay: 0.3s; }
|
| 614 |
+
.wave-bar:nth-child(5) { animation-delay: 0.4s; }
|
| 615 |
+
|
| 616 |
+
@keyframes wave {
|
| 617 |
+
0%, 100% { height: 20%; }
|
| 618 |
+
50% { height: 100%; }
|
| 619 |
+
}
|
| 620 |
+
|
| 621 |
+
/* Scrollbar */
|
| 622 |
+
::-webkit-scrollbar {
|
| 623 |
+
width: 8px;
|
| 624 |
+
}
|
| 625 |
+
|
| 626 |
+
::-webkit-scrollbar-track {
|
| 627 |
+
background: transparent;
|
| 628 |
+
}
|
| 629 |
+
|
| 630 |
+
::-webkit-scrollbar-thumb {
|
| 631 |
+
background: #cbd5e1;
|
| 632 |
+
border-radius: 4px;
|
| 633 |
+
}
|
| 634 |
+
|
| 635 |
+
::-webkit-scrollbar-thumb:hover {
|
| 636 |
+
background: #94a3b8;
|
| 637 |
+
}
|
| 638 |
+
</style>
|
| 639 |
+
<script type="module" crossorigin src="./assets/index-DwF4hvla.js"></script>
|
| 640 |
+
</head>
|
| 641 |
+
<body>
|
| 642 |
+
<!-- Loading Screen -->
|
| 643 |
+
<div class="loading-overlay" id="loadingOverlay">
|
| 644 |
+
<div class="loading-content">
|
| 645 |
+
<div class="loading-spinner"></div>
|
| 646 |
+
<h1>MedScribe</h1>
|
| 647 |
+
<p>Initializing AI-powered medical scribe...</p>
|
| 648 |
+
<div class="progress-bar">
|
| 649 |
+
<div class="progress-fill" id="progressFill"></div>
|
| 650 |
+
</div>
|
| 651 |
+
<div class="progress-text" id="progressText">Starting...</div>
|
| 652 |
+
</div>
|
| 653 |
+
</div>
|
| 654 |
+
|
| 655 |
+
<div class="container">
|
| 656 |
+
<div class="header">
|
| 657 |
+
<div class="panel-label">Clinical Workspace</div>
|
| 658 |
+
<h1>MedScribe</h1>
|
| 659 |
+
<p>Private medical documentation workspace for capturing consultations, generating structured clinical notes, and preparing printable reports.</p>
|
| 660 |
+
</div>
|
| 661 |
+
|
| 662 |
+
<div class="intro-card">
|
| 663 |
+
<section class="intro-panel">
|
| 664 |
+
<h2>Focused consultation capture</h2>
|
| 665 |
+
<p>Record a session or enter the transcript manually. MedScribe structures the note into the sections clinicians actually review: history, prescriptions, orders, treatment plan, and summary.</p>
|
| 666 |
+
<div class="control-group">
|
| 667 |
+
<div class="action-note">Runs locally in the browser</div>
|
| 668 |
+
<div class="action-note">Liquid AI extraction engine</div>
|
| 669 |
+
<div class="action-note">Printable report output</div>
|
| 670 |
+
</div>
|
| 671 |
+
</section>
|
| 672 |
+
<aside class="summary-panel">
|
| 673 |
+
<h2>Workflow</h2>
|
| 674 |
+
<p>Use the session controls below, then review and print the generated note once the transcript has been processed.</p>
|
| 675 |
+
<dl>
|
| 676 |
+
<div>
|
| 677 |
+
<dt>Step 1</dt>
|
| 678 |
+
<dd>Start a session or open manual entry</dd>
|
| 679 |
+
</div>
|
| 680 |
+
<div>
|
| 681 |
+
<dt>Step 2</dt>
|
| 682 |
+
<dd>Capture or paste the consultation transcript</dd>
|
| 683 |
+
</div>
|
| 684 |
+
<div>
|
| 685 |
+
<dt>Step 3</dt>
|
| 686 |
+
<dd>Review the structured report and print when ready</dd>
|
| 687 |
+
</div>
|
| 688 |
+
</dl>
|
| 689 |
+
</aside>
|
| 690 |
+
</div>
|
| 691 |
+
|
| 692 |
+
<div class="status-bar">
|
| 693 |
+
<div class="status-indicator" id="statusIndicator"></div>
|
| 694 |
+
<div class="status-text" id="statusText">Initializing...</div>
|
| 695 |
+
<div class="recording-wave" id="recordingWave">
|
| 696 |
+
<div class="wave-bar"></div>
|
| 697 |
+
<div class="wave-bar"></div>
|
| 698 |
+
<div class="wave-bar"></div>
|
| 699 |
+
<div class="wave-bar"></div>
|
| 700 |
+
<div class="wave-bar"></div>
|
| 701 |
+
</div>
|
| 702 |
+
</div>
|
| 703 |
+
|
| 704 |
+
<div class="activity-progress hidden" id="activityProgress">
|
| 705 |
+
<div class="activity-progress-text" id="activityProgressText">Preparing report generation...</div>
|
| 706 |
+
<div class="progress-bar">
|
| 707 |
+
<div class="progress-fill" id="activityProgressFill"></div>
|
| 708 |
+
</div>
|
| 709 |
+
</div>
|
| 710 |
+
|
| 711 |
+
<div class="controls">
|
| 712 |
+
<button class="btn-primary" id="startBtn" disabled>
|
| 713 |
+
Start Session
|
| 714 |
+
</button>
|
| 715 |
+
<button class="btn-danger" id="stopBtn" disabled>
|
| 716 |
+
Finish and Generate
|
| 717 |
+
</button>
|
| 718 |
+
<button class="btn-secondary" id="printBtn" disabled>
|
| 719 |
+
Print Report
|
| 720 |
+
</button>
|
| 721 |
+
</div>
|
| 722 |
+
|
| 723 |
+
<div class="dashboard">
|
| 724 |
+
<div class="widget full-width">
|
| 725 |
+
<div class="widget-header">
|
| 726 |
+
<h3>Transcript</h3>
|
| 727 |
+
<button class="btn-outline btn-small" id="toggleManualBtn" type="button">
|
| 728 |
+
Manual Entry
|
| 729 |
+
</button>
|
| 730 |
+
</div>
|
| 731 |
+
<div class="widget-content" id="transcriptWidget">
|
| 732 |
+
<div class="placeholder">The transcript will appear here once a session starts or manual text is submitted.</div>
|
| 733 |
+
</div>
|
| 734 |
+
<div class="manual-input-panel" id="manualInputSection">
|
| 735 |
+
<p>Paste dictated notes or type the consultation transcript directly here, then generate the structured report.</p>
|
| 736 |
+
<textarea
|
| 737 |
+
class="manual-textarea"
|
| 738 |
+
id="manualTextInput"
|
| 739 |
+
placeholder="Enter or paste consultation transcript here...
|
| 740 |
+
|
| 741 |
+
Example: Patient complains of headache for 3 days, fever since yesterday. History of present illness includes nausea and photophobia. On examination, patient appears febrile with temperature 38.5°C. BP 130/80 mmHg.
|
| 742 |
+
|
| 743 |
+
Prescribed: Paracetamol 500mg TID for fever, Ibuprofen 400mg PRN for pain.
|
| 744 |
+
|
| 745 |
+
Recommended: CBC, fasting blood sugar. Chest X-ray.
|
| 746 |
+
|
| 747 |
+
Advice: Rest, plenty of fluids, soft diet."
|
| 748 |
+
></textarea>
|
| 749 |
+
<div class="manual-actions">
|
| 750 |
+
<button class="btn-primary" id="processTextBtn" type="button">
|
| 751 |
+
Generate Report
|
| 752 |
+
</button>
|
| 753 |
+
<button class="btn-secondary btn-small" id="clearManualTextBtn" type="button">
|
| 754 |
+
Clear Text
|
| 755 |
+
</button>
|
| 756 |
+
</div>
|
| 757 |
+
</div>
|
| 758 |
+
<audio id="audioPlayer" controls style="display: none;"></audio>
|
| 759 |
+
</div>
|
| 760 |
+
|
| 761 |
+
<div class="widget">
|
| 762 |
+
<h3>Clinical Note</h3>
|
| 763 |
+
<div class="widget-content" id="incidentWidget">
|
| 764 |
+
<div class="placeholder">Structured clinical details will appear after extraction.</div>
|
| 765 |
+
</div>
|
| 766 |
+
</div>
|
| 767 |
+
|
| 768 |
+
<div class="widget">
|
| 769 |
+
<h3>Prescription</h3>
|
| 770 |
+
<div class="widget-content" id="prescriptionWidget">
|
| 771 |
+
<div class="placeholder">Medication orders will appear after extraction.</div>
|
| 772 |
+
</div>
|
| 773 |
+
</div>
|
| 774 |
+
|
| 775 |
+
<div class="widget">
|
| 776 |
+
<h3>Lab Orders</h3>
|
| 777 |
+
<div class="widget-content" id="labWidget">
|
| 778 |
+
<div class="placeholder">Laboratory recommendations will appear after extraction.</div>
|
| 779 |
+
</div>
|
| 780 |
+
</div>
|
| 781 |
+
|
| 782 |
+
<div class="widget">
|
| 783 |
+
<h3>Imaging Orders</h3>
|
| 784 |
+
<div class="widget-content" id="radiologyWidget">
|
| 785 |
+
<div class="placeholder">Imaging recommendations will appear after extraction.</div>
|
| 786 |
+
</div>
|
| 787 |
+
</div>
|
| 788 |
+
|
| 789 |
+
<div class="widget">
|
| 790 |
+
<h3>Treatment Plan</h3>
|
| 791 |
+
<div class="widget-content" id="treatmentWidget">
|
| 792 |
+
<div class="placeholder">The treatment plan will appear after extraction.</div>
|
| 793 |
+
</div>
|
| 794 |
+
</div>
|
| 795 |
+
|
| 796 |
+
<div class="widget">
|
| 797 |
+
<h3>Diet and Lifestyle</h3>
|
| 798 |
+
<div class="widget-content" id="dietWidget">
|
| 799 |
+
<div class="placeholder">Dietary and lifestyle advice will appear after extraction.</div>
|
| 800 |
+
</div>
|
| 801 |
+
</div>
|
| 802 |
+
|
| 803 |
+
<div class="widget full-width">
|
| 804 |
+
<h3>Clinical Summary</h3>
|
| 805 |
+
<div class="widget-content" id="summaryWidget">
|
| 806 |
+
<div class="placeholder">The consultation summary will appear after extraction.</div>
|
| 807 |
+
</div>
|
| 808 |
+
</div>
|
| 809 |
+
</div>
|
| 810 |
+
</div>
|
| 811 |
+
|
| 812 |
+
</body>
|
| 813 |
</html>
|