Skip to content

Commit 28d8cd8

Browse files
committed
feat: Add loading and error handling for report detail page, enhance i18n support with new translation keys
1 parent dc06367 commit 28d8cd8

File tree

15 files changed

+322
-95
lines changed

15 files changed

+322
-95
lines changed

frontend/src/common/models/medicalReport.ts

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -22,6 +22,7 @@ export enum ProcessingStatus {
2222
PROCESSED = 'processed',
2323
UNPROCESSED = 'unprocessed',
2424
IN_PROGRESS = 'in_progress',
25+
FAILED = 'failed',
2526
}
2627

2728
/**

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

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,6 +70,9 @@
7070
"required-path": "{{path}} is required. ",
7171
"url": "Must be a URL. "
7272
},
73+
"loading": {
74+
"report": "Loading report..."
75+
},
7376
"no": "no",
7477
"updated": "updated",
7578
"welcome": "Welcome",
@@ -79,4 +82,4 @@
7982
"title": "AI Assistant"
8083
}
8184
}
82-
}
85+
}

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

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,9 @@
44
},
55
"ai": {
66
"content_filtered": "I couldn't find an answer. Please try rephrasing your question or consult your healthcare provider."
7-
}
8-
}
7+
},
8+
"loading": {
9+
"report": "Error loading the report. Please try again."
10+
},
11+
"no-report-data": "No report data available."
12+
}

frontend/src/common/utils/i18n/resources/en/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,6 +4,7 @@ import common from './common.json';
44
import errors from './errors.json';
55
import home from './home.json';
66
import report from './report.json';
7+
import reportDetail from './reportDetail.json';
78
import user from './user.json';
89

9-
export default { account, auth, common, errors, home, report, user };
10+
export default { account, auth, common, errors, home, report, reportDetail, user };
Lines changed: 91 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,91 @@
1+
{
2+
"detail": {
3+
"title": "Report Detail",
4+
"loading": "Loading report...",
5+
"errorLoading": "Error loading report. Please try again later.",
6+
"aiInsights": "AI Insights",
7+
"testResults": "Test Results",
8+
"test": "Test",
9+
"results": "Results",
10+
"refRange": "Ref. Range",
11+
"reportDate": "Report Date",
12+
"medicalComments": "Medical Comments",
13+
"hemoglobin": "Hemoglobin",
14+
"ldl": "LDL Cholesterol",
15+
"glucose": "Fasting Blood Glucose",
16+
"alt": "ALT (Liver Enzyme)",
17+
"wbc": "WBC (White Blood Cells)",
18+
"vitaminD": "Vitamin D (25-OH)",
19+
"cholesterol": "Total Cholesterol",
20+
"bookmarkAdded": "Report added to bookmarks",
21+
"bookmarkRemoved": "Report removed from bookmarks",
22+
"aiInsightsContent": "Based on the blood test results, our AI has identified several points of interest that may require attention or further discussion with your healthcare provider.",
23+
"insight1Title": "Hemoglobin Level",
24+
"insight1Content": "Your hemoglobin level is slightly below the reference range. This could indicate mild anemia, which may cause fatigue and weakness.",
25+
"insight2Title": "Cholesterol Levels",
26+
"insight2Content": "Both your LDL cholesterol and total cholesterol are elevated, which may increase your risk for cardiovascular disease.",
27+
"insight3Title": "Blood Glucose",
28+
"insight3Content": "Your fasting blood glucose is elevated, potentially indicating prediabetes. Lifestyle modifications may help improve this value.",
29+
"hemoglobinComment": "The patient's hemoglobin level is 12.5 g/dL, which falls within the lower end of the normal reference range for most adults. While this value may still be considered acceptable, it is important to assess it in the context of the patient's age, sex, clinical symptoms, and medical history.",
30+
"emergencyWarning": "Please contact your doctor or seek emergency care immediately.",
31+
"flaggedValues": "Flagged values",
32+
"highLdl": "High LDL Cholesterol",
33+
"lowHemoglobin": "Low Hemoglobin (10.1 g/dL)",
34+
"conclusion": "Conclusion:",
35+
"suggestions": "Suggestions:",
36+
"ldlConclusion": "Elevated LDL (bad cholesterol) increases your risk of cardiovascular disease",
37+
"ldlSuggestion1": "Consider a heart-healthy diet (e.g., Mediterranean).",
38+
"ldlSuggestion2": "Increase physical activity.",
39+
"ldlSuggestion3": "Discuss statin therapy with your doctor if not already on one.",
40+
"hemoglobinConclusion": "This level suggests anemia, which may cause fatigue and weakness.",
41+
"hemoglobinSuggestion1": "Test for iron, B12, and folate deficiency.",
42+
"hemoglobinSuggestion2": "Consider iron-rich foods or supplements after medical consultation already on one."
43+
},
44+
"list": {
45+
"title": "Reports",
46+
"emptyState": "No reports found",
47+
"uploadPrompt": "Upload a medical report to get started",
48+
"filterAll": "All",
49+
"filterBookmarked": "Bookmarked",
50+
"noBookmarksTitle": "No Bookmarked Reports",
51+
"noBookmarksMessage": "Bookmark reports to find them quickly here",
52+
"sortButton": "Sort reports",
53+
"filterButton": "Filter reports",
54+
"categoryGeneral": "General",
55+
"categoryBrain": "Brain",
56+
"categoryHeart": "Heart"
57+
},
58+
"report": {
59+
"analysis": {
60+
"title": "Results Analysis"
61+
},
62+
"emergency": {
63+
"message": "Please contact your doctor or seek emergency care immediately."
64+
},
65+
"flagged-values": {
66+
"title": "Flagged values"
67+
},
68+
"normal-values": {
69+
"title": "Normal values"
70+
},
71+
"conclusion": {
72+
"title": "Conclusion"
73+
},
74+
"suggestions": {
75+
"title": "Suggestions"
76+
},
77+
"doctor-note": "With all interpretations, these results should be discussed with your doctor.",
78+
"ai-help": {
79+
"title": "Still need further clarifications?",
80+
"action": "Ask our AI Assistant"
81+
},
82+
"action": {
83+
"discard": "Discard",
84+
"new-upload": "New Upload"
85+
},
86+
"tabs": {
87+
"ai-insights": "AI Insights",
88+
"original-report": "Original Report"
89+
}
90+
}
91+
}

frontend/src/common/utils/i18n/resources/es/common.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -64,9 +64,12 @@
6464
"min": "Debe tener al menos {{min}} caracteres. ",
6565
"oneOf": "Debe ser uno de: {{values}} ",
6666
"required": "Requerido. ",
67-
"required-path": "{{path}} es obligatorio. ",
67+
"required-path": "{{path}} es requerido. ",
6868
"url": "Debe ser una URL. "
6969
},
70+
"loading": {
71+
"report": "Cargando informe..."
72+
},
7073
"no": "no",
7174
"updated": "actualizado",
7275
"welcome": "Bienvenido",
@@ -79,4 +82,4 @@
7982
"app": {
8083
"name": "MEDReport AI"
8184
}
82-
}
85+
}

frontend/src/common/utils/i18n/resources/es/errors.json

Lines changed: 6 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -4,5 +4,9 @@
44
},
55
"ai": {
66
"content_filtered": "No pude encontrar una respuesta. Intenta reformular tu pregunta o consulta a tu proveedor de salud."
7-
}
8-
}
7+
},
8+
"loading": {
9+
"report": "Error al cargar el informe. Por favor, inténtelo de nuevo."
10+
},
11+
"no-report-data": "No hay datos de informe disponibles."
12+
}
Lines changed: 12 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,12 @@
1+
{
2+
"chat": {
3+
"general": "Lo siento, algo salió mal. Por favor, inténtalo de nuevo."
4+
},
5+
"ai": {
6+
"content_filtered": "No pude encontrar una respuesta. Intenta reformular tu pregunta o consulta a tu proveedor de salud."
7+
},
8+
"loading": {
9+
"report": "Error al cargar el informe. Por favor, inténtelo de nuevo."
10+
},
11+
"no-report-data": "No hay datos de informe disponibles."
12+
}

frontend/src/common/utils/i18n/resources/es/index.ts

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,7 @@ import auth from './auth.json';
33
import common from './common.json';
44
import errors from './errors.json';
55
import home from './home.json';
6+
import reportDetail from './reportDetail.json';
67
import user from './user.json';
78

8-
export default { account, auth, common, errors, home, user };
9+
export default { account, auth, common, errors, home, reportDetail, user };
Lines changed: 35 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
{
2+
"report": {
3+
"analysis": {
4+
"title": "Análisis de resultados"
5+
},
6+
"emergency": {
7+
"message": "Por favor contacte a su médico o busque atención de emergencia inmediatamente."
8+
},
9+
"flagged-values": {
10+
"title": "Valores marcados"
11+
},
12+
"normal-values": {
13+
"title": "Valores normales"
14+
},
15+
"conclusion": {
16+
"title": "Conclusión"
17+
},
18+
"suggestions": {
19+
"title": "Sugerencias"
20+
},
21+
"doctor-note": "Con todas las interpretaciones, estos resultados deben ser discutidos con su médico.",
22+
"ai-help": {
23+
"title": "¿Todavía necesita más aclaraciones?",
24+
"action": "Pregunte a nuestro Asistente de IA"
25+
},
26+
"action": {
27+
"discard": "Descartar",
28+
"new-upload": "Nueva carga"
29+
},
30+
"tabs": {
31+
"ai-insights": "Información de IA",
32+
"original-report": "Informe original"
33+
}
34+
}
35+
}

0 commit comments

Comments
 (0)