HCQ-QT: Transparent QT-Prolongation Risk-Context Stratification Before or During Hydroxychloroquine Therapy in Rheumatic and Autoimmune Disease
HCQ-QT: Transparent QT-Prolongation Risk-Context Stratification Before or During Hydroxychloroquine Therapy in Rheumatic and Autoimmune Disease
Abstract
Hydroxychloroquine is generally familiar and well tolerated in rheumatology, yet arrhythmic concern becomes clinically meaningful when baseline QT prolongation, renal impairment, electrolyte abnormalities, bradycardia, structural heart disease, ventricular arrhythmia history, and other QT-active medications accumulate together. HCQ-QT is an executable Python skill that converts this medication-safety problem into a transparent 0-100 risk-context score. The model weights baseline QTc, sex-age context, kidney function, potassium and magnesium status, structural and arrhythmic cardiac history, bradycardia, concomitant QT-prolonging drugs, hydroxychloroquine dose intensity, and syncope or palpitations. It outputs a concern band, component breakdown, and recommendation statement oriented toward ECG-capable reassessment, reversible risk correction, and medication review. In demonstration scenarios, the tool identifies reassuring low-risk outpatient hydroxychloroquine use, distinguishes a higher-risk lupus profile with CKD, hypokalemia, and interacting drugs, and escalates to critical concern when marked baseline QT prolongation and arrhythmic history are already present. The model is deliberately heuristic, dependency-free, and reviewer-runnable. It is not a validated torsades prediction model, but it addresses a real clinical problem: deciding when hydroxychloroquine should move from routine rheumatology prescribing into active cardiac safety review.
Clinical methodology
Problem being solved
Hydroxychloroquine safety questions in rheumatology are usually contextual rather than absolute. Most patients do not require alarm, but some do require slower prescribing, ECG review, electrolyte correction, or simplification of QT-active co-medication before treatment is continued casually.
Design principles
- Baseline QTc matters most. Pre-existing QT prolongation is the dominant electrophysiologic warning signal.
- Electrolytes matter. Hypokalemia and hypomagnesemia reduce repolarization reserve.
- Cardiac context matters. Structural disease, prior ventricular arrhythmia, and bradycardia raise concern.
- Polypharmacy matters. Concomitant QT-prolonging drugs may convert a tolerable regimen into a risky one.
- Dose context matters. Higher mg/kg/day exposure modestly strengthens concern.
- Symptoms matter. Syncope or palpitations should lower the threshold for escalation.
- Transparency matters. The tool is fully auditable in plain Python.
Output interpretation
HCQ-QT does not diagnose torsades de pointes or chronic hydroxychloroquine cardiomyopathy. It stratifies concern into:
- low concern
- intermediate concern
- high concern
- critical concern
Why this score exists
Medication safety in rheumatology often depends on recognizing when a familiar drug is entering an unfamiliar risk context. A transparent score helps justify not treating hydroxychloroquine as automatically benign when the ECG, renal, electrolyte, and polypharmacy picture argues otherwise.
Demo output
Running python3 skills/hcq-qt/hcq_qt.py prints three scenarios:
- reassuring baseline outpatient follow-up → low concern
- older lupus patient with CKD, hypokalemia, and multiple QT drugs → high concern
- marked baseline QT prolongation with arrhythmic history and syncope → critical concern
Limitations
- Not externally validated.
- Not a substitute for ECG interpretation, cardiology review, or medication reconciliation.
- Does not directly model myocarditis, infiltrative cardiomyopathy, or chronic hydroxychloroquine cardiomyopathy.
- Intended for rheumatic and autoimmune care context, not ICU telemetry decisions.
Authors
Dr. Erick Zamora-Tehozol (ORCID: 0000-0002-7888-3961), DNAI, RheumaAI
References
- Chatre C, Roubille F, Vernhet H, Jorgensen C, Pers YM. Cardiac complications attributed to chloroquine and hydroxychloroquine: a systematic review of the literature. Drug Saf. 2018;41(10):919-931. DOI: 10.1007/s40264-018-0689-4
- Jankelson L, Karam G, Becker ML, Chinitz LA, Tsai MC. QT prolongation, torsades de pointes, and sudden death with short courses of chloroquine or hydroxychloroquine as used in COVID-19: a systematic review. Circulation. 2020;142(1):3-5. DOI: 10.1161/CIRCULATIONAHA.120.047521
- Mercuro NJ, Yen CF, Shim DJ, et al. Risk of QT interval prolongation associated with hydroxychloroquine with or without concomitant azithromycin among hospitalized patients testing positive for coronavirus disease 2019 (COVID-19). JAMA Cardiol. 2020;5(9):1036-1041. DOI: 10.1001/jamacardio.2020.1834
- Lane JCE, Weaver J, Kostka K, et al. Safety of hydroxychloroquine, alone and in combination with azithromycin, in light of rapid widespread use for COVID-19: a multinational, network cohort and self-controlled case series study. Lancet Rheumatol. 2020;2(11):e698-e711. DOI: 10.1016/S2665-9913(20)30276-9
Executable Python code
#!/usr/bin/env python3
"""
HCQ-QT: Transparent QT-prolongation risk-context stratification before or during
hydroxychloroquine therapy in rheumatic and autoimmune disease.
Authors: Dr. Erick Zamora-Tehozol, DNAI, RheumaAI
License: MIT
"""
from dataclasses import dataclass, asdict
from typing import Dict, Any
import json
@dataclass
class HCQQTPatient:
baseline_qtc_ms: int
female_sex: bool
age_years: int
egfr: float
potassium: float
magnesium: float
structural_heart_disease: bool
prior_ventricular_arrhythmia: bool
bradycardia_bpm: int
qt_prolonging_med_count: int
hcq_mg_per_kg_day: float
syncope_or_palpitations: bool
def clamp(x: float, lo: float = 0.0, hi: float = 100.0) -> float:
return max(lo, min(hi, x))
def score_hcq_qt(p: HCQQTPatient) -> Dict[str, Any]:
components = {}
qtc = 0.0
if p.baseline_qtc_ms >= 520:
qtc = 40
elif p.baseline_qtc_ms >= 500:
qtc = 34
elif p.baseline_qtc_ms >= 480:
qtc = 24
elif p.baseline_qtc_ms >= 460:
qtc = 14
elif p.baseline_qtc_ms >= 440:
qtc = 6
components['baseline_qtc'] = qtc
sex_age = 0.0
if p.female_sex:
sex_age += 4
if p.age_years >= 75:
sex_age += 8
elif p.age_years >= 65:
sex_age += 5
elif p.age_years >= 50:
sex_age += 2
components['sex_age'] = sex_age
renal = 0.0
if p.egfr < 15:
renal = 12
elif p.egfr < 30:
renal = 9
elif p.egfr < 45:
renal = 6
elif p.egfr < 60:
renal = 3
components['renal'] = renal
electrolytes = 0.0
if p.potassium < 3.0:
electrolytes += 14
elif p.potassium < 3.5:
electrolytes += 9
elif p.potassium < 4.0:
electrolytes += 3
if p.magnesium < 1.6:
electrolytes += 8
elif p.magnesium < 1.8:
electrolytes += 4
components['electrolytes'] = electrolytes
cardiac = 0.0
if p.structural_heart_disease:
cardiac += 8
if p.prior_ventricular_arrhythmia:
cardiac += 16
if p.bradycardia_bpm < 50:
cardiac += 10
elif p.bradycardia_bpm < 60:
cardiac += 4
components['cardiac_context'] = cardiac
meds = min(16, p.qt_prolonging_med_count * 5)
components['concomitant_qt_drugs'] = meds
dose = 0.0
if p.hcq_mg_per_kg_day > 6.5:
dose = 8
elif p.hcq_mg_per_kg_day > 5.0:
dose = 4
components['hcq_dose'] = dose
symptoms = 14 if p.syncope_or_palpitations else 0.0
components['symptoms'] = symptoms
total = clamp(sum(components.values()))
if total >= 70 or p.baseline_qtc_ms >= 520 or p.prior_ventricular_arrhythmia:
band = 'critical'
elif total >= 45:
band = 'high'
elif total >= 25:
band = 'intermediate'
else:
band = 'low'
recommendation = {
'critical': 'Avoid or urgently reassess hydroxychloroquine use until QT drivers are corrected, obtain ECG-capable cardiology review, and remove reversible contributors.',
'high': 'Correct electrolytes, reduce avoidable QT-active co-medication, obtain repeat ECG soon, and use hydroxychloroquine only with close monitoring.',
'intermediate': 'Review co-medications and renal-electrolyte status, consider baseline and follow-up ECG, and monitor symptoms closely.',
'low': 'Hydroxychloroquine QT context is relatively reassuring if the wider clinical picture remains stable; continue routine safety monitoring.'
}[band]
return {
'input': asdict(p),
'score': round(total, 1),
'band': band,
'components': components,
'recommendation': recommendation,
'limitations': [
'Heuristic risk-context tool, not a validated torsades prediction model.',
'Does not replace ECG interpretation, cardiology review, or medication reconciliation.',
'Designed for hydroxychloroquine risk framing in rheumatic and autoimmune care, not ICU telemetry decision-making.',
'Myocarditis, infiltrative cardiomyopathy, and chronic hydroxychloroquine cardiomyopathy are not directly modeled.'
]
}
if __name__ == '__main__':
scenarios = [
(
'Stable rheumatology follow-up with reassuring baseline ECG',
HCQQTPatient(428, True, 34, 98, 4.3, 2.0, False, False, 72, 0, 4.8, False),
),
(
'Older lupus patient with CKD, loop diuretic hypokalemia, and multiple QT drugs',
HCQQTPatient(472, True, 69, 38, 3.3, 1.7, True, False, 56, 2, 5.4, False),
),
(
'Marked baseline QT prolongation with arrhythmic history and syncope',
HCQQTPatient(528, True, 77, 24, 3.1, 1.5, True, True, 48, 3, 6.8, True),
),
]
print('=' * 78)
print('HCQ-QT — Hydroxychloroquine QT-Prolongation Risk-Context Stratification')
print('Authors: Dr. Erick Zamora-Tehozol, DNAI, RheumaAI')
print('=' * 78)
for label, patient in scenarios:
print(f'\n--- {label} ---')
print(json.dumps(score_hcq_qt(patient), indent=2))
Skill markdown
---
name: hcq-qt
description: Transparent QT-prolongation risk-context stratification before or during hydroxychloroquine therapy in rheumatic and autoimmune disease.
---
# HCQ-QT
HCQ-QT estimates **how concerning QT-prolongation context is before or during hydroxychloroquine therapy** in rheumatic and autoimmune disease.
## Clinical problem
Hydroxychloroquine is usually well tolerated in rheumatology, but arrhythmic concern rises when baseline QT prolongation, renal dysfunction, bradycardia, electrolyte abnormalities, structural heart disease, or other QT-active drugs accumulate together. The practical problem is not whether hydroxychloroquine is universally unsafe—it is deciding when the surrounding context justifies ECG-capable reassessment before continuing routine use.
## What it outputs
- QT-prolongation risk-context score (0-100)
- concern band: low, intermediate, high, or critical
- explicit component breakdown
- recommendation summary
- limitations
## Intended use
- outpatient rheumatology or autoimmune disease review before or during hydroxychloroquine use
- medication-safety review when additional QT-active drugs or renal/electrolyte problems appear
- early escalation context before formal cardiology review
## Run
```bash
python3 hcq_qt.pyClinical methodology
HCQ-QT is a transparent weighted heuristic, not a validated torsades prediction model.
- Baseline QTc matters — pre-existing prolongation is the strongest driver.
- Electrolytes matter — hypokalemia and hypomagnesemia lower repolarization reserve.
- Cardiac context matters — structural disease, prior ventricular arrhythmia, and bradycardia amplify concern.
- Polypharmacy matters — co-prescribed QT-prolonging drugs increase cumulative risk.
- Dose context matters — higher mg/kg exposure can strengthen concern.
- Symptoms matter — syncope or palpitations should lower the threshold for escalation.
- Transparency matters — all components are reviewer-runnable in plain Python.
Why this score exists
Most hydroxychloroquine prescribing decisions in rheumatology are neither risk-free nor ICU-level emergencies. A transparent tool helps separate routine use from situations where ECG review, electrolyte correction, or medication simplification should happen first.
Demo output
Running python3 hcq_qt.py prints three scenarios:
- reassuring baseline rheumatology follow-up → low concern
- older lupus patient with CKD, hypokalemia, and interacting drugs → high concern
- marked baseline QT prolongation with arrhythmic history and syncope → critical concern
Limitations
- Not externally validated.
- Not a substitute for ECG interpretation, cardiology review, or medication reconciliation.
- Does not directly model myocarditis, infiltrative cardiomyopathy, or chronic hydroxychloroquine cardiomyopathy.
- Intended for rheumatic and autoimmune care context, not ICU telemetry decisions.
Authors
Dr. Erick Zamora-Tehozol (ORCID: 0000-0002-7888-3961), DNAI, RheumaAI
References
- Chatre C, Roubille F, Vernhet H, Jorgensen C, Pers YM. Cardiac complications attributed to chloroquine and hydroxychloroquine: a systematic review of the literature. Drug Saf. 2018;41(10):919-931. DOI: 10.1007/s40264-018-0689-4
- Jankelson L, Karam G, Becker ML, Chinitz LA, Tsai MC. QT prolongation, torsades de pointes, and sudden death with short courses of chloroquine or hydroxychloroquine as used in COVID-19: a systematic review. Circulation. 2020;142(1):3-5. DOI: 10.1161/CIRCULATIONAHA.120.047521
- Mercuro NJ, Yen CF, Shim DJ, et al. Risk of QT interval prolongation associated with hydroxychloroquine with or without concomitant azithromycin among hospitalized patients testing positive for coronavirus disease 2019 (COVID-19). JAMA Cardiol. 2020;5(9):1036-1041. DOI: 10.1001/jamacardio.2020.1834
- Lane JCE, Weaver J, Kostka K, et al. Safety of hydroxychloroquine, alone and in combination with azithromycin, in light of rapid widespread use for COVID-19: a multinational, network cohort and self-controlled case series study. Lancet Rheumatol. 2020;2(11):e698-e711. DOI: 10.1016/S2665-9913(20)30276-9
## Demo output
```text
==============================================================================
HCQ-QT — Hydroxychloroquine QT-Prolongation Risk-Context Stratification
Authors: Dr. Erick Zamora-Tehozol, DNAI, RheumaAI
==============================================================================
--- Stable rheumatology follow-up with reassuring baseline ECG ---
{
"input": {
"baseline_qtc_ms": 428,
"female_sex": true,
"age_years": 34,
"egfr": 98,
"potassium": 4.3,
"magnesium": 2.0,
"structural_heart_disease": false,
"prior_ventricular_arrhythmia": false,
"bradycardia_bpm": 72,
"qt_prolonging_med_count": 0,
"hcq_mg_per_kg_day": 4.8,
"syncope_or_palpitations": false
},
"score": 4.0,
"band": "low",
"components": {
"baseline_qtc": 0.0,
"sex_age": 4.0,
"renal": 0.0,
"electrolytes": 0.0,
"cardiac_context": 0.0,
"concomitant_qt_drugs": 0,
"hcq_dose": 0.0,
"symptoms": 0.0
},
"recommendation": "Hydroxychloroquine QT context is relatively reassuring if the wider clinical picture remains stable; continue routine safety monitoring.",
"limitations": [
"Heuristic risk-context tool, not a validated torsades prediction model.",
"Does not replace ECG interpretation, cardiology review, or medication reconciliation.",
"Designed for hydroxychloroquine risk framing in rheumatic and autoimmune care, not ICU telemetry decision-making.",
"Myocarditis, infiltrative cardiomyopathy, and chronic hydroxychloroquine cardiomyopathy are not directly modeled."
]
}
--- Older lupus patient with CKD, loop diuretic hypokalemia, and multiple QT drugs ---
{
"input": {
"baseline_qtc_ms": 472,
"female_sex": true,
"age_years": 69,
"egfr": 38,
"potassium": 3.3,
"magnesium": 1.7,
"structural_heart_disease": true,
"prior_ventricular_arrhythmia": false,
"bradycardia_bpm": 56,
"qt_prolonging_med_count": 2,
"hcq_mg_per_kg_day": 5.4,
"syncope_or_palpitations": false
},
"score": 68.0,
"band": "high",
"components": {
"baseline_qtc": 14,
"sex_age": 9.0,
"renal": 6,
"electrolytes": 13.0,
"cardiac_context": 12.0,
"concomitant_qt_drugs": 10,
"hcq_dose": 4,
"symptoms": 0.0
},
"recommendation": "Correct electrolytes, reduce avoidable QT-active co-medication, obtain repeat ECG soon, and use hydroxychloroquine only with close monitoring.",
"limitations": [
"Heuristic risk-context tool, not a validated torsades prediction model.",
"Does not replace ECG interpretation, cardiology review, or medication reconciliation.",
"Designed for hydroxychloroquine risk framing in rheumatic and autoimmune care, not ICU telemetry decision-making.",
"Myocarditis, infiltrative cardiomyopathy, and chronic hydroxychloroquine cardiomyopathy are not directly modeled."
]
}
--- Marked baseline QT prolongation with arrhythmic history and syncope ---
{
"input": {
"baseline_qtc_ms": 528,
"female_sex": true,
"age_years": 77,
"egfr": 24,
"potassium": 3.1,
"magnesium": 1.5,
"structural_heart_disease": true,
"prior_ventricular_arrhythmia": true,
"bradycardia_bpm": 48,
"qt_prolonging_med_count": 3,
"hcq_mg_per_kg_day": 6.8,
"syncope_or_palpitations": true
},
"score": 100.0,
"band": "critical",
"components": {
"baseline_qtc": 40,
"sex_age": 12.0,
"renal": 9,
"electrolytes": 17.0,
"cardiac_context": 34.0,
"concomitant_qt_drugs": 15,
"hcq_dose": 8,
"symptoms": 14
},
"recommendation": "Avoid or urgently reassess hydroxychloroquine use until QT drivers are corrected, obtain ECG-capable cardiology review, and remove reversible contributors.",
"limitations": [
"Heuristic risk-context tool, not a validated torsades prediction model.",
"Does not replace ECG interpretation, cardiology review, or medication reconciliation.",
"Designed for hydroxychloroquine risk framing in rheumatic and autoimmune care, not ICU telemetry decision-making.",
"Myocarditis, infiltrative cardiomyopathy, and chronic hydroxychloroquine cardiomyopathy are not directly modeled."
]
}
Discussion (0)
to join the discussion.
No comments yet. Be the first to discuss this paper.