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
Copy file name to clipboardExpand all lines: backend/src/document-processor/services/aws-bedrock.service.ts
+3-1Lines changed: 3 additions & 1 deletion
Original file line number
Diff line number
Diff line change
@@ -72,7 +72,8 @@ For lab values:
72
72
- Set "isCritical" to true for urgent medical situations
73
73
- Provide brief "conclusion" about what the value means for health
74
74
- Add brief "suggestions" based on the value
75
-
- If reference ranges are missing, add "reference-ranges-missing" to missingInformation and use standard ranges
75
+
- IMPORTANT: For ANY lab value where reference/normal ranges are not explicitly stated in the document, you MUST add "reference-ranges-missing" to the missingInformation array and use standard medical ranges
76
+
- If you use standard ranges because the document lacks them, clearly mark this in your response
76
77
77
78
CRITICAL FORMATTING RULES:
78
79
- Begin immediately with { and end with }
@@ -87,6 +88,7 @@ Common errors to avoid:
87
88
- Starting with "This appears to be a medical report..."
88
89
- Creating nested JSON structures
89
90
- Placing data inside definition fields
91
+
- IMPORTANT: Failing to add "reference-ranges-missing" to missingInformation when ANY lab value lacks explicit ranges
this.logger.log('Reviewing medical document analysis with Perplexity');
280
284
281
285
constsystemPrompt=
282
-
'Medical information verification specialist. Verify analysis against trusted sources (Mayo Clinic, Cleveland Clinic, CDC, NIH, WHO, medical journals). Ensure accuracy of lab ranges, interpretations, and recommendations. Return only corrected JSON.';
286
+
'Medical information verification specialist. Verify analysis against trusted sources (Mayo Clinic, Cleveland Clinic, CDC, NIH, WHO, medical journals). Ensure accuracy of lab ranges, interpretations, and recommendations. Return only corrected JSON. IMPORTANT: Do not modify the metadata object, especially preserve the metadata.missingInformation array exactly as provided.';
@@ -289,6 +293,7 @@ export class PerplexityService {
289
293
`2. Interpretations of abnormal values\n`+
290
294
`3. Medical conclusions and recommendations\n`+
291
295
`4. Lab value categorizations\n\n`+
296
+
`CRITICAL INSTRUCTION: Do NOT modify the metadata object. The metadata.missingInformation array must remain exactly as provided without any additions, removals, or changes.\n\n`+
292
297
`Analysis JSON:\n${analysisJson}\n\n`+
293
298
`Original Text:\n${originalText}\n\n`+
294
299
`Return ONLY corrected JSON with identical structure. No preamble, explanation, or text before/after JSON.`;
0 commit comments