Skip to content

Commit bfdc653

Browse files
authored
Merge pull request #84 from ModusCreateOrg/ADE-31-reports-page
[ADE-31] Reports page
2 parents af2fd2f + efb9d0a commit bfdc653

File tree

19 files changed

+213
-156
lines changed

19 files changed

+213
-156
lines changed
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading
Lines changed: 4 additions & 0 deletions
Loading
Lines changed: 3 additions & 0 deletions
Loading

frontend/src/assets/icons/sort.svg

Lines changed: 4 additions & 0 deletions
Loading

frontend/src/common/api/__tests__/reportService.test.ts

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -98,7 +98,7 @@ const mockReports = [
9898
id: '2',
9999
title: 'brain-scan',
100100
status: ReportStatus.UNREAD,
101-
category: ReportCategory.NEUROLOGICAL,
101+
category: ReportCategory.BRAIN,
102102
date: '2024-03-24',
103103
}
104104
];
@@ -154,20 +154,20 @@ describe('reportService', () => {
154154
const heartReport = await uploadReport(heartFile);
155155
expect(heartReport.category).toBe(ReportCategory.HEART);
156156

157-
// Mock response for neurological file
157+
// Mock response for brain file
158158
(axios.post as ReturnType<typeof vi.fn>).mockResolvedValueOnce({
159159
data: {
160160
id: 'neuro-id',
161161
title: 'brain-scan',
162162
status: ReportStatus.UNREAD,
163-
category: ReportCategory.NEUROLOGICAL,
163+
category: ReportCategory.BRAIN,
164164
date: '2024-05-10',
165165
}
166166
});
167167

168168
const neuroFile = new File(['test'], 'brain-scan.pdf', { type: 'application/pdf' });
169169
const neuroReport = await uploadReport(neuroFile);
170-
expect(neuroReport.category).toBe(ReportCategory.NEUROLOGICAL);
170+
expect(neuroReport.category).toBe(ReportCategory.BRAIN);
171171
});
172172

173173
test('should handle upload without progress callback', async () => {

frontend/src/common/api/reportService.ts

Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -224,3 +224,18 @@ export const toggleReportBookmark = async (
224224
throw new ReportError('Failed to toggle bookmark status');
225225
}
226226
};
227+
228+
/**
229+
* Fetches a single medical report by ID
230+
* @param reportId The ID of the report to fetch
231+
* @returns Promise with the report data
232+
*/
233+
export const fetchReportById = async (reportId: string): Promise<MedicalReport> => {
234+
try {
235+
const response = await axios.get(`${API_URL}/api/reports/${reportId}`, await getAuthConfig());
236+
return response.data;
237+
} catch (error) {
238+
console.error('Error fetching report:', error);
239+
throw error;
240+
}
241+
};

frontend/src/common/models/medicalReport.ts

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -2,13 +2,9 @@
22
* Possible categories for medical reports.
33
*/
44
export enum ReportCategory {
5-
GENERAL = 'General',
6-
NEUROLOGICAL = 'Neurological',
7-
OFTALMOLOGICAL = 'Oftalmological',
8-
HEART = 'Heart',
9-
GASTRO = 'Gastroenterology',
10-
ORTHOPEDIC = 'Orthopedic',
11-
OTHER = 'Other'
5+
GENERAL = 'general',
6+
BRAIN = 'brain',
7+
HEART = 'heart',
128
}
139

1410
/**

frontend/src/common/utils/i18n/resources/en/home.json

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,12 +32,8 @@
3232
},
3333
"categories": {
3434
"general": "General",
35-
"neurological": "Neurological",
36-
"oftalmological": "Oftalmological",
3735
"heart": "Heart",
38-
"gastro": "Gastroenterology",
39-
"orthopedic": "Orthopedic",
40-
"other": "Other"
36+
"brain": "Brain"
4137
},
4238
"status": {
4339
"read": "Read",

frontend/src/common/utils/i18n/resources/en/report.json

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22
"detail": {
33
"title": "Report Detail",
44
"loading": "Loading report...",
5+
"errorLoading": "Error loading report. Please try again later.",
56
"aiInsights": "AI Insights",
67
"testResults": "Test Results",
78
"test": "Test",

0 commit comments

Comments
 (0)