定制 medicoassassino/prevent-calc-api 二次开发

按需修改功能、优化性能、对接业务系统,提供一站式技术支持

邮箱:yvsm@zunyunkeji.com | QQ:316430983 | 微信:yvsm316

medicoassassino/prevent-calc-api

Composer 安装命令:

composer require medicoassassino/prevent-calc-api

包简介

AHA 2023 PREVENT equations for cardiovascular risk calculation in Laravel.

README 文档

README

🌍 Read this in other languages: فارسی (Persian)

A fast, structured, and standalone API service based on PHP for calculating the 10-year risk of Cardiovascular Disease (CVD), Atherosclerotic Cardiovascular Disease (ASCVD), and Heart Failure (HF) using the AHA 2023 PREVENT™ Equations.

🩺 Clinical Significance & Background

The PREVENT (Predicting Risk of cardiovascular disease EVENTs) equations are a modern replacement for the older Pooled Cohort Equations (PCE). These new equations utilize data from the latest multi-ethnic cohorts and have the capability to incorporate kidney function markers (eGFR and uACR) as well as metabolic markers (HbA1c) to increase prediction accuracy.

📚 Source: Tables S12A to S12E from the American Heart Association (AHA) 2023 article supplement.

🚀 API Usage Guide

This service is designed to receive patient clinical data via a JSON payload and return the calculated 10-year risk percentages after processing.

🎯 Endpoint Expectation

You can easily integrate this class into the controllers of PHPframeworks (or Serverless functions) to handle POST requests.

📌 Required Headers:

  • Content-Type: application/json
  • Accept: application/json

📥 Request Body

Here is a complete example of the patient clinical parameters that should be sent in JSON format:

{
  "gender": "male",
  "age": 60,
  "tc": 200,
  "hdl": 45,
  "sbp": 140,
  "bmi": 28.5,
  "egfr": 75,
  "diabetes": 0,
  "smoker": 0,
  "bpMeds": 1,
  "statin": 1,
  "hba1c": 5.8,
  "uacr": 15
}

💡 Important Note: The hba1c and uacr parameters are optional. The system is designed so that if these values are not provided, it will automatically fall back to the Base Models for calculation.

📤 Response

After processing, the output is returned in this format:

{
  "status": "success",
  "data": {
    "cvd": 12.4,
    "ascvd": 9.8,
    "hf": 3.5
  },
  "message": "Calculated successfully."
}

🧠 Routing Logic

The calculate() method in this service acts as a smart router, selecting the appropriate model based on the provided data:

  • 🥇 Full Model: Used if both hba1c and uacr values are available.
  • 🥈 ACR Model: Used if only the uacr value is provided.
  • 🥉 A1C Model: Used if only the hba1c value is provided.
  • 🏅 Base Model: Used if neither of these two optional parameters is provided.

📦 Installation via Composer

To integrate this service into your Laravel project, run the following command in your terminal:

composer require medicoassassino/prevent-calc-api

⚙️ Laravel Integration

This package features Auto-Discovery, meaning Laravel will automatically register the Service Provider and the PreventCalc Facade.

Using the Facade (Recommended)

You can call the calculator from anywhere in your application:

use HClean\PreventCalcApi\Facades\PreventCalc;

$data = [
    "gender" => "female",
    "age" => 55,
    "tc" => 210,
    "hdl" => 55,
    "sbp" => 130,
    "bmi" => 26.0,
    "egfr" => 85,
    "diabetes" => 0,
    "smoker" => 0,
    "bpMeds" => 0,
    "statin" => 0
];

$results = PreventCalc::calculate($data);

// Output: ["cvd" => 4.2, "ascvd" => 3.1, "hf" => 1.2]

🛠 Manual Registration

If you are using an older version of Laravel (below 5.5) or have auto-discovery disabled, add the following to your config/app.php:

'providers' => [
    HClean\PreventCalcApi\MyServiceProvider::class,
],

'aliases' => [
    'PreventCalc' => HClean\PreventCalcApi\Facades\PreventCalc::class,
],

medicoassassino/prevent-calc-api 适用场景与选型建议

medicoassassino/prevent-calc-api 是一款 基于 PHP 开发的 Composer 扩展包,目前已累计 1 次下载、GitHub Stars 达 3, 最近一次更新时间为 2026 年 02 月 27 日, 在 PHP 生态内属于活跃度较高的组件。

我们在过去多个企业项目中使用过 medicoassassino/prevent-calc-api 或与其功能相近的方案,如果你在选型或落地过程中遇到问题,例如 版本兼容、二次改造、私有化封装、与内部系统对接、生产 BUG 排查,欢迎联系我们协助评估。

围绕 medicoassassino/prevent-calc-api 我们能提供哪些服务?
定制开发 / 二次开发

基于 medicoassassino/prevent-calc-api 在你已有业务上做功能扩展、字段裁剪、UI 适配、与内部账号 / 权限 / 日志系统的深度对接。

BUG 修复 & 性能优化

线上偶发问题、内存泄漏、慢查询、并发异常等排查修复;针对高流量场景做缓存、队列、索引层面的调优。

项目外包 & 长期维护

承接完整的项目从需求 → 设计 → 开发 → 上线 → 长期运维;也可按月提供技术保姆服务。

yvsm@zunyunkeji.com QQ:316430983 微信:yvsm316 西安尊云信息科技 · 专注 PHP / Go / 分布式系统研发

统计信息

  • 总下载量: 1
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 3
  • 点击次数: 30
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

  • Stars: 3
  • Watchers: 1
  • Forks: 0
  • 开发语言: PHP

其他信息

  • 授权协议: MIT
  • 更新时间: 2026-02-27