Skip to content
Skills Library
Medicine & health · Analysis

hfrs

/hfrs

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.

Repository
m4 ↗
Licence
MIT
Last repository change
22.10.2026

Assessment and security

100/ 100Class: good
Format25 / 25
Frontmatter with name and description, valid name, description up to 1,024 characters, name matching the folder.
Discoverability25 / 25
Description explains when to use the skill, has a reasonable length and uses third person.
Content35 / 35
At least 150 words and at most 500 lines, headings, step lists, examples or code.
Hygiene15 / 15
No placeholders such as TODO, no Windows paths, with a licence.
Riskno signals detected in the scan
Files in this package
6
Scripts
1
HTML comments
0
URLs in SKILL.md
0
Deprecation

No signals detected. Repository changed on 22.10.2026, without references to retired models or APIs.

Licence

MIT, open: use and modify while retaining author attribution.

What to check before installing
  • 1 scripts in this package. Review them before installing, as Claude may execute them.

Scripts: scripts/calculate_hfrs.py

What it does and when to use it

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.

Original author description

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.

How it works

  1. When to Use This Skill
  2. Methodology
  3. Risk Categories
  4. Critical Implementation Notes
  5. Top Contributing Codes
  6. Example Queries
  7. References
Original SKILL.md headings · 91 lines, 441 words
SKILL.md preview
---
name: hfrs
description: 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.
tier: expert
category: clinical
kind: domain
---

# 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

| Score | Category | 30-day Mortality OR |
|-------|----------|---------------------|
| < 5 | Low | Reference |
| 5-15 | Intermediate | 1.65 (1.62-1.68) |
| > 15 | High | 1.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.

2. **Emergency admission types in MIMIC-IV**: The SQL implementation considers `EMERGENCY`, `URGENT`, and `EW EMER.` as emergency admissions.

3. **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-10 | Points | Description |
|--------|--------|-------------|
| F00 | 7.1 | Dementia in Alzheimer's |
| G81 | 4.4 | Hemiplegia |
| G30 | 4.0 | Alzheimer's disease |
| I69 | 3.7 | Sequelae of CVD |
| R29 | 3.6 | Tendency to fall |
| F05 | 3.2 | Delirium |
| N39 | 3.2 | UTI/incontinence |
| W19 | 3.2 | Unspecified 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.
Files in this package (6)
  • PROVENANCE.yaml 1 KB
  • SKILL.md 3 KB
  • references/hfrs_codes.json 12 KB
  • references/hfrs_icd_codes.csv 7 KB
  • scripts/calculate_hfrs.py 18 KB
  • scripts/calculate_hfrs.sql 18 KB

Versions

The database has no other skills named hfrs.

Database snapshot: 13.11.2026 · package version 85129c01dd0f (SHA-256 digest of the entire package)

Downloads in the last 30 days: 0 · ranking

: harmful content, incorrect descriptions or an author’s removal request.

Similar skills

  • 100apache-iv-score
    Calculate APACHE IV (Acute Physiology and Chronic Health Evaluation IV) score for ICU mortality prediction. Use for severity assessment, hospital mortality prediction, ICU benchmarking, or case-mix adjustment. eICU has pre-computed scores; MIMIC-IV requires custom implementation…
  • 100apsiii-score
    Calculate APACHE III (Acute Physiology Score III) for ICU patients. Use for mortality prediction, severity stratification, case-mix adjustment, or risk-adjusted outcome comparisons.
  • 100risk-adjustment
    Pipeline skill for CMS-HCC risk adjustment calculation and coding gap identification. Use when the user asks to apply the ICD-10-to-HCC crosswalk, calculate RAF scores, resolve disease hierarchies programmatically, identify coding gaps from Rx or lab proxies, project…
  • 100coding-icd10
    Suggests candidate ICD-10-CM diagnosis codes (and ICD-10-PCS procedure codes) for diagnoses and procedures extracted by OpenMed, with rationale and a human-coder caveat. Use when the user wants to code a problem list, map a diagnosis span to a billable ICD-10-CM code, route a…
  • 100pyhealth
    Builds and validates PyHealth clinical machine-learning pipelines for EHR, signals, imaging, and medical codes. Use for PyHealth dataset loading, MIMIC-III/IV, eICU or OMOP prediction tasks, patient-level evaluation, mortality/readmission/length-of-stay modeling, medication…
  • 100mimic-patient-analysis
    Comprehensive patient analysis using the MIMIC-IV clinical database. Use this skill whenever asked to analyze, summarize, or investigate a patient's medical history, hospital admissions, diagnoses, medications, procedures, or clinical course from a MIMIC-IV SQLite database.…

Feedback and reports

Your message goes to Bartosz Sokoliński. An email address is needed only for a reply. See the privacy policy.