Added IMPACT (Index for Mortality Prediction After Cardiac Transplantation) score
This commit is contained in:
@@ -35,9 +35,9 @@ export default function RenderCalculator({section, id} : {section:string, id:str
|
|||||||
<p className="text-gray-500 mt-1 max-w-xl">
|
<p className="text-gray-500 mt-1 max-w-xl">
|
||||||
{calculator?.desc}
|
{calculator?.desc}
|
||||||
</p>
|
</p>
|
||||||
<h1 className="text-1xl font-semibold">
|
{calculator?.unit ? <h1 className="text-1xl font-semibold">
|
||||||
Unit of the value:- {calculator?.unit}
|
Unit of the value:- {calculator?.unit}
|
||||||
</h1>
|
</h1> : null}
|
||||||
</div>
|
</div>
|
||||||
<div className="max-w-2xl">
|
<div className="max-w-2xl">
|
||||||
<form onSubmit={(e: React.SubmitEvent) => {
|
<form onSubmit={(e: React.SubmitEvent) => {
|
||||||
|
|||||||
@@ -1,5 +1,5 @@
|
|||||||
import LayoutClient from "./layoutClient";
|
import LayoutClient from "./layoutClient";
|
||||||
import { Roboto } from "next/font/google";
|
|
||||||
export default function CalculatorsLayout({children} : {children:React.ReactNode}){
|
export default function CalculatorsLayout({children} : {children:React.ReactNode}){
|
||||||
return(
|
return(
|
||||||
<>
|
<>
|
||||||
|
|||||||
@@ -3,8 +3,8 @@ import "./globals.css";
|
|||||||
import 'animate.css';
|
import 'animate.css';
|
||||||
|
|
||||||
export const metadata: Metadata = {
|
export const metadata: Metadata = {
|
||||||
title: "Create Next App",
|
title: "CalcForCardiac",
|
||||||
description: "Generated by create next app",
|
description: "A zero friction and zero login medical calculator made by Saksham Vitwekar (SomeTroller77)",
|
||||||
};
|
};
|
||||||
|
|
||||||
export default function RootLayout({
|
export default function RootLayout({
|
||||||
|
|||||||
@@ -56,12 +56,28 @@ export default function InputComponent({id, type, inputOptions, min, max, requir
|
|||||||
<option value="" disabled hidden>{placeholder}</option>
|
<option value="" disabled hidden>{placeholder}</option>
|
||||||
{inputOptions?.map(e => {
|
{inputOptions?.map(e => {
|
||||||
return(
|
return(
|
||||||
<option key={e.label} value={e.value}>{e.value}</option>
|
<option key={e.label} value={e.value}>{e.label}</option>
|
||||||
)
|
)
|
||||||
})}
|
})}
|
||||||
</select>
|
</select>
|
||||||
{/* <span className="label text-red-400">Optional</span> */}
|
{/* <span className="label text-red-400">Optional</span> */}
|
||||||
</fieldset>
|
</fieldset>
|
||||||
)
|
)
|
||||||
|
}else if(type === "checkbox"){
|
||||||
|
return(
|
||||||
|
<fieldset className="fieldset bg-white bg-base-100 border border-base-300 rounded-box w-full min-w-0 p-2">
|
||||||
|
<legend className="fieldset-legend text-black">{name}</legend>
|
||||||
|
<label className="label flex gap-3 items-start w-full">
|
||||||
|
<input type="checkbox"
|
||||||
|
className="checkbox checkbox-neutral border-solid border-black mt-1 shrink-0"
|
||||||
|
onChange={(e) => {
|
||||||
|
handleDataChange !== undefined ? handleDataChange(id, e.target.checked) : null;
|
||||||
|
}} />
|
||||||
|
<span className="text-sm break-words whitespace-normal">
|
||||||
|
{placeholder}
|
||||||
|
</span>
|
||||||
|
</label>
|
||||||
|
</fieldset>
|
||||||
|
)
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
@@ -1,7 +1,17 @@
|
|||||||
import { cockcroftGault } from "./miscellaneous/cockcroft-gault-eq";
|
import { cockcroftGault } from "./miscellaneous/cockcroft-gault-eq";
|
||||||
|
import { IMPACT } from "./transplantation/IMPACT";
|
||||||
import { Section } from "./types";
|
import { Section } from "./types";
|
||||||
|
|
||||||
export const CalculatorRegistry : Record<string, Section> = {
|
export const CalculatorRegistry : Record<string, Section> = {
|
||||||
|
transplantation:{
|
||||||
|
id:"transplantation",
|
||||||
|
displayName:"Transplantation",
|
||||||
|
textColor:"#ccc",
|
||||||
|
svg:"",
|
||||||
|
calculators:[
|
||||||
|
IMPACT
|
||||||
|
]
|
||||||
|
},
|
||||||
miscellaneous:{
|
miscellaneous:{
|
||||||
id:"miscellaneous",
|
id:"miscellaneous",
|
||||||
displayName:"Miscellaneous",
|
displayName:"Miscellaneous",
|
||||||
|
|||||||
262
src/app/utils/calculators/transplantation/IMPACT.ts
Normal file
262
src/app/utils/calculators/transplantation/IMPACT.ts
Normal file
@@ -0,0 +1,262 @@
|
|||||||
|
import { Calculator, Input, Interpretation, Values } from "../types";
|
||||||
|
|
||||||
|
const parameters : Input[] = [
|
||||||
|
{
|
||||||
|
id:"age",
|
||||||
|
name:"Age",
|
||||||
|
placeholder:"Enter age",
|
||||||
|
type:"number",
|
||||||
|
min:0,
|
||||||
|
required:true,
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id:"sbilirubin",
|
||||||
|
name:"Serum Bilirubin",
|
||||||
|
placeholder:"Enter the serum bilirubin value in mg/dL",
|
||||||
|
type:"number",
|
||||||
|
defaultUnit:"mg/dL",
|
||||||
|
required:true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id:"crcl",
|
||||||
|
name:"Creatinine Clearance (CrCl)",
|
||||||
|
placeholder:"Enter the CrCl value in mL/min",
|
||||||
|
type:"number",
|
||||||
|
defaultUnit:"mL/min",
|
||||||
|
required:true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id:"dialysisStatus",
|
||||||
|
name:"Dialysis Requirement",
|
||||||
|
placeholder:"Whether Dialysis was done between listing and transplantation",
|
||||||
|
type:"checkbox",
|
||||||
|
required:true
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id:"gender",
|
||||||
|
name:"Gender",
|
||||||
|
placeholder:"Select Gender",
|
||||||
|
type:"select",
|
||||||
|
required:true,
|
||||||
|
inputOptions:[
|
||||||
|
{
|
||||||
|
label:"Male",
|
||||||
|
value:"male"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label:"Female",
|
||||||
|
value:"female"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id:"causeOfHF",
|
||||||
|
name:"Heart Failure Etiology",
|
||||||
|
placeholder:"Cause of Heart Failure",
|
||||||
|
type:"select",
|
||||||
|
required:true,
|
||||||
|
inputOptions:[
|
||||||
|
{
|
||||||
|
label:"Idiopathic",
|
||||||
|
value:"idiopathic"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label:"Ischemic",
|
||||||
|
value:"ischemic"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label:"Congenital",
|
||||||
|
value:"congenital"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label:"Other",
|
||||||
|
value:"other"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id:"recentInfection",
|
||||||
|
name:"Recent Infection Status",
|
||||||
|
placeholder:"Whether the patient had a recent infection",
|
||||||
|
type:"checkbox"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id:"aorticBalloonPump",
|
||||||
|
name:"Intra-Aortic Balloon Pump",
|
||||||
|
placeholder:"Whether Intra-Aortic Balloon Pump was implanted",
|
||||||
|
type:"checkbox"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id:"preTransplantMechVent",
|
||||||
|
name:"Mechanical Ventilation",
|
||||||
|
placeholder:"whether Mechanical Ventilation was done pre-transplant",
|
||||||
|
type:"checkbox"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id:"race",
|
||||||
|
name:"Race",
|
||||||
|
placeholder:"Select the Race of the patient",
|
||||||
|
type:"select",
|
||||||
|
required:true,
|
||||||
|
inputOptions:[
|
||||||
|
{
|
||||||
|
label:"Caucasian",
|
||||||
|
value:"caucasian"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label:"African American",
|
||||||
|
value:"african-american"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label:"Hispanic",
|
||||||
|
value:"hispanic"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label:"Other",
|
||||||
|
value:"other"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id:"tempCircSupp",
|
||||||
|
name:"Temporary Circulation Support",
|
||||||
|
placeholder:"Whether temporary circulation support was needed (includes ECMO and e-VADs)",
|
||||||
|
type:"checkbox"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
id:"VAD",
|
||||||
|
name:"Ventricular Assist Device",
|
||||||
|
placeholder:"Select the Ventricular Assist Device used",
|
||||||
|
type:"select",
|
||||||
|
required:true,
|
||||||
|
inputOptions:[
|
||||||
|
{
|
||||||
|
label:"None used",
|
||||||
|
value:"none"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label:"Older-Generation Pulsatile",
|
||||||
|
value:"older-generation"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label:"Newer-Generation continuous",
|
||||||
|
value:"newer-generation"
|
||||||
|
},
|
||||||
|
{
|
||||||
|
label:"HeartMate II",
|
||||||
|
value:"heartmateii"
|
||||||
|
}
|
||||||
|
]
|
||||||
|
}
|
||||||
|
]
|
||||||
|
|
||||||
|
export const IMPACT:Calculator = {
|
||||||
|
id:"impact-score",
|
||||||
|
name:"IMPACT (Index for Mortality Prediction After Cardiac Transplantation",
|
||||||
|
desc:"IMPACT score is a risk assessment tool used to predict 1-year mortality following a Heart Transplantation based on 12 parameters (including renal function, liver function, age)",
|
||||||
|
inputs:parameters,
|
||||||
|
calc_func:(values : Values):number => {
|
||||||
|
const age = values.age as number;
|
||||||
|
const sbilirubin = values.sbilirubin as number;
|
||||||
|
const crcl = values.crcl as number;
|
||||||
|
const dialysisStatus = values.dialysisStatus as boolean;
|
||||||
|
const gender = values.gender as "male" | "female";
|
||||||
|
const causeOfHF = values.causeOfHF as "idiopathic" | "ischemic" | "congenital" | "others";
|
||||||
|
const recentInfection = values.recentInfection as boolean;
|
||||||
|
const aorticBalloonPump = values.aorticBalloonPump as boolean;
|
||||||
|
const preTransplantMechVent = values.preTransplantMechVent as boolean;
|
||||||
|
const race = values.race as "caucasian" | "african-american" | "hispanic" | "other";
|
||||||
|
const tempCircSupp = values.tempCircSupp as boolean;
|
||||||
|
const VAD = values.VAD as "none" | "older-generation" | "newer-generation" | "heartmateii";
|
||||||
|
var score = 0;
|
||||||
|
console.log(preTransplantMechVent);
|
||||||
|
if(age > 60){
|
||||||
|
score += 3;
|
||||||
|
}
|
||||||
|
if(sbilirubin > 0 && sbilirubin < 1){
|
||||||
|
score += 0;
|
||||||
|
}else if(sbilirubin >= 1 && sbilirubin < 2){
|
||||||
|
score += 1;
|
||||||
|
}else if(sbilirubin >= 2 && sbilirubin < 4){
|
||||||
|
score += 3;
|
||||||
|
}else{
|
||||||
|
score += 4;
|
||||||
|
}
|
||||||
|
if(crcl >= 50){
|
||||||
|
score += 0;
|
||||||
|
}else if(crcl < 50 && crcl > 30){
|
||||||
|
score += 2;
|
||||||
|
}else{
|
||||||
|
score += 5;
|
||||||
|
}
|
||||||
|
if(dialysisStatus){
|
||||||
|
score += 4;
|
||||||
|
}
|
||||||
|
if(gender === "female"){
|
||||||
|
score += 3;
|
||||||
|
}
|
||||||
|
if(causeOfHF === "idiopathic"){
|
||||||
|
score += 0;
|
||||||
|
}else if(causeOfHF === "ischemic"){
|
||||||
|
score += 2;
|
||||||
|
}else if(causeOfHF === "congenital"){
|
||||||
|
score += 5;
|
||||||
|
}else{
|
||||||
|
score += 1;
|
||||||
|
}
|
||||||
|
if(recentInfection){
|
||||||
|
score += 3;
|
||||||
|
}
|
||||||
|
if(aorticBalloonPump){
|
||||||
|
score += 3;
|
||||||
|
}
|
||||||
|
if(preTransplantMechVent){
|
||||||
|
score += 5;
|
||||||
|
}
|
||||||
|
if(race === "caucasian" || race === "other" || race === "hispanic"){
|
||||||
|
score += 0;
|
||||||
|
}else{
|
||||||
|
score += 3;
|
||||||
|
}
|
||||||
|
if(tempCircSupp){
|
||||||
|
console.log("ran temp")
|
||||||
|
score += 7;
|
||||||
|
}
|
||||||
|
if(VAD === "none" || VAD === "heartmateii"){
|
||||||
|
score += 0;
|
||||||
|
}else if(VAD === "older-generation"){
|
||||||
|
score += 3;
|
||||||
|
}else{
|
||||||
|
score += 5;
|
||||||
|
}
|
||||||
|
return score;
|
||||||
|
},
|
||||||
|
interpret_func:(score : number):Interpretation => {
|
||||||
|
if(score >= 0 && score < 5){
|
||||||
|
return {
|
||||||
|
level:"none",
|
||||||
|
message:"The rate of mortality for the patient is really low"
|
||||||
|
}
|
||||||
|
}else if(score >= 5 && score < 10){
|
||||||
|
return {
|
||||||
|
level:"low",
|
||||||
|
message:"The rate of mortality for the patient is low"
|
||||||
|
}
|
||||||
|
}else if(score >= 10 && score < 15){
|
||||||
|
return {
|
||||||
|
level:"moderate",
|
||||||
|
message:"The rate of mortality for the patient is moderate"
|
||||||
|
}
|
||||||
|
}else if(score >= 15 && score < 20){
|
||||||
|
return {
|
||||||
|
level:"high",
|
||||||
|
message:"The rate of mortality for the patient is high"
|
||||||
|
}
|
||||||
|
}else{
|
||||||
|
return {
|
||||||
|
level:"severe",
|
||||||
|
message:"The rate of mortality for the patient is severe"
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,8 +15,8 @@ interface inputOptions {
|
|||||||
export interface Input{
|
export interface Input{
|
||||||
id:string,
|
id:string,
|
||||||
name:string,
|
name:string,
|
||||||
placeholder:string,
|
placeholder?:string,
|
||||||
type: "number" | "text" | "select",
|
type: "number" | "text" | "select" | "checkbox",
|
||||||
inputOptions?:inputOptions[],
|
inputOptions?:inputOptions[],
|
||||||
min?:number,
|
min?:number,
|
||||||
max?:number,
|
max?:number,
|
||||||
@@ -40,4 +40,4 @@ export interface Section {
|
|||||||
calculators:Calculator[]
|
calculators:Calculator[]
|
||||||
}
|
}
|
||||||
|
|
||||||
export type Values = Record<string, string | number >;
|
export type Values = Record<string, string | number | boolean >;
|
||||||
|
|||||||
Reference in New Issue
Block a user