Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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:
`;
Expand Down
4 changes: 2 additions & 2 deletions backend/src/services/perplexity.service.ts
Original file line number Diff line number Diff line change
Expand Up @@ -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);

Expand All @@ -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.`;
Expand Down
9 changes: 0 additions & 9 deletions frontend/src/pages/Reports/components/AiAnalysisTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -37,11 +36,6 @@ const AiAnalysisTab: React.FC<AiAnalysisTabProps> = ({

const isLowConfidence = confidenceScore < 0.75;

// Check if reference ranges are missing
const hasReferenceRangesMissing = !!reportData.missingInformation?.includes(
'reference-ranges-missing',
);

return (
<div className="ai-analysis-tab">
{/* Emergency alert if needed */}
Expand All @@ -50,9 +44,6 @@ const AiAnalysisTab: React.FC<AiAnalysisTabProps> = ({
{/* Low confidence notice */}
{isLowConfidence && <LowConfidenceNotice />}

{/* Missing reference ranges notice */}
{hasReferenceRangesMissing && <MissingReferenceRangesNotice />}

{/* Flagged values section */}
{flaggedValues.length > 0 && (
<FlaggedValuesSection
Expand Down

This file was deleted.