src/Services/Health/GenCardioLipids.php line 18

Open in your IDE?
  1. <?php
  2. namespace App\Services\Health;
  3. class GenCardioLipids
  4. {
  5.     protected $params;
  6.     protected $sex;
  7.     protected $age;
  8.     protected $sysBloodPresure;
  9.     protected $treatmentForHypertension;
  10.     protected $smoking;
  11.     protected $diabetes;
  12.     protected $hDL;
  13.     protected $totalCholesterol;
  14.     public function __construct(
  15.         ParametersInterface $params,
  16.         int $sex,
  17.         int $age,
  18.         int $sysBloodPresure,
  19.         bool $treatmentForHypertension,
  20.         bool $smoking,
  21.         bool $diabetes,
  22.         int $hDL,
  23.         int $totalCholesterol
  24.     ) {
  25.         $this->params $params;
  26.         $this->sex $sex;
  27.         $this->age $age;
  28.         $this->sysBloodPresure $sysBloodPresure;
  29.         $this->treatmentForHypertension $treatmentForHypertension;
  30.         $this->smoking $smoking;
  31.         $this->diabetes $diabetes;
  32.         $this->hDL $hDL;
  33.         $this->totalCholesterol $totalCholesterol;
  34.     }
  35.     public function generateCvdRiskPredictionUsingLipids()
  36.     {
  37.         $sex $this->sex;
  38.         $age log($this->age);
  39.         $sbp log($this->sysBloodPresure);
  40.         $tcl log($this->totalCholesterol);
  41.         $hdl log($this->hDL);
  42.         $trtbp $this->treatmentForHypertension 0;
  43.         $smoke $this->smoking 0;
  44.         $diab $this->diabetes 0;
  45.         $sumBetaX_No_SBP_Trt $age $this->params->getAGE() + $sbp $this->params->getSBPNOTRT() + $tcl $this->params->getTCL() + $hdl $this->params->getHDL() + $smoke $this->params->getSMOKE() + $diab $this->params->getDIAB();
  46.         $sumBetaX_SBP_With_Trt $age $this->params->getAGE() + $sbp $this->params->getSBPTRT() + $tcl $this->params->getTCL() + $hdl $this->params->getHDL() + $smoke $this->params->getSMOKE() + $diab $this->params->getDIAB();
  47.         $riskScore_No_SBP_Trt pow(0.88936exp($sumBetaX_No_SBP_Trt 23.9802));
  48.         $riskScore_With_SBP_Trt pow(0.88936exp($sumBetaX_SBP_With_Trt 23.9802));
  49.         $sumBetaX_No_SBP_Trt_OPTIMAL $this->params->getAGE() * $age $this->params->getSBPNOTRT() * log(110) + $this->params->getTCL() * log(160) + $this->params->getHDL() * log(60);
  50.         $sumBetaX_No_SBP_Trt_NORMAL $this->params->getAGE() * $age $this->params->getSBPNOTRT() * log(125) + $this->params->getTCL() * log(180) + $this->params->getHDL() * log(45);
  51.         $optimalRisk pow(0.88936exp($sumBetaX_No_SBP_Trt_OPTIMAL 23.9802));
  52.         $normalRisk pow(0.88936exp($sumBetaX_No_SBP_Trt_NORMAL 23.9802));
  53.         $riskScore_No_SBP_Trt $riskScore_No_SBP_Trt 100;
  54.         $riskScore_With_SBP_Trt $riskScore_With_SBP_Trt 100;
  55.         $sumBetaX_No_SBP_Trt_OPTIMAL $sumBetaX_No_SBP_Trt_OPTIMAL 100;
  56.         $sumBetaX_No_SBP_Trt_NORMAL $sumBetaX_No_SBP_Trt_NORMAL 100;
  57.         $optimalRisk $optimalRisk 100;
  58.         $normalRisk $normalRisk 100;
  59.         return compact(
  60.             'sumBetaX_No_SBP_Trt',
  61.             'sumBetaX_SBP_With_Trt',
  62.             'riskScore_No_SBP_Trt',
  63.             'riskScore_With_SBP_Trt',
  64.             'sumBetaX_No_SBP_Trt_OPTIMAL',
  65.             'sumBetaX_No_SBP_Trt_NORMAL',
  66.             'optimalRisk',
  67.             'normalRisk'
  68.         );
  69.     }
  70. }