Skip to content
Merged
Show file tree
Hide file tree
Changes from 1 commit
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 @@ -151,6 +151,9 @@ export class DocumentProcessorController {
report.labValues = result.analysis.labValues || [];

report.confidence = result.analysis.metadata.confidence || 0;
if (result.analysis.metadata.missingInformation) {
report.missingInformation = result.analysis.metadata.missingInformation;
}

// Create summary from simplified explanation or diagnoses
report.summary = result.simplifiedExplanation!;
Expand Down
3 changes: 3 additions & 0 deletions backend/src/reports/models/report.model.ts
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,9 @@ export class Report {
@ApiProperty({ description: 'File size in bytes' })
fileSize: number;

@ApiProperty({ description: 'Missing information in the report' })
missingInformation?: string[];

@ApiProperty({ description: 'Creation timestamp' })
createdAt: string;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
import { describe, expect, it } from 'vitest';
import { describe, expect, it, beforeAll, vi } from 'vitest';
import { IonSelectOption } from '@ionic/react';
import { Form, Formik } from 'formik';
import userEvent from '@testing-library/user-event';
Expand All @@ -7,6 +7,11 @@ import { render, screen, waitFor } from 'test/test-utils';

import SelectInput from '../SelectInput';

// Mock scrollIntoView globally
beforeAll(() => {
Element.prototype.scrollIntoView = vi.fn();
});

describe('SelectInput', () => {
it('should render successfully', async () => {
// ARRANGE
Expand Down
11 changes: 1 addition & 10 deletions frontend/src/common/models/medicalReport.ts
Original file line number Diff line number Diff line change
Expand Up @@ -39,15 +39,6 @@ export interface LabValue {
suggestions: string;
}

/**
* Interface for report metadata.
*/
export interface ReportMetadata {
isMedicalReport: boolean;
confidence: number;
missingInformation: string[];
}

/**
* Interface representing a medical report.
*/
Expand All @@ -64,10 +55,10 @@ export interface MedicalReport {
filePath: string;
originalFilename: string;
fileSize: number;
missingInformation?: string[];
status: ReportStatus;
errorMessage?: string; // Optional error message for the report
isMedicalReport?: boolean; // Optional flag to indicate if the report is a medical report
createdAt: string; // ISO date string
updatedAt: string; // ISO date string
metadata?: ReportMetadata; // Optional metadata for the report
}
8 changes: 5 additions & 3 deletions frontend/src/pages/Reports/components/AiAnalysisTab.tsx
Original file line number Diff line number Diff line change
Expand Up @@ -36,9 +36,11 @@ const AiAnalysisTab: React.FC<AiAnalysisTabProps> = ({
const confidenceScore = reportData.confidence;

const isLowConfidence = confidenceScore < 0.75;

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

return (
<div className="ai-analysis-tab">
Expand All @@ -47,7 +49,7 @@ const AiAnalysisTab: React.FC<AiAnalysisTabProps> = ({

{/* Low confidence notice */}
{isLowConfidence && <LowConfidenceNotice />}

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

Expand Down