定制 atiweb/edss-in-php 二次开发

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

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

atiweb/edss-in-php

Composer 安装命令:

composer require atiweb/edss-in-php

包简介

PHP implementation of the Expanded Disability Status Scale (EDSS) calculator based on the Kurtzke/Kappos scoring table

README 文档

README

License: MIT

PHP implementation of the Expanded Disability Status Scale (EDSS) calculator, based on the scoring table by Ludwig Kappos, MD (University Hospital Basel) and the Neurostatus-EDSS™ standard (Kurtzke, 1983).

This library calculates the EDSS score from 7 Functional System (FS) scores and an Ambulation score, used in the clinical assessment of Multiple Sclerosis.

Based on the JavaScript reference implementation (forked from adobrasinovic/edss).

Installation

composer require atiweb/edss-in-php

Usage

Direct calculation with individual scores

Parameter names match the JS reference: calculateEDSS(visualFunctionsScore, brainstemFunctionsScore, pyramidalFunctionsScore, cerebellarFunctionsScore, sensoryFunctionsScore, bowelAndBladderFunctionsScore, cerebralFunctionsScore, ambulationScore)

use Atiweb\Edss\EdssCalculator;

$calculator = new EdssCalculator();

$edss = $calculator->calculate(
    visualFunctionsScore: 1,          // Visual (Optic) — raw 0-6
    brainstemFunctionsScore: 2,       // Brainstem — 0-5
    pyramidalFunctionsScore: 1,       // Pyramidal — 0-6
    cerebellarFunctionsScore: 3,      // Cerebellar — 0-5
    sensoryFunctionsScore: 1,         // Sensory — 0-6
    bowelAndBladderFunctionsScore: 4, // Bowel & Bladder — raw 0-6
    cerebralFunctionsScore: 2,        // Cerebral (Mental) — 0-5
    ambulationScore: 1,               // Ambulation — 0-16
);

echo $edss; // "4"

From an associative array

By default, calculateFromArray() expects English field names:

$data = [
    'visual_functions_score' => '1',
    'brainstem_functions_score' => '2',
    'pyramidal_functions_score' => '1',
    'cerebellar_functions_score' => '3',
    'sensory_functions_score' => '1',
    'bowel_and_bladder_functions_score' => '4',
    'cerebral_functions_score' => '2',
    'ambulation_score' => '1',
];

$edss = $calculator->calculateFromArray($data);
echo $edss; // "4"

With REDCap Portuguese field names

If your data uses the Portuguese field names from REDCap/REDONE.br, pass the built-in FIELDS_REDCAP_PT mapping:

$redcapData = [
    'edss_func_visuais' => '1',                       // Visual Functions Score
    'edss_cap_func_tronco_cereb' => '2',              // Brainstem Functions Score
    'edss_cap_func_pirad' => '1',                     // Pyramidal Functions Score
    'edss_cap_func_cereb' => '3',                     // Cerebellar Functions Score
    'edss_cap_func_sensitivas' => '1',                // Sensory Functions Score
    'edss_func_vesicais_e_instestinais' => '4',       // Bowel & Bladder Functions Score
    'edss_func_cerebrais' => '2',                     // Cerebral Functions Score
    'edss_func_demabulacao_incapacidade' => '1',      // Ambulation Score
];

$edss = $calculator->calculateFromArray($redcapData, EdssCalculator::FIELDS_REDCAP_PT);
echo $edss; // "4"

// Longitudinal data with suffix
$edss = $calculator->calculateFromArray($longitudinalData, EdssCalculator::FIELDS_REDCAP_PT, '_long');

Custom field mapping

You can define your own field name mapping for any data source:

$myFields = [
    'visual'       => 'my_visual_field',
    'brainstem'    => 'my_brainstem_field',
    'pyramidal'    => 'my_pyramidal_field',
    'cerebellar'   => 'my_cerebellar_field',
    'sensory'      => 'my_sensory_field',
    'bowelBladder' => 'my_bowel_bladder_field',
    'cerebral'     => 'my_cerebral_field',
    'ambulation'   => 'my_ambulation_field',
];

$edss = $calculator->calculateFromArray($myData, $myFields);

Score conversions

The Visual and Bowel & Bladder Functional Systems use a wider raw scale that is compressed for EDSS calculation:

// Visual: raw 0-6 → converted 0-4
//   0→0, 1→1, 2-3→2, 4-5→3, 6→4
EdssCalculator::convertVisualScore(3);  // 2
EdssCalculator::convertVisualScore(5);  // 3

// Bowel & Bladder: raw 0-6 → converted 0-5
//   0→0, 1→1, 2→2, 3-4→3, 5→4, 6→5
EdssCalculator::convertBowelAndBladderScore(4);  // 3
EdssCalculator::convertBowelAndBladderScore(6);  // 5

Functional Systems

# Functional System Raw Scale Converted Scale JS Parameter Name
1 Visual (Optic) 0-6 0-4 visualFunctionsScore
2 Brainstem 0-5 brainstemFunctionsScore
3 Pyramidal 0-6 pyramidalFunctionsScore
4 Cerebellar 0-5 cerebellarFunctionsScore
5 Sensory 0-6 sensoryFunctionsScore
6 Bowel & Bladder 0-6 0-5 bowelAndBladderFunctionsScore
7 Cerebral (Mental) 0-5 cerebralFunctionsScore
8 Ambulation 0-16 ambulationScore

Note: The Ambulation score (≥3) directly determines the EDSS score (≥5.0). When Ambulation is 0-2, the EDSS is determined by the combination of FS scores.

Algorithm

The EDSS calculation follows a two-phase approach:

Phase 1: Ambulation-driven (EDSS ≥ 5.0)

When the Ambulation score is ≥ 3, it directly maps to an EDSS value:

Ambulation EDSS Description
3 5.0 Walks 200-300m without help
4 5.5 Walks 100-200m without help
5-7 6.0 Assistance needed for walking
8-9 6.5 Bilateral/limited assistance
10 7.0 Wheelchair without help
11 7.5 Wheelchair with help
12 8.0 Restricted to bed/chair
13 8.5 Restricted to bed
14 9.0 Helpless bed patient
15 9.5 Totally helpless
16 10.0 Death due to MS

Phase 2: FS-driven (EDSS 0 – 5.0)

When Ambulation is 0-2, the EDSS is calculated from the combination of the 7 FS scores based on the Kappos scoring table, considering:

  • The maximum FS score and how many systems have that score
  • The second-highest FS score and its frequency
  • The Ambulation score (0, 1, or 2)

Field Name Mappings

The library includes built-in constants for field name mappings:

Constant Description Example field
FIELDS_DEFAULT English names (default) visual_functions_score
FIELDS_REDCAP_PT Portuguese REDCap names edss_func_visuais

You can also pass your own array<string, string> mapping to calculateFromArray().

Other implementations

Language Repository
JavaScript atiweb/edss
Kotlin atiweb/edss-in-kotlin
Flutter/Dart atiweb/edss-in-flutter

Testing

composer install
composer test

The test suite includes 70+ test cases covering:

  • All EDSS ranges from 0 to 10
  • Visual and Bowel/Bladder score conversions
  • All ambulation-driven scores
  • Edge cases for FS combinations
  • The reference example from the JavaScript implementation
  • Custom field mapping support

References

License

MIT

atiweb/edss-in-php 适用场景与选型建议

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

它主要适用于以下技术方向: 「edss」 「multiple-sclerosis」 「neurology」 「kurtzke」 「disability-scale」 「clinical-assessment」 等业务场景。在实际项目中,围绕这些方向常见需要落地的问题包括:接口对接、性能调优、并发安全、与既有框架(Laravel / ThinkPHP / Yii / Webman 等)的兼容适配,以及生产环境的日志埋点与稳定性保障。

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

围绕 atiweb/edss-in-php 我们能提供哪些服务?
定制开发 / 二次开发

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

BUG 修复 & 性能优化

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

项目外包 & 长期维护

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

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

统计信息

  • 总下载量: 11
  • 月度下载量: 0
  • 日度下载量: 0
  • 收藏数: 2
  • 点击次数: 38
  • 依赖项目数: 0
  • 推荐数: 0

GitHub 信息

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

其他信息

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