← penux.uk Patient Journeyמסע המטופל Models & Matricesמודלים ומטריצות Predictחיזוי 📋 Tasks📋 משימות 🇮🇱 Secondary Analysis (HE)🇮🇱 ניתוח משני (עברית) Review Article · 2026מאמר סקירה · 2026
Scientific Review · Clinical AI

PenuX-AP-Severity: Machine Learning and Deep Learning for Early Prediction of Severe Acute Pancreatitis

Nine-model comparative evaluation — Logistic Regression, Random Forest, Gradient Boosting, MLP, Residual MLP, Attention MLP, XGBoost, LightGBM, CatBoost — on a Chinese AP cohort (n=722)
📅 June 2026 🔬 PenuX Research Group 🏥 Retrospective cohort study 📊 Chinese AP Dataset · HL7 R4 · Camelion
Stage 0 — Seeking Hospital Data Partners — We are building hospital data partnership agreements before formal validation (Stage I) begins. Interested sites are invited to contact the PI. See protocol / contact PI

Abstract

Background: Severe Acute Pancreatitis (SAP) carries a mortality rate of 20–30% and requires early risk stratification. Classical scoring tools — BISAP, Ranson, APACHE II — require 24–48 hours of follow-up data and are not designed for automated EHR integration.

Objective: To evaluate six ML and deep learning models for SAP severity prediction using routine admission laboratory values, and to compare their performance on a Chinese AP inpatient cohort.

Methods: Retrospective cohort of 722 AP admissions (585 severe / 137 mild, Atlanta 2012 classification) from a single Chinese institution. Nine models trained with 5-fold stratified cross-validation on 106 routine laboratory features: three classical ML models (Logistic Regression, Random Forest, Gradient Boosting), three MLP-based deep learning models, and three gradient-boosted tree models (XGBoost, LightGBM, CatBoost). An earlier LSTM-based sequence-model family was evaluated and discontinued — see §3.3 for rationale — since these lab values are a single admission-time snapshot with no genuine temporal ordering, making a recurrent architecture a poor methodological fit.

Results: CatBoost achieved the highest F1 and Sensitivity among all models (F1=0.926, Sensitivity=95.6% at threshold 0.592), while XGBoost achieved the highest AUC (0.883, F1=0.923). Random Forest remained competitive (AUC=0.877, F1=0.917, Sensitivity=96.8% at threshold 0.535). Gradient Boosting was comparable (AUC=0.874, F1=0.918). Among deep learning models, MLP achieved AUC=0.836. Key predictive features across all models: Calcium, D-dimer, LDH, Lactate, Hematocrit.

Conclusions: For routine lab-based SAP triage with ≥95% sensitivity, CatBoost or XGBoost are the recommended models — highest AUC/F1, interpretable tree-based feature importance, robust to missing values, no normalisation required. Random Forest remains a strong, simpler alternative. External validation on Western and Israeli cohorts is required before clinical use.

Acute Pancreatitis SAP Machine Learning Deep Learning Random Forest Attention MLP FHIR R4 Camelion HIS BISAP Clinical Prediction

1. Background and Motivation

Acute Pancreatitis (AP) is one of the most common causes of emergency gastrointestinal hospitalisation, with an incidence of approximately 34 cases per 100,000 persons per year. Around 20% of cases progress to Severe Acute Pancreatitis (SAP), characterised by organ failure and pancreatic necrosis, carrying a mortality of 20–30%.

Classical scoring systems — Ranson (1974), APACHE II, BISAP (2008) — were developed before the era of electronic health records and require 24–48 hours of serial observations. Later studies reported modest predictive ability (AUROC 0.73–0.83 across different series). The Revised Atlanta Classification (2012) established the need for faster, more accurate severity stratification at admission.

PenuX-AP-Severity proposes a modern approach: using routine laboratory values available within 2–4 hours of admission, evaluated across six ML and deep learning architectures, with direct EHR integration via FHIR R4, HL7 v2.x, and the Israeli HIS Camelion.

A key finding in this cohort analysis is a label inversion effect: "mild AP" patients (predominantly biliary origin with concurrent cholangitis) showed higher WBC, CRP, and lipase values than "severe AP" patients (predominantly pancreatic necrosis). This explains why classical BISAP/Ranson-weighted heuristics underperformed on this Chinese dataset, and why data-driven models trained directly on the cohort are necessary.

2. Dataset and Cohort Characteristics

2.1 Cohort Description

The dataset consists of 722 AP inpatient admissions from a single Chinese institution, exported as ap_lnn_sanitized.csv. Ground truth labels follow the Atlanta 2012 classification (ICD coding). The cohort includes 106 routine laboratory features collected at or near admission, covering haematology, biochemistry, coagulation, blood gas, and liver function panels.

722
Total AP admissions
585
Severe AP (81%)
137
Mild AP (19%)
106
Laboratory features

2.2 Label Inversion — Clinical Insight

Analysis of mean values by severity group revealed a counter-intuitive pattern: mild AP patients had higher WBC (15.1 vs 11.7 ×10⁹/L), CRP (102.5 vs 50.4 mg/L), and lipase (1,857 vs 904 U/L) than severe AP patients. Conversely, severe AP showed lower albumin (36.7 vs 41.0 g/L) and calcium (1.96 vs 2.23 mmol/L).

This inversion reflects the likely etiology mix: mild-labeled biliary AP cases with concurrent cholangitis produce a strong inflammatory response (elevated WBC/CRP/lipase) without progressing to organ failure, whereas severe-labeled cases represent pancreatic necrosis with hypoalbuminaemia and hypocalcaemia as dominant features. Importantly, 13–14 patients with high pancreatic sepsis risk scores were labeled "mild" — possible misclassification of infected pancreatic necrosis.

⚠️ Consequence for heuristic models: Ranson/BISAP-weighted logistic models applied to this cohort produced AUC < 0.5 (worse than chance) because their feature directions assume Western-population pathophysiology. All six models were trained data-driven on the cohort itself, not on literature-derived weights.

3. Model Architectures

3.1 Classical Machine Learning

All three classical models were trained on StandardScaler-normalised features with 5-fold stratified cross-validation. Optimal threshold was selected by maximum F1 score on out-of-fold predictions.

ModelHyperparametersThreshold selection
Logistic Regression MLL2, C=0.5, max_iter=1000Max F1 on OOF predictions
Random Forest MLn_estimators=200, max_depth=6, min_samples_leaf=5Max F1 on OOF predictions
Gradient Boosting MLn_estimators=150, max_depth=3, lr=0.05Max F1 on OOF predictions

3.2 Deep Learning (TensorFlow / Keras)

All deep learning models were trained with Adam optimizer, early stopping on val_AUC (patience=8), batch size 32, and a maximum of 60 epochs per fold. Features were StandardScaler-normalised within each fold. Convergence was rapid — 7–11 mean epochs — reflecting the limited depth of benefit achievable on n=722.

ModelArchitectureLearning RateOptimal Epochs (mean)Fold range
MLP DL256→128→64→1, BN+Dropout (0.35/0.30/0.20)1e-3~118–16
Residual MLP DL128-dim projection + 2 residual blocks + skip connections8e-4~104–17
Attention MLP DLSigmoid feature gate (106→106) → 256→128→64→11e-3~72–14

The Attention MLP converges fastest (~7 epochs), suggesting the sigmoid attention gate learns feature selection rapidly, after which the downstream network has little remaining optimisation to do. The wider epoch variance of Residual MLP (4–17) reflects sensitivity of skip-connection networks to weight initialisation on small datasets.

3.3 Gradient-Boosted Trees (replacing an earlier LSTM sequence-model family)

An earlier iteration of this evaluation treated the 106 laboratory features as a one-dimensional sequence and trained five LSTM architectures (Vanilla LSTM, Stacked LSTM, Bidirectional LSTM, LSTM+Attention, CNN-LSTM). On reflection, this was a poor methodological fit: the 106 features are a single admission-time snapshot with no genuine temporal or ordinal relationship between them — reshaping them to (106, 1) imposes a sequence structure that does not exist in the underlying clinical data. Consistent with this, the LSTM family underperformed every other model (AUC 0.68–0.78 vs. 0.82–0.88 for tabular-appropriate methods) and is reported in the archived results file rather than here.

Gradient-boosted decision trees (GBDT) are the standard high-performance approach for tabular clinical data of this kind, and were trained here as the replacement family, using the same 5-fold stratified cross-validation protocol as every other model in this evaluation.

ModelArchitectureLearning RateKey design choice
XGBoost GBDT300 trees, max_depth=4, subsample/colsample=0.80.05Depth-wise growth with L2 regularisation
LightGBM GBDT300 trees, num_leaves=31, max_depth=50.05Leaf-wise growth — faster convergence on small/medium tabular data
CatBoost GBDT300 symmetric trees, depth=50.05Ordered boosting reduces prediction shift on small cohorts

4. Results — 5-Fold Cross-Validation

Best model for routine lab-based SAP triage: Random Forest
AUC=0.877 · F1=0.917 · Sensitivity=96.8% · Specificity=38.7% at threshold 0.535
Why: Highest AUC across all 11 models. No feature scaling required. Robust to missing lab values (fillna=0). Natively outputs probability scores. Feature importance is directly interpretable. Misses only 19/585 severe cases at the optimal threshold.

4.1 Full Performance Table — All 11 Models

ModelTypeAUCF1Threshold SensitivitySpecificityPPV
Logistic RegressionML 0.8170.9070.575 93.8%43.8%87.7%
Random Forest ★ML 0.8770.9170.535 96.8%38.7%87.1%
Gradient BoostingML 0.8740.9180.350 97.1%38.0%87.0%
MLP (3-layer)DL 0.8360.9090.282 96.9%24.8%84.6%
Residual MLPDL 0.8040.9120.203 97.8%28.5%85.4%
Attention MLPDL 0.7840.9090.418 98.3%23.4%84.6%
XGBoostGBDT
LightGBMGBDT
CatBoost ★GBDT

GBDT model results load dynamically from ../PenuX-AP-Severity/models/eval_results.json via the script below. If the cells show "—", the training run has not yet completed.

4.1b Gradient-Boosted Trees — Why They Replaced LSTM

XGBoost, LightGBM, and CatBoost all build ensembles of decision trees on the 106 lab values directly, with no artificial sequence structure imposed. Each split in each tree tests a single feature against a threshold, and predictions are an additive sum of tree outputs — a natural fit for tabular data where features have no temporal ordering. This is the same reasoning that makes Random Forest and Gradient Boosting strong baselines here; XGBoost/LightGBM/CatBoost extend that approach with more sophisticated regularisation and boosting schedules.

In practice on n=722, all three GBDT models converge to AUC 0.879–0.883, clearly ahead of every deep-learning model and the discontinued LSTM family. CatBoost's ordered boosting gives it a slight edge in F1/Sensitivity, likely because it is specifically designed to resist overfitting on small datasets like this 722-patient cohort. LightGBM's leaf-wise growth is the fastest to train but showed marginally lower AUC here, consistent with leaf-wise growth being more prone to overfitting without careful tuning on small n.

4.2 Key Predictive Features

Feature importance analysis across models consistently identifies the same cluster of biomarkers as most predictive:

FeatureLR (|coef|)RF (importance)GB (importance)Clinical rationale
Calcium2nd1st2ndHypocalcaemia — saponification in necrotic fat; classic Ranson criterion
D-dimer4th2nd1stCoagulopathy / DIC in severe disease
LDH5th3rd3rdTissue necrosis marker; Ranson criterion (>250 U/L)
Lactate4th4th4thHypoperfusion / organ dysfunction
Hematocrit5th5thHaemoconcentration — early marker of necrotising pancreatitis
Lymphocytes1stLymphopenia in systemic inflammatory response
Creatinine3rd9th10thAKI — Ranson criterion

4.3 Threshold Analysis — Clinical Interpretation

In a clinical setting, minimising false negatives (missed SAP) is the primary objective. The threshold sweep across all models shows that sensitivity >95% is achievable at thresholds of 0.20–0.55, depending on the model. The Random Forest at its default threshold (0.535) achieves 96.8% sensitivity — missing only 19 of 585 severe cases.

Lowering the threshold to 0.30 across all models pushes sensitivity above 99% but reduces specificity to <20%, generating many false alarms. In practice, a threshold of 0.40–0.55 provides the best clinical trade-off for triage purposes.

ℹ️ Threshold recommendation: For clinical triage of SAP, a sensitivity target of ≥95% is appropriate. All 9 models achieve this at or below their optimal thresholds. The Random Forest (T=0.535) and Gradient Boosting (T=0.350) offer complementary sensitivity/specificity trade-offs and should be considered for ensemble use. CatBoost (T=0.592) and XGBoost (T=0.522) offer the best F1/sensitivity trade-off with fully interpretable tree-based feature importance as a secondary advantage.

5. EHR Integration

5.1 FHIR R4 — International Standard

The API accepts FHIR R4 Bundle resources containing a Patient resource and a list of Observation resources with LOINC codes. The response is returned as a RiskAssessment resource with SNOMED CT risk group codes:

Risk LevelSNOMED CT CodeProbability Threshold
Low723505004<0.30
Intermediate7235060030.30–0.60
High723507007>0.60

5.2 HL7 v2.x — Legacy System Compatibility

The HL7 v2.x interface parses ORU^R01 messages, extracting age/sex from PID and laboratory values from OBX segments. The system supports LOINC codes and vendor-specific LIS codes (Epic, Cerner, OpenEMR, VistA, Allscripts), enabling integration without EHR-side code changes.

5.3 Camelion — Israeli HIS

Camelion (Malam-Team) is the most widely deployed HIS in Israel. PenuX-AP-Severity includes a dedicated adapter supporting:

ℹ️ For sandbox access to the Camelion environment, contact Malam-Team to request SMART on FHIR credentials: api-support@malam.co.il

6. Privacy and Data Security

PenuX-AP-Severity was designed with Privacy by Design from the outset:

✅ SAP prediction is a prediction tool only — not a diagnosis. All clinical decisions remain the sole responsibility of the treating physician.

7. Comparison with Existing Scoring Tools

Scoring ToolAUROC (literature)Time to ResultParametersEHR Integration
PenuX — Random Forest ★0.877 (this cohort, 5-fold CV) 2–4 hours106 routine labsFHIR · HL7 · Camelion
PenuX — Gradient Boosting0.874 2–4 hours106 routine labsFHIR · HL7 · Camelion
PenuX — MLP0.836 2–4 hours106 routine labsFHIR · HL7 · Camelion
BISAP0.8224 hours5Manual
Ranson (admission)0.73Admission5 of 11Manual
APACHE II0.8324 hours12 + age + chronic diseaseManual
Harmless AP Score0.88Admission3No
CTSI (CT-based)0.87Post-CTCT onlyPACS only

PenuX Random Forest (AUC=0.877) matches or exceeds BISAP and approaches APACHE II and CTSI performance, with the key advantage that results are available within 2–4 hours of admission using only routine blood tests — no CT required, no 24-hour wait, with full API integration for automated workflows.

7.1 Why Do Classical Scoring Tools Require 48 Hours to Confirm Severity?

A key clinical limitation of Ranson, Glasgow (Imrie), and related scoring systems is that their final score cannot be computed at admission — a subset of criteria is only evaluable after 48 hours of observation. This delay is not arbitrary: it reflects the two-wave physiological response of the body to acute pancreatic injury.

Wave 1 — Immediate Enzymatic Release (0–24 h)

Wave 2 — Systemic Inflammatory Response (24–48 h)

Which Parameters Require a 48-Hour Window

Scoring Tool48-Hour ParametersReason for Delay
Ranson (1974) ΔBUN ≥5 mg/dL · ΔHematocrit ≥10% · Ca²⁺ <8 mg/dL · PaO₂ <60 mmHg · Base deficit >4 mEq/L · Fluid sequestration >6 L All are dynamic delta values — require two time points to compute
Glasgow / Imrie PaO₂ · albumin · calcium · LDH (re-measured at 48 h) Values peak or trough at 24–48 h; admission values underestimate severity
BISAP BUN >25 mg/dL (first 24 h) BUN inflated before IV resuscitation — more reliable after initial fluid therapy
CT Severity Index CT scan performed at 48–72 h Pancreatic necrosis is not visible on early CT (<48 h) — contrast enhancement underestimates devitalised tissue

The Clinical Cost of the 48-Hour Window

For severe cases, a 48-hour diagnostic delay is clinically dangerous. Patients who will develop infected pancreatic necrosis, abdominal compartment syndrome, or multi-organ dysfunction often show early warning signals — altered lab trajectories, rising inflammatory markers — that a data-driven model can detect in the first blood draw. A prospective study by Mounzer et al. (2012, Gastroenterology) demonstrated that BISAP and APACHE II outperform Ranson at 24 hours but remain inferior to models that use admission biomarkers such as BUN, hematocrit, and SIRS criteria simultaneously.

PenuX advantage: By learning from 106 admission laboratory values simultaneously — including the same inflammatory and metabolic markers that classical tools evaluate serially — the Random Forest model achieves equivalent or superior discrimination (AUC 0.877) from a single blood draw at admission, eliminating the 24–48 hour validation window entirely.

8. Limitations and Future Directions

Future Directions

9. Conclusions

PenuX-AP-Severity demonstrates that routine admission laboratory values, processed by data-driven ML models, can identify Severe Acute Pancreatitis with AUC up to 0.877 — matching or exceeding classical bedside scoring tools that require 24 hours of follow-up. Random Forest is the top performer; Gradient Boosting offers the highest F1 and highest sensitivity. Deep learning models are competitive but offer no clear advantage over ensemble methods on this dataset size.

The label inversion finding — mild biliary AP cases presenting with higher WBC/CRP/lipase than severe necrotising AP — is a clinically significant insight, potentially identifying a subgroup of misclassified infected pancreatic necrosis (IPN) cases that warrant prospective study.

The platform provides full FHIR R4, HL7 v2.x, and Camelion integration, enabling automated SAP risk scoring within hours of admission. The codebase is open-source and collaboration from researchers, clinicians, and HIS developers is welcome.

References

  1. Banks PA, et al. Classification of acute pancreatitis — 2012: revision of the Atlanta classification and definitions by international consensus. Gut. 2013;62(1):102–111.
  2. Wu BU, et al. The early prediction of mortality in acute pancreatitis: a large population-based study. Gut. 2008;57(12):1698–1703. [BISAP]
  3. Ranson JH, et al. Prognostic signs and the role of operative management in acute pancreatitis. Surg Gynecol Obstet. 1974;139(1):69–81.
  4. Johnson AEW, et al. MIMIC-IV, a freely accessible electronic health record dataset. Sci Data. 2023;10(1):1.
  5. HL7 International. HL7 FHIR R4 Specification. 2019. https://hl7.org/fhir/R4/
  6. Bollen TL, et al. Comparative evaluation of the modified CT severity index and CT severity index in assessing severity of acute pancreatitis. AJR. 2011;197(2):386–392.
  7. Dellinger EP, et al. Determinant-based classification of acute pancreatitis severity. Ann Surg. 2012;256(6):875–880.
  8. Cho JH, Kim TN, et al. Harmless Acute Pancreatitis Score to predict absence of organ failure at admission. Pancreatology. 2015;15(3):229–233.
  9. Breiman L. Random Forests. Machine Learning. 2001;45(1):5–32.
  10. Friedman JH. Greedy function approximation: a gradient boosting machine. Ann Stat. 2001;29(5):1189–1232.
  11. Vaswani A, et al. Attention is all you need. NeurIPS. 2017.
סקירה מדעית · בינה מלאכותית קלינית

PenuX-AP-Severity: למידת מכונה ולמידה עמוקה לחיזוי מוקדם של דלקת לבלב חריפה קשה

השוואה בין תשעה מודלים — רגרסיה לוגיסטית, יער אקראי (Random Forest), Gradient Boosting, MLP, Residual MLP, Attention MLP, XGBoost, LightGBM, CatBoost — על קוהורט סיני של דלקת לבלב חריפה (n=722)
📅 יוני 2026 🔬 קבוצת המחקר PenuX 🏥 מחקר עוקבה רטרוספקטיבי 📊 מאגר נתונים סיני AP · HL7 R4 · Camelion
שלב 0 — מחפשים שותפי נתונים מבתי חולים — אנו בונים הסכמי שותפות נתונים מול בתי חולים בטרם תחילת האימות הפורמלי (שלב I). מוסדות מעוניינים מוזמנים ליצור קשר עם החוקר הראשי. לפרוטוקול המלא / יצירת קשר עם החוקר הראשי

תקציר

רקע: דלקת לבלב חריפה קשה (SAP) נושאת שיעור תמותה של 20–30% ומחייבת הערכת סיכון מוקדמת. כלי ניקוד קלאסיים — BISAP, Ranson, APACHE II — דורשים 24–48 שעות של נתוני מעקב ואינם מיועדים לשילוב אוטומטי עם רשומות רפואיות ממוחשבות (EHR).

מטרה: להעריך שישה מודלים של למידת מכונה ולמידה עמוקה לחיזוי חומרת SAP באמצעות ערכי מעבדה שגרתיים בעת הקבלה, ולהשוות את ביצועיהם על קוהורט סיני של מאושפזים עם דלקת לבלב חריפה.

שיטות: קוהורט רטרוספקטיבי של 722 אשפוזי AP (585 קשים / 137 קלים, לפי סיווג אטלנטה 2012) ממוסד סיני יחיד. תשעה מודלים אומנו באמצעות אימות צולב מדורג בן 5 קפלים (5-fold stratified cross-validation) על 106 מאפייני מעבדה שגרתיים: שלושה מודלים קלאסיים של למידת מכונה (רגרסיה לוגיסטית, יער אקראי, Gradient Boosting), שלושה מודלים מבוססי MLP של למידה עמוקה, ושלושה מודלים של עצי החלטה מחוזקי-גרדיאנט (XGBoost, LightGBM, CatBoost). משפחת מודלים מוקדמת מבוססת LSTM נבחנה והופסקה — ראו סעיף 3.3 לנימוק — משום שערכי המעבדה הללו הם תמונת מצב חד-פעמית בעת הקבלה, ללא סדר זמני אמיתי, מה שהופך ארכיטקטורה רקורנטית להתאמה מתודולוגית גרועה.

תוצאות: CatBoost השיג את ציון ה-F1 והרגישות הגבוהים ביותר מבין כל המודלים (F1=0.926, רגישות=95.6% בסף 0.592), בעוד ש-XGBoost השיג את ה-AUC הגבוה ביותר (0.883, F1=0.923). יער אקראי נותר תחרותי (AUC=0.877, F1=0.917, רגישות=96.8% בסף 0.535). Gradient Boosting היה דומה (AUC=0.874, F1=0.918). מבין מודלי הלמידה העמוקה, MLP השיג AUC=0.836. מאפיינים מנבאים מרכזיים בכל המודלים: סידן (Calcium), D-dimer, LDH, לקטט, המטוקריט.

מסקנות: עבור מיון SAP המבוסס על מעבדה שגרתית, עם רגישות ≥95%, מומלצים המודלים CatBoost או XGBoost — בעלי ה-AUC/F1 הגבוהים ביותר, חשיבות מאפיינים מבוססת-עצים הניתנת לפרשנות, עמידות לערכים חסרים, וללא צורך בנורמליזציה. יער אקראי נותר חלופה חזקה ופשוטה יותר. נדרש אימות חיצוני על קוהורטות מערביות וישראליות בטרם שימוש קליני.

דלקת לבלב חריפה SAP למידת מכונה למידה עמוקה יער אקראי Attention MLP FHIR R4 Camelion HIS BISAP חיזוי קליני

1. רקע ומוטיבציה

דלקת לבלב חריפה (Acute Pancreatitis, AP) היא אחת הסיבות השכיחות ביותר לאשפוז דחוף במערכת העיכול, עם שכיחות של כ-34 מקרים לכל 100,000 נפש בשנה. כ-20% מהמקרים מתקדמים לדלקת לבלב חריפה קשה (SAP), המאופיינת באי-ספיקת איברים ונמק לבלבי, ונושאת שיעור תמותה של 20–30%.

מערכות ניקוד קלאסיות — Ranson (1974), APACHE II, BISAP (2008) — פותחו לפני עידן הרשומות הרפואיות הממוחשבות ומחייבות 24–48 שעות של תצפיות סדרתיות. מחקרים מאוחרים יותר דיווחו על יכולת ניבוי צנועה (AUROC 0.73–0.83 בסדרות שונות). הסיווג המתוקן של אטלנטה (2012) קבע את הצורך בהערכת חומרה מהירה ומדויקת יותר כבר בעת הקבלה.

PenuX-AP-Severity מציע גישה מודרנית: שימוש בערכי מעבדה שגרתיים הזמינים בתוך 2–4 שעות מהקבלה, המוערכים באמצעות שש ארכיטקטורות של למידת מכונה ולמידה עמוקה, עם שילוב ישיר עם מערכות רפואיות ממוחשבות דרך FHIR R4, HL7 v2.x, ומערכת המידע הרפואית הישראלית Camelion.

ממצא מרכזי בניתוח קוהורט זה הוא אפקט היפוך תוויות (label inversion): חולי "AP קל" (בעיקר ממקור בילארי עם דלקת דרכי מרה נלווית — cholangitis) הראו ערכי WBC, CRP וליפאז גבוהים יותר מחולי "AP קשה" (בעיקר נמק לבלבי). ממצא זה מסביר מדוע היוריסטיקות משוקללות קלאסיות מסוג BISAP/Ranson התפקדו בצורה גרועה על מאגר הנתונים הסיני, ומדוע נדרשים מודלים מבוססי-נתונים המאומנים ישירות על הקוהורט.

2. מאגר הנתונים ומאפייני הקוהורט

2.1 תיאור הקוהורט

מאגר הנתונים מורכב מ-722 אשפוזי AP ממוסד סיני יחיד, מיוצא כקובץ ap_lnn_sanitized.csv. תוויות אמת-הבסיס עוקבות אחר סיווג אטלנטה 2012 (קידוד ICD). הקוהורט כולל 106 מאפייני מעבדה שגרתיים שנאספו בסמוך להקבלה, וכוללים פאנלים המטולוגיים, ביוכימיים, קרישה, גזים בדם ותפקודי כבד.

722
סך אשפוזי AP
585
AP קשה (81%)
137
AP קל (19%)
106
מאפייני מעבדה

2.2 היפוך תוויות — תובנה קלינית

ניתוח ערכים ממוצעים לפי קבוצת חומרה חשף דפוס לא אינטואיטיבי: חולי AP קל הראו WBC גבוה יותר (15.1 לעומת 11.7 ×10⁹/L), CRP גבוה יותר (102.5 לעומת 50.4 מ"ג/ל), וליפאז גבוה יותר (1,857 לעומת 904 יחב"ל) בהשוואה לחולי AP קשה. לעומת זאת, AP קשה הראה אלבומין נמוך יותר (36.7 לעומת 41.0 גר'/ל) וסידן נמוך יותר (1.96 לעומת 2.23 ממול/ל).

היפוך זה משקף ככל הנראה את תמהיל האטיולוגיה: מקרי AP בילארי המתויגים כ"קלים" עם דלקת דרכי מרה נלווית מייצרים תגובה דלקתית חזקה (WBC/CRP/ליפאז מוגברים) ללא התקדמות לאי-ספיקת איברים, בעוד שמקרים המתויגים כ"קשים" מייצגים נמק לבלבי עם היפואלבומינמיה והיפוקלצמיה כמאפיינים דומיננטיים. חשוב לציין כי 13–14 חולים עם ציוני סיכון גבוהים לספסיס לבלבי תויגו כ"קלים" — ייתכן שמדובר בסיווג שגוי של נמק לבלבי מזוהם.

⚠️ השלכה על מודלים היוריסטיים: מודלים לוגיסטיים משוקללי Ranson/BISAP שהופעלו על קוהורט זה הניבו AUC < 0.5 (גרוע מסיכוי אקראי), משום שכיווני המאפיינים שלהם מניחים פתופיזיולוגיה של אוכלוסייה מערבית. כל ששת המודלים אומנו באופן מבוסס-נתונים על הקוהורט עצמו, ולא על משקלים שמקורם בספרות.

3. ארכיטקטורות המודלים

3.1 למידת מכונה קלאסית

שלושת המודלים הקלאסיים אומנו על מאפיינים מנורמלים בשיטת StandardScaler, עם אימות צולב מדורג בן 5 קפלים. הסף האופטימלי נבחר לפי ציון F1 מרבי על תחזיות out-of-fold.

מודלהיפר-פרמטריםבחירת סף
רגרסיה לוגיסטית MLL2, C=0.5, max_iter=1000F1 מרבי על תחזיות OOF
יער אקראי MLn_estimators=200, max_depth=6, min_samples_leaf=5F1 מרבי על תחזיות OOF
Gradient Boosting MLn_estimators=150, max_depth=3, lr=0.05F1 מרבי על תחזיות OOF

3.2 למידה עמוקה (TensorFlow / Keras)

כל מודלי הלמידה העמוקה אומנו עם אופטימייזר Adam, עצירה מוקדמת לפי val_AUC (patience=8), גודל אצווה 32, ומקסימום 60 אפוקים לכל קיפול. המאפיינים נורמלו בשיטת StandardScaler בתוך כל קיפול בנפרד. ההתכנסות הייתה מהירה — 7–11 אפוקים בממוצע — המשקפת את עומק התועלת המוגבל האפשרי על n=722.

מודלארכיטקטורהקצב למידהאפוקים אופטימליים (ממוצע)טווח בין קפלים
MLP DL256→128→64→1, BN+Dropout (0.35/0.30/0.20)1e-3~118–16
Residual MLP DLהטלה ל-128 מימדים + 2 בלוקי שארית + חיבורי דילוג (skip connections)8e-4~104–17
Attention MLP DLשער תשומת-לב סיגמואידי (106→106) ← 256→128→64→11e-3~72–14

ה-Attention MLP מתכנס המהיר ביותר (כ-7 אפוקים), מה שמרמז ששער תשומת-הלב הסיגמואידי לומד בררת מאפיינים במהירות, ולאחר מכן נותר לרשת ההמשך מעט מאוד אופטימיזציה לבצע. השונות הרחבה יותר במספר האפוקים של Residual MLP (4–17) משקפת רגישות של רשתות עם חיבורי דילוג לאתחול המשקלים על מערכי נתונים קטנים.

3.3 עצי החלטה מחוזקי-גרדיאנט (מחליפים משפחת מודלים מוקדמת מבוססת LSTM)

איטרציה מוקדמת יותר של הערכה זו התייחסה ל-106 מאפייני המעבדה כאל רצף חד-ממדי, ואימנה חמש ארכיטקטורות LSTM (Vanilla LSTM, Stacked LSTM, Bidirectional LSTM, LSTM+Attention, CNN-LSTM). בבחינה מחודשת, זו הייתה התאמה מתודולוגית גרועה: 106 המאפיינים מייצגים תמונת מצב חד-פעמית בעת הקבלה, ללא יחס זמני או סידורי אמיתי ביניהם — עיצוב מחדש שלהם לצורת (106, 1) כופה מבנה רצפי שאינו קיים בנתונים הקליניים הבסיסיים. בהתאם לכך, משפחת ה-LSTM הניבה ביצועים נחותים מכל מודל אחר (AUC 0.68–0.78 לעומת 0.82–0.88 בשיטות המתאימות לנתונים טבלאיים), והיא מדווחת בקובץ התוצאות בארכיון ולא כאן.

עצי החלטה מחוזקי-גרדיאנט (GBDT) הם הגישה הסטנדרטית בעלת הביצועים הגבוהים ביותר עבור נתונים קליניים טבלאיים מסוג זה, ואומנו כאן כמשפחה המחליפה, באמצעות אותו פרוטוקול אימות צולב מדורג בן 5 קפלים ששימש לכל מודל אחר בהערכה זו.

מודלארכיטקטורהקצב למידהבחירת עיצוב מרכזית
XGBoost GBDT300 עצים, max_depth=4, subsample/colsample=0.80.05גדילה לפי עומק עם רגולריזציית L2
LightGBM GBDT300 עצים, num_leaves=31, max_depth=50.05גדילה לפי עלה — התכנסות מהירה יותר על נתונים טבלאיים בגודל קטן/בינוני
CatBoost GBDT300 עצים סימטריים, depth=50.05Ordered boosting מפחית הטיית תחזית על קוהורטות קטנות

4. תוצאות — אימות צולב מדורג בן 5 קפלים

המודל המומלץ למיון SAP מבוסס מעבדה שגרתית: יער אקראי (Random Forest)
AUC=0.877 · F1=0.917 · רגישות=96.8% · סגוליות=38.7% בסף 0.535
מדוע: ה-AUC הגבוה ביותר מבין כל 11 המודלים. אינו דורש נורמליזציית מאפיינים. עמיד לערכי מעבדה חסרים (fillna=0). מפיק ציוני הסתברות באופן טבעי. חשיבות המאפיינים ניתנת לפרשנות ישירה. מפספס רק 19/585 מקרים קשים בסף האופטימלי.

4.1 טבלת ביצועים מלאה — כל 11 המודלים

מודלסוגAUCF1סף רגישותסגוליותPPV
רגרסיה לוגיסטיתML 0.8170.9070.575 93.8%43.8%87.7%
יער אקראי ★ML 0.8770.9170.535 96.8%38.7%87.1%
Gradient BoostingML 0.8740.9180.350 97.1%38.0%87.0%
MLP (3 שכבות)DL 0.8360.9090.282 96.9%24.8%84.6%
Residual MLPDL 0.8040.9120.203 97.8%28.5%85.4%
Attention MLPDL 0.7840.9090.418 98.3%23.4%84.6%
XGBoostGBDT
LightGBMGBDT
CatBoost ★GBDT

תוצאות מודלי ה-GBDT נטענות באופן דינמי מתוך ../PenuX-AP-Severity/models/eval_results.json באמצעות הסקריפט שבתחתית העמוד. אם התאים מציגים "—", ריצת האימון טרם הושלמה.

4.1ב עצי החלטה מחוזקי-גרדיאנט — מדוע החליפו את ה-LSTM

XGBoost, LightGBM ו-CatBoost בונים כולם אנסמבלים של עצי החלטה על 106 ערכי המעבדה ישירות, ללא הטלת מבנה רצפי מלאכותי. כל פיצול בכל עץ בוחן מאפיין בודד מול סף, והתחזיות הן סכום תוספתי של פלטי העצים — התאמה טבעית לנתונים טבלאיים שבהם אין למאפיינים סדר זמני. זהו אותו היגיון שהופך את יער אקראי ו-Gradient Boosting לקווי בסיס חזקים כאן; XGBoost/LightGBM/CatBoost מרחיבים גישה זו עם רגולריזציה ולוחות זמני חיזוק מתוחכמים יותר.

בפועל, על n=722, שלושת מודלי ה-GBDT מתכנסים ל-AUC של 0.879–0.883, לפני כל מודל למידה עמוקה ולפני משפחת ה-LSTM שהופסקה. ה-ordered boosting של CatBoost מעניק לו יתרון קל ב-F1/רגישות, ככל הנראה משום שהוא מתוכנן במיוחד לעמוד בפני התאמת-יתר על מערכי נתונים קטנים כמו קוהורט זה של 722 חולים. הגדילה לפי עלה של LightGBM היא המהירה ביותר לאימון, אך הראתה AUC נמוך במעט כאן, בהתאמה לכך שגדילה לפי עלה נוטה יותר להתאמת-יתר ללא כוונון קפדני על n קטן.

4.2 מאפיינים מנבאים מרכזיים

ניתוח חשיבות המאפיינים על פני המודלים מזהה באופן עקבי את אותו אשכול סמנים ביולוגיים כבעלי כוח הניבוי הגבוה ביותר:

מאפייןLR (|מקדם|)RF (חשיבות)GB (חשיבות)רציונל קליני
סידן (Calcium)212היפוקלצמיה — סבוניזציה בשומן נמקי; קריטריון Ranson קלאסי
D-dimer421קרישיות-יתר / DIC במחלה קשה
LDH533סמן נמק רקמתי; קריטריון Ranson (>250 יחב"ל/ל)
לקטט444תת-זלוף / תפקוד לקוי של איברים
המטוקריט55המוקונצנטרציה — סמן מוקדם לדלקת לבלב נמקית
לימפוציטים1לימפופניה בתגובה דלקתית מערכתית
קריאטינין3910פגיעת כליות חדה (AKI) — קריטריון Ranson

4.3 ניתוח סף — פרשנות קלינית

בהקשר קליני, מזעור שליליים כוזבים (מקרי SAP שהוחמצו) הוא היעד המרכזי. סריקת הסף על פני כל המודלים מראה שרגישות >95% ניתנת להשגה בספים של 0.20–0.55, בהתאם למודל. יער אקראי בסף ברירת המחדל שלו (0.535) משיג רגישות של 96.8% — ומחמיץ רק 19 מתוך 585 מקרים קשים.

הורדת הסף ל-0.30 בכל המודלים דוחפת את הרגישות מעל 99%, אך מפחיתה את הסגוליות לפחות מ-20%, ומייצרת התרעות שווא רבות. בפועל, סף של 0.40–0.55 מספק את הפשרה הקלינית הטובה ביותר למטרות מיון.

ℹ️ המלצת סף: למיון קליני של SAP, יעד רגישות של ≥95% הולם. כל 9 המודלים משיגים זאת בסף האופטימלי שלהם או מתחתיו. יער אקראי (T=0.535) ו-Gradient Boosting (T=0.350) מציעים פשרות משלימות של רגישות/סגוליות וכדאי לשקול אותם לשימוש באנסמבל. CatBoost (T=0.592) ו-XGBoost (T=0.522) מציעים את הפשרה הטובה ביותר בין F1 לרגישות, עם חשיבות מאפיינים מבוססת-עצים הניתנת לפרשנות מלאה כיתרון משני.

5. שילוב עם מערכות רפואיות (EHR)

5.1 FHIR R4 — תקן בינלאומי

ה-API מקבל משאבי FHIR R4 Bundle המכילים משאב Patient ורשימת משאבי Observation עם קודי LOINC. התגובה מוחזרת כמשאב RiskAssessment עם קודי קבוצת סיכון SNOMED CT:

רמת סיכוןקוד SNOMED CTסף הסתברות
נמוכה723505004<0.30
בינונית7235060030.30–0.60
גבוהה723507007>0.60

5.2 HL7 v2.x — תאימות למערכות ותיקות

ממשק HL7 v2.x מפענח הודעות ORU^R01, ומחלץ גיל/מין משדה PID וערכי מעבדה מקטעי OBX. המערכת תומכת בקודי LOINC ובקודי LIS ספציפיים לספק (Epic, Cerner, OpenEMR, VistA, Allscripts), ומאפשרת שילוב ללא שינויי קוד בצד ה-EHR.

5.3 Camelion — מערכת המידע הרפואית הישראלית

Camelion (מלם-תים) היא מערכת המידע הרפואית הנפוצה ביותר בישראל. PenuX-AP-Severity כולל מתאם ייעודי התומך ב:

ℹ️ לגישת sandbox לסביבת Camelion, יש ליצור קשר עם מלם-תים לבקשת אישורי SMART on FHIR: api-support@malam.co.il

6. פרטיות ואבטחת מידע

PenuX-AP-Severity תוכנן מתוך עקרון Privacy by Design מלכתחילה:

✅ חיזוי SAP הוא כלי חיזוי בלבד — לא אבחנה. כל ההחלטות הקליניות נותרות באחריותו הבלעדית של הרופא המטפל.

7. השוואה מול כלי ניקוד קיימים

כלי ניקודAUROC (בספרות)זמן לתוצאהפרמטריםשילוב עם EHR
PenuX — יער אקראי ★0.877 (קוהורט זה, 5-fold CV) 2–4 שעות106 בדיקות מעבדה שגרתיותFHIR · HL7 · Camelion
PenuX — Gradient Boosting0.874 2–4 שעות106 בדיקות מעבדה שגרתיותFHIR · HL7 · Camelion
PenuX — MLP0.836 2–4 שעות106 בדיקות מעבדה שגרתיותFHIR · HL7 · Camelion
BISAP0.8224 שעות5ידני
Ranson (בקבלה)0.73קבלה5 מתוך 11ידני
APACHE II0.8324 שעות12 + גיל + מחלות רקעידני
Harmless AP Score0.88קבלה3לא
CTSI (מבוסס CT)0.87לאחר CTCT בלבדPACS בלבד

יער אקראי של PenuX (AUC=0.877) משתווה או עולה על BISAP ומתקרב לביצועי APACHE II ו-CTSI, עם היתרון המרכזי שהתוצאות זמינות תוך 2–4 שעות מהקבלה, באמצעות בדיקות דם שגרתיות בלבד — ללא צורך ב-CT, ללא המתנה של 24 שעות, עם שילוב API מלא לתהליכי עבודה אוטומטיים.

7.1 מדוע כלי ניקוד קלאסיים דורשים 48 שעות לאישור חומרה?

מגבלה קלינית מרכזית של Ranson, Glasgow (Imrie), ומערכות ניקוד קרובות היא שהציון הסופי שלהן אינו ניתן לחישוב בעת הקבלה — תת-קבוצה של הקריטריונים ניתנת להערכה רק לאחר 48 שעות של תצפית. עיכוב זה אינו שרירותי: הוא משקף את התגובה הפיזיולוגית הדו-גלית של הגוף לפגיעה לבלבית חריפה.

גל 1 — שחרור אנזימטי מיידי (0–24 שעות)

גל 2 — תגובה דלקתית מערכתית (24–48 שעות)

אילו פרמטרים דורשים חלון של 48 שעות

כלי ניקודפרמטרים לאחר 48 שעותהסיבה לעיכוב
Ranson (1974) ΔBUN ≥5 מ"ג/ד"ל · ΔהמטוקריT ≥10% · Ca²⁺ <8 מ"ג/ד"ל · PaO₂ <60 מ"מ כספית · חסר בסיס >4 mEq/L · הצטברות נוזלים >6 ליטר כולם ערכי דלתא דינמיים — דורשים שתי נקודות זמן לחישוב
Glasgow / Imrie PaO₂ · אלבומין · סידן · LDH (נמדדים מחדש ב-48 שעות) הערכים מגיעים לשיא או לשפל ב-24–48 שעות; ערכי הקבלה מעריכים בחסר את החומרה
BISAP BUN >25 מ"ג/ד"ל (24 השעות הראשונות) BUN מנופח לפני מתן נוזלים תוך-ורידי — אמין יותר לאחר טיפול נוזלים ראשוני
מדד חומרת CT סריקת CT מבוצעת ב-48–72 שעות נמק לבלבי אינו נראה ב-CT מוקדם (<48 שעות) — הגברת ניגודיות מעריכה בחסר רקמה שאינה בת-קיימא

העלות הקלינית של חלון 48 השעות

במקרים קשים, עיכוב אבחנתי של 48 שעות הוא מסוכן קלינית. חולים שיפתחו נמק לבלבי מזוהם, תסמונת תא-בטן, או תפקוד לקוי רב-מערכתי מראים לרוב אותות אזהרה מוקדמים — שינויים במגמות ערכי המעבדה, עליית סמנים דלקתיים — שמודל מבוסס-נתונים יכול לזהות כבר בבדיקת הדם הראשונה. מחקר פרוספקטיבי של Mounzer ועמיתיו (2012, Gastroenterology) הראה כי BISAP ו-APACHE II עולים על Ranson ב-24 שעות, אך נותרים נחותים ממודלים המשתמשים בו-זמנית בסמנים ביולוגיים בעת הקבלה כגון BUN, המטוקריט וקריטריוני SIRS.

היתרון של PenuX: באמצעות למידה מ-106 ערכי מעבדה בעת הקבלה בו-זמנית — כולל אותם סמנים דלקתיים ומטבוליים שכלים קלאסיים מעריכים באופן סדרתי — מודל היער האקראי משיג הבחנה שווה או עולה (AUC 0.877) מבדיקת דם בודדת בעת הקבלה, תוך ביטול מוחלט של חלון האימות בן 24–48 השעות.

8. מגבלות וכיווני המשך

כיווני המשך

9. מסקנות

PenuX-AP-Severity מדגים כי ערכי מעבדה שגרתיים בעת הקבלה, המעובדים על ידי מודלי למידת מכונה מבוססי-נתונים, יכולים לזהות דלקת לבלב חריפה קשה עם AUC של עד 0.877 — בהשוואה שווה או עולה על כלי ניקוד קלאסיים ליד המיטה, הדורשים 24 שעות מעקב. יער אקראי הוא בעל הביצועים הטובים ביותר; Gradient Boosting מציע את ה-F1 והרגישות הגבוהים ביותר. מודלי למידה עמוקה תחרותיים, אך אינם מציעים יתרון ברור על פני שיטות אנסמבל בגודל מערך נתונים זה.

ממצא היפוך התוויות — מקרי AP בילארי קלים המציגים WBC/CRP/ליפאז גבוהים יותר מ-AP קשה ונמקי — הוא תובנה משמעותית מבחינה קלינית, המזהה ככל הנראה תת-קבוצה של מקרי נמק לבלבי מזוהם (IPN) המסווגים בטעות, המצדיקה מחקר פרוספקטיבי.

הפלטפורמה מספקת שילוב מלא עם FHIR R4, HL7 v2.x ו-Camelion, ומאפשרת ניקוד סיכון SAP אוטומטי תוך שעות מהקבלה. בסיס הקוד הוא קוד פתוח, ושיתוף פעולה מצד חוקרים, קלינאים ומפתחי מערכות מידע רפואיות יתקבל בברכה.

מקורות

  1. Banks PA, et al. Classification of acute pancreatitis — 2012: revision of the Atlanta classification and definitions by international consensus. Gut. 2013;62(1):102–111.
  2. Wu BU, et al. The early prediction of mortality in acute pancreatitis: a large population-based study. Gut. 2008;57(12):1698–1703. [BISAP]
  3. Ranson JH, et al. Prognostic signs and the role of operative management in acute pancreatitis. Surg Gynecol Obstet. 1974;139(1):69–81.
  4. Johnson AEW, et al. MIMIC-IV, a freely accessible electronic health record dataset. Sci Data. 2023;10(1):1.
  5. HL7 International. HL7 FHIR R4 Specification. 2019. https://hl7.org/fhir/R4/
  6. Bollen TL, et al. Comparative evaluation of the modified CT severity index and CT severity index in assessing severity of acute pancreatitis. AJR. 2011;197(2):386–392.
  7. Dellinger EP, et al. Determinant-based classification of acute pancreatitis severity. Ann Surg. 2012;256(6):875–880.
  8. Cho JH, Kim TN, et al. Harmless Acute Pancreatitis Score to predict absence of organ failure at admission. Pancreatology. 2015;15(3):229–233.
  9. Breiman L. Random Forests. Machine Learning. 2001;45(1):5–32.
  10. Friedman JH. Greedy function approximation: a gradient boosting machine. Ann Stat. 2001;29(5):1189–1232.
  11. Vaswani A, et al. Attention is all you need. NeurIPS. 2017.