Skip to content

Commit fc26c99

Browse files
authored
Merge pull request #116 from ModusCreateOrg/ADE-66
[ADE-66] add missingInformation field to report model and update processing logic
2 parents e024995 + 373cc51 commit fc26c99

File tree

6 files changed

+20
-43
lines changed

6 files changed

+20
-43
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

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

Lines changed: 2 additions & 29 deletions
Original file line numberDiff line numberDiff line change
@@ -1,41 +1,14 @@
11
import React from 'react';
22
import { useTranslation } from 'react-i18next';
3+
import redAlertIcon from 'assets/icons/red-alert.svg';
34

45
const EmergencyAlert: React.FC = () => {
56
const { t } = useTranslation();
67

78
return (
89
<div className="report-detail-page__emergency">
910
<div className="report-detail-page__emergency-icon">
10-
<svg
11-
width="20"
12-
height="20"
13-
viewBox="0 0 20 20"
14-
fill="none"
15-
xmlns="http://www.w3.org/2000/svg"
16-
>
17-
<path
18-
d="M9.25736 3.99072C9.52536 3.5167 10.1999 3.5167 10.4679 3.99072L17.8891 16.5347C18.1571 17.0087 17.8199 17.5999 17.2839 17.5999H2.44132C1.90536 17.5999 1.56816 17.0087 1.83616 16.5347L9.25736 3.99072Z"
19-
stroke="#C93A54"
20-
strokeWidth="1.5"
21-
strokeLinecap="round"
22-
strokeLinejoin="round"
23-
/>
24-
<path
25-
d="M9.8623 7.20001V11.2"
26-
stroke="#C93A54"
27-
strokeWidth="1.5"
28-
strokeLinecap="round"
29-
strokeLinejoin="round"
30-
/>
31-
<path
32-
d="M9.8623 14.4H9.87027"
33-
stroke="#C93A54"
34-
strokeWidth="1.5"
35-
strokeLinecap="round"
36-
strokeLinejoin="round"
37-
/>
38-
</svg>
11+
<img src={redAlertIcon} width="25" height="25" alt="Emergency Alert" />
3912
</div>
4013
<p className="report-detail-page__emergency-text">
4114
{t('report.emergency.message', { ns: 'reportDetail' })}

0 commit comments

Comments
 (0)