diff --git a/backend/src/document-processor/services/aws-bedrock.service.ts b/backend/src/document-processor/services/aws-bedrock.service.ts index 6d8dd08..4b851d6 100644 --- a/backend/src/document-processor/services/aws-bedrock.service.ts +++ b/backend/src/document-processor/services/aws-bedrock.service.ts @@ -72,7 +72,6 @@ For lab values: - Set "isCritical" to true for urgent medical situations - Provide brief "conclusion" about what the value means for health - Add brief "suggestions" based on the value -- 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 - If you use standard ranges because the document lacks them, clearly mark this in your response CRITICAL FORMATTING RULES: @@ -88,7 +87,6 @@ Common errors to avoid: - Starting with "This appears to be a medical report..." - Creating nested JSON structures - Placing data inside definition fields -- IMPORTANT: Failing to add "reference-ranges-missing" to missingInformation when ANY lab value lacks explicit ranges Document text: `; diff --git a/backend/src/services/perplexity.service.ts b/backend/src/services/perplexity.service.ts index 0d3b292..16028a9 100644 --- a/backend/src/services/perplexity.service.ts +++ b/backend/src/services/perplexity.service.ts @@ -283,7 +283,7 @@ export class PerplexityService { this.logger.log('Reviewing medical document analysis with Perplexity'); const systemPrompt = - '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.'; + '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.'; const analysisJson = JSON.stringify(analysis, null, 2); @@ -293,7 +293,7 @@ export class PerplexityService { `2. Interpretations of abnormal values\n` + `3. Medical conclusions and recommendations\n` + `4. Lab value categorizations\n\n` + - `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` + + `CRITICAL INSTRUCTION: Do NOT modify the metadata object.\n\n` + `Analysis JSON:\n${analysisJson}\n\n` + `Original Text:\n${originalText}\n\n` + `Return ONLY corrected JSON with identical structure. No preamble, explanation, or text before/after JSON.`; diff --git a/frontend/src/pages/Reports/components/AiAnalysisTab.tsx b/frontend/src/pages/Reports/components/AiAnalysisTab.tsx index cc1b0d5..fe6217c 100644 --- a/frontend/src/pages/Reports/components/AiAnalysisTab.tsx +++ b/frontend/src/pages/Reports/components/AiAnalysisTab.tsx @@ -4,7 +4,6 @@ import EmergencyAlert from './EmergencyAlert'; import FlaggedValuesSection from './FlaggedValuesSection'; import NormalValuesSection from './NormalValuesSection'; import LowConfidenceNotice from './LowConfidenceNotice'; -import MissingReferenceRangesNotice from './MissingReferenceRangesNotice'; interface AiAnalysisTabProps { reportData: MedicalReport; @@ -37,11 +36,6 @@ const AiAnalysisTab: React.FC = ({ const isLowConfidence = confidenceScore < 0.75; - // Check if reference ranges are missing - const hasReferenceRangesMissing = !!reportData.missingInformation?.includes( - 'reference-ranges-missing', - ); - return (
{/* Emergency alert if needed */} @@ -50,9 +44,6 @@ const AiAnalysisTab: React.FC = ({ {/* Low confidence notice */} {isLowConfidence && } - {/* Missing reference ranges notice */} - {hasReferenceRangesMissing && } - {/* Flagged values section */} {flaggedValues.length > 0 && ( { - const { t } = useTranslation(); - - return ( -
-
- Information Icon -
-
- {t('reports.missingReferenceRanges', { - ns: 'reportDetail', - defaultValue: - 'Reference ranges were not available on this report. The analysis may be limited without this information. Please consult with your healthcare provider for a complete interpretation.', - })} -
-
- ); -}; - -export default MissingReferenceRangesNotice; \ No newline at end of file