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 @@ -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
31 changes: 2 additions & 29 deletions frontend/src/pages/Reports/components/EmergencyAlert.tsx
Original file line number Diff line number Diff line change
@@ -1,41 +1,14 @@
import React from 'react';
import { useTranslation } from 'react-i18next';
import redAlertIcon from 'assets/icons/red-alert.svg';

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

return (
<div className="report-detail-page__emergency">
<div className="report-detail-page__emergency-icon">
<svg
width="20"
height="20"
viewBox="0 0 20 20"
fill="none"
xmlns="http://www.w3.org/2000/svg"
>
<path
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"
stroke="#C93A54"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M9.8623 7.20001V11.2"
stroke="#C93A54"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
/>
<path
d="M9.8623 14.4H9.87027"
stroke="#C93A54"
strokeWidth="1.5"
strokeLinecap="round"
strokeLinejoin="round"
/>
</svg>
<img src={redAlertIcon} width="25" height="25" alt="Emergency Alert" />
</div>
<p className="report-detail-page__emergency-text">
{t('report.emergency.message', { ns: 'reportDetail' })}
Expand Down