Skip to content
Open
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
2 changes: 1 addition & 1 deletion server/routes/assessments.routes.ts
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ assessmentsRouter.patch(
async (req, res) => {
try {
const id = parseInt(req.params.id as string, 10);
if (isNaN(id) || id <= 0) {
if (Number.isNaN(id) || id <= 0) {
return res.status(400).json({ message: "api.errors.invalidAssessmentId" });
}

Expand Down
8 changes: 4 additions & 4 deletions server/services/fhirParser.ts
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ export function parseFhirBundle(payload: any): NormalizedFhirStructure {
}

if (resource.component && Array.isArray(resource.component)) {
obs.component = resource.component.map((comp: any) => ({
obs.component = resource.(component ?? []).map((comp: any) => ({
code: comp.code,
valueQuantity: comp.valueQuantity ? { value: Number(comp.valueQuantity.value) } : undefined,
}));
Expand Down Expand Up @@ -567,7 +567,7 @@ export function convertToInternalSchema(structure: NormalizedFhirStructure): Con
? extractClinicalNoteDateWarnings(clinicalNote)
: [];

const dateWarnings = rawDateWarnings.map((d) => {
const dateWarnings = (rawDateWarnings ?? []).map((d) => {
// Reconstruct both interpretations for display purposes
const a = parseInt(d.rawMatch.split(/[\/\-]/)[0], 10);
const b = parseInt(d.rawMatch.split(/[\/\-]/)[1], 10);
Expand All @@ -588,8 +588,8 @@ export function convertToInternalSchema(structure: NormalizedFhirStructure): Con
confidence: d.confidence,
ambiguous: d.ambiguous,
warning: d.warning,
mmddInterpretation: !isNaN(a) && !isNaN(b) && !isNaN(y) ? makeISO(y, a, b) : null,
ddmmInterpretation: !isNaN(a) && !isNaN(b) && !isNaN(y) ? makeISO(y, b, a) : null,
mmddInterpretation: !Number.isNaN(a) && !Number.isNaN(b) && !Number.isNaN(y) ? makeISO(y, a, b) : null,
ddmmInterpretation: !Number.isNaN(a) && !Number.isNaN(b) && !Number.isNaN(y) ? makeISO(y, b, a) : null,
};
});

Expand Down
4 changes: 2 additions & 2 deletions server/services/report-scheduler.ts
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ class ReportScheduler {

const emailHtml = `
<div style="font-family: sans-serif; max-w: 600px; margin: 0 auto; color: #333;">
<h2 style="color: #2563eb;">Clinical Insight Engine - ${frequency.charAt(0).toUpperCase() + frequency.slice(1)} Summary</h2>
<h2 style="color: #2563eb;">Clinical Insight Engine - ${frequency[0].toUpperCase() + frequency.slice(1)} Summary</h2>
<p>Here is the high-level patient cohort statistics for the ${timeframeStr.toLowerCase()}:</p>

<div style="background-color: #f3f4f6; padding: 15px; border-radius: 8px; margin: 20px 0;">
Expand All @@ -84,7 +84,7 @@ class ReportScheduler {
</div>
`;

const emailSubject = `[Clinical Insight Engine] ${frequency.charAt(0).toUpperCase() + frequency.slice(1)} Summary Report`;
const emailSubject = `[Clinical Insight Engine] ${frequency[0].toUpperCase() + frequency.slice(1)} Summary Report`;

// 4. Send the emails
for (const user of subscribedUsers) {
Expand Down
2 changes: 1 addition & 1 deletion server/socket/notesSocket.ts
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ export function initNotesSocket(httpServer: HttpServer): void {
}

const assessmentId = parseInt(assessmentIdStr, 10);
if (isNaN(assessmentId)) {
if (Number.isNaN(assessmentId)) {
ws.close(1008, "Invalid assessmentId");
return;
}
Expand Down
Loading