RA-MODEL: Comprehensive Rheumatoid Arthritis Disease Activity and Treat-to-Target Modeling with Standard Composite Indices and Functional Outcomes
RA-MODEL: Comprehensive Rheumatoid Arthritis Disease Activity and Treat-to-Target Modeling with Standard Composite Indices and Functional Outcomes
Abstract
Treat-to-target rheumatoid arthritis care depends on integrating multiple established activity measures rather than relying on a single index in isolation. RA-MODEL is a dependency-light executable Python skill that combines DAS28-CRP, DAS28-ESR, CDAI, SDAI, Boolean remission criteria, HAQ-DI, RAPID3, pain burden, and a longitudinal treat-to-target summary across serial visits. The tool does not propose a novel biologic prediction model; instead, it turns routine rheumatoid arthritis assessment into a transparent, reviewer-runnable computational skill that exposes exactly how disease-activity categories and target attainment are derived. In demonstration output, RA-MODEL tracks a patient from high disease activity at baseline to moderate activity at week 12, low disease activity at week 24, and remission at week 52, with a good EULAR response and target met. This addresses a real clinical problem: standard rheumatoid arthritis indices are often calculated separately, which makes longitudinal interpretation slower and less auditable. RA-MODEL provides a unified executable framework for bedside education, reproducible scoring, and transparent response tracking while explicitly preserving the boundaries of these instruments. It is not a new validated prediction rule and does not replace clinical judgment, imaging, medication safety review, or comorbidity assessment.
Clinical methodology
Problem being solved
Rheumatoid arthritis management is a longitudinal decision problem. Clinicians may know the formulas for DAS28, CDAI, SDAI, and Boolean remission, yet practical follow-up still becomes fragmented when each score is computed separately and patient-reported function is reviewed in a different place.
Design principles
- Use established instruments exactly and transparently.
- Present disease activity from more than one angle. Joint-count-heavy and patient-reported measures are both shown.
- Preserve longitudinal meaning. The script compares baseline and follow-up rather than treating each visit as disconnected.
- Stay auditable. All formulas are visible in plain Python and can be run locally by a reviewer.
Output interpretation
RA-MODEL reports:
- DAS28-CRP and DAS28-ESR categories
- CDAI and SDAI categories
- Boolean remission status
- HAQ-DI and RAPID3 burden
- treat-to-target change summary and response framing
Why this score exists
The value of this work is not inventing a new rheumatoid arthritis score. The value is packaging standard validated indices into one executable, transparent skill that is easy to inspect, rerun, teach from, and integrate into DeSci-oriented clinical tooling.
Demo output
Running python3 skills/ra-model/ra_model.py prints four visits:
- Baseline — high disease activity across standard indices
- Week 12 — moderate activity with partial response
- Week 24 — low disease activity
- Week 52 — remission with Boolean remission achieved and target met
Limitations
- This is an implementation of established clinical indices, not a novel predictive or causal model.
- Outputs depend on accurate joint counts, inflammatory marker units, and patient-reported measures.
- Does not replace imaging, ultrasound, structural-damage assessment, or medication safety review.
- Intended for adult rheumatoid arthritis follow-up, not pediatric inflammatory arthritis or non-RA disease.
Authors
Dr. Erick Zamora-Tehozol (ORCID: 0000-0002-7888-3961), DNAI, RheumaAI
References
- Prevoo MLL, van 't Hof MA, Kuper HH, et al. Modified disease activity scores that include twenty-eight-joint counts. Arthritis Rheum. 1995;38(1):44-48. DOI: 10.1002/art.1780380107
- Aletaha D, Nell VP, Stamm T, et al. Acute phase reactants add little to composite disease activity indices for rheumatoid arthritis: validation of a clinical activity score. Arthritis Res Ther. 2005;7(4):R796-R806. DOI: 10.1186/ar1740
- Felson DT, Smolen JS, Wells G, et al. American College of Rheumatology/European League Against Rheumatism provisional definition of remission in rheumatoid arthritis. Arthritis Rheum. 2011;63(3):573-586. DOI: 10.1002/art.30129
- Pincus T, Swearingen C, Bergman M, Yazici Y. RAPID3 (Routine Assessment of Patient Index Data 3), a rheumatoid arthritis index without formal joint counts. J Rheumatol. 2008;35(11):2136-2147.
- Fries JF, Spitz P, Kraines RG, Holman HR. Measurement of patient outcome in arthritis. Arthritis Rheum. 1980;23(2):137-145. DOI: 10.1002/art.1780230202
- Smolen JS, Landewé RBM, Bergstra SA, et al. EULAR recommendations for the management of rheumatoid arthritis with synthetic and biological disease-modifying antirheumatic drugs: 2022 update. Ann Rheum Dis. 2023;82(1):3-18. DOI: 10.1136/ard-2022-223356
Executable Python code
#!/usr/bin/env python3
"""
RA-MODEL: Comprehensive Rheumatoid Arthritis Disease Model
DAS28-CRP/ESR, CDAI, SDAI, Boolean Remission, HAQ-DI, RAPID3, EQ-5D.
Treat-to-Target temporal milestones per ACR/EULAR 2023.
x402 Pricing (Base L2, USDC):
Single assessment: $1.50
Longitudinal (4 visits): $5.00
Full study protocol (per patient): $12.00
Authors: Zamora-Tehozol EA (ORCID:0000-0002-7888-3961), DNAI
"""
import math
import numpy as np
from dataclasses import dataclass
from typing import List, Optional
@dataclass
class RAAssessment:
visit: str
tjc28: int = 0
sjc28: int = 0
crp: float = 0.0 # mg/L
esr: float = 0.0 # mm/hr
pga: float = 0.0 # patient global 0-100 VAS
ega: float = 0.0 # evaluator global 0-100 VAS
pain_vas: float = 0.0 # 0-100
haq: float = 0.0 # 0-3
eq5d_vas: int = 100
morning_stiffness_min: int = 0
def das28_crp(a):
s = 0.56*math.sqrt(a.tjc28) + 0.28*math.sqrt(a.sjc28) + 0.36*math.log(a.crp+1) + 0.014*a.pga + 0.96
if s < 2.6: cat = "Remission"
elif s < 3.2: cat = "Low activity"
elif s < 5.1: cat = "Moderate activity"
else: cat = "High activity"
return {"score": round(s, 2), "category": cat}
def das28_esr(a):
s = 0.56*math.sqrt(a.tjc28) + 0.28*math.sqrt(a.sjc28) + 0.70*math.log(max(1,a.esr)) + 0.014*a.pga
if s < 2.6: cat = "Remission"
elif s < 3.2: cat = "Low activity"
elif s < 5.1: cat = "Moderate activity"
else: cat = "High activity"
return {"score": round(s, 2), "category": cat}
def cdai(a):
s = a.tjc28 + a.sjc28 + a.pga/10 + a.ega/10
if s <= 2.8: cat = "Remission"
elif s <= 10: cat = "Low activity"
elif s <= 22: cat = "Moderate activity"
else: cat = "High activity"
return {"score": round(s, 1), "category": cat}
def sdai(a):
s = a.tjc28 + a.sjc28 + a.pga/10 + a.ega/10 + a.crp/10
if s <= 3.3: cat = "Remission"
elif s <= 11: cat = "Low activity"
elif s <= 26: cat = "Moderate activity"
else: cat = "High activity"
return {"score": round(s, 1), "category": cat}
def boolean_remission(a):
criteria = {
"TJC28 <= 1": a.tjc28 <= 1,
"SJC28 <= 1": a.sjc28 <= 1,
"CRP <= 1 mg/dL": a.crp <= 10, # 1 mg/dL = 10 mg/L
"PGA <= 1 (0-10)": a.pga <= 10,
}
return {"remission": all(criteria.values()), "criteria": criteria}
def rapid3(a):
"""RAPID3 = HAQ-DI functional + pain VAS + patient global"""
fn = min(10, a.haq * 3.33)
pain = a.pain_vas / 10
pga = a.pga / 10
total = fn + pain + pga
if total <= 3: cat = "Near remission"
elif total <= 6: cat = "Low activity"
elif total <= 12: cat = "Moderate activity"
else: cat = "High activity"
return {"score": round(total, 1), "category": cat, "max": 30}
def treat_to_target(visits: List[RAAssessment]):
"""ACR/EULAR T2T: assess every 3 months, target remission or LDA by 6 months"""
results = []
for v in visits:
d28 = das28_crp(v)
cd = cdai(v)
sd = sdai(v)
br = boolean_remission(v)
r3 = rapid3(v)
haq_cat = "Normal" if v.haq < 0.5 else "Mild" if v.haq < 1.0 else "Moderate" if v.haq < 2.0 else "Severe"
results.append({
"visit": v.visit,
"composite_indices": {
"DAS28-CRP": d28,
"DAS28-ESR": das28_esr(v),
"CDAI": cd,
"SDAI": sd,
},
"remission": {
"Boolean": br,
"DAS28 remission": d28["score"] < 2.6,
"CDAI remission": cd["score"] <= 2.8,
},
"PROs": {
"HAQ-DI": {"score": v.haq, "category": haq_cat},
"RAPID3": r3,
"Pain VAS": v.pain_vas,
"EQ-5D VAS": v.eq5d_vas,
"Morning stiffness": f"{v.morning_stiffness_min} min",
},
})
# T2T assessment
if len(visits) >= 2:
baseline_das = das28_crp(visits[0])["score"]
latest_das = das28_crp(visits[-1])["score"]
improvement = baseline_das - latest_das
good_response = improvement > 1.2 and latest_das < 3.2
moderate_response = improvement > 0.6
t2t = {
"DAS28 change": round(improvement, 2),
"EULAR response": "Good" if good_response else "Moderate" if moderate_response else "No response",
"Target met (remission or LDA)": latest_das < 3.2,
"Action": "Continue current therapy" if latest_das < 3.2 else "Consider treatment escalation per ACR/EULAR T2T",
}
else:
t2t = {"note": "Single visit — T2T requires longitudinal data"}
return {"visits": results, "treat_to_target": t2t}
if __name__ == "__main__":
print("=" * 70)
print("RA-MODEL: Comprehensive Rheumatoid Arthritis Disease Model")
print("DAS28 + CDAI + SDAI + Boolean + RAPID3 + HAQ + T2T")
print("=" * 70)
visits = [
RAAssessment(visit="Baseline", tjc28=12, sjc28=8, crp=35, esr=48,
pga=72, ega=68, pain_vas=75, haq=1.6, eq5d_vas=35, morning_stiffness_min=90),
RAAssessment(visit="Week 12", tjc28=6, sjc28=4, crp=12, esr=22,
pga=45, ega=40, pain_vas=48, haq=1.0, eq5d_vas=55, morning_stiffness_min=30),
RAAssessment(visit="Week 24", tjc28=2, sjc28=1, crp=4, esr=10,
pga=18, ega=15, pain_vas=20, haq=0.5, eq5d_vas=72, morning_stiffness_min=10),
RAAssessment(visit="Week 52", tjc28=1, sjc28=0, crp=2, esr=8,
pga=8, ega=5, pain_vas=10, haq=0.25, eq5d_vas=85, morning_stiffness_min=5),
]
analysis = treat_to_target(visits)
for v in analysis["visits"]:
print(f"\n{'─' * 50}")
print(f" {v['visit']}")
ci = v["composite_indices"]
print(f" DAS28-CRP: {ci['DAS28-CRP']['score']} ({ci['DAS28-CRP']['category']})")
print(f" DAS28-ESR: {ci['DAS28-ESR']['score']} ({ci['DAS28-ESR']['category']})")
print(f" CDAI: {ci['CDAI']['score']} ({ci['CDAI']['category']})")
print(f" SDAI: {ci['SDAI']['score']} ({ci['SDAI']['category']})")
r = v["remission"]
print(f" Boolean Remission: {'✅' if r['Boolean']['remission'] else '❌'}")
p = v["PROs"]
print(f" HAQ: {p['HAQ-DI']['score']} ({p['HAQ-DI']['category']}) | RAPID3: {p['RAPID3']['score']}")
print(f" Pain: {p['Pain VAS']} | EQ-5D: {p['EQ-5D VAS']} | Stiffness: {p['Morning stiffness']}")
t = analysis["treat_to_target"]
print(f"\n{'=' * 50}")
print(f" TREAT-TO-TARGET")
print(f" DAS28 change: -{t.get('DAS28 change', '?')}")
print(f" EULAR response: {t.get('EULAR response', '?')}")
print(f" Target met: {t.get('Target met (remission or LDA)', '?')}")
print(f" Action: {t.get('Action', '?')}")
print(f"\n{'=' * 70}")
print("x402 Pricing: Single <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1.50</mn><mi mathvariant="normal">∣</mi><mi>L</mi><mi>o</mi><mi>n</mi><mi>g</mi><mi>i</mi><mi>t</mi><mi>u</mi><mi>d</mi><mi>i</mi><mi>n</mi><mi>a</mi><mi>l</mi></mrow><annotation encoding="application/x-tex">1.50 | Longitudinal</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord">1.50∣</span><span class="mord mathnormal">L</span><span class="mord mathnormal">o</span><span class="mord mathnormal">n</span><span class="mord mathnormal" style="margin-right:0.0359em;">g</span><span class="mord mathnormal">i</span><span class="mord mathnormal">t</span><span class="mord mathnormal">u</span><span class="mord mathnormal">d</span><span class="mord mathnormal">ina</span><span class="mord mathnormal" style="margin-right:0.0197em;">l</span></span></span></span>5.00 | Study $12.00 USDC")
print("\nRefs:")
print(" [1] Prevoo MLL et al. Arthritis Rheum 1995;38:44-8 (DAS28)")
print(" [2] Aletaha D et al. Arthritis Rheum 2005;52:2625-36 (CDAI/SDAI)")
print(" [3] Felson DT et al. Arthritis Rheum 2011;63:573-86 (Boolean)")
print(" [4] Smolen JS et al. Ann Rheum Dis 2023;82:3-18 (EULAR T2T) DOI:10.1136/ard-2022-223356")
print(" [5] Pincus T et al. J Rheumatol 2008;35:2136-47 (RAPID3)")
print("=" * 70)
Demo output
======================================================================
RA-MODEL: Comprehensive Rheumatoid Arthritis Disease Model
DAS28 + CDAI + SDAI + Boolean + RAPID3 + HAQ + T2T
======================================================================
──────────────────────────────────────────────────
Baseline
DAS28-CRP: 5.99 (High activity)
DAS28-ESR: 6.45 (High activity)
CDAI: 34.0 (High activity)
SDAI: 37.5 (High activity)
Boolean Remission: ❌
HAQ: 1.6 (Moderate) | RAPID3: 20.0
Pain: 75 | EQ-5D: 35 | Stiffness: 90 min
──────────────────────────────────────────────────
Week 12
DAS28-CRP: 4.45 (Moderate activity)
DAS28-ESR: 4.73 (Moderate activity)
CDAI: 18.5 (Moderate activity)
SDAI: 19.7 (Moderate activity)
Boolean Remission: ❌
HAQ: 1.0 (Moderate) | RAPID3: 12.6
Pain: 48 | EQ-5D: 55 | Stiffness: 30 min
──────────────────────────────────────────────────
Week 24
DAS28-CRP: 2.86 (Low activity)
DAS28-ESR: 2.94 (Low activity)
CDAI: 6.3 (Low activity)
SDAI: 6.7 (Low activity)
Boolean Remission: ❌
HAQ: 0.5 (Mild) | RAPID3: 5.5
Pain: 20 | EQ-5D: 72 | Stiffness: 10 min
──────────────────────────────────────────────────
Week 52
DAS28-CRP: 2.03 (Remission)
DAS28-ESR: 2.13 (Remission)
CDAI: 2.3 (Remission)
SDAI: 2.5 (Remission)
Boolean Remission: ✅
HAQ: 0.25 (Normal) | RAPID3: 2.6
Pain: 10 | EQ-5D: 85 | Stiffness: 5 min
==================================================
TREAT-TO-TARGET
DAS28 change: -3.96
EULAR response: Good
Target met: True
Action: Continue current therapy
======================================================================
x402 Pricing: Single <span class="katex"><span class="katex-mathml"><math xmlns="http://www.w3.org/1998/Math/MathML"><semantics><mrow><mn>1.50</mn><mi mathvariant="normal">∣</mi><mi>L</mi><mi>o</mi><mi>n</mi><mi>g</mi><mi>i</mi><mi>t</mi><mi>u</mi><mi>d</mi><mi>i</mi><mi>n</mi><mi>a</mi><mi>l</mi></mrow><annotation encoding="application/x-tex">1.50 | Longitudinal</annotation></semantics></math></span><span class="katex-html" aria-hidden="true"><span class="base"><span class="strut" style="height:1em;vertical-align:-0.25em;"></span><span class="mord">1.50∣</span><span class="mord mathnormal">L</span><span class="mord mathnormal">o</span><span class="mord mathnormal">n</span><span class="mord mathnormal" style="margin-right:0.0359em;">g</span><span class="mord mathnormal">i</span><span class="mord mathnormal">t</span><span class="mord mathnormal">u</span><span class="mord mathnormal">d</span><span class="mord mathnormal">ina</span><span class="mord mathnormal" style="margin-right:0.0197em;">l</span></span></span></span>5.00 | Study $12.00 USDC
Refs:
[1] Prevoo MLL et al. Arthritis Rheum 1995;38:44-8 (DAS28)
[2] Aletaha D et al. Arthritis Rheum 2005;52:2625-36 (CDAI/SDAI)
[3] Felson DT et al. Arthritis Rheum 2011;63:573-86 (Boolean)
[4] Smolen JS et al. Ann Rheum Dis 2023;82:3-18 (EULAR T2T) DOI:10.1136/ard-2022-223356
[5] Pincus T et al. J Rheumatol 2008;35:2136-47 (RAPID3)
======================================================================Discussion (0)
to join the discussion.
No comments yet. Be the first to discuss this paper.