Fix: chart review New clears all fields/notes, date context for AI, Bedrock vendor model-only models

- resetChartReview() clears all pasted notes, visit cards, labs, demographics, and output on New
- clearTab('chart') in encounters.js now calls resetChartReview() for complete reset
- chartReview route injects today's date so AI understands time-relative terms
- Bedrock models updated to vendor model-only with verified 2025 IDs (Sonnet 4, 3.7 Sonnet, 3.5 Sonnet v2, 3.5 Haiku)
- Removed Llama/Mistral/Titan from Bedrock; fixed incorrect vendor-model-4.6 Bedrock IDs
- Bump version to 2.8.0
This commit is contained in:
Daniel 2026-03-23 18:12:07 +01:00
parent 5139a15e51
commit c7f1bd4901
5 changed files with 57 additions and 20 deletions

View file

@ -1,6 +1,6 @@
{
"name": "pediatric-ai-scribe",
"version": "2.1.0",
"version": "2.8.0",
"description": "AI-powered pediatric clinical documentation platform",
"main": "server.js",
"scripts": {

View file

@ -10,6 +10,47 @@
var visitIndex = 1;
function resetChartReview() {
// Clear demographics and fields
['cr-age', 'cr-pmh', 'cr-instructions', 'chart-label'].forEach(function(id) {
var el = document.getElementById(id);
if (el) el.value = '';
});
var gender = document.getElementById('cr-gender');
if (gender) gender.value = '';
var type = document.getElementById('cr-type');
if (type) type.value = 'outpatient';
// Reset visit index and restore single empty visit card
visitIndex = 1;
visitsContainer.innerHTML = '<div class="card visit-card">' +
'<div class="card-header"><h3><i class="fas fa-calendar"></i> Visit / Note #1</h3>' +
'<button class="btn-sm btn-ghost remove-visit-btn"><i class="fas fa-trash"></i></button></div>' +
'<div class="note-entry"><div class="note-meta">' +
'<input type="date" class="visit-date">' +
'<select class="visit-type"><option value="outpatient">Outpatient Visit</option><option value="subspecialty">Subspecialty Note</option><option value="ed">ED Visit</option></select>' +
'<input type="text" class="visit-specialist" placeholder="Specialist name (if subspecialty)">' +
'<input type="text" class="visit-specialty" placeholder="Specialty (e.g., Endocrinology)"></div>' +
'<div class="editable-box visit-content" contenteditable="true" data-placeholder="Paste note here..."></div>' +
'<textarea class="visit-labs" placeholder="Labs from this visit (optional)" rows="3"></textarea></div></div>';
visitsContainer.querySelector('.remove-visit-btn').addEventListener('click', function() {
visitsContainer.querySelector('.visit-card').remove();
});
// Clear labs container - restore single empty entry
labsContainer.innerHTML = '<div class="lab-entry">' +
'<input type="date" class="lab-date">' +
'<textarea class="lab-values" placeholder="Lab results..." rows="3"></textarea>' +
'</div>';
// Clear output
reviewText.textContent = '';
outputCard.classList.add('hidden');
}
// Expose for encounters.js clearTab
window.resetChartReview = resetChartReview;
addVisitBtn.addEventListener('click', function() {
visitIndex++;
var card = document.createElement('div');

View file

@ -429,6 +429,10 @@
// Reset saved ID (memory + sessionStorage)
window['_savedEncId_' + type] = null;
try { sessionStorage.removeItem('_savedEncId_' + type); } catch(e) {}
// Chart review has additional fields/cards to clear
if (type === 'chart' && typeof window.resetChartReview === 'function') {
window.resetChartReview();
}
showToast('Ready for new patient', 'info');
}

View file

@ -18,8 +18,9 @@ router.post('/generate-chart-review', authMiddleware, async (req, res) => {
additionalInstructions
} = req.body;
const today = new Date().toLocaleDateString('en-US', { weekday: 'long', year: 'numeric', month: 'long', day: 'numeric' });
let prompt;
let clinicalData = `Patient: ${patientAge || 'Unknown'}, ${patientGender || 'Unknown'}`;
let clinicalData = `Today's date: ${today}\nPatient: ${patientAge || 'Unknown'}, ${patientGender || 'Unknown'}`;
if (pmh) clinicalData += `\nPMH: ${pmh}`;
if (type === 'ed' || (edVisits && edVisits.length > 0)) {

View file

@ -27,24 +27,15 @@ var OPENROUTER_MODELS = [
];
var BEDROCK_MODELS = [
{ id: 'anthropic/vendor-model-opus-4-6', name: 'vendor model Opus 4.6', cost: '~$0.075', tag: 'BEST NUANCE', category: 'premium',
bedrockId: 'anthropic.agent-config-opus-4-6-20251001-v1:0' },
{ id: 'anthropic/vendor-model-sonnet-4-6', name: 'vendor model Sonnet 4.6', cost: '~$0.015', tag: 'RECOMMENDED', category: 'premium',
bedrockId: 'anthropic.agent-config-sonnet-4-6-20251001-v1:0' },
{ id: 'anthropic/vendor-model-sonnet-4', name: 'vendor model Sonnet 4', cost: '~$0.015', tag: 'BEST', category: 'premium',
// vendor model models only — verified Bedrock IDs (2025)
{ id: 'anthropic/vendor-model-sonnet-4', name: 'vendor model Sonnet 4', cost: '~$0.015', tag: 'RECOMMENDED', category: 'premium',
bedrockId: 'anthropic.agent-config-sonnet-4-20250514-v1:0' },
{ id: 'anthropic/vendor-model-3.5-sonnet', name: 'vendor model 3.5 Sonnet', cost: '~$0.015', tag: 'MEDICAL', category: 'premium',
{ id: 'anthropic/vendor-model-3-7-sonnet', name: 'vendor model 3.7 Sonnet', cost: '~$0.015', tag: 'SMART', category: 'premium',
bedrockId: 'anthropic.agent-config-3-7-sonnet-20250219-v1:0' },
{ id: 'anthropic/vendor-model-3.5-sonnet', name: 'vendor model 3.5 Sonnet v2', cost: '~$0.015', tag: 'MEDICAL', category: 'premium',
bedrockId: 'anthropic.agent-config-3-5-sonnet-20241022-v2:0' },
{ id: 'anthropic/vendor-model-3-haiku', name: 'vendor model 3 Haiku', cost: '~$0.001', tag: 'CHEAPEST', category: 'fast',
bedrockId: 'anthropic.agent-config-3-haiku-20240307-v1:0' },
{ id: 'meta-llama/llama-3.1-70b', name: 'Llama 3.1 70B', cost: '~$0.003', tag: 'GOOD', category: 'smart',
bedrockId: 'meta.llama3-1-70b-instruct-v1:0' },
{ id: 'meta-llama/llama-3.1-8b', name: 'Llama 3.1 8B', cost: '~$0.001', tag: 'FAST', category: 'fast',
bedrockId: 'meta.llama3-1-8b-instruct-v1:0' },
{ id: 'mistral/mistral-large', name: 'Mistral Large', cost: '~$0.008', tag: 'GOOD', category: 'smart',
bedrockId: 'mistral.mistral-large-2407-v1:0' },
{ id: 'amazon/titan-text-premier', name: 'Amazon Titan Premier', cost: '~$0.002', tag: 'AWS', category: 'fast',
bedrockId: 'amazon.titan-text-premier-v1:0' }
{ id: 'anthropic/vendor-model-3.5-haiku', name: 'vendor model 3.5 Haiku', cost: '~$0.003', tag: 'FAST', category: 'smart',
bedrockId: 'anthropic.agent-config-3-5-haiku-20241022-v1:0' }
];
var AZURE_MODELS = [
@ -69,7 +60,7 @@ function getAvailableModels() {
function getDefaultModel() {
switch (activeProvider) {
case 'bedrock': return 'anthropic/vendor-model-sonnet-4-6';
case 'bedrock': return 'anthropic/vendor-model-sonnet-4';
case 'azure': return process.env.AZURE_DEPLOYMENT_NAME || 'gpt-4o-mini';
case 'openrouter':
default: return 'google/gemini-2.5-flash';
@ -78,7 +69,7 @@ function getDefaultModel() {
function getFallbackModel() {
switch (activeProvider) {
case 'bedrock': return 'meta-llama/llama-3.1-8b';
case 'bedrock': return 'anthropic/vendor-model-3.5-haiku';
case 'azure': return process.env.AZURE_DEPLOYMENT_NAME || 'gpt-4o-mini';
case 'openrouter':
default: return 'deepseek/deepseek-chat-v3-0324';