diff --git a/docs/Emergency/TIMI.md b/docs/Emergency/TIMI.md new file mode 100644 index 0000000..5e6af01 --- /dev/null +++ b/docs/Emergency/TIMI.md @@ -0,0 +1,26 @@ +### TIMI (Thrombolysis in Myocardial Infarction) Score + +#### TIMI score is a risk assessment tool used to predict 14-day mortality and ischemic events in patient with UA/NSTEMI (Unstable Angina/ non-ST-elevation Myocardial Infarction). It calculates the risk based on the seven parameters given below + + +#### Parameters +Each of the parameters count as 1 point +| Parameters | Range | +| ---------- | ----- | +| Age | >= 65 years | +| Markers | If cardiac markers are elevated | +| EKG | ST-deviated elevations of >= 0.5 mm | +| Risk factors | (3 or more risk factors for CAD - hypertension, diabetes mellitus, smoking, family history, hypercholesterolemia)| +| Ischemia | Severe angina: >= 2 episodes within 24 hours | +| Coronary stenosis | Known CAD >= 50% | +| Aspirin use | in the past 7 days | + +### Risk Stratification +| Score | Risk % | +| ----- | ------- | +| 0 - 1 | 4.7% | +| 2 | 8.3% | +| 3 | 13.2% | +| 4 | 19.9% | +| 5 | 26.2% | +| 6 - 7 | 40.9% | \ No newline at end of file diff --git a/docs/General Cardiology/MAP.md b/docs/General Cardiology/MAP.md new file mode 100644 index 0000000..7e423b5 --- /dev/null +++ b/docs/General Cardiology/MAP.md @@ -0,0 +1,24 @@ +### MAP (Mean Arterial Pressure) +#### Mean Arterial Pressure or MAP is the average blood pressure within the arteries during one cardiac cycle (systole and diastole). +#### Unit:- mmHg + + +#### Parameters required:- +| Parameters | Unit | +| ---------- | ---- | +| Systolic Blood Pressure | mmHg | +| Diastolic Blood Pressure | mmHg | + +#### Interpretation range:- +| Range | Interpretation | +| ----- | -------------- | +| <60 mmHg | Vital organs are poorly perfused | +| 60-65 mmHg | Vital orgaans are borderline perfused | +| 65-70 mmHg | Vital organs are adequately perfused | +| 70-100 mmHg | Vital organs are well perfused | +| >100 mmHg | Vital organs are hyper perfused | + +#### Formula:- +$$ +\text{MAP} = \text{DBP} + \frac{1}{3} \times\text{(SBP - DBP)} +$$ \ No newline at end of file diff --git a/src/app/(calculators)/layoutClient.tsx b/src/app/(calculators)/layoutClient.tsx index beda67c..2ae5a83 100644 --- a/src/app/(calculators)/layoutClient.tsx +++ b/src/app/(calculators)/layoutClient.tsx @@ -12,7 +12,7 @@ export default function LayoutClient({children} : {children:React.ReactNode}){
-
+
{children}
diff --git a/src/app/globals.css b/src/app/globals.css index ec5df3a..8f7a5a8 100644 --- a/src/app/globals.css +++ b/src/app/globals.css @@ -70,4 +70,10 @@ .animate-ecg { animation: ecgMove 6s linear infinite; +} +.tooltip::before { + max-width: 90vw; + left: 50% !important; + transform: translateX(-50%) !important; + white-space: normal; } \ No newline at end of file diff --git a/src/app/layout.tsx b/src/app/layout.tsx index 1c6d148..253cb7d 100644 --- a/src/app/layout.tsx +++ b/src/app/layout.tsx @@ -6,6 +6,12 @@ import { Analytics } from "@vercel/analytics/next" export const metadata: Metadata = { title: "CalcForCardiac", description: "A zero friction and zero login medical calculator made by Saksham Vitwekar (SomeTroller77)", + authors:[{name:"Saksham Vitwekar"}], + openGraph:{ + title:"CalcForCardiac", + description:"A mininal friction and zero login medical calculator especially for cardiologists", + images:["/calcforcardiac_logo.png"] + } }; export default function RootLayout({ diff --git a/src/app/utils/Input.tsx b/src/app/utils/Input.tsx index 3c7e274..319715d 100644 --- a/src/app/utils/Input.tsx +++ b/src/app/utils/Input.tsx @@ -2,7 +2,7 @@ import { useState } from "react"; import { Input } from "./calculators/types"; -export default function InputComponent({id, type, inputOptions, min, max, required, defaultUnit, unitOptions, name, placeholder, handleDataChange} : Input){ +export default function InputComponent({id, type, inputOptions, min, max, required, defaultUnit, unitOptions, name, placeholder, handleDataChange, info} : Input){ const [showError, setErrorStatus] = useState(false); const [error, setError] = useState(); const [option, setOption] = useState(""); @@ -10,7 +10,22 @@ export default function InputComponent({id, type, inputOptions, min, max, requir return( <>
- {name} + { typeof info === "string" ? + <> +
+ + + + + +
: null + } {name} {defaultUnit ? `(${defaultUnit})` : null}
- {name} + { info ? + <> +
+ + + + + +
: null + } {name} {defaultUnit ? `(${defaultUnit})` : null}
{ const bookmarkedStr:string = localStorage.getItem("bookmarks") || "[]"; const bookmarkedObj : {section:string, id:string}[] = JSON.parse(bookmarkedStr); - console.log(bookmarkedObj); setBookmarks(bookmarkedObj); }, []) return( diff --git a/src/app/utils/calculators/Arrhythmias and Anti-Coagulation/CHA2DS2-VASc-score.ts b/src/app/utils/calculators/Arrhythmias and Anti-Coagulation/CHA2DS2-VASc-score.ts new file mode 100644 index 0000000..5e9b71c --- /dev/null +++ b/src/app/utils/calculators/Arrhythmias and Anti-Coagulation/CHA2DS2-VASc-score.ts @@ -0,0 +1,158 @@ +import { Calculator, Input, Interpretation, Values } from "../types"; + +const parameters:Input[] = [ + { + id:"chf", + name:"CHF/LV dysfunction", + type:"checkbox", + placeholder:"Whether the patient has CHF or LV dysfunction", + required:true + }, + { + id:"hypertension", + name:"Hypertension", + type:"checkbox", + placeholder:"Whether the patient has hypertension", + required:true + }, + { + id:"age", + name:"age", + type:"number", + placeholder:"Enter the age", + required:true, + min: 18, + max: 95 + }, + { + id:"dm", + name:"Diabetes Mellitus", + placeholder:"Whether the patient has diabetes", + type:"checkbox", + required:true + }, + { + id:"ischemia", + name:"Prior ischemia", + placeholder:"Whether the patient had prior ischemic event", + type:"checkbox", + required:true + }, + { + id:"vd", + name:"Vascular Disease", + placeholder:"Whether the patient has any vascular disease", + info:"Myocardial Infarction, Peripheral Vascular Disease etc.", + type:"checkbox", + required:true + }, + { + id:"gender", + name:"Gender", + placeholder:"Select the gender", + type:"select", + required:true, + inputOptions:[ + { + label:"Male", + value:"male" + }, + { + label:"Female", + value:"female" + } + ] + } +]; + +export const cha2ds2 : Calculator = { + id:"cha2ds2", + name:"CHA₂DS₂-VASc Score", + desc:"CHA₂DS₂-VASc Score is a clinical prediction tool used to estimate the risk of stroke in patients with non-valvular atrial fibrillation (AF).", + inputs:parameters, + calc_func:(values : Values):number => { + const chf = values.chf as boolean; + const hypertension = values.hypertension as boolean; + const age = values.age as number; + const dm = values.dm as boolean; + const ischemia = values.ischemia as boolean; + const vd = values.vd as boolean; + const gender = values.gender as "male" | "female"; + var score = 0; + if(chf) score++; + if(hypertension) score++ + if(age >= 75) score = score + 2; + if(dm) score++; + if(ischemia) score = score + 2; + if(vd) score ++; + if(age >= 65 && age < 75) score++; + if(gender === "female") score++; + return score; + }, + interpret_func:(score : number):Interpretation => { + if(score === 0){ + return { + level:"low", + message:"The stroke risk % for the patient is 0.2%" + } + } + if(score === 1){ + return { + level:"low", + message:"The stroke risk % for the patient is 0.6%" + } + } + if(score === 2){ + return { + level:"low", + message:"The stroke risk % for the patient is 2.2%" + } + } + if(score === 3){ + return { + level:"low", + message:"The stroke risk % for the patient is 3.2%" + } + } + if(score === 4){ + return { + level:"moderate", + message:"The stroke risk % for the patient is 4.8%" + } + } + if(score === 5){ + return { + level:"moderate", + message:"The stroke risk % for the patient is 7.2%" + } + } + if(score === 6){ + return { + level:"moderate", + message:"The stroke risk % for the patient is 9.7%" + } + } + if(score === 7){ + return { + level:"high", + message:"The stroke risk % for the patient is 11.2%" + } + } + if(score === 8){ + return { + level:"high", + message:"The stroke risk % for the patient is 10.8%" + } + } + if(score === 9){ + return { + level:"severe", + message:"The stroke risk % for the patient is 12.2" + } + } + return { + level:"none", + message:"invalid values" + } + } +} \ No newline at end of file diff --git a/src/app/utils/calculators/Emergency/TIMI_score.ts b/src/app/utils/calculators/Emergency/TIMI_score.ts index eda9919..66a8a18 100644 --- a/src/app/utils/calculators/Emergency/TIMI_score.ts +++ b/src/app/utils/calculators/Emergency/TIMI_score.ts @@ -10,14 +10,15 @@ const parameters:Input[] = [ }, { id:"isCAD", - name:"Known Coronary Artery Disease (stenosis >= 50%)", - placeholder:"Whether the patient has a known CAD with more than 50% stenosis", + name:"Known Coronary Artery Disease", + placeholder:"Whether the patient has a known CAD with more than or equal to 50% stenosis", type:"checkbox" }, { id:"cadRiskFactors", name:"CAD Risk Factors", - placeholder:"Whether the patient has 3 or more than 3 CAD Risk Factors (Family history of CAD, Hypertension, Hypercholesterolemia, Diabetes, Smoker)", + placeholder:"Whether the patient has 3 or more than 3 CAD Risk Factors", + info:"Hypertension, hypercholesterolemia, diabetes, family history of CAD, or current smoker", type:"checkbox" }, { @@ -41,8 +42,9 @@ const parameters:Input[] = [ { id:"biomarkers", name:"Elevated Serum cardiac biomarkers", - placeholder:"Whether the patient has Elevated Serum cardiac biomarkers (Troponin levels, creatine kinase etc)", - type:"checkbox" + placeholder:"Whether the patient has Elevated Serum cardiac biomarkers", + type:"checkbox", + info:"Troponin levels, creatine kinase" } ]; diff --git a/src/app/utils/calculators/General Cardiology/MAP.ts b/src/app/utils/calculators/General Cardiology/MAP.ts index be51cf4..773cea1 100644 --- a/src/app/utils/calculators/General Cardiology/MAP.ts +++ b/src/app/utils/calculators/General Cardiology/MAP.ts @@ -4,18 +4,20 @@ const parameters : Input[] = [ { id:"sbp", name:"Systolic Blood Pressure", - placeholder:"Enter the Systolic Blood Pressure in mmHg", + placeholder:"Enter the Systolic Blood Pressure", type:"number", required:true, - min:0 + min:0, + defaultUnit:"mmHg", }, { id:"dbp", name:"Diastolic Blood Pressure", - placeholder:"Enter the Disatolic Blood Pressure in mmHg", + placeholder:"Enter the Disatolic Blood Pressure", type:"number", required:true, - min:0 + min:0, + defaultUnit:"mmHg" } ] diff --git a/src/app/utils/calculators/registry.ts b/src/app/utils/calculators/registry.ts index d8680f6..6332b0d 100644 --- a/src/app/utils/calculators/registry.ts +++ b/src/app/utils/calculators/registry.ts @@ -4,6 +4,7 @@ import { Section } from "./types"; import { MELD } from "./Utilities/MELD"; import { MAP } from "./General Cardiology/MAP"; import { TIMI } from "./Emergency/TIMI_score"; +import { cha2ds2 } from "./Arrhythmias and Anti-Coagulation/CHA2DS2-VASc-score"; export const CalculatorRegistry : Record = { generalCardiology:{ @@ -15,6 +16,15 @@ export const CalculatorRegistry : Record = { MAP ] }, + arrhythmias:{ + id:"arrhythmias", + displayName:"Arrhythmias & Anti-Coagulation", + textColor:"#ccc", + svg:"", + calculators:[ + cha2ds2 + ] + }, emergency:{ id:"emergency", displayName:"Emergency", diff --git a/src/app/utils/calculators/types.ts b/src/app/utils/calculators/types.ts index 8dcb417..6505583 100644 --- a/src/app/utils/calculators/types.ts +++ b/src/app/utils/calculators/types.ts @@ -23,6 +23,7 @@ export interface Input{ required?:boolean, defaultUnit?:string, unitOptions?:string[], + info?: string, handleDataChange?:Function }