Skip to content

Commit c09fff3

Browse files
committed
feat: add missingInformation field to report model and update processing logic
1 parent cc00864 commit c09fff3

File tree

5 files changed

+18
-14
lines changed

5 files changed

+18
-14
lines changed

backend/src/document-processor/controllers/document-processor.controller.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -151,6 +151,9 @@ export class DocumentProcessorController {
151151
report.labValues = result.analysis.labValues || [];
152152

153153
report.confidence = result.analysis.metadata.confidence || 0;
154+
if (result.analysis.metadata.missingInformation) {
155+
report.missingInformation = result.analysis.metadata.missingInformation;
156+
}
154157

155158
// Create summary from simplified explanation or diagnoses
156159
report.summary = result.simplifiedExplanation!;

backend/src/reports/models/report.model.ts

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -72,6 +72,9 @@ export class Report {
7272
@ApiProperty({ description: 'File size in bytes' })
7373
fileSize: number;
7474

75+
@ApiProperty({ description: 'Missing information in the report' })
76+
missingInformation?: string[];
77+
7578
@ApiProperty({ description: 'Creation timestamp' })
7679
createdAt: string;
7780

frontend/src/common/components/Input/__tests__/SelectInput.test.tsx

Lines changed: 6 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
import { describe, expect, it } from 'vitest';
1+
import { describe, expect, it, beforeAll, vi } from 'vitest';
22
import { IonSelectOption } from '@ionic/react';
33
import { Form, Formik } from 'formik';
44
import userEvent from '@testing-library/user-event';
@@ -7,6 +7,11 @@ import { render, screen, waitFor } from 'test/test-utils';
77

88
import SelectInput from '../SelectInput';
99

10+
// Mock scrollIntoView globally
11+
beforeAll(() => {
12+
Element.prototype.scrollIntoView = vi.fn();
13+
});
14+
1015
describe('SelectInput', () => {
1116
it('should render successfully', async () => {
1217
// ARRANGE

frontend/src/common/models/medicalReport.ts

Lines changed: 1 addition & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -39,15 +39,6 @@ export interface LabValue {
3939
suggestions: string;
4040
}
4141

42-
/**
43-
* Interface for report metadata.
44-
*/
45-
export interface ReportMetadata {
46-
isMedicalReport: boolean;
47-
confidence: number;
48-
missingInformation: string[];
49-
}
50-
5142
/**
5243
* Interface representing a medical report.
5344
*/
@@ -64,10 +55,10 @@ export interface MedicalReport {
6455
filePath: string;
6556
originalFilename: string;
6657
fileSize: number;
58+
missingInformation?: string[];
6759
status: ReportStatus;
6860
errorMessage?: string; // Optional error message for the report
6961
isMedicalReport?: boolean; // Optional flag to indicate if the report is a medical report
7062
createdAt: string; // ISO date string
7163
updatedAt: string; // ISO date string
72-
metadata?: ReportMetadata; // Optional metadata for the report
7364
}

frontend/src/pages/Reports/components/AiAnalysisTab.tsx

Lines changed: 5 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,11 @@ const AiAnalysisTab: React.FC<AiAnalysisTabProps> = ({
3636
const confidenceScore = reportData.confidence;
3737

3838
const isLowConfidence = confidenceScore < 0.75;
39-
39+
4040
// Check if reference ranges are missing
41-
const hasReferenceRangesMissing = reportData.metadata?.missingInformation?.includes('reference-ranges-missing');
41+
const hasReferenceRangesMissing = !!reportData.missingInformation?.includes(
42+
'reference-ranges-missing',
43+
);
4244

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

4850
{/* Low confidence notice */}
4951
{isLowConfidence && <LowConfidenceNotice />}
50-
52+
5153
{/* Missing reference ranges notice */}
5254
{hasReferenceRangesMissing && <MissingReferenceRangesNotice />}
5355

0 commit comments

Comments
 (0)