You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
@@ -45,30 +45,17 @@ export class AwsBedrockService {
45
45
privatereadonlyinferenceProfileArn?: string;
46
46
47
47
// Medical document analysis prompt
48
-
privatereadonlymedicalAnalysisPrompt=`Please analyze this medical document carefully, with specific attention to medical lab reports.
49
-
50
-
Look for and extract the following information:
51
-
1. Document title or main subject based on content
52
-
2. Document category based on organ system focus
53
-
3. Lab test values with their normal ranges and whether they are normal, high, or low (particularly important for blood work, metabolic panels, etc.)
54
-
4. Any diagnoses, findings, or medical observations with details and recommendations
55
-
5. Analyze if this is a medical document (lab report, test result, medical chart, prescription, etc.) and provide confidence level
56
-
57
-
This document may be a lab report showing blood work or other test results, so please pay special attention to tables, numeric values, reference ranges, and medical terminology.
58
-
59
-
IMPORTANT: Base your analysis on information from multiple trusted medical sources and authorities, including but not limited to:
60
-
- Mayo Clinic
61
-
- Cleveland Clinic
62
-
- CDC (Centers for Disease Control and Prevention)
63
-
- NIH (National Institutes of Health)
64
-
- WHO (World Health Organization)
65
-
- American Medical Association
66
-
- American Heart Association
67
-
- American Academy of Pediatrics
68
-
- UpToDate
69
-
- MedlinePlus
70
-
71
-
Format the response as a JSON object with the following structure:
48
+
privatereadonlymedicalAnalysisPrompt=`Analyze this medical document with focus on lab reports. Extract:
3. Lab values with ranges and status (normal/high/low)
53
+
4. Diagnoses, findings, and recommendations
54
+
5. Medical document verification with confidence level
55
+
56
+
Reference trusted sources: Mayo Clinic, Cleveland Clinic, CDC, NIH, WHO, AMA, etc.
57
+
58
+
Return ONLY a JSON object with this structure:
72
59
{
73
60
"title": string,
74
61
"category": string,
@@ -81,89 +68,25 @@ Format the response as a JSON object with the following structure:
81
68
}
82
69
}
83
70
84
-
For the title field, create a concise title that summarizes what the document is about (e.g., "Complete Blood Count Results", "Liver Function Test", "MRI Report").
85
-
For the category field, you MUST choose exactly one of these three values:
86
-
- "heart" - if the document focuses primarily on cardiac/cardiovascular issues or tests
87
-
- "brain" - if the document focuses primarily on neurological issues or brain-related tests
88
-
- "general" - for all other medical documents, or when the focus spans multiple systems
89
-
90
-
Set isMedicalReport to true if you see ANY medical content such as lab values, medical terminology, doctor's notes, or prescription information.
91
-
Set confidence between 0 and 1 based on document clarity and how confident you are about the medical nature of the document.
92
-
93
-
94
-
This is extremely important: If you see ANY lab values, numbers with units, or medical terminology, please consider this a medical document even if you're not 100% certain.
95
-
96
-
When extracting lab values:
97
-
1. Look for tables with numeric values and reference ranges
98
-
2. Include any values even if you're not sure of the meaning
99
-
3. For each lab value, use "status" field with values "normal", "high", or "low" based on whether the value falls within, above, or below the normal range
100
-
4. Set "isCritical" to true when the value indicates an urgent medical situation. Set it to false for values that are normal or only slightly abnormal.
101
-
5. Include a "conclusion" field that provides a brief interpretation of what this value indicates about the patient's health
102
-
6. Include a "suggestions" field that provides brief recommendations based on this value
103
-
7. IMPORTANT: If reference ranges are missing from the document, add "reference-ranges-missing" to the missingInformation array in metadata, and use standard reference ranges from trusted medical sources to determine the status.
104
-
105
-
EXTREMELY IMPORTANT FORMATTING INSTRUCTIONS:
106
-
1. ABSOLUTELY DO NOT START YOUR RESPONSE WITH ANY TEXT. Begin immediately with the JSON object.
107
-
2. Return ONLY the JSON object without any introduction, explanation, or text like "This appears to be a medical report..."
108
-
3. Do NOT include phrases like "Here is the information" or "formatted in the requested JSON structure"
109
-
4. Do NOT write any text before the opening brace { or after the closing brace }
110
-
5. Do NOT wrap the JSON in code blocks or add comments
111
-
6. Do NOT nest JSON inside other JSON fields
112
-
7. Start your response with the opening brace { and end with the closing brace }
113
-
8. CRITICAL: Do NOT place JSON data inside a definition field or any other field. Return only the direct JSON format requested.
114
-
9. Do NOT put explanatory text about how you structured the analysis inside the JSON.
115
-
10. Always provide empty arrays ([]) rather than null for empty fields.
116
-
11. YOU MUST NOT create a "term" called "Here is the information extracted" or similar phrases.
117
-
12. NEVER put actual data inside a "definition" field of a medical term.
118
-
119
-
YOU REPEATEDLY MAKE THESE MISTAKES:
120
-
- You create a "term" field with text like "Here is the information extracted"
121
-
- You start your response with "This appears to be a medical report..."
122
-
- You write "Here is the information extracted in the requested JSON format:" before the JSON
123
-
- THESE ARE WRONG and cause our system to fail
124
-
125
-
INCORRECT RESPONSE FORMATS (DO NOT DO THESE):
126
-
127
-
1) DO NOT DO THIS - Adding explanatory text before JSON:
128
-
"This appears to be a medical report. Here is the information extracted in the requested JSON format:
0 commit comments