PHPackages                             medicoassassino/prevent-calc-api - PHPackages - PHPackages  [Skip to content](#main-content)[PHPackages](/)[Directory](/)[Categories](/categories)[Trending](/trending)[Leaderboard](/leaderboard)[Changelog](/changelog)[Analyze](/analyze)[Collections](/collections)[Log in](/login)[Sign up](/register)

1. [Directory](/)
2. /
3. [API Development](/categories/api)
4. /
5. medicoassassino/prevent-calc-api

ActiveLibrary[API Development](/categories/api)

medicoassassino/prevent-calc-api
================================

AHA 2023 PREVENT equations for cardiovascular risk calculation in Laravel.

v1.1.2(2mo ago)21MITPHPPHP ^8.2

Since Feb 26Pushed 2mo ago1 watchersCompare

[ Source](https://github.com/MedicoAssassino/PREVENT-AHA-calculator-api)[ Packagist](https://packagist.org/packages/medicoassassino/prevent-calc-api)[ RSS](/packages/medicoassassino-prevent-calc-api/feed)WikiDiscussions main Synced 1mo ago

READMEChangelogDependencies (1)Versions (4)Used By (0)

🫀 AHA 2023 PREVENT Risk Calculator API
======================================

[](#-aha-2023-prevent-risk-calculator-api)

🌍 *Read this in other languages: [فارسی (Persian)](README-fa.md)*

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 &amp; Background
----------------------------------------

[](#-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
-----------------

[](#-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

[](#-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

[](#-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

[](#-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
---------------

[](#-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
---------------------------

[](#-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

[](#️-laravel-integration)

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

#### Using the Facade (Recommended)

[](#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

[](#-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,
],
```

###  Health Score

38

—

LowBetter than 85% of packages

Maintenance86

Actively maintained with recent releases

Popularity4

Limited adoption so far

Community7

Small or concentrated contributor base

Maturity48

Maturing project, gaining track record

 Bus Factor1

Top contributor holds 100% of commits — single point of failure

How is this calculated?**Maintenance (25%)** — Last commit recency, latest release date, and issue-to-star ratio. Uses a 2-year decay window.

**Popularity (30%)** — Total and monthly downloads, GitHub stars, and forks. Logarithmic scaling prevents top-heavy scores.

**Community (15%)** — Contributors, dependents, forks, watchers, and maintainers. Measures real ecosystem engagement.

**Maturity (30%)** — Project age, version count, PHP version support, and release stability.

###  Release Activity

Cadence

Every ~0 days

Total

3

Last Release

74d ago

### Community

Maintainers

![](https://www.gravatar.com/avatar/4125397b8a1161e0084a32b008c361f6073fc6341cabc49573126c5c97b104a5?d=identicon)[MedicoAssassino](/maintainers/MedicoAssassino)

---

Top Contributors

[![MedicoAssassino](https://avatars.githubusercontent.com/u/169415670?v=4)](https://github.com/MedicoAssassino "MedicoAssassino (8 commits)")

---

Tags

aha-2023-prevent-calculatorcardiovascular-riskcardiovascular-risk-predictioninternal-medicinelaravelmedical-apiphp

### Embed Badge

![Health badge](/badges/medicoassassino-prevent-calc-api/health.svg)

```
[![Health](https://phpackages.com/badges/medicoassassino-prevent-calc-api/health.svg)](https://phpackages.com/packages/medicoassassino-prevent-calc-api)
```

###  Alternatives

[mollie/laravel-mollie

Mollie API client wrapper for Laravel &amp; Mollie Connect provider for Laravel Socialite

3624.1M28](/packages/mollie-laravel-mollie)[mll-lab/laravel-graphiql

Easily integrate GraphiQL into your Laravel project

683.2M9](/packages/mll-lab-laravel-graphiql)[spatie/laravel-route-discovery

Auto register routes using PHP attributes

23645.0k2](/packages/spatie-laravel-route-discovery)[esign/laravel-conversions-api

A laravel wrapper package around the Facebook Conversions API

69145.4k](/packages/esign-laravel-conversions-api)[didww/didww-api-3-php-sdk

PHP SDK for DIDWW API 3

1218.2k](/packages/didww-didww-api-3-php-sdk)[surface/laravel-webfinger

A Laravel package to create an ActivityPub webfinger.

113.8k](/packages/surface-laravel-webfinger)

PHPackages © 2026

[Directory](/)[Categories](/categories)[Trending](/trending)[Changelog](/changelog)[Analyze](/analyze)
