alexandreamato/dppg

GitHub: alexandreamato/dppg

用于 Elcat Vasoquant 1000 数字光电容积描记设备的开源跨平台替代软件,通过逆向工程实现静脉功能评估的完整诊断流程。

Stars: 0 | Forks: 0

# D-PPG Manager **用于 Elcat Vasoquant 1000 数字化光电容积描记设备的开源、跨平台软件。** *Alexandre Amato 博士 — [Instituto Amato de Medicina Avancada](https://software.amato.com.br)* ![Python](https://img.shields.io/badge/Python-3.10%2B-blue) ![许可证](https://img.shields.io/badge/License-MIT-green) ![平台](https://img.shields.io/badge/Platform-macOS%20%7C%20Windows%20%7C%20Linux-lightgrey) ## 概述 Elcat Vasoquant 1000 是一款用于无创静脉功能评估的数字化光电容积描记 (D-PPG) 设备。其原装的 Vasoview/Vasoscreen 软件仅能在老旧的 Windows 系统上运行,且已不再维护。 **D-PPG Manager** 是通过对其专有通信协议和信号处理算法进行逆向工程构建的完整替代方案。它支持在 macOS、Windows 和 Linux 上运行。 ### 主要功能 - **完整协议支持** — 通过串口或 WiFi 桥接与 Vasoquant 1000 进行通信 - **5 个标准参数** — To、Th、Ti、Vo、Fo(已针对 226 份官方报告完成验证) - **3 种创新分析** — 指数时间常数 (tau)、双侧不对称指数、止血带效应量化 - **患者管理** — 带有检查历史记录的 SQLite 数据库 - **PDF 报告** — 自动生成包含波形、参数表、雷达图和临床解读的诊断报告 - **独立可执行文件** — 约 88 MB,无需安装 Python ### 诊断参数 | 参数 | 描述 | 单位 | |-----------|-------------|------| | **To** | 静脉再充盈时间 | 秒 | | **Th** | 半幅时间 | 秒 | | **Ti** | 初始流入时间(自适应线性外推法) | 秒 | | **Vo** | 静脉泵功率 | % | | **Fo** | 静脉泵容量(曲线积分) | %*s | | **tau** | 指数时间常数(恢复曲线拟合) | 秒 | ### 静脉功能分级 | 级别 | To | 解读 | |-------|:--:|----------------| | 正常 | > 25 s | 静脉功能正常 | | I 级 | 20-25 s | 轻度功能不全 | | II 级 | 10-20 s | 中度功能不全 | | III 级 | <= 10 s | 重度功能不全 | ## 软件截图 *即将推出* ## 下载 独立可执行文件 — 无需 Python: | 平台 | 下载 | 大小 | |----------|----------|------| | **Windows** | [DPPG-Manager-Windows.zip](https://github.com/alexandreamato/dppg/releases/latest/download/DPPG-Manager-Windows.zip) | ~56 MB | | **macOS** | [DPPG-Manager-macOS.zip](https://github.com/alexandreamato/dppg/releases/latest/download/DPPG-Manager-macOS.zip) | ~86 MB | 查看所有版本:[github.com/alexandreamato/dppg/releases](https://github.com/alexandreamato/dppg/releases) ## 从源码安装 ``` git clone https://github.com/alexandreamato/dppg.git cd dppg pip install -r requirements.txt python3 dppg_manager.py ``` ### 环境要求 - Python 3.10+ - numpy >= 1.20 - scipy >= 1.7 - matplotlib >= 3.5 - reportlab >= 4.0 - sqlalchemy >= 2.0 - Pillow - tkinter(Python 自带) ### 从源码构建 ``` pip install pyinstaller pyinstaller dppg_manager.spec --clean --noconfirm ``` 数据库存储在 `~/Documents/DPPG Manager/` 中。 ## 硬件设置 ### Vasoquant 1000 该设备通过 RS-232 串口进行通信,参数为 9600 波特率,8N2(8 个数据位,无奇偶校验位,**2 个停止位**)。 ### WiFi 桥接(可选) 串口转 WiFi 桥接器(例如 TGY Cyber WS1C)可实现无线连接: | 设置 | 值 | |---------|-------| | IP | 192.168.0.234 | | TCP 端口 | 1100 | | 波特率 | 9600 | | 配置 | 8N2 | ## 工作原理 ### 通信协议 该软件使用了从原装 Vasoview 驱动程序 (`vl320hw.dll`) 逆向工程得出的打印机模拟协议: 1. 设备发送 **DLE** (0x10) 以检查“打印机”是否在线 2. 软件回复 **ACK** (0x06) 3. 用户在设备上导出检查数据 4. 设备传输二进制数据包:通道标签 + 原始 PPG 采样数据 (4 Hz, 16 位 LE) + 硬件计算的元数据 5. 软件回复 **ACK** 以确认接收 ### 信号处理 相关算法是使用 radare2 反汇编 `dppg 2.dll` 进行逆向工程得出的。关键发现如下: - 所有计算均使用**整数算术**(无 FPU) - **Ti** 使用自适应线性外推法(3 秒或 6 秒窗口),而非阈值交叉 - **Fo** 是带有梯形校正的真实曲线积分,而不是 Vo x Th - 在 DLL 中发现的浮点常量 (0.125, 0.50, 3.0) **仅用于打印布局** ### 验证 这五个标准参数已针对官方 Vasoscreen 报告进行了验证,并提供了 95% 的置信区间。准确率是基于可获取原始信号的 37 项已采集测量结果进行评估的;描述性统计则使用了包含 226 份报告(57 名患者)的参考队列。 | 模式 | 平均误差 (95% CI) | 分级一致性 (95% CI) | |------|:----------:|:---------------:| | 硬件辅助 | 1.5% (1.0–2.3) | 92% (79–97) | | 纯软件 | 13.4% (11.2–15.9) | 46% (31–62) | 在硬件辅助模式下,软件会读取设备自身的标志点(包括固件序列化至导出元数据中的静脉再充盈时间),并复现官方参数;纯软件模式则是从原始信号中重建标志点,作为缺乏元数据时的后备方案。完整的验证过程可通过已发布的脚本重现: ``` python3 validation/run_validation.py # accuracy + 95% CIs for every reported figure python3 validation/to_recoverability.py # shows the refilling-time endpoint is device/operator-supplied ``` ## 创新分析 ### 指数时间常数 (tau) 将 `V(t) = A * exp(-t/tau) + C` 拟合至恢复曲线。tau 值越大 = 再充盈越慢 = 静脉功能越好。 ### 双侧不对称指数 量化肢体间差异:`A = |P_left - P_right| / max(P_left, P_right) * 100%` - \> 20% = 显著不对称 - \> 40% = 极度显著 ### 止血带效应量化 以百分比变化表示止血带响应: - 正值(改善) = 浅静脉反流 - 负值(恶化) = 深静脉功能不全 ## 项目结构 ``` dppg/ ├── dppg_manager.py # Main application entry point ├── dppg_manager.spec # PyInstaller build spec ├── requirements.txt # Python dependencies ├── src/ │ ├── analysis.py # Signal processing & parameter calculation │ ├── models.py # Data models (PPGBlock, PPGParameters) │ ├── protocol.py # Vasoquant binary protocol parser │ ├── config.py # Constants & configuration │ ├── exporters.py # CSV/JSON export │ ├── gui/ │ │ ├── app.py # Main GUI application │ │ ├── exam_view.py # Exam visualization │ │ ├── capture_view.py # Live data capture │ │ ├── patient_list.py # Patient management │ │ ├── report_editor.py # Report editing │ │ └── widgets.py # Custom widgets (ParametersTable, etc.) │ ├── diagnosis/ │ │ ├── classifier.py # Venous function grading │ │ └── text_generator.py # Automated diagnostic text │ ├── report/ │ │ ├── pdf_generator.py # PDF report generation │ │ ├── chart_renderer.py # Matplotlib charts for reports │ │ └── templates.py # Report text templates │ └── db/ │ └── schema.py # SQLAlchemy database schema ├── dppg_reader.py # Legacy standalone reader ├── CLAUDE.md # Technical documentation └── PROTOCOL.md # Complete protocol documentation ``` ## 引用 如果您在研究中使用本软件,请引用: ## 许可证 本项目基于 MIT 许可证授权 — 详情请参阅 [LICENSE](LICENSE)。 ## 作者 **Alexandre Amato 博士,医学博士 (MD, PhD)** Instituto Amato de Medicina Avancada 巴西圣保罗 [software.amato.com.br](https://software.amato.com.br) ## 免责声明 本软件按“原样”提供,不提供任何明示或暗示的保证。作者对任何使用或滥用本软件的行为不承担任何责任或义务。 本软件仅供研究和教育目的使用。它**不是**经过认证或注册的医疗设备,也未获得任何监管机构(ANVISA、FDA、CE 或同等机构)的批准。绝不可将其作为临床决策的唯一依据。 作者不对以下情况负责: - 因使用本软件而产生的任何临床结果 - 误用、配置不当或在预期范围外使用 - 数据丢失、设备损坏或任何直接或间接损害 - 在可能不符合当地法规的司法管辖区使用本软件 临床决策应始终由合格的医疗保健专业人员使用经过验证和认证的诊断工具来做出。用户须承担使用本软件的相关风险。
标签:Python, SQLite, 信号处理, 医疗设备, 医疗软件, 无后门, 漏洞挖掘, 逆向工具