diff --git a/docs/miscellaneous/cockcroft-gault-eq.md b/docs/miscellaneous/cockcroft-gault-eq.md index 6ed6a66..62f836c 100644 --- a/docs/miscellaneous/cockcroft-gault-eq.md +++ b/docs/miscellaneous/cockcroft-gault-eq.md @@ -1,6 +1,6 @@ # CockCroft Gault Equation -### CockCroft Gault Equation is an equation which is used to calculate the eGFR (Estimated Glomerular Filtration Rate) of a patient +### CockCroft Gault Equation is an equation which is used to calculate the CrCl (Creatinine Clearance) of a patient ### Unit:- mL/min @@ -14,9 +14,9 @@ ### Formula -#### It uses the following formula to calculate the GFR +#### It uses the following formula to calculate the CrCl $$ -GFR = \frac{(140 - Age)}{(72 \times S. Creatinine)} \times 0.85 \text{(if patient is female)} +CrCl = \frac{(140 - Age)}{(72 \times S. Creatinine)} \times 0.85 \text{(if patient is female)} $$ ## Interpretation @@ -31,4 +31,4 @@ $$ | **less than 15 mL/min** | **CKD Stage 5 / ESRD** | **Renal Function is severely reduced** | ### Notice:- -#### This equation of calculating eGFR is not as accurate, other equations like MDRD and CKD-EPI are recommended. Equation is not reliable in the cases of AKI (Acute Kidney Injury). Consultation with a Nephrologist is always recommended. No diagnosis should be made just on the basis of a medical calculator. Other clinical clues are to be taken into account (Urinalysis, UACR(Urine Albumin to Creatinine Ratio) etc.) +#### This equation of calculating Creatinine Clearance is not as accurate, other equations like MDRD and CKD-EPI are recommended. Equation is not reliable in the cases of AKI (Acute Kidney Injury). Consultation with a Nephrologist is always recommended. No diagnosis should be made just on the basis of a medical calculator. Other clinical clues are to be taken into account (Urinalysis, UACR(Urine Albumin to Creatinine Ratio) etc.) diff --git a/src/app/(calculators)/calculate/[section]/[id]/page.tsx b/src/app/(calculators)/calculate/[section]/[id]/page.tsx index 827cfcb..6c5e992 100644 --- a/src/app/(calculators)/calculate/[section]/[id]/page.tsx +++ b/src/app/(calculators)/calculate/[section]/[id]/page.tsx @@ -1,6 +1,14 @@ +import { Metadata } from "next"; import RenderCalculator from "./renderCalc"; - - +import { CalculatorRegistry } from "@/app/utils/calculators/registry"; +export async function generateMetadata({params} : {params:Promise<{section:string, id:string}>}):Promise{ + const calcData : {section:string, id:string} = await params; + const calculator = CalculatorRegistry[calcData.section].calculators.find(e => e.id === calcData.id); + return { + title:`${calculator?.name} calculator`, + description:`A ${calculator?.name} calculator to evaluate the patient as accurately as possible` + }; +} export default async function Calculator({params} : {params:Promise<{section:string, id:string}>}){ const calcData : {section:string, id:string} = await params; return( diff --git a/src/app/(calculators)/calculate/[section]/[id]/renderCalc.tsx b/src/app/(calculators)/calculate/[section]/[id]/renderCalc.tsx index 4c4500c..8f129e9 100644 --- a/src/app/(calculators)/calculate/[section]/[id]/renderCalc.tsx +++ b/src/app/(calculators)/calculate/[section]/[id]/renderCalc.tsx @@ -5,6 +5,7 @@ import Input from "@/app/utils/Input"; import Result from "@/app/utils/Result"; import { CalculatorRegistry } from "@/app/utils/calculators/registry"; import { Interpretation } from "@/app/utils/calculators/types"; +import { Metadata } from "next"; import { useState } from "react"; export default function RenderCalculator({section, id} : {section:string, id:string}){ diff --git a/src/app/utils/Result.tsx b/src/app/utils/Result.tsx index 0734032..414a6aa 100644 --- a/src/app/utils/Result.tsx +++ b/src/app/utils/Result.tsx @@ -7,9 +7,9 @@ export default function Result({interpretation, calculated_value, unit} : {inter if(level === "none" || level === "low"){ levelClass = "bg-success"; }else if(level === "moderate"){ - levelClass = "bg-orange-600"; + levelClass = "bg-orange-600 text-white"; }else if(level === "high" || level === "severe"){ - levelClass = "bg-red-500"; + levelClass = "bg-red-500 text-white"; }else{ levelClass = "bg-white"; } diff --git a/src/app/utils/calculators/miscellaneous/cockcroft-gault-eq.ts b/src/app/utils/calculators/miscellaneous/cockcroft-gault-eq.ts index 4bcb15f..4164777 100644 --- a/src/app/utils/calculators/miscellaneous/cockcroft-gault-eq.ts +++ b/src/app/utils/calculators/miscellaneous/cockcroft-gault-eq.ts @@ -55,44 +55,44 @@ function calc_func(values : Values):number{ ? Math.floor(((140 - age) * weight)/(72 * creatinine)) : Math.floor((((140 - age) * weight)/(72 * creatinine)) * 0.85); } -function interpret_func(gfr:number):Interpretation{ - if(gfr >= 90){ +function interpret_func(crcl:number):Interpretation{ + if(crcl >= 90){ return { level:"none", - message:"Glomerular Filtration Rate (GFR) is normal or on the higher side, To be correlated with other clinical clues", + message:"Creatinine Clearance (CrCl) is normal or on the higher side, To be correlated with other clinical clues", diagnosis:"CKD Stage 1" } - }else if(gfr < 90 && gfr >= 60){ + }else if(crcl < 90 && crcl >= 60){ return { level:"low", - message:"Glomerular Filtration Rate (GFR) is slightly reduced, To be correlated with other clinical clues", + message:"Creatinine Clearance (CrCl) is slightly reduced, To be correlated with other clinical clues", diagnosis:"CKD Stage 2" } - }else if(gfr < 60 && gfr >= 45){ + }else if(crcl < 60 && crcl >= 45){ return{ level:"moderate", - message:"Glomerular Filtration Rate (GFR) is moderately reduced", + message:"Creatinine Clearance (CrCl) is moderately reduced", advice:"Consult a Nephrologist", diagnosis:"CKD Stage 3A" } - }else if(gfr < 45 && gfr >= 30){ + }else if(crcl < 45 && crcl >= 30){ return{ level:"high", - message:"Glomerular Filtration Rate (GFR) is significantly reduced", + message:"Creatinine Clearance (CrCl) is significantly reduced", advice:"Consult a Nephrologist urgently", diagnosis:"CKD Stage 3B" } - }else if(gfr < 30 && gfr >= 15){ + }else if(crcl < 30 && crcl >= 15){ return{ level:"high", - message:"Glomerular Filtration Rate (GFR) is largely reduced", + message:"Creatinine Clearance (CrCl) is largely reduced", advice:"Consult a Nephrologist urgently", diagnosis:"CKD Stage 4" } }else{ return{ level:"severe", - message:"Glomerular Filtration Rate (GFR) is severely reduced", + message:"Creatinine Clearance (CrCl) is severely reduced", advice:"Consult a Nephrologist urgently to consider dialysis", diagnosis:"CKD Stage 5 / ESRD (End Stage Renal Disease)" } diff --git a/src/app/utils/calculators/registry.js b/src/app/utils/calculators/registry.js deleted file mode 100644 index 0f8793b..0000000 --- a/src/app/utils/calculators/registry.js +++ /dev/null @@ -1,15 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true }); -exports.CalculatorRegistry = void 0; -var cockcroft_gault_eq_1 = require("./miscellaneous/cockcroft-gault-eq"); -exports.CalculatorRegistry = { - miscellaneous: { - id: "miscellaneous", - displayName: "Miscellaneous", - textColor: "#ccc", - svg: "", - calculators: [ - cockcroft_gault_eq_1.cockcroftGault - ] - } -}; diff --git a/src/app/utils/calculators/types.js b/src/app/utils/calculators/types.js deleted file mode 100644 index c8ad2e5..0000000 --- a/src/app/utils/calculators/types.js +++ /dev/null @@ -1,2 +0,0 @@ -"use strict"; -Object.defineProperty(exports, "__esModule", { value: true });