coronasafe/care_fe

View on GitHub
src/components/Patient/TreatmentSummary.tsx

Summary

Maintainability
F
6 days
Test Coverage

Showing 17 of 17 total issues

File TreatmentSummary.tsx has 511 lines of code (exceeds 250 allowed). Consider refactoring.
Open

import careConfig from "@careConfig";
import { useQuery } from "@tanstack/react-query";
import { format } from "date-fns";
import { Loader } from "lucide-react";
import { useEffect } from "react";
Severity: Major
Found in src/components/Patient/TreatmentSummary.tsx - About 1 day to fix

Function TreatmentSummary has a Cognitive Complexity of 12 (exceeds 5 allowed). Consider refactoring.
Open

export default function TreatmentSummary({
facilityId,
encounterId,
patientId,
}: TreatmentSummaryProps) {
Severity: Minor
Found in src/components/Patient/TreatmentSummary.tsx - About 1 hr to fix

Similar blocks of code found in 2 locations. Consider refactoring.
Open

rows={medications?.results.map((medication) => {
const instruction = medication.dosage_instruction[0];
const frequency = getFrequencyDisplay(instruction?.timing);
const dosage = formatDosage(instruction);
const duration =
Severity: Major
Found in src/components/Patient/TreatmentSummary.tsx and 1 other location - About 1 day to fix
src/pages/Encounters/PrintPrescription.tsx on lines 146..166

Similar blocks of code found in 2 locations. Consider refactoring.
Open

{encounter.hospitalization?.diet_preference && (
<div className="grid grid-cols-[10rem_auto_1fr] md:grid-cols-[8rem_auto_1fr] items-center">
<span className="text-gray-600">{t("diet_preference")}</span>
<span className="text-gray-600">:</span>
<span className="font-semibold">
Severity: Major
Found in src/components/Patient/TreatmentSummary.tsx and 1 other location - About 4 hrs to fix
src/components/Patient/TreatmentSummary.tsx on lines 239..249

Similar blocks of code found in 2 locations. Consider refactoring.
Open

{encounter.hospitalization?.admit_source && (
<div className="grid grid-cols-[10rem_auto_1fr] md:grid-cols-[8rem_auto_1fr] items-center">
<span className="text-gray-600">{t("admission_source")}</span>
<span className="text-gray-600">:</span>
<span className="font-semibold">
Severity: Major
Found in src/components/Patient/TreatmentSummary.tsx and 1 other location - About 4 hrs to fix
src/components/Patient/TreatmentSummary.tsx on lines 257..267

Similar blocks of code found in 3 locations. Consider refactoring.
Open

<div className="grid grid-cols-[10rem_auto_1fr] md:grid-cols-[8rem_auto_1fr] items-center">
<span className="text-gray-600">{t("status")}</span>
<span className="text-gray-600">:</span>
<span className="font-semibold">
{t(`encounter_status__${encounter.status}`)}
Severity: Major
Found in src/components/Patient/TreatmentSummary.tsx and 2 other locations - About 3 hrs to fix
src/components/Patient/TreatmentSummary.tsx on lines 224..230
src/components/Patient/TreatmentSummary.tsx on lines 231..237

Similar blocks of code found in 3 locations. Consider refactoring.
Open

<div className="grid grid-cols-[10rem_auto_1fr] md:grid-cols-[8rem_auto_1fr] items-center">
<span className="text-gray-600">{t("encounter_class")}</span>
<span className="text-gray-600">:</span>
<span className="font-semibold">
{t(`encounter_class__${encounter.encounter_class}`)}
Severity: Major
Found in src/components/Patient/TreatmentSummary.tsx and 2 other locations - About 3 hrs to fix
src/components/Patient/TreatmentSummary.tsx on lines 231..237
src/components/Patient/TreatmentSummary.tsx on lines 294..300

Similar blocks of code found in 3 locations. Consider refactoring.
Open

<div className="grid grid-cols-[10rem_auto_1fr] md:grid-cols-[8rem_auto_1fr] items-center">
<span className="text-gray-600">{t("priority")}</span>
<span className="text-gray-600">:</span>
<span className="font-semibold">
{t(`encounter_priority__${encounter.priority}`)}
Severity: Major
Found in src/components/Patient/TreatmentSummary.tsx and 2 other locations - About 3 hrs to fix
src/components/Patient/TreatmentSummary.tsx on lines 224..230
src/components/Patient/TreatmentSummary.tsx on lines 294..300

Similar blocks of code found in 2 locations. Consider refactoring.
Open

medication_taken_between: [
medication.effective_period?.start,
medication.effective_period?.end,
]
.map((date, ind) =>
Severity: Major
Found in src/components/Patient/TreatmentSummary.tsx and 1 other location - About 1 hr to fix
src/components/Patient/MedicationStatementList.tsx on lines 70..74

Similar blocks of code found in 2 locations. Consider refactoring.
Open

<div>
<h1 className="text-3xl font-semibold">
{encounter.facility?.name}
</h1>
<h2 className="text-gray-500 uppercase text-sm tracking-wide font-semibold mt-1">
Severity: Major
Found in src/components/Patient/TreatmentSummary.tsx and 1 other location - About 1 hr to fix
src/components/ui/sidebar/patient-switcher.tsx on lines 75..82

Similar blocks of code found in 2 locations. Consider refactoring.
Open

headers={[
{ key: "symptom" },
{ key: "severity" },
{ key: "status" },
{ key: "verification" },
Severity: Major
Found in src/components/Patient/TreatmentSummary.tsx and 1 other location - About 1 hr to fix
src/components/Patient/TreatmentSummary.tsx on lines 504..514

Similar blocks of code found in 2 locations. Consider refactoring.
Open

headers={[
{ key: "medication" },
{ key: "dosage" },
{ key: "status" },
{
Severity: Major
Found in src/components/Patient/TreatmentSummary.tsx and 1 other location - About 1 hr to fix
src/components/Patient/TreatmentSummary.tsx on lines 406..414

Similar blocks of code found in 3 locations. Consider refactoring.
Open

headers={[
{ key: "allergen" },
{ key: "status" },
{ key: "criticality" },
{ key: "verification" },
Severity: Major
Found in src/components/Patient/TreatmentSummary.tsx and 2 other locations - About 45 mins to fix
src/components/Patient/TreatmentSummary.tsx on lines 436..443
src/components/Patient/TreatmentSummary.tsx on lines 464..471

Similar blocks of code found in 3 locations. Consider refactoring.
Open

headers={[
{ key: "diagnosis" },
{ key: "status" },
{ key: "verification" },
{ key: "onset" },
Severity: Major
Found in src/components/Patient/TreatmentSummary.tsx and 2 other locations - About 45 mins to fix
src/components/Patient/TreatmentSummary.tsx on lines 382..389
src/components/Patient/TreatmentSummary.tsx on lines 464..471

Similar blocks of code found in 3 locations. Consider refactoring.
Open

headers={[
{ key: "medicine" },
{ key: "status" },
{ key: "dosage" },
{ key: "frequency" },
Severity: Major
Found in src/components/Patient/TreatmentSummary.tsx and 2 other locations - About 45 mins to fix
src/components/Patient/TreatmentSummary.tsx on lines 382..389
src/components/Patient/TreatmentSummary.tsx on lines 436..443

Similar blocks of code found in 3 locations. Consider refactoring.
Open

queryFn: query.paginated(medicationRequestApi.list, {
pathParams: { patientId },
queryParams: { encounter: encounterId },
pageSize: 100,
}),
Severity: Minor
Found in src/components/Patient/TreatmentSummary.tsx and 2 other locations - About 35 mins to fix
src/components/Medicine/MedicationAdministration/PrintMedicationAdministration.tsx on lines 52..58
src/components/Patient/TreatmentSummary.tsx on lines 110..114

Similar blocks of code found in 3 locations. Consider refactoring.
Open

queryFn: query.paginated(symptomApi.listSymptoms, {
pathParams: { patientId },
queryParams: { encounter: encounterId },
pageSize: 100,
}),
Severity: Minor
Found in src/components/Patient/TreatmentSummary.tsx and 2 other locations - About 35 mins to fix
src/components/Medicine/MedicationAdministration/PrintMedicationAdministration.tsx on lines 52..58
src/components/Patient/TreatmentSummary.tsx on lines 133..137

There are no issues that match your filters.

Category
Status