hannesill/m4/hfrs

Claude Code and agent skill by hannesill/m4

Trust tier 3
  • community
Source check pending

Checking that the SKILL.md file is still in the repository.

Calculate Hospital Frailty Risk Score (HFRS) for ICU patients using ICD diagnosis codes. Use for frailty assessment, risk stratification, or outcome prediction in older patients. Supports both ICD-9-CM and ICD-10-CM codes for MIMIC-IV compatibility.

Install

npx vskill@latest install hannesill/m4/hfrs

SKILL.md

Hospital Frailty Risk Score (HFRS)

Calculate HFRS from ICD diagnosis codes. Based on Gilbert et al. (2018) Lancet methodology with 109 weighted ICD-10 codes.

When to Use This Skill

  • Assessing frailty in ICU or hospitalized patients
  • Risk stratification for older adults
  • Predicting 30-day mortality, prolonged length of stay, or readmission
  • Research requiring a validated frailty metric from administrative data

Methodology

Per the original publication, HFRS is calculated using diagnoses from:

  1. The current (index) admission
  2. All emergency admissions in the preceding 2 years

Each unique ICD code is counted only once, even if it appears in multiple admissions.

Risk Categories

ScoreCategory30-day Mortality OR
< 5LowReference
5-15Intermediate1.65 (1.62-1.68)
> 15High1.71 (1.68-1.75)

Critical Implementation Notes

  1. ICD-9 mappings are NOT part of the original publication. They have been added for MIMIC-IV compatibility, which contains both ICD-9 and ICD-10 coded admissions. Use ICD-9 mappings with appropriate caution.
  1. Emergency admission types in MIMIC-IV: The SQL implementation considers EMERGENCY, URGENT, and EW EMER. as emergency admissions.
  1. Code matching uses 3-character prefix for ICD-10 (e.g., F05 matches F05.0, F05.1). ICD-9 uses variable-length matching.

Top Contributing Codes

ICD-10PointsDescription
F007.1Dementia in Alzheimer's
G814.4Hemiplegia
G304.0Alzheimer's disease
I693.7Sequelae of CVD
R293.6Tendency to fall
F053.2Delirium
N393.2UTI/incontinence
W193.2Unspecified fall

Full 109-code list: references/hfrs_icd_codes.csv

Example Queries

Calculate HFRS for all admissions
sql
-- See scripts/calculate_hfrs.sql for the complete query
-- Key tables used:
-- - mimiciv_hosp.admissions (admission dates and types)
-- - mimiciv_hosp.diagnoses_icd (ICD codes)
-- Simplified example: score a single admission
SELECT
a.subject_id,
a.hadm_id,
SUM(w.points) AS hfrs_score
FROM mimiciv_hosp.diagnoses_icd d
JOIN mimiciv_hosp.admissions a ON d.hadm_id = a.hadm_id
JOIN hfrs_weights w ON d.icd_code LIKE w.icd_prefix || '%'
AND d.icd_version = w.icd_version
GROUP BY a.subject_id, a.hadm_id;
Python: ad-hoc calculation
python
from scripts.calculate_hfrs import calculate_hfrs
diagnoses = [
{'icd_code': 'F05', 'icd_version': 10}, # Delirium
{'icd_code': '2900', 'icd_version': 9}, # Dementia (ICD-9)
{'icd_code': 'R29', 'icd_version': 10}, # Falls
]
result = calculate_hfrs(diagnoses)
print(f"HFRS: {result['score']} ({result['risk_category']} risk)")

References

  • Gilbert T, et al. "Development and validation of a Hospital Frailty Risk Score focusing on older people in acute care settings using electronic hospital records: an observational study." Lancet. 2018;391:1775-82.

Security

  • Security scanPassed, 95 of 100Pattern checks on the skill's files.
  • Model reviewPassed

Quality evaluation

  • Task evaluationNot runNo evaluation yet. Run one in Skill Studio.

Source

Popularity

7-day trend score
0

Not refreshed yet.

Works with

Any agent vskill installs to: 56 targets in all. These 39 have a page on this site.

  • Claude Code
  • Cursor
  • GitHub Copilot
  • Windsurf
  • Codex
  • Gemini CLI
  • Cline
  • Amp
  • Roo Code
  • Goose
  • Continue
  • Kilo Code
  • Junie
  • Trae
  • OpenHands
  • Qwen Code
  • AI Agent
  • Tabnine Chat
  • Sourcegraph Cody
  • Amazon Q
  • Firebase Genkit
  • Sweep
  • Devin
  • Phind
  • Mentat
  • Claude Desktop
  • Aider
  • GPT Pilot
  • Plandex
  • bolt.new
  • v0
  • Replit Agent
  • Anse
  • TypingMind
  • BetterChatGPT
  • LibreChat
  • Warp AI
  • Pieces
  • Fig AI
Embed badge
vskill VERIFIED badge
[![vskill VERIFIED](https://verified-skill.com/api/v1/skills/hannesill/m4/hfrs/badge)](https://verified-skill.com/skills/hannesill/m4/hfrs)

Something wrong with this skill or its page? Tell us.