[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-aws-labs-risk-adjustment":3,"mdc--uxjctg-key":49,"related-org-aws-labs-risk-adjustment":2499,"related-repo-aws-labs-risk-adjustment":2677},{"slug":4,"name":4,"fn":5,"description":6,"org":7,"tags":12,"stars":26,"repoUrl":27,"updatedAt":28,"license":29,"forks":30,"topics":31,"repo":44,"sourceUrl":47,"mdContent":48},"risk-adjustment","calculate CMS-HCC risk adjustment scores","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 member-level risk scores, build a risk adjustment data pipeline, compute HCC coefficients, run hierarchy resolution code, or generate member risk score reports. Triggers include \"calculate RAF score\", \"ICD-10 to HCC crosswalk\", \"hierarchy resolution code\", \"coding gap detection\", \"Rx proxy gap\", \"lab proxy gap\", \"risk score projection\", \"HCC pipeline\", \"member risk report\", \"risk adjustment Python\", \"risk adjustment SQL\", \"RAF calculation code\", \"CMS-HCC pipeline\".\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},"aws-labs","AWS Labs","https:\u002F\u002Fpexgzepcugksgbtrxkhf.supabase.co\u002Fstorage\u002Fv1\u002Fobject\u002Fpublic\u002Forg-logos\u002Faws-labs.png","awslabs",[13,17,20,23],{"name":14,"slug":15,"type":16},"Healthcare","healthcare","tag",{"name":18,"slug":19,"type":16},"Data Analysis","data-analysis",{"name":21,"slug":22,"type":16},"Regulatory Compliance","regulatory-compliance",{"name":24,"slug":25,"type":16},"Insurance","insurance",4,"https:\u002F\u002Fgithub.com\u002Fawslabs\u002Fhcls-agent-skills","2026-07-12T08:37:29.595216",null,0,[32,33,34,35,36,37,38,39,40,41,42,4,43],"agent-skills","agentcore","ai-agents","amazon-quick-desktop","claims-processing","drug-discovery","genomics","healthcare-ai","kiro","life-sciences","medical-imaging","strands-agents",{"repoUrl":27,"stars":26,"forks":30,"topics":45,"description":46},[32,33,34,35,36,37,38,39,40,41,42,4,43],"Agent skills for healthcare and life sciences: genomics, imaging, claims, drug discovery, and more. Works with Amazon Quick, Kiro, Amazon AgentCore, AWS Strands SDK, Claude Code, Codex, and any Agent Skills-compatible platform.","https:\u002F\u002Fgithub.com\u002Fawslabs\u002Fhcls-agent-skills\u002Ftree\u002FHEAD\u002Fskills\u002Frisk-adjustment","---\nname: risk-adjustment\ndescription: >\n  Pipeline skill for CMS-HCC risk adjustment calculation and coding gap identification. Use\n  when the user asks to apply the ICD-10-to-HCC crosswalk, calculate RAF scores, resolve\n  disease hierarchies programmatically, identify coding gaps from Rx or lab proxies, project\n  member-level risk scores, build a risk adjustment data pipeline, compute HCC coefficients,\n  run hierarchy resolution code, or generate member risk score reports. Triggers include\n  \"calculate RAF score\", \"ICD-10 to HCC crosswalk\", \"hierarchy resolution code\", \"coding\n  gap detection\", \"Rx proxy gap\", \"lab proxy gap\", \"risk score projection\", \"HCC pipeline\",\n  \"member risk report\", \"risk adjustment Python\", \"risk adjustment SQL\", \"RAF calculation\n  code\", \"CMS-HCC pipeline\".\nusage: Invoke to generate executable Python and SQL code for ICD-10-to-HCC mapping, hierarchy resolution, RAF score calculation, and coding gap identification.\nversion: 1.0.0\nvalidated_against:\n  date: 2025-01-15\n  packages: {hcc-tools: \"1.0\", pandas: \"2.2\"}\ntags: [skill, category:pipeline, risk-adjustment, hcc, hcls]\n---\n\n# Risk Adjustment — Pipeline Skill\n\n## Overview\n\nProvide deterministic, copy-paste-ready Python and SQL code for CMS-HCC risk adjustment:\nICD-10-to-HCC crosswalk, hierarchy resolution, RAF score calculation, and coding gap\nidentification from Rx\u002Flab proxies.\n\n## Usage\n\n- Apply ICD-10-to-HCC crosswalk and resolve disease hierarchies programmatically\n- Calculate member-level RAF scores and identify coding gaps from Rx\u002Flab proxies\n\n## Core Concepts\n\n---\n\n\n## Response Format\n\n- Lead with the command or code the user needs — explain after\n- Structure as: confirm inputs → working code → key parameters explained → gotchas\n- One complete working example per task; do not show every alternative\n- Keep code comments minimal and functional (what, not why-it-exists)\n- Target: 50-100 lines of code with brief surrounding explanation\n\n## 1. ICD-10-to-HCC Crosswalk\n\n### Python\n\n```python\nimport pandas as pd\n\n\ndef load_crosswalk(filepath: str) -> pd.DataFrame:\n    \"\"\"Load CMS ICD-10-to-CC crosswalk. Expected columns: [icd10, cc].\"\"\"\n    xwalk = pd.read_csv(filepath, dtype=str)\n    xwalk.columns = [c.strip().lower() for c in xwalk.columns]\n    xwalk[\"icd10\"] = xwalk[\"icd10\"].str.replace(\".\", \"\", regex=False).str.upper()\n    xwalk[\"cc\"] = xwalk[\"cc\"].astype(int)\n    return xwalk\n\n\ndef map_diagnoses_to_ccs(dx_df: pd.DataFrame, xwalk: pd.DataFrame) -> pd.DataFrame:\n    \"\"\"Map member diagnoses to Condition Categories.\n\n    Args:\n        dx_df: [member_id, icd10, service_date, provider_type].\n        xwalk: [icd10, cc].\n    Returns:\n        Deduplicated [member_id, icd10, cc].\n    \"\"\"\n    dx = dx_df.copy()\n    dx[\"icd10\"] = dx[\"icd10\"].str.replace(\".\", \"\", regex=False).str.upper()\n    qualifying = {\"MD\", \"DO\", \"NP\", \"PA\", \"CNS\"}\n    dx = dx[dx[\"provider_type\"].str.upper().isin(qualifying)]\n    mapped = dx.merge(xwalk, on=\"icd10\", how=\"inner\")\n    return mapped.drop_duplicates(subset=[\"member_id\", \"cc\"])\n```\n\n### SQL\n\n```sql\nSELECT DISTINCT d.member_id, d.icd10, x.cc\nFROM diagnoses d\nJOIN icd10_cc_crosswalk x ON REPLACE(d.icd10, '.', '') = x.icd10\nWHERE d.provider_type IN ('MD','DO','NP','PA','CNS')\n  AND d.service_date BETWEEN '2025-01-01' AND '2025-12-31';\n```\n\n---\n\n## 2. Hierarchy Resolution\n\n### Python\n\n```python\nimport pandas as pd\nfrom collections import defaultdict\n\n# V24 hierarchies: {higher_cc: [lower_ccs_it_supersedes]}\nV24_HIERARCHIES = {\n    17: [18, 19], 18: [19],           # Diabetes\n    85: [86, 87], 86: [87],           # Heart failure\n    111: [112],                        # COPD > asthma\n    136: [137, 138], 137: [138],      # Renal\n    8: [9,10,11,12], 9: [10,11,12], 10: [11,12], 11: [12],  # Cancer\n    107: [108],                        # Vascular\n    27: [28, 29], 28: [29],           # Liver\n    51: [52],                          # Dementia\n    82: [83, 84], 83: [84],           # Hemiplegia\n}\n\n\ndef resolve_hierarchies(member_ccs: pd.DataFrame,\n                        hierarchies: dict = None) -> pd.DataFrame:\n    \"\"\"Remove lower CCs when higher CC in same hierarchy is present.\n\n    Args:\n        member_ccs: [member_id, cc].\n        hierarchies: {higher_cc: [lower_ccs]}. Defaults to V24.\n    Returns:\n        [member_id, hcc] with only surviving CCs.\n    \"\"\"\n    if hierarchies is None:\n        hierarchies = V24_HIERARCHIES\n\n    superseded_by = defaultdict(set)\n    for higher, lowers in hierarchies.items():\n        for lower in lowers:\n            superseded_by[lower].add(higher)\n\n    results = []\n    for mid, grp in member_ccs.groupby(\"member_id\"):\n        cc_set = set(grp[\"cc\"])\n        for cc in cc_set:\n            if not superseded_by.get(cc, set()).intersection(cc_set):\n                results.append({\"member_id\": mid, \"hcc\": cc})\n    return pd.DataFrame(results)\n```\n\n### SQL\n\n```sql\nWITH hierarchy_rules AS (\n    SELECT 17 AS hi, 18 AS lo UNION ALL SELECT 17,19 UNION ALL SELECT 18,19 UNION ALL\n    SELECT 85,86 UNION ALL SELECT 85,87 UNION ALL SELECT 86,87 UNION ALL\n    SELECT 111,112 UNION ALL SELECT 136,137 UNION ALL SELECT 136,138 UNION ALL SELECT 137,138\n),\nsuperseded AS (\n    SELECT mc.member_id, mc.cc\n    FROM member_ccs mc\n    JOIN hierarchy_rules h ON mc.cc = h.lo\n    JOIN member_ccs mc2 ON mc.member_id = mc2.member_id AND mc2.cc = h.hi\n)\nSELECT mc.member_id, mc.cc AS hcc\nFROM member_ccs mc\nLEFT JOIN superseded s ON mc.member_id = s.member_id AND mc.cc = s.cc\nWHERE s.cc IS NULL;\n```\n\n---\n\n## 3. RAF Score Calculation\n\n```python\nimport pandas as pd\n\n# V24 Community Non-Dual Aged (example subset)\nDEMO_COEFF = {\n    (\"M\",\"65-69\"): 0.395, (\"M\",\"70-74\"): 0.487, (\"M\",\"75-79\"): 0.596,\n    (\"M\",\"80-84\"): 0.728, (\"M\",\"85-89\"): 0.896, (\"M\",\"90-94\"): 1.003, (\"M\",\"95+\"): 1.073,\n    (\"F\",\"65-69\"): 0.339, (\"F\",\"70-74\"): 0.421, (\"F\",\"75-79\"): 0.532,\n    (\"F\",\"80-84\"): 0.668, (\"F\",\"85-89\"): 0.854, (\"F\",\"90-94\"): 0.979, (\"F\",\"95+\"): 1.055,\n}\n\nHCC_COEFF = {\n    8: 2.484, 9: 0.975, 10: 0.690, 17: 0.368, 18: 0.368, 19: 0.118,\n    47: 0.545, 51: 0.437, 52: 0.294, 85: 0.441, 86: 0.335, 87: 0.237,\n    96: 0.296, 111: 0.335, 112: 0.199, 136: 0.288, 137: 0.237, 138: 0.237,\n}\n\nINTERACTIONS = {\n    frozenset([\"diabetes\",\"chf\"]): 0.154,\n    frozenset([\"chf\",\"copd\"]): 0.175,\n    frozenset([\"chf\",\"renal\"]): 0.154,\n    frozenset([\"diabetes\",\"chf\",\"copd\"]): 0.047,\n}\n\nHCC_GROUP = {\n    17: \"diabetes\", 18: \"diabetes\", 85: \"chf\", 86: \"chf\",\n    111: \"copd\", 112: \"copd\", 136: \"renal\", 137: \"renal\", 138: \"renal\",\n}\n\n\ndef calculate_raf(demographics: pd.DataFrame, member_hccs: pd.DataFrame) -> pd.DataFrame:\n    \"\"\"Calculate RAF scores. demographics: [member_id, sex, age_group]. member_hccs: [member_id, hcc].\"\"\"\n    hcc_map = member_hccs.groupby(\"member_id\")[\"hcc\"].apply(set).to_dict()\n    rows = []\n    for _, r in demographics.iterrows():\n        mid, hccs = r[\"member_id\"], hcc_map.get(r[\"member_id\"], set())\n        demo = DEMO_COEFF.get((r[\"sex\"], r[\"age_group\"]), 0.0)\n        hcc_score = sum(HCC_COEFF.get(h, 0.0) for h in hccs)\n        groups = {HCC_GROUP[h] for h in hccs if h in HCC_GROUP}\n        interact = sum(v for k, v in INTERACTIONS.items() if k.issubset(groups))\n        rows.append({\"member_id\": mid, \"demo\": round(demo, 3), \"hcc_score\": round(hcc_score, 3),\n                      \"interaction\": round(interact, 3), \"total_raf\": round(demo + hcc_score + interact, 3),\n                      \"hcc_count\": len(hccs), \"hccs\": sorted(hccs)})\n    return pd.DataFrame(rows).sort_values(\"total_raf\", ascending=False)\n```\n\n### SQL\n\n```sql\nWITH hcc_scores AS (\n    SELECT mh.member_id, SUM(c.coefficient) AS hcc_score, COUNT(*) AS hcc_count\n    FROM member_hccs mh\n    JOIN hcc_coefficients c ON mh.hcc = c.hcc\n    WHERE c.model_version = 'V24' AND c.segment = 'CNA'\n    GROUP BY mh.member_id\n),\ndemo_scores AS (\n    SELECT md.member_id, dc.coefficient AS demo_score\n    FROM member_demographics md\n    JOIN demographic_coefficients dc ON md.sex = dc.sex AND md.age_group = dc.age_group\n    WHERE dc.model_version = 'V24' AND dc.segment = 'CNA'\n)\nSELECT d.member_id, d.demo_score, COALESCE(h.hcc_score, 0) AS hcc_score,\n       ROUND(d.demo_score + COALESCE(h.hcc_score, 0), 3) AS total_raf\nFROM demo_scores d LEFT JOIN hcc_scores h ON d.member_id = h.member_id\nORDER BY total_raf DESC;\n```\n\n---\n\n## 4. Coding Gap Identification\n\n### 4a. Rx Proxy Gaps\n\n```python\nimport pandas as pd\n\nRX_MAP = {\n    \"metformin\":      {\"condition\": \"diabetes\",       \"icd_pfx\": \"E11\", \"hccs\": [17,18,19]},\n    \"glipizide\":      {\"condition\": \"diabetes\",       \"icd_pfx\": \"E11\", \"hccs\": [17,18,19]},\n    \"insulin\":        {\"condition\": \"diabetes\",       \"icd_pfx\": \"E11\", \"hccs\": [17,18,19]},\n    \"furosemide\":     {\"condition\": \"heart_failure\",  \"icd_pfx\": \"I50\", \"hccs\": [85,86,87]},\n    \"spironolactone\": {\"condition\": \"heart_failure\",  \"icd_pfx\": \"I50\", \"hccs\": [85,86,87]},\n    \"albuterol\":      {\"condition\": \"copd_asthma\",    \"icd_pfx\": \"J44\", \"hccs\": [111,112]},\n    \"donepezil\":      {\"condition\": \"dementia\",       \"icd_pfx\": \"F03\", \"hccs\": [51,52]},\n    \"memantine\":      {\"condition\": \"dementia\",       \"icd_pfx\": \"F03\", \"hccs\": [51,52]},\n}\n\n\ndef identify_rx_gaps(rx_df: pd.DataFrame, dx_df: pd.DataFrame, year: int) -> pd.DataFrame:\n    \"\"\"Members with Rx evidence but no matching diagnosis in payment year.\"\"\"\n    rx_yr = rx_df[rx_df[\"fill_date\"].dt.year == year]\n    dx_yr = dx_df[dx_df[\"service_date\"].dt.year == year].copy()\n    dx_yr[\"pfx\"] = dx_yr[\"icd10\"].str[:3]\n\n    gaps = []\n    for drug, m in RX_MAP.items():\n        with_rx = set(rx_yr[rx_yr[\"drug_name\"].str.lower().str.contains(drug, na=False)][\"member_id\"])\n        with_dx = set(dx_yr[dx_yr[\"pfx\"] == m[\"icd_pfx\"]][\"member_id\"])\n        for mid in with_rx - with_dx:\n            gaps.append({\"member_id\": mid, \"condition\": m[\"condition\"],\n                         \"evidence\": drug, \"target_hccs\": m[\"hccs\"], \"gap_type\": \"rx_proxy\"})\n    return pd.DataFrame(gaps).drop_duplicates(subset=[\"member_id\", \"condition\"])\n```\n\n### 4b. Lab Proxy Gaps\n\n```python\nimport pandas as pd\n\nLAB_MAP = {\n    \"HbA1c\": {\"thresh\": 6.5, \"op\": \">=\", \"condition\": \"diabetes\",       \"icd_pfx\": \"E11\", \"hccs\": [17,18,19]},\n    \"eGFR\":  {\"thresh\": 60,  \"op\": \"\u003C\",  \"condition\": \"ckd\",            \"icd_pfx\": \"N18\", \"hccs\": [136,137,138]},\n    \"BNP\":   {\"thresh\": 100, \"op\": \">=\", \"condition\": \"heart_failure\",  \"icd_pfx\": \"I50\", \"hccs\": [85,86,87]},\n    \"BMI\":   {\"thresh\": 40,  \"op\": \">=\", \"condition\": \"morbid_obesity\", \"icd_pfx\": \"E66\", \"hccs\": [22]},\n}\n\n\ndef identify_lab_gaps(labs: pd.DataFrame, dx_df: pd.DataFrame, year: int) -> pd.DataFrame:\n    \"\"\"Members with abnormal labs but no matching diagnosis.\"\"\"\n    labs_yr = labs[labs[\"result_date\"].dt.year == year]\n    dx_yr = dx_df[dx_df[\"service_date\"].dt.year == year].copy()\n    dx_yr[\"pfx\"] = dx_yr[\"icd10\"].str[:3]\n\n    gaps = []\n    for test, m in LAB_MAP.items():\n        t = labs_yr[labs_yr[\"test_name\"].str.upper() == test.upper()].copy()\n        t[\"val\"] = pd.to_numeric(t[\"result_value\"], errors=\"coerce\")\n        abn = t[t[\"val\"] >= m[\"thresh\"]] if m[\"op\"] == \">=\" else t[t[\"val\"] \u003C m[\"thresh\"]]\n        with_dx = set(dx_yr[dx_yr[\"pfx\"] == m[\"icd_pfx\"]][\"member_id\"])\n        for mid in set(abn[\"member_id\"]) - with_dx:\n            gaps.append({\"member_id\": mid, \"condition\": m[\"condition\"],\n                         \"evidence\": test, \"target_hccs\": m[\"hccs\"], \"gap_type\": \"lab_proxy\"})\n    return pd.DataFrame(gaps).drop_duplicates(subset=[\"member_id\", \"condition\"])\n```\n\n### SQL — Rx Gap Detection\n\n```sql\nWITH rx_diabetes AS (\n    SELECT DISTINCT member_id FROM rx_claims\n    WHERE LOWER(drug_name) IN ('metformin','glipizide','insulin glargine','insulin lispro')\n      AND fill_date BETWEEN '2025-01-01' AND '2025-12-31'\n),\ndx_diabetes AS (\n    SELECT DISTINCT member_id FROM diagnoses\n    WHERE icd10 LIKE 'E11%' AND service_date BETWEEN '2025-01-01' AND '2025-12-31'\n      AND provider_type IN ('MD','DO','NP','PA')\n)\nSELECT r.member_id, 'diabetes' AS condition, 'rx_proxy' AS gap_type\nFROM rx_diabetes r LEFT JOIN dx_diabetes d ON r.member_id = d.member_id\nWHERE d.member_id IS NULL;\n```\n\n---\n\n## 5. End-to-End Pipeline\n\n```python\ndef project_risk_scores(dx_df, xwalk_df, demo_df, hierarchies=None):\n    \"\"\"Full pipeline: crosswalk → hierarchy → RAF → summary.\"\"\"\n    ccs = map_diagnoses_to_ccs(dx_df, xwalk_df)\n    hccs = resolve_hierarchies(ccs, hierarchies)\n    scores = calculate_raf(demo_df, hccs)\n    print(f\"Members: {len(scores)}, Mean RAF: {scores['total_raf'].mean():.3f}, \"\n          f\"Median: {scores['total_raf'].median():.3f}\")\n    return scores\n```\n\n---\n\n## 6. Parameter Reference\n\n| Function | Key Parameter | Default | Guidance |\n|---|---|---|---|\n| `load_crosswalk` | CMS file | Annual release | Verify payment year match |\n| `resolve_hierarchies` | `hierarchies` | V24 | Use V28 for PY 2026+; both during transition |\n| `calculate_raf` | Coefficient tables | V24 CNA | Match to population segment |\n| `identify_rx_gaps` | `year` | Current | Gaps are year-specific |\n| `identify_lab_gaps` | Lab thresholds | Clinical standards | Adjust per guidelines |\n\n---\n\n## Common Mistakes\n\n- **Wrong:** Applying the ICD-10-to-HCC crosswalk without stripping periods from ICD-10 codes\n  **Right:** Normalize codes with `str.replace(\".\", \"\").upper()` before joining to the crosswalk\n  **Why:** CMS crosswalk files use unformatted codes (e.g., `E119` not `E11.9`); mismatches silently drop valid mappings\n\n- **Wrong:** Summing all CC coefficients without running hierarchy resolution first\n  **Right:** Always call `resolve_hierarchies()` to retain only the highest-severity CC per hierarchy group before scoring\n  **Why:** Counting superseded CCs inflates RAF scores and produces incorrect revenue projections\n\n- **Wrong:** Using V24 hierarchies and coefficients for payment year 2026+\n  **Right:** Use V28 tables for PY 2026+; use blended weights (33% V24 \u002F 67% V28) for PY 2025\n  **Why:** CMS transitions to V28 full-weight in 2026; stale coefficients produce materially wrong scores\n\n- **Wrong:** Including diagnoses from any provider type in the crosswalk mapping\n  **Right:** Filter to qualifying provider types (MD, DO, NP, PA, CNS) before mapping\n  **Why:** CMS only accepts diagnoses from face-to-face encounters with eligible providers for risk adjustment\n\n- **Wrong:** Treating Rx proxy gaps as confirmed diagnoses and coding them directly\n  **Right:** Use Rx\u002Flab proxies to identify suspected gaps that require provider documentation on a qualifying encounter\n  **Why:** Proxies are screening signals, not diagnosis sources — submitting without documentation fails RADV audit\n\n- **Wrong:** Running `identify_lab_gaps` without converting `result_value` to numeric first\n  **Right:** Cast with `pd.to_numeric(errors=\"coerce\")` and handle NaN before threshold comparison\n  **Why:** Lab values often contain text qualifiers (\">100\", \"see note\"); string comparison produces wrong results\n",{"data":50,"body":63},{"name":4,"description":6,"usage":51,"version":52,"validated_against":53,"tags":58},"Invoke to generate executable Python and SQL code for ICD-10-to-HCC mapping, hierarchy resolution, RAF score calculation, and coding gap identification.","1.0.0",{"date":54,"packages":55},"2025-01-15",{"hcc-tools":56,"pandas":57},"1.0","2.2",[59,60,4,61,62],"skill","category:pipeline","hcc","hcls",{"type":64,"children":65},"root",[66,75,82,88,94,109,115,119,125,153,159,166,418,424,472,475,481,486,834,839,966,969,975,1316,1321,1462,1465,1471,1477,1702,1708,1911,1917,2026,2029,2035,2106,2109,2115,2296,2299,2305,2493],{"type":67,"tag":68,"props":69,"children":71},"element","h1",{"id":70},"risk-adjustment-pipeline-skill",[72],{"type":73,"value":74},"text","Risk Adjustment — Pipeline Skill",{"type":67,"tag":76,"props":77,"children":79},"h2",{"id":78},"overview",[80],{"type":73,"value":81},"Overview",{"type":67,"tag":83,"props":84,"children":85},"p",{},[86],{"type":73,"value":87},"Provide deterministic, copy-paste-ready Python and SQL code for CMS-HCC risk adjustment:\nICD-10-to-HCC crosswalk, hierarchy resolution, RAF score calculation, and coding gap\nidentification from Rx\u002Flab proxies.",{"type":67,"tag":76,"props":89,"children":91},{"id":90},"usage",[92],{"type":73,"value":93},"Usage",{"type":67,"tag":95,"props":96,"children":97},"ul",{},[98,104],{"type":67,"tag":99,"props":100,"children":101},"li",{},[102],{"type":73,"value":103},"Apply ICD-10-to-HCC crosswalk and resolve disease hierarchies programmatically",{"type":67,"tag":99,"props":105,"children":106},{},[107],{"type":73,"value":108},"Calculate member-level RAF scores and identify coding gaps from Rx\u002Flab proxies",{"type":67,"tag":76,"props":110,"children":112},{"id":111},"core-concepts",[113],{"type":73,"value":114},"Core Concepts",{"type":67,"tag":116,"props":117,"children":118},"hr",{},[],{"type":67,"tag":76,"props":120,"children":122},{"id":121},"response-format",[123],{"type":73,"value":124},"Response Format",{"type":67,"tag":95,"props":126,"children":127},{},[128,133,138,143,148],{"type":67,"tag":99,"props":129,"children":130},{},[131],{"type":73,"value":132},"Lead with the command or code the user needs — explain after",{"type":67,"tag":99,"props":134,"children":135},{},[136],{"type":73,"value":137},"Structure as: confirm inputs → working code → key parameters explained → gotchas",{"type":67,"tag":99,"props":139,"children":140},{},[141],{"type":73,"value":142},"One complete working example per task; do not show every alternative",{"type":67,"tag":99,"props":144,"children":145},{},[146],{"type":73,"value":147},"Keep code comments minimal and functional (what, not why-it-exists)",{"type":67,"tag":99,"props":149,"children":150},{},[151],{"type":73,"value":152},"Target: 50-100 lines of code with brief surrounding explanation",{"type":67,"tag":76,"props":154,"children":156},{"id":155},"_1-icd-10-to-hcc-crosswalk",[157],{"type":73,"value":158},"1. ICD-10-to-HCC Crosswalk",{"type":67,"tag":160,"props":161,"children":163},"h3",{"id":162},"python",[164],{"type":73,"value":165},"Python",{"type":67,"tag":167,"props":168,"children":172},"pre",{"className":169,"code":170,"language":162,"meta":171,"style":171},"language-python shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import pandas as pd\n\n\ndef load_crosswalk(filepath: str) -> pd.DataFrame:\n    \"\"\"Load CMS ICD-10-to-CC crosswalk. Expected columns: [icd10, cc].\"\"\"\n    xwalk = pd.read_csv(filepath, dtype=str)\n    xwalk.columns = [c.strip().lower() for c in xwalk.columns]\n    xwalk[\"icd10\"] = xwalk[\"icd10\"].str.replace(\".\", \"\", regex=False).str.upper()\n    xwalk[\"cc\"] = xwalk[\"cc\"].astype(int)\n    return xwalk\n\n\ndef map_diagnoses_to_ccs(dx_df: pd.DataFrame, xwalk: pd.DataFrame) -> pd.DataFrame:\n    \"\"\"Map member diagnoses to Condition Categories.\n\n    Args:\n        dx_df: [member_id, icd10, service_date, provider_type].\n        xwalk: [icd10, cc].\n    Returns:\n        Deduplicated [member_id, icd10, cc].\n    \"\"\"\n    dx = dx_df.copy()\n    dx[\"icd10\"] = dx[\"icd10\"].str.replace(\".\", \"\", regex=False).str.upper()\n    qualifying = {\"MD\", \"DO\", \"NP\", \"PA\", \"CNS\"}\n    dx = dx[dx[\"provider_type\"].str.upper().isin(qualifying)]\n    mapped = dx.merge(xwalk, on=\"icd10\", how=\"inner\")\n    return mapped.drop_duplicates(subset=[\"member_id\", \"cc\"])\n","",[173],{"type":67,"tag":174,"props":175,"children":176},"code",{"__ignoreMap":171},[177,188,198,206,214,223,232,241,250,259,268,276,284,293,302,310,319,328,337,346,355,364,373,382,391,400,409],{"type":67,"tag":178,"props":179,"children":182},"span",{"class":180,"line":181},"line",1,[183],{"type":67,"tag":178,"props":184,"children":185},{},[186],{"type":73,"value":187},"import pandas as pd\n",{"type":67,"tag":178,"props":189,"children":191},{"class":180,"line":190},2,[192],{"type":67,"tag":178,"props":193,"children":195},{"emptyLinePlaceholder":194},true,[196],{"type":73,"value":197},"\n",{"type":67,"tag":178,"props":199,"children":201},{"class":180,"line":200},3,[202],{"type":67,"tag":178,"props":203,"children":204},{"emptyLinePlaceholder":194},[205],{"type":73,"value":197},{"type":67,"tag":178,"props":207,"children":208},{"class":180,"line":26},[209],{"type":67,"tag":178,"props":210,"children":211},{},[212],{"type":73,"value":213},"def load_crosswalk(filepath: str) -> pd.DataFrame:\n",{"type":67,"tag":178,"props":215,"children":217},{"class":180,"line":216},5,[218],{"type":67,"tag":178,"props":219,"children":220},{},[221],{"type":73,"value":222},"    \"\"\"Load CMS ICD-10-to-CC crosswalk. Expected columns: [icd10, cc].\"\"\"\n",{"type":67,"tag":178,"props":224,"children":226},{"class":180,"line":225},6,[227],{"type":67,"tag":178,"props":228,"children":229},{},[230],{"type":73,"value":231},"    xwalk = pd.read_csv(filepath, dtype=str)\n",{"type":67,"tag":178,"props":233,"children":235},{"class":180,"line":234},7,[236],{"type":67,"tag":178,"props":237,"children":238},{},[239],{"type":73,"value":240},"    xwalk.columns = [c.strip().lower() for c in xwalk.columns]\n",{"type":67,"tag":178,"props":242,"children":244},{"class":180,"line":243},8,[245],{"type":67,"tag":178,"props":246,"children":247},{},[248],{"type":73,"value":249},"    xwalk[\"icd10\"] = xwalk[\"icd10\"].str.replace(\".\", \"\", regex=False).str.upper()\n",{"type":67,"tag":178,"props":251,"children":253},{"class":180,"line":252},9,[254],{"type":67,"tag":178,"props":255,"children":256},{},[257],{"type":73,"value":258},"    xwalk[\"cc\"] = xwalk[\"cc\"].astype(int)\n",{"type":67,"tag":178,"props":260,"children":262},{"class":180,"line":261},10,[263],{"type":67,"tag":178,"props":264,"children":265},{},[266],{"type":73,"value":267},"    return xwalk\n",{"type":67,"tag":178,"props":269,"children":271},{"class":180,"line":270},11,[272],{"type":67,"tag":178,"props":273,"children":274},{"emptyLinePlaceholder":194},[275],{"type":73,"value":197},{"type":67,"tag":178,"props":277,"children":279},{"class":180,"line":278},12,[280],{"type":67,"tag":178,"props":281,"children":282},{"emptyLinePlaceholder":194},[283],{"type":73,"value":197},{"type":67,"tag":178,"props":285,"children":287},{"class":180,"line":286},13,[288],{"type":67,"tag":178,"props":289,"children":290},{},[291],{"type":73,"value":292},"def map_diagnoses_to_ccs(dx_df: pd.DataFrame, xwalk: pd.DataFrame) -> pd.DataFrame:\n",{"type":67,"tag":178,"props":294,"children":296},{"class":180,"line":295},14,[297],{"type":67,"tag":178,"props":298,"children":299},{},[300],{"type":73,"value":301},"    \"\"\"Map member diagnoses to Condition Categories.\n",{"type":67,"tag":178,"props":303,"children":305},{"class":180,"line":304},15,[306],{"type":67,"tag":178,"props":307,"children":308},{"emptyLinePlaceholder":194},[309],{"type":73,"value":197},{"type":67,"tag":178,"props":311,"children":313},{"class":180,"line":312},16,[314],{"type":67,"tag":178,"props":315,"children":316},{},[317],{"type":73,"value":318},"    Args:\n",{"type":67,"tag":178,"props":320,"children":322},{"class":180,"line":321},17,[323],{"type":67,"tag":178,"props":324,"children":325},{},[326],{"type":73,"value":327},"        dx_df: [member_id, icd10, service_date, provider_type].\n",{"type":67,"tag":178,"props":329,"children":331},{"class":180,"line":330},18,[332],{"type":67,"tag":178,"props":333,"children":334},{},[335],{"type":73,"value":336},"        xwalk: [icd10, cc].\n",{"type":67,"tag":178,"props":338,"children":340},{"class":180,"line":339},19,[341],{"type":67,"tag":178,"props":342,"children":343},{},[344],{"type":73,"value":345},"    Returns:\n",{"type":67,"tag":178,"props":347,"children":349},{"class":180,"line":348},20,[350],{"type":67,"tag":178,"props":351,"children":352},{},[353],{"type":73,"value":354},"        Deduplicated [member_id, icd10, cc].\n",{"type":67,"tag":178,"props":356,"children":358},{"class":180,"line":357},21,[359],{"type":67,"tag":178,"props":360,"children":361},{},[362],{"type":73,"value":363},"    \"\"\"\n",{"type":67,"tag":178,"props":365,"children":367},{"class":180,"line":366},22,[368],{"type":67,"tag":178,"props":369,"children":370},{},[371],{"type":73,"value":372},"    dx = dx_df.copy()\n",{"type":67,"tag":178,"props":374,"children":376},{"class":180,"line":375},23,[377],{"type":67,"tag":178,"props":378,"children":379},{},[380],{"type":73,"value":381},"    dx[\"icd10\"] = dx[\"icd10\"].str.replace(\".\", \"\", regex=False).str.upper()\n",{"type":67,"tag":178,"props":383,"children":385},{"class":180,"line":384},24,[386],{"type":67,"tag":178,"props":387,"children":388},{},[389],{"type":73,"value":390},"    qualifying = {\"MD\", \"DO\", \"NP\", \"PA\", \"CNS\"}\n",{"type":67,"tag":178,"props":392,"children":394},{"class":180,"line":393},25,[395],{"type":67,"tag":178,"props":396,"children":397},{},[398],{"type":73,"value":399},"    dx = dx[dx[\"provider_type\"].str.upper().isin(qualifying)]\n",{"type":67,"tag":178,"props":401,"children":403},{"class":180,"line":402},26,[404],{"type":67,"tag":178,"props":405,"children":406},{},[407],{"type":73,"value":408},"    mapped = dx.merge(xwalk, on=\"icd10\", how=\"inner\")\n",{"type":67,"tag":178,"props":410,"children":412},{"class":180,"line":411},27,[413],{"type":67,"tag":178,"props":414,"children":415},{},[416],{"type":73,"value":417},"    return mapped.drop_duplicates(subset=[\"member_id\", \"cc\"])\n",{"type":67,"tag":160,"props":419,"children":421},{"id":420},"sql",[422],{"type":73,"value":423},"SQL",{"type":67,"tag":167,"props":425,"children":428},{"className":426,"code":427,"language":420,"meta":171,"style":171},"language-sql shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","SELECT DISTINCT d.member_id, d.icd10, x.cc\nFROM diagnoses d\nJOIN icd10_cc_crosswalk x ON REPLACE(d.icd10, '.', '') = x.icd10\nWHERE d.provider_type IN ('MD','DO','NP','PA','CNS')\n  AND d.service_date BETWEEN '2025-01-01' AND '2025-12-31';\n",[429],{"type":67,"tag":174,"props":430,"children":431},{"__ignoreMap":171},[432,440,448,456,464],{"type":67,"tag":178,"props":433,"children":434},{"class":180,"line":181},[435],{"type":67,"tag":178,"props":436,"children":437},{},[438],{"type":73,"value":439},"SELECT DISTINCT d.member_id, d.icd10, x.cc\n",{"type":67,"tag":178,"props":441,"children":442},{"class":180,"line":190},[443],{"type":67,"tag":178,"props":444,"children":445},{},[446],{"type":73,"value":447},"FROM diagnoses d\n",{"type":67,"tag":178,"props":449,"children":450},{"class":180,"line":200},[451],{"type":67,"tag":178,"props":452,"children":453},{},[454],{"type":73,"value":455},"JOIN icd10_cc_crosswalk x ON REPLACE(d.icd10, '.', '') = x.icd10\n",{"type":67,"tag":178,"props":457,"children":458},{"class":180,"line":26},[459],{"type":67,"tag":178,"props":460,"children":461},{},[462],{"type":73,"value":463},"WHERE d.provider_type IN ('MD','DO','NP','PA','CNS')\n",{"type":67,"tag":178,"props":465,"children":466},{"class":180,"line":216},[467],{"type":67,"tag":178,"props":468,"children":469},{},[470],{"type":73,"value":471},"  AND d.service_date BETWEEN '2025-01-01' AND '2025-12-31';\n",{"type":67,"tag":116,"props":473,"children":474},{},[],{"type":67,"tag":76,"props":476,"children":478},{"id":477},"_2-hierarchy-resolution",[479],{"type":73,"value":480},"2. Hierarchy Resolution",{"type":67,"tag":160,"props":482,"children":484},{"id":483},"python-1",[485],{"type":73,"value":165},{"type":67,"tag":167,"props":487,"children":489},{"className":169,"code":488,"language":162,"meta":171,"style":171},"import pandas as pd\nfrom collections import defaultdict\n\n# V24 hierarchies: {higher_cc: [lower_ccs_it_supersedes]}\nV24_HIERARCHIES = {\n    17: [18, 19], 18: [19],           # Diabetes\n    85: [86, 87], 86: [87],           # Heart failure\n    111: [112],                        # COPD > asthma\n    136: [137, 138], 137: [138],      # Renal\n    8: [9,10,11,12], 9: [10,11,12], 10: [11,12], 11: [12],  # Cancer\n    107: [108],                        # Vascular\n    27: [28, 29], 28: [29],           # Liver\n    51: [52],                          # Dementia\n    82: [83, 84], 83: [84],           # Hemiplegia\n}\n\n\ndef resolve_hierarchies(member_ccs: pd.DataFrame,\n                        hierarchies: dict = None) -> pd.DataFrame:\n    \"\"\"Remove lower CCs when higher CC in same hierarchy is present.\n\n    Args:\n        member_ccs: [member_id, cc].\n        hierarchies: {higher_cc: [lower_ccs]}. Defaults to V24.\n    Returns:\n        [member_id, hcc] with only surviving CCs.\n    \"\"\"\n    if hierarchies is None:\n        hierarchies = V24_HIERARCHIES\n\n    superseded_by = defaultdict(set)\n    for higher, lowers in hierarchies.items():\n        for lower in lowers:\n            superseded_by[lower].add(higher)\n\n    results = []\n    for mid, grp in member_ccs.groupby(\"member_id\"):\n        cc_set = set(grp[\"cc\"])\n        for cc in cc_set:\n            if not superseded_by.get(cc, set()).intersection(cc_set):\n                results.append({\"member_id\": mid, \"hcc\": cc})\n    return pd.DataFrame(results)\n",[490],{"type":67,"tag":174,"props":491,"children":492},{"__ignoreMap":171},[493,500,508,515,523,531,539,547,555,563,571,579,587,595,603,611,618,625,633,641,649,656,663,671,679,686,694,701,710,719,727,736,745,754,763,771,780,789,798,807,816,825],{"type":67,"tag":178,"props":494,"children":495},{"class":180,"line":181},[496],{"type":67,"tag":178,"props":497,"children":498},{},[499],{"type":73,"value":187},{"type":67,"tag":178,"props":501,"children":502},{"class":180,"line":190},[503],{"type":67,"tag":178,"props":504,"children":505},{},[506],{"type":73,"value":507},"from collections import defaultdict\n",{"type":67,"tag":178,"props":509,"children":510},{"class":180,"line":200},[511],{"type":67,"tag":178,"props":512,"children":513},{"emptyLinePlaceholder":194},[514],{"type":73,"value":197},{"type":67,"tag":178,"props":516,"children":517},{"class":180,"line":26},[518],{"type":67,"tag":178,"props":519,"children":520},{},[521],{"type":73,"value":522},"# V24 hierarchies: {higher_cc: [lower_ccs_it_supersedes]}\n",{"type":67,"tag":178,"props":524,"children":525},{"class":180,"line":216},[526],{"type":67,"tag":178,"props":527,"children":528},{},[529],{"type":73,"value":530},"V24_HIERARCHIES = {\n",{"type":67,"tag":178,"props":532,"children":533},{"class":180,"line":225},[534],{"type":67,"tag":178,"props":535,"children":536},{},[537],{"type":73,"value":538},"    17: [18, 19], 18: [19],           # Diabetes\n",{"type":67,"tag":178,"props":540,"children":541},{"class":180,"line":234},[542],{"type":67,"tag":178,"props":543,"children":544},{},[545],{"type":73,"value":546},"    85: [86, 87], 86: [87],           # Heart failure\n",{"type":67,"tag":178,"props":548,"children":549},{"class":180,"line":243},[550],{"type":67,"tag":178,"props":551,"children":552},{},[553],{"type":73,"value":554},"    111: [112],                        # COPD > asthma\n",{"type":67,"tag":178,"props":556,"children":557},{"class":180,"line":252},[558],{"type":67,"tag":178,"props":559,"children":560},{},[561],{"type":73,"value":562},"    136: [137, 138], 137: [138],      # Renal\n",{"type":67,"tag":178,"props":564,"children":565},{"class":180,"line":261},[566],{"type":67,"tag":178,"props":567,"children":568},{},[569],{"type":73,"value":570},"    8: [9,10,11,12], 9: [10,11,12], 10: [11,12], 11: [12],  # Cancer\n",{"type":67,"tag":178,"props":572,"children":573},{"class":180,"line":270},[574],{"type":67,"tag":178,"props":575,"children":576},{},[577],{"type":73,"value":578},"    107: [108],                        # Vascular\n",{"type":67,"tag":178,"props":580,"children":581},{"class":180,"line":278},[582],{"type":67,"tag":178,"props":583,"children":584},{},[585],{"type":73,"value":586},"    27: [28, 29], 28: [29],           # Liver\n",{"type":67,"tag":178,"props":588,"children":589},{"class":180,"line":286},[590],{"type":67,"tag":178,"props":591,"children":592},{},[593],{"type":73,"value":594},"    51: [52],                          # Dementia\n",{"type":67,"tag":178,"props":596,"children":597},{"class":180,"line":295},[598],{"type":67,"tag":178,"props":599,"children":600},{},[601],{"type":73,"value":602},"    82: [83, 84], 83: [84],           # Hemiplegia\n",{"type":67,"tag":178,"props":604,"children":605},{"class":180,"line":304},[606],{"type":67,"tag":178,"props":607,"children":608},{},[609],{"type":73,"value":610},"}\n",{"type":67,"tag":178,"props":612,"children":613},{"class":180,"line":312},[614],{"type":67,"tag":178,"props":615,"children":616},{"emptyLinePlaceholder":194},[617],{"type":73,"value":197},{"type":67,"tag":178,"props":619,"children":620},{"class":180,"line":321},[621],{"type":67,"tag":178,"props":622,"children":623},{"emptyLinePlaceholder":194},[624],{"type":73,"value":197},{"type":67,"tag":178,"props":626,"children":627},{"class":180,"line":330},[628],{"type":67,"tag":178,"props":629,"children":630},{},[631],{"type":73,"value":632},"def resolve_hierarchies(member_ccs: pd.DataFrame,\n",{"type":67,"tag":178,"props":634,"children":635},{"class":180,"line":339},[636],{"type":67,"tag":178,"props":637,"children":638},{},[639],{"type":73,"value":640},"                        hierarchies: dict = None) -> pd.DataFrame:\n",{"type":67,"tag":178,"props":642,"children":643},{"class":180,"line":348},[644],{"type":67,"tag":178,"props":645,"children":646},{},[647],{"type":73,"value":648},"    \"\"\"Remove lower CCs when higher CC in same hierarchy is present.\n",{"type":67,"tag":178,"props":650,"children":651},{"class":180,"line":357},[652],{"type":67,"tag":178,"props":653,"children":654},{"emptyLinePlaceholder":194},[655],{"type":73,"value":197},{"type":67,"tag":178,"props":657,"children":658},{"class":180,"line":366},[659],{"type":67,"tag":178,"props":660,"children":661},{},[662],{"type":73,"value":318},{"type":67,"tag":178,"props":664,"children":665},{"class":180,"line":375},[666],{"type":67,"tag":178,"props":667,"children":668},{},[669],{"type":73,"value":670},"        member_ccs: [member_id, cc].\n",{"type":67,"tag":178,"props":672,"children":673},{"class":180,"line":384},[674],{"type":67,"tag":178,"props":675,"children":676},{},[677],{"type":73,"value":678},"        hierarchies: {higher_cc: [lower_ccs]}. Defaults to V24.\n",{"type":67,"tag":178,"props":680,"children":681},{"class":180,"line":393},[682],{"type":67,"tag":178,"props":683,"children":684},{},[685],{"type":73,"value":345},{"type":67,"tag":178,"props":687,"children":688},{"class":180,"line":402},[689],{"type":67,"tag":178,"props":690,"children":691},{},[692],{"type":73,"value":693},"        [member_id, hcc] with only surviving CCs.\n",{"type":67,"tag":178,"props":695,"children":696},{"class":180,"line":411},[697],{"type":67,"tag":178,"props":698,"children":699},{},[700],{"type":73,"value":363},{"type":67,"tag":178,"props":702,"children":704},{"class":180,"line":703},28,[705],{"type":67,"tag":178,"props":706,"children":707},{},[708],{"type":73,"value":709},"    if hierarchies is None:\n",{"type":67,"tag":178,"props":711,"children":713},{"class":180,"line":712},29,[714],{"type":67,"tag":178,"props":715,"children":716},{},[717],{"type":73,"value":718},"        hierarchies = V24_HIERARCHIES\n",{"type":67,"tag":178,"props":720,"children":722},{"class":180,"line":721},30,[723],{"type":67,"tag":178,"props":724,"children":725},{"emptyLinePlaceholder":194},[726],{"type":73,"value":197},{"type":67,"tag":178,"props":728,"children":730},{"class":180,"line":729},31,[731],{"type":67,"tag":178,"props":732,"children":733},{},[734],{"type":73,"value":735},"    superseded_by = defaultdict(set)\n",{"type":67,"tag":178,"props":737,"children":739},{"class":180,"line":738},32,[740],{"type":67,"tag":178,"props":741,"children":742},{},[743],{"type":73,"value":744},"    for higher, lowers in hierarchies.items():\n",{"type":67,"tag":178,"props":746,"children":748},{"class":180,"line":747},33,[749],{"type":67,"tag":178,"props":750,"children":751},{},[752],{"type":73,"value":753},"        for lower in lowers:\n",{"type":67,"tag":178,"props":755,"children":757},{"class":180,"line":756},34,[758],{"type":67,"tag":178,"props":759,"children":760},{},[761],{"type":73,"value":762},"            superseded_by[lower].add(higher)\n",{"type":67,"tag":178,"props":764,"children":766},{"class":180,"line":765},35,[767],{"type":67,"tag":178,"props":768,"children":769},{"emptyLinePlaceholder":194},[770],{"type":73,"value":197},{"type":67,"tag":178,"props":772,"children":774},{"class":180,"line":773},36,[775],{"type":67,"tag":178,"props":776,"children":777},{},[778],{"type":73,"value":779},"    results = []\n",{"type":67,"tag":178,"props":781,"children":783},{"class":180,"line":782},37,[784],{"type":67,"tag":178,"props":785,"children":786},{},[787],{"type":73,"value":788},"    for mid, grp in member_ccs.groupby(\"member_id\"):\n",{"type":67,"tag":178,"props":790,"children":792},{"class":180,"line":791},38,[793],{"type":67,"tag":178,"props":794,"children":795},{},[796],{"type":73,"value":797},"        cc_set = set(grp[\"cc\"])\n",{"type":67,"tag":178,"props":799,"children":801},{"class":180,"line":800},39,[802],{"type":67,"tag":178,"props":803,"children":804},{},[805],{"type":73,"value":806},"        for cc in cc_set:\n",{"type":67,"tag":178,"props":808,"children":810},{"class":180,"line":809},40,[811],{"type":67,"tag":178,"props":812,"children":813},{},[814],{"type":73,"value":815},"            if not superseded_by.get(cc, set()).intersection(cc_set):\n",{"type":67,"tag":178,"props":817,"children":819},{"class":180,"line":818},41,[820],{"type":67,"tag":178,"props":821,"children":822},{},[823],{"type":73,"value":824},"                results.append({\"member_id\": mid, \"hcc\": cc})\n",{"type":67,"tag":178,"props":826,"children":828},{"class":180,"line":827},42,[829],{"type":67,"tag":178,"props":830,"children":831},{},[832],{"type":73,"value":833},"    return pd.DataFrame(results)\n",{"type":67,"tag":160,"props":835,"children":837},{"id":836},"sql-1",[838],{"type":73,"value":423},{"type":67,"tag":167,"props":840,"children":842},{"className":426,"code":841,"language":420,"meta":171,"style":171},"WITH hierarchy_rules AS (\n    SELECT 17 AS hi, 18 AS lo UNION ALL SELECT 17,19 UNION ALL SELECT 18,19 UNION ALL\n    SELECT 85,86 UNION ALL SELECT 85,87 UNION ALL SELECT 86,87 UNION ALL\n    SELECT 111,112 UNION ALL SELECT 136,137 UNION ALL SELECT 136,138 UNION ALL SELECT 137,138\n),\nsuperseded AS (\n    SELECT mc.member_id, mc.cc\n    FROM member_ccs mc\n    JOIN hierarchy_rules h ON mc.cc = h.lo\n    JOIN member_ccs mc2 ON mc.member_id = mc2.member_id AND mc2.cc = h.hi\n)\nSELECT mc.member_id, mc.cc AS hcc\nFROM member_ccs mc\nLEFT JOIN superseded s ON mc.member_id = s.member_id AND mc.cc = s.cc\nWHERE s.cc IS NULL;\n",[843],{"type":67,"tag":174,"props":844,"children":845},{"__ignoreMap":171},[846,854,862,870,878,886,894,902,910,918,926,934,942,950,958],{"type":67,"tag":178,"props":847,"children":848},{"class":180,"line":181},[849],{"type":67,"tag":178,"props":850,"children":851},{},[852],{"type":73,"value":853},"WITH hierarchy_rules AS (\n",{"type":67,"tag":178,"props":855,"children":856},{"class":180,"line":190},[857],{"type":67,"tag":178,"props":858,"children":859},{},[860],{"type":73,"value":861},"    SELECT 17 AS hi, 18 AS lo UNION ALL SELECT 17,19 UNION ALL SELECT 18,19 UNION ALL\n",{"type":67,"tag":178,"props":863,"children":864},{"class":180,"line":200},[865],{"type":67,"tag":178,"props":866,"children":867},{},[868],{"type":73,"value":869},"    SELECT 85,86 UNION ALL SELECT 85,87 UNION ALL SELECT 86,87 UNION ALL\n",{"type":67,"tag":178,"props":871,"children":872},{"class":180,"line":26},[873],{"type":67,"tag":178,"props":874,"children":875},{},[876],{"type":73,"value":877},"    SELECT 111,112 UNION ALL SELECT 136,137 UNION ALL SELECT 136,138 UNION ALL SELECT 137,138\n",{"type":67,"tag":178,"props":879,"children":880},{"class":180,"line":216},[881],{"type":67,"tag":178,"props":882,"children":883},{},[884],{"type":73,"value":885},"),\n",{"type":67,"tag":178,"props":887,"children":888},{"class":180,"line":225},[889],{"type":67,"tag":178,"props":890,"children":891},{},[892],{"type":73,"value":893},"superseded AS (\n",{"type":67,"tag":178,"props":895,"children":896},{"class":180,"line":234},[897],{"type":67,"tag":178,"props":898,"children":899},{},[900],{"type":73,"value":901},"    SELECT mc.member_id, mc.cc\n",{"type":67,"tag":178,"props":903,"children":904},{"class":180,"line":243},[905],{"type":67,"tag":178,"props":906,"children":907},{},[908],{"type":73,"value":909},"    FROM member_ccs mc\n",{"type":67,"tag":178,"props":911,"children":912},{"class":180,"line":252},[913],{"type":67,"tag":178,"props":914,"children":915},{},[916],{"type":73,"value":917},"    JOIN hierarchy_rules h ON mc.cc = h.lo\n",{"type":67,"tag":178,"props":919,"children":920},{"class":180,"line":261},[921],{"type":67,"tag":178,"props":922,"children":923},{},[924],{"type":73,"value":925},"    JOIN member_ccs mc2 ON mc.member_id = mc2.member_id AND mc2.cc = h.hi\n",{"type":67,"tag":178,"props":927,"children":928},{"class":180,"line":270},[929],{"type":67,"tag":178,"props":930,"children":931},{},[932],{"type":73,"value":933},")\n",{"type":67,"tag":178,"props":935,"children":936},{"class":180,"line":278},[937],{"type":67,"tag":178,"props":938,"children":939},{},[940],{"type":73,"value":941},"SELECT mc.member_id, mc.cc AS hcc\n",{"type":67,"tag":178,"props":943,"children":944},{"class":180,"line":286},[945],{"type":67,"tag":178,"props":946,"children":947},{},[948],{"type":73,"value":949},"FROM member_ccs mc\n",{"type":67,"tag":178,"props":951,"children":952},{"class":180,"line":295},[953],{"type":67,"tag":178,"props":954,"children":955},{},[956],{"type":73,"value":957},"LEFT JOIN superseded s ON mc.member_id = s.member_id AND mc.cc = s.cc\n",{"type":67,"tag":178,"props":959,"children":960},{"class":180,"line":304},[961],{"type":67,"tag":178,"props":962,"children":963},{},[964],{"type":73,"value":965},"WHERE s.cc IS NULL;\n",{"type":67,"tag":116,"props":967,"children":968},{},[],{"type":67,"tag":76,"props":970,"children":972},{"id":971},"_3-raf-score-calculation",[973],{"type":73,"value":974},"3. RAF Score Calculation",{"type":67,"tag":167,"props":976,"children":978},{"className":169,"code":977,"language":162,"meta":171,"style":171},"import pandas as pd\n\n# V24 Community Non-Dual Aged (example subset)\nDEMO_COEFF = {\n    (\"M\",\"65-69\"): 0.395, (\"M\",\"70-74\"): 0.487, (\"M\",\"75-79\"): 0.596,\n    (\"M\",\"80-84\"): 0.728, (\"M\",\"85-89\"): 0.896, (\"M\",\"90-94\"): 1.003, (\"M\",\"95+\"): 1.073,\n    (\"F\",\"65-69\"): 0.339, (\"F\",\"70-74\"): 0.421, (\"F\",\"75-79\"): 0.532,\n    (\"F\",\"80-84\"): 0.668, (\"F\",\"85-89\"): 0.854, (\"F\",\"90-94\"): 0.979, (\"F\",\"95+\"): 1.055,\n}\n\nHCC_COEFF = {\n    8: 2.484, 9: 0.975, 10: 0.690, 17: 0.368, 18: 0.368, 19: 0.118,\n    47: 0.545, 51: 0.437, 52: 0.294, 85: 0.441, 86: 0.335, 87: 0.237,\n    96: 0.296, 111: 0.335, 112: 0.199, 136: 0.288, 137: 0.237, 138: 0.237,\n}\n\nINTERACTIONS = {\n    frozenset([\"diabetes\",\"chf\"]): 0.154,\n    frozenset([\"chf\",\"copd\"]): 0.175,\n    frozenset([\"chf\",\"renal\"]): 0.154,\n    frozenset([\"diabetes\",\"chf\",\"copd\"]): 0.047,\n}\n\nHCC_GROUP = {\n    17: \"diabetes\", 18: \"diabetes\", 85: \"chf\", 86: \"chf\",\n    111: \"copd\", 112: \"copd\", 136: \"renal\", 137: \"renal\", 138: \"renal\",\n}\n\n\ndef calculate_raf(demographics: pd.DataFrame, member_hccs: pd.DataFrame) -> pd.DataFrame:\n    \"\"\"Calculate RAF scores. demographics: [member_id, sex, age_group]. member_hccs: [member_id, hcc].\"\"\"\n    hcc_map = member_hccs.groupby(\"member_id\")[\"hcc\"].apply(set).to_dict()\n    rows = []\n    for _, r in demographics.iterrows():\n        mid, hccs = r[\"member_id\"], hcc_map.get(r[\"member_id\"], set())\n        demo = DEMO_COEFF.get((r[\"sex\"], r[\"age_group\"]), 0.0)\n        hcc_score = sum(HCC_COEFF.get(h, 0.0) for h in hccs)\n        groups = {HCC_GROUP[h] for h in hccs if h in HCC_GROUP}\n        interact = sum(v for k, v in INTERACTIONS.items() if k.issubset(groups))\n        rows.append({\"member_id\": mid, \"demo\": round(demo, 3), \"hcc_score\": round(hcc_score, 3),\n                      \"interaction\": round(interact, 3), \"total_raf\": round(demo + hcc_score + interact, 3),\n                      \"hcc_count\": len(hccs), \"hccs\": sorted(hccs)})\n    return pd.DataFrame(rows).sort_values(\"total_raf\", ascending=False)\n",[979],{"type":67,"tag":174,"props":980,"children":981},{"__ignoreMap":171},[982,989,996,1004,1012,1020,1028,1036,1044,1051,1058,1066,1074,1082,1090,1097,1104,1112,1120,1128,1136,1144,1151,1158,1166,1174,1182,1189,1196,1203,1211,1219,1227,1235,1243,1251,1259,1267,1275,1283,1291,1299,1307],{"type":67,"tag":178,"props":983,"children":984},{"class":180,"line":181},[985],{"type":67,"tag":178,"props":986,"children":987},{},[988],{"type":73,"value":187},{"type":67,"tag":178,"props":990,"children":991},{"class":180,"line":190},[992],{"type":67,"tag":178,"props":993,"children":994},{"emptyLinePlaceholder":194},[995],{"type":73,"value":197},{"type":67,"tag":178,"props":997,"children":998},{"class":180,"line":200},[999],{"type":67,"tag":178,"props":1000,"children":1001},{},[1002],{"type":73,"value":1003},"# V24 Community Non-Dual Aged (example subset)\n",{"type":67,"tag":178,"props":1005,"children":1006},{"class":180,"line":26},[1007],{"type":67,"tag":178,"props":1008,"children":1009},{},[1010],{"type":73,"value":1011},"DEMO_COEFF = {\n",{"type":67,"tag":178,"props":1013,"children":1014},{"class":180,"line":216},[1015],{"type":67,"tag":178,"props":1016,"children":1017},{},[1018],{"type":73,"value":1019},"    (\"M\",\"65-69\"): 0.395, (\"M\",\"70-74\"): 0.487, (\"M\",\"75-79\"): 0.596,\n",{"type":67,"tag":178,"props":1021,"children":1022},{"class":180,"line":225},[1023],{"type":67,"tag":178,"props":1024,"children":1025},{},[1026],{"type":73,"value":1027},"    (\"M\",\"80-84\"): 0.728, (\"M\",\"85-89\"): 0.896, (\"M\",\"90-94\"): 1.003, (\"M\",\"95+\"): 1.073,\n",{"type":67,"tag":178,"props":1029,"children":1030},{"class":180,"line":234},[1031],{"type":67,"tag":178,"props":1032,"children":1033},{},[1034],{"type":73,"value":1035},"    (\"F\",\"65-69\"): 0.339, (\"F\",\"70-74\"): 0.421, (\"F\",\"75-79\"): 0.532,\n",{"type":67,"tag":178,"props":1037,"children":1038},{"class":180,"line":243},[1039],{"type":67,"tag":178,"props":1040,"children":1041},{},[1042],{"type":73,"value":1043},"    (\"F\",\"80-84\"): 0.668, (\"F\",\"85-89\"): 0.854, (\"F\",\"90-94\"): 0.979, (\"F\",\"95+\"): 1.055,\n",{"type":67,"tag":178,"props":1045,"children":1046},{"class":180,"line":252},[1047],{"type":67,"tag":178,"props":1048,"children":1049},{},[1050],{"type":73,"value":610},{"type":67,"tag":178,"props":1052,"children":1053},{"class":180,"line":261},[1054],{"type":67,"tag":178,"props":1055,"children":1056},{"emptyLinePlaceholder":194},[1057],{"type":73,"value":197},{"type":67,"tag":178,"props":1059,"children":1060},{"class":180,"line":270},[1061],{"type":67,"tag":178,"props":1062,"children":1063},{},[1064],{"type":73,"value":1065},"HCC_COEFF = {\n",{"type":67,"tag":178,"props":1067,"children":1068},{"class":180,"line":278},[1069],{"type":67,"tag":178,"props":1070,"children":1071},{},[1072],{"type":73,"value":1073},"    8: 2.484, 9: 0.975, 10: 0.690, 17: 0.368, 18: 0.368, 19: 0.118,\n",{"type":67,"tag":178,"props":1075,"children":1076},{"class":180,"line":286},[1077],{"type":67,"tag":178,"props":1078,"children":1079},{},[1080],{"type":73,"value":1081},"    47: 0.545, 51: 0.437, 52: 0.294, 85: 0.441, 86: 0.335, 87: 0.237,\n",{"type":67,"tag":178,"props":1083,"children":1084},{"class":180,"line":295},[1085],{"type":67,"tag":178,"props":1086,"children":1087},{},[1088],{"type":73,"value":1089},"    96: 0.296, 111: 0.335, 112: 0.199, 136: 0.288, 137: 0.237, 138: 0.237,\n",{"type":67,"tag":178,"props":1091,"children":1092},{"class":180,"line":304},[1093],{"type":67,"tag":178,"props":1094,"children":1095},{},[1096],{"type":73,"value":610},{"type":67,"tag":178,"props":1098,"children":1099},{"class":180,"line":312},[1100],{"type":67,"tag":178,"props":1101,"children":1102},{"emptyLinePlaceholder":194},[1103],{"type":73,"value":197},{"type":67,"tag":178,"props":1105,"children":1106},{"class":180,"line":321},[1107],{"type":67,"tag":178,"props":1108,"children":1109},{},[1110],{"type":73,"value":1111},"INTERACTIONS = {\n",{"type":67,"tag":178,"props":1113,"children":1114},{"class":180,"line":330},[1115],{"type":67,"tag":178,"props":1116,"children":1117},{},[1118],{"type":73,"value":1119},"    frozenset([\"diabetes\",\"chf\"]): 0.154,\n",{"type":67,"tag":178,"props":1121,"children":1122},{"class":180,"line":339},[1123],{"type":67,"tag":178,"props":1124,"children":1125},{},[1126],{"type":73,"value":1127},"    frozenset([\"chf\",\"copd\"]): 0.175,\n",{"type":67,"tag":178,"props":1129,"children":1130},{"class":180,"line":348},[1131],{"type":67,"tag":178,"props":1132,"children":1133},{},[1134],{"type":73,"value":1135},"    frozenset([\"chf\",\"renal\"]): 0.154,\n",{"type":67,"tag":178,"props":1137,"children":1138},{"class":180,"line":357},[1139],{"type":67,"tag":178,"props":1140,"children":1141},{},[1142],{"type":73,"value":1143},"    frozenset([\"diabetes\",\"chf\",\"copd\"]): 0.047,\n",{"type":67,"tag":178,"props":1145,"children":1146},{"class":180,"line":366},[1147],{"type":67,"tag":178,"props":1148,"children":1149},{},[1150],{"type":73,"value":610},{"type":67,"tag":178,"props":1152,"children":1153},{"class":180,"line":375},[1154],{"type":67,"tag":178,"props":1155,"children":1156},{"emptyLinePlaceholder":194},[1157],{"type":73,"value":197},{"type":67,"tag":178,"props":1159,"children":1160},{"class":180,"line":384},[1161],{"type":67,"tag":178,"props":1162,"children":1163},{},[1164],{"type":73,"value":1165},"HCC_GROUP = {\n",{"type":67,"tag":178,"props":1167,"children":1168},{"class":180,"line":393},[1169],{"type":67,"tag":178,"props":1170,"children":1171},{},[1172],{"type":73,"value":1173},"    17: \"diabetes\", 18: \"diabetes\", 85: \"chf\", 86: \"chf\",\n",{"type":67,"tag":178,"props":1175,"children":1176},{"class":180,"line":402},[1177],{"type":67,"tag":178,"props":1178,"children":1179},{},[1180],{"type":73,"value":1181},"    111: \"copd\", 112: \"copd\", 136: \"renal\", 137: \"renal\", 138: \"renal\",\n",{"type":67,"tag":178,"props":1183,"children":1184},{"class":180,"line":411},[1185],{"type":67,"tag":178,"props":1186,"children":1187},{},[1188],{"type":73,"value":610},{"type":67,"tag":178,"props":1190,"children":1191},{"class":180,"line":703},[1192],{"type":67,"tag":178,"props":1193,"children":1194},{"emptyLinePlaceholder":194},[1195],{"type":73,"value":197},{"type":67,"tag":178,"props":1197,"children":1198},{"class":180,"line":712},[1199],{"type":67,"tag":178,"props":1200,"children":1201},{"emptyLinePlaceholder":194},[1202],{"type":73,"value":197},{"type":67,"tag":178,"props":1204,"children":1205},{"class":180,"line":721},[1206],{"type":67,"tag":178,"props":1207,"children":1208},{},[1209],{"type":73,"value":1210},"def calculate_raf(demographics: pd.DataFrame, member_hccs: pd.DataFrame) -> pd.DataFrame:\n",{"type":67,"tag":178,"props":1212,"children":1213},{"class":180,"line":729},[1214],{"type":67,"tag":178,"props":1215,"children":1216},{},[1217],{"type":73,"value":1218},"    \"\"\"Calculate RAF scores. demographics: [member_id, sex, age_group]. member_hccs: [member_id, hcc].\"\"\"\n",{"type":67,"tag":178,"props":1220,"children":1221},{"class":180,"line":738},[1222],{"type":67,"tag":178,"props":1223,"children":1224},{},[1225],{"type":73,"value":1226},"    hcc_map = member_hccs.groupby(\"member_id\")[\"hcc\"].apply(set).to_dict()\n",{"type":67,"tag":178,"props":1228,"children":1229},{"class":180,"line":747},[1230],{"type":67,"tag":178,"props":1231,"children":1232},{},[1233],{"type":73,"value":1234},"    rows = []\n",{"type":67,"tag":178,"props":1236,"children":1237},{"class":180,"line":756},[1238],{"type":67,"tag":178,"props":1239,"children":1240},{},[1241],{"type":73,"value":1242},"    for _, r in demographics.iterrows():\n",{"type":67,"tag":178,"props":1244,"children":1245},{"class":180,"line":765},[1246],{"type":67,"tag":178,"props":1247,"children":1248},{},[1249],{"type":73,"value":1250},"        mid, hccs = r[\"member_id\"], hcc_map.get(r[\"member_id\"], set())\n",{"type":67,"tag":178,"props":1252,"children":1253},{"class":180,"line":773},[1254],{"type":67,"tag":178,"props":1255,"children":1256},{},[1257],{"type":73,"value":1258},"        demo = DEMO_COEFF.get((r[\"sex\"], r[\"age_group\"]), 0.0)\n",{"type":67,"tag":178,"props":1260,"children":1261},{"class":180,"line":782},[1262],{"type":67,"tag":178,"props":1263,"children":1264},{},[1265],{"type":73,"value":1266},"        hcc_score = sum(HCC_COEFF.get(h, 0.0) for h in hccs)\n",{"type":67,"tag":178,"props":1268,"children":1269},{"class":180,"line":791},[1270],{"type":67,"tag":178,"props":1271,"children":1272},{},[1273],{"type":73,"value":1274},"        groups = {HCC_GROUP[h] for h in hccs if h in HCC_GROUP}\n",{"type":67,"tag":178,"props":1276,"children":1277},{"class":180,"line":800},[1278],{"type":67,"tag":178,"props":1279,"children":1280},{},[1281],{"type":73,"value":1282},"        interact = sum(v for k, v in INTERACTIONS.items() if k.issubset(groups))\n",{"type":67,"tag":178,"props":1284,"children":1285},{"class":180,"line":809},[1286],{"type":67,"tag":178,"props":1287,"children":1288},{},[1289],{"type":73,"value":1290},"        rows.append({\"member_id\": mid, \"demo\": round(demo, 3), \"hcc_score\": round(hcc_score, 3),\n",{"type":67,"tag":178,"props":1292,"children":1293},{"class":180,"line":818},[1294],{"type":67,"tag":178,"props":1295,"children":1296},{},[1297],{"type":73,"value":1298},"                      \"interaction\": round(interact, 3), \"total_raf\": round(demo + hcc_score + interact, 3),\n",{"type":67,"tag":178,"props":1300,"children":1301},{"class":180,"line":827},[1302],{"type":67,"tag":178,"props":1303,"children":1304},{},[1305],{"type":73,"value":1306},"                      \"hcc_count\": len(hccs), \"hccs\": sorted(hccs)})\n",{"type":67,"tag":178,"props":1308,"children":1310},{"class":180,"line":1309},43,[1311],{"type":67,"tag":178,"props":1312,"children":1313},{},[1314],{"type":73,"value":1315},"    return pd.DataFrame(rows).sort_values(\"total_raf\", ascending=False)\n",{"type":67,"tag":160,"props":1317,"children":1319},{"id":1318},"sql-2",[1320],{"type":73,"value":423},{"type":67,"tag":167,"props":1322,"children":1324},{"className":426,"code":1323,"language":420,"meta":171,"style":171},"WITH hcc_scores AS (\n    SELECT mh.member_id, SUM(c.coefficient) AS hcc_score, COUNT(*) AS hcc_count\n    FROM member_hccs mh\n    JOIN hcc_coefficients c ON mh.hcc = c.hcc\n    WHERE c.model_version = 'V24' AND c.segment = 'CNA'\n    GROUP BY mh.member_id\n),\ndemo_scores AS (\n    SELECT md.member_id, dc.coefficient AS demo_score\n    FROM member_demographics md\n    JOIN demographic_coefficients dc ON md.sex = dc.sex AND md.age_group = dc.age_group\n    WHERE dc.model_version = 'V24' AND dc.segment = 'CNA'\n)\nSELECT d.member_id, d.demo_score, COALESCE(h.hcc_score, 0) AS hcc_score,\n       ROUND(d.demo_score + COALESCE(h.hcc_score, 0), 3) AS total_raf\nFROM demo_scores d LEFT JOIN hcc_scores h ON d.member_id = h.member_id\nORDER BY total_raf DESC;\n",[1325],{"type":67,"tag":174,"props":1326,"children":1327},{"__ignoreMap":171},[1328,1336,1344,1352,1360,1368,1376,1383,1391,1399,1407,1415,1423,1430,1438,1446,1454],{"type":67,"tag":178,"props":1329,"children":1330},{"class":180,"line":181},[1331],{"type":67,"tag":178,"props":1332,"children":1333},{},[1334],{"type":73,"value":1335},"WITH hcc_scores AS (\n",{"type":67,"tag":178,"props":1337,"children":1338},{"class":180,"line":190},[1339],{"type":67,"tag":178,"props":1340,"children":1341},{},[1342],{"type":73,"value":1343},"    SELECT mh.member_id, SUM(c.coefficient) AS hcc_score, COUNT(*) AS hcc_count\n",{"type":67,"tag":178,"props":1345,"children":1346},{"class":180,"line":200},[1347],{"type":67,"tag":178,"props":1348,"children":1349},{},[1350],{"type":73,"value":1351},"    FROM member_hccs mh\n",{"type":67,"tag":178,"props":1353,"children":1354},{"class":180,"line":26},[1355],{"type":67,"tag":178,"props":1356,"children":1357},{},[1358],{"type":73,"value":1359},"    JOIN hcc_coefficients c ON mh.hcc = c.hcc\n",{"type":67,"tag":178,"props":1361,"children":1362},{"class":180,"line":216},[1363],{"type":67,"tag":178,"props":1364,"children":1365},{},[1366],{"type":73,"value":1367},"    WHERE c.model_version = 'V24' AND c.segment = 'CNA'\n",{"type":67,"tag":178,"props":1369,"children":1370},{"class":180,"line":225},[1371],{"type":67,"tag":178,"props":1372,"children":1373},{},[1374],{"type":73,"value":1375},"    GROUP BY mh.member_id\n",{"type":67,"tag":178,"props":1377,"children":1378},{"class":180,"line":234},[1379],{"type":67,"tag":178,"props":1380,"children":1381},{},[1382],{"type":73,"value":885},{"type":67,"tag":178,"props":1384,"children":1385},{"class":180,"line":243},[1386],{"type":67,"tag":178,"props":1387,"children":1388},{},[1389],{"type":73,"value":1390},"demo_scores AS (\n",{"type":67,"tag":178,"props":1392,"children":1393},{"class":180,"line":252},[1394],{"type":67,"tag":178,"props":1395,"children":1396},{},[1397],{"type":73,"value":1398},"    SELECT md.member_id, dc.coefficient AS demo_score\n",{"type":67,"tag":178,"props":1400,"children":1401},{"class":180,"line":261},[1402],{"type":67,"tag":178,"props":1403,"children":1404},{},[1405],{"type":73,"value":1406},"    FROM member_demographics md\n",{"type":67,"tag":178,"props":1408,"children":1409},{"class":180,"line":270},[1410],{"type":67,"tag":178,"props":1411,"children":1412},{},[1413],{"type":73,"value":1414},"    JOIN demographic_coefficients dc ON md.sex = dc.sex AND md.age_group = dc.age_group\n",{"type":67,"tag":178,"props":1416,"children":1417},{"class":180,"line":278},[1418],{"type":67,"tag":178,"props":1419,"children":1420},{},[1421],{"type":73,"value":1422},"    WHERE dc.model_version = 'V24' AND dc.segment = 'CNA'\n",{"type":67,"tag":178,"props":1424,"children":1425},{"class":180,"line":286},[1426],{"type":67,"tag":178,"props":1427,"children":1428},{},[1429],{"type":73,"value":933},{"type":67,"tag":178,"props":1431,"children":1432},{"class":180,"line":295},[1433],{"type":67,"tag":178,"props":1434,"children":1435},{},[1436],{"type":73,"value":1437},"SELECT d.member_id, d.demo_score, COALESCE(h.hcc_score, 0) AS hcc_score,\n",{"type":67,"tag":178,"props":1439,"children":1440},{"class":180,"line":304},[1441],{"type":67,"tag":178,"props":1442,"children":1443},{},[1444],{"type":73,"value":1445},"       ROUND(d.demo_score + COALESCE(h.hcc_score, 0), 3) AS total_raf\n",{"type":67,"tag":178,"props":1447,"children":1448},{"class":180,"line":312},[1449],{"type":67,"tag":178,"props":1450,"children":1451},{},[1452],{"type":73,"value":1453},"FROM demo_scores d LEFT JOIN hcc_scores h ON d.member_id = h.member_id\n",{"type":67,"tag":178,"props":1455,"children":1456},{"class":180,"line":321},[1457],{"type":67,"tag":178,"props":1458,"children":1459},{},[1460],{"type":73,"value":1461},"ORDER BY total_raf DESC;\n",{"type":67,"tag":116,"props":1463,"children":1464},{},[],{"type":67,"tag":76,"props":1466,"children":1468},{"id":1467},"_4-coding-gap-identification",[1469],{"type":73,"value":1470},"4. Coding Gap Identification",{"type":67,"tag":160,"props":1472,"children":1474},{"id":1473},"_4a-rx-proxy-gaps",[1475],{"type":73,"value":1476},"4a. Rx Proxy Gaps",{"type":67,"tag":167,"props":1478,"children":1480},{"className":169,"code":1479,"language":162,"meta":171,"style":171},"import pandas as pd\n\nRX_MAP = {\n    \"metformin\":      {\"condition\": \"diabetes\",       \"icd_pfx\": \"E11\", \"hccs\": [17,18,19]},\n    \"glipizide\":      {\"condition\": \"diabetes\",       \"icd_pfx\": \"E11\", \"hccs\": [17,18,19]},\n    \"insulin\":        {\"condition\": \"diabetes\",       \"icd_pfx\": \"E11\", \"hccs\": [17,18,19]},\n    \"furosemide\":     {\"condition\": \"heart_failure\",  \"icd_pfx\": \"I50\", \"hccs\": [85,86,87]},\n    \"spironolactone\": {\"condition\": \"heart_failure\",  \"icd_pfx\": \"I50\", \"hccs\": [85,86,87]},\n    \"albuterol\":      {\"condition\": \"copd_asthma\",    \"icd_pfx\": \"J44\", \"hccs\": [111,112]},\n    \"donepezil\":      {\"condition\": \"dementia\",       \"icd_pfx\": \"F03\", \"hccs\": [51,52]},\n    \"memantine\":      {\"condition\": \"dementia\",       \"icd_pfx\": \"F03\", \"hccs\": [51,52]},\n}\n\n\ndef identify_rx_gaps(rx_df: pd.DataFrame, dx_df: pd.DataFrame, year: int) -> pd.DataFrame:\n    \"\"\"Members with Rx evidence but no matching diagnosis in payment year.\"\"\"\n    rx_yr = rx_df[rx_df[\"fill_date\"].dt.year == year]\n    dx_yr = dx_df[dx_df[\"service_date\"].dt.year == year].copy()\n    dx_yr[\"pfx\"] = dx_yr[\"icd10\"].str[:3]\n\n    gaps = []\n    for drug, m in RX_MAP.items():\n        with_rx = set(rx_yr[rx_yr[\"drug_name\"].str.lower().str.contains(drug, na=False)][\"member_id\"])\n        with_dx = set(dx_yr[dx_yr[\"pfx\"] == m[\"icd_pfx\"]][\"member_id\"])\n        for mid in with_rx - with_dx:\n            gaps.append({\"member_id\": mid, \"condition\": m[\"condition\"],\n                         \"evidence\": drug, \"target_hccs\": m[\"hccs\"], \"gap_type\": \"rx_proxy\"})\n    return pd.DataFrame(gaps).drop_duplicates(subset=[\"member_id\", \"condition\"])\n",[1481],{"type":67,"tag":174,"props":1482,"children":1483},{"__ignoreMap":171},[1484,1491,1498,1506,1514,1522,1530,1538,1546,1554,1562,1570,1577,1584,1591,1599,1607,1615,1623,1631,1638,1646,1654,1662,1670,1678,1686,1694],{"type":67,"tag":178,"props":1485,"children":1486},{"class":180,"line":181},[1487],{"type":67,"tag":178,"props":1488,"children":1489},{},[1490],{"type":73,"value":187},{"type":67,"tag":178,"props":1492,"children":1493},{"class":180,"line":190},[1494],{"type":67,"tag":178,"props":1495,"children":1496},{"emptyLinePlaceholder":194},[1497],{"type":73,"value":197},{"type":67,"tag":178,"props":1499,"children":1500},{"class":180,"line":200},[1501],{"type":67,"tag":178,"props":1502,"children":1503},{},[1504],{"type":73,"value":1505},"RX_MAP = {\n",{"type":67,"tag":178,"props":1507,"children":1508},{"class":180,"line":26},[1509],{"type":67,"tag":178,"props":1510,"children":1511},{},[1512],{"type":73,"value":1513},"    \"metformin\":      {\"condition\": \"diabetes\",       \"icd_pfx\": \"E11\", \"hccs\": [17,18,19]},\n",{"type":67,"tag":178,"props":1515,"children":1516},{"class":180,"line":216},[1517],{"type":67,"tag":178,"props":1518,"children":1519},{},[1520],{"type":73,"value":1521},"    \"glipizide\":      {\"condition\": \"diabetes\",       \"icd_pfx\": \"E11\", \"hccs\": [17,18,19]},\n",{"type":67,"tag":178,"props":1523,"children":1524},{"class":180,"line":225},[1525],{"type":67,"tag":178,"props":1526,"children":1527},{},[1528],{"type":73,"value":1529},"    \"insulin\":        {\"condition\": \"diabetes\",       \"icd_pfx\": \"E11\", \"hccs\": [17,18,19]},\n",{"type":67,"tag":178,"props":1531,"children":1532},{"class":180,"line":234},[1533],{"type":67,"tag":178,"props":1534,"children":1535},{},[1536],{"type":73,"value":1537},"    \"furosemide\":     {\"condition\": \"heart_failure\",  \"icd_pfx\": \"I50\", \"hccs\": [85,86,87]},\n",{"type":67,"tag":178,"props":1539,"children":1540},{"class":180,"line":243},[1541],{"type":67,"tag":178,"props":1542,"children":1543},{},[1544],{"type":73,"value":1545},"    \"spironolactone\": {\"condition\": \"heart_failure\",  \"icd_pfx\": \"I50\", \"hccs\": [85,86,87]},\n",{"type":67,"tag":178,"props":1547,"children":1548},{"class":180,"line":252},[1549],{"type":67,"tag":178,"props":1550,"children":1551},{},[1552],{"type":73,"value":1553},"    \"albuterol\":      {\"condition\": \"copd_asthma\",    \"icd_pfx\": \"J44\", \"hccs\": [111,112]},\n",{"type":67,"tag":178,"props":1555,"children":1556},{"class":180,"line":261},[1557],{"type":67,"tag":178,"props":1558,"children":1559},{},[1560],{"type":73,"value":1561},"    \"donepezil\":      {\"condition\": \"dementia\",       \"icd_pfx\": \"F03\", \"hccs\": [51,52]},\n",{"type":67,"tag":178,"props":1563,"children":1564},{"class":180,"line":270},[1565],{"type":67,"tag":178,"props":1566,"children":1567},{},[1568],{"type":73,"value":1569},"    \"memantine\":      {\"condition\": \"dementia\",       \"icd_pfx\": \"F03\", \"hccs\": [51,52]},\n",{"type":67,"tag":178,"props":1571,"children":1572},{"class":180,"line":278},[1573],{"type":67,"tag":178,"props":1574,"children":1575},{},[1576],{"type":73,"value":610},{"type":67,"tag":178,"props":1578,"children":1579},{"class":180,"line":286},[1580],{"type":67,"tag":178,"props":1581,"children":1582},{"emptyLinePlaceholder":194},[1583],{"type":73,"value":197},{"type":67,"tag":178,"props":1585,"children":1586},{"class":180,"line":295},[1587],{"type":67,"tag":178,"props":1588,"children":1589},{"emptyLinePlaceholder":194},[1590],{"type":73,"value":197},{"type":67,"tag":178,"props":1592,"children":1593},{"class":180,"line":304},[1594],{"type":67,"tag":178,"props":1595,"children":1596},{},[1597],{"type":73,"value":1598},"def identify_rx_gaps(rx_df: pd.DataFrame, dx_df: pd.DataFrame, year: int) -> pd.DataFrame:\n",{"type":67,"tag":178,"props":1600,"children":1601},{"class":180,"line":312},[1602],{"type":67,"tag":178,"props":1603,"children":1604},{},[1605],{"type":73,"value":1606},"    \"\"\"Members with Rx evidence but no matching diagnosis in payment year.\"\"\"\n",{"type":67,"tag":178,"props":1608,"children":1609},{"class":180,"line":321},[1610],{"type":67,"tag":178,"props":1611,"children":1612},{},[1613],{"type":73,"value":1614},"    rx_yr = rx_df[rx_df[\"fill_date\"].dt.year == year]\n",{"type":67,"tag":178,"props":1616,"children":1617},{"class":180,"line":330},[1618],{"type":67,"tag":178,"props":1619,"children":1620},{},[1621],{"type":73,"value":1622},"    dx_yr = dx_df[dx_df[\"service_date\"].dt.year == year].copy()\n",{"type":67,"tag":178,"props":1624,"children":1625},{"class":180,"line":339},[1626],{"type":67,"tag":178,"props":1627,"children":1628},{},[1629],{"type":73,"value":1630},"    dx_yr[\"pfx\"] = dx_yr[\"icd10\"].str[:3]\n",{"type":67,"tag":178,"props":1632,"children":1633},{"class":180,"line":348},[1634],{"type":67,"tag":178,"props":1635,"children":1636},{"emptyLinePlaceholder":194},[1637],{"type":73,"value":197},{"type":67,"tag":178,"props":1639,"children":1640},{"class":180,"line":357},[1641],{"type":67,"tag":178,"props":1642,"children":1643},{},[1644],{"type":73,"value":1645},"    gaps = []\n",{"type":67,"tag":178,"props":1647,"children":1648},{"class":180,"line":366},[1649],{"type":67,"tag":178,"props":1650,"children":1651},{},[1652],{"type":73,"value":1653},"    for drug, m in RX_MAP.items():\n",{"type":67,"tag":178,"props":1655,"children":1656},{"class":180,"line":375},[1657],{"type":67,"tag":178,"props":1658,"children":1659},{},[1660],{"type":73,"value":1661},"        with_rx = set(rx_yr[rx_yr[\"drug_name\"].str.lower().str.contains(drug, na=False)][\"member_id\"])\n",{"type":67,"tag":178,"props":1663,"children":1664},{"class":180,"line":384},[1665],{"type":67,"tag":178,"props":1666,"children":1667},{},[1668],{"type":73,"value":1669},"        with_dx = set(dx_yr[dx_yr[\"pfx\"] == m[\"icd_pfx\"]][\"member_id\"])\n",{"type":67,"tag":178,"props":1671,"children":1672},{"class":180,"line":393},[1673],{"type":67,"tag":178,"props":1674,"children":1675},{},[1676],{"type":73,"value":1677},"        for mid in with_rx - with_dx:\n",{"type":67,"tag":178,"props":1679,"children":1680},{"class":180,"line":402},[1681],{"type":67,"tag":178,"props":1682,"children":1683},{},[1684],{"type":73,"value":1685},"            gaps.append({\"member_id\": mid, \"condition\": m[\"condition\"],\n",{"type":67,"tag":178,"props":1687,"children":1688},{"class":180,"line":411},[1689],{"type":67,"tag":178,"props":1690,"children":1691},{},[1692],{"type":73,"value":1693},"                         \"evidence\": drug, \"target_hccs\": m[\"hccs\"], \"gap_type\": \"rx_proxy\"})\n",{"type":67,"tag":178,"props":1695,"children":1696},{"class":180,"line":703},[1697],{"type":67,"tag":178,"props":1698,"children":1699},{},[1700],{"type":73,"value":1701},"    return pd.DataFrame(gaps).drop_duplicates(subset=[\"member_id\", \"condition\"])\n",{"type":67,"tag":160,"props":1703,"children":1705},{"id":1704},"_4b-lab-proxy-gaps",[1706],{"type":73,"value":1707},"4b. Lab Proxy Gaps",{"type":67,"tag":167,"props":1709,"children":1711},{"className":169,"code":1710,"language":162,"meta":171,"style":171},"import pandas as pd\n\nLAB_MAP = {\n    \"HbA1c\": {\"thresh\": 6.5, \"op\": \">=\", \"condition\": \"diabetes\",       \"icd_pfx\": \"E11\", \"hccs\": [17,18,19]},\n    \"eGFR\":  {\"thresh\": 60,  \"op\": \"\u003C\",  \"condition\": \"ckd\",            \"icd_pfx\": \"N18\", \"hccs\": [136,137,138]},\n    \"BNP\":   {\"thresh\": 100, \"op\": \">=\", \"condition\": \"heart_failure\",  \"icd_pfx\": \"I50\", \"hccs\": [85,86,87]},\n    \"BMI\":   {\"thresh\": 40,  \"op\": \">=\", \"condition\": \"morbid_obesity\", \"icd_pfx\": \"E66\", \"hccs\": [22]},\n}\n\n\ndef identify_lab_gaps(labs: pd.DataFrame, dx_df: pd.DataFrame, year: int) -> pd.DataFrame:\n    \"\"\"Members with abnormal labs but no matching diagnosis.\"\"\"\n    labs_yr = labs[labs[\"result_date\"].dt.year == year]\n    dx_yr = dx_df[dx_df[\"service_date\"].dt.year == year].copy()\n    dx_yr[\"pfx\"] = dx_yr[\"icd10\"].str[:3]\n\n    gaps = []\n    for test, m in LAB_MAP.items():\n        t = labs_yr[labs_yr[\"test_name\"].str.upper() == test.upper()].copy()\n        t[\"val\"] = pd.to_numeric(t[\"result_value\"], errors=\"coerce\")\n        abn = t[t[\"val\"] >= m[\"thresh\"]] if m[\"op\"] == \">=\" else t[t[\"val\"] \u003C m[\"thresh\"]]\n        with_dx = set(dx_yr[dx_yr[\"pfx\"] == m[\"icd_pfx\"]][\"member_id\"])\n        for mid in set(abn[\"member_id\"]) - with_dx:\n            gaps.append({\"member_id\": mid, \"condition\": m[\"condition\"],\n                         \"evidence\": test, \"target_hccs\": m[\"hccs\"], \"gap_type\": \"lab_proxy\"})\n    return pd.DataFrame(gaps).drop_duplicates(subset=[\"member_id\", \"condition\"])\n",[1712],{"type":67,"tag":174,"props":1713,"children":1714},{"__ignoreMap":171},[1715,1722,1729,1737,1745,1753,1761,1769,1776,1783,1790,1798,1806,1814,1821,1828,1835,1842,1850,1858,1866,1874,1881,1889,1896,1904],{"type":67,"tag":178,"props":1716,"children":1717},{"class":180,"line":181},[1718],{"type":67,"tag":178,"props":1719,"children":1720},{},[1721],{"type":73,"value":187},{"type":67,"tag":178,"props":1723,"children":1724},{"class":180,"line":190},[1725],{"type":67,"tag":178,"props":1726,"children":1727},{"emptyLinePlaceholder":194},[1728],{"type":73,"value":197},{"type":67,"tag":178,"props":1730,"children":1731},{"class":180,"line":200},[1732],{"type":67,"tag":178,"props":1733,"children":1734},{},[1735],{"type":73,"value":1736},"LAB_MAP = {\n",{"type":67,"tag":178,"props":1738,"children":1739},{"class":180,"line":26},[1740],{"type":67,"tag":178,"props":1741,"children":1742},{},[1743],{"type":73,"value":1744},"    \"HbA1c\": {\"thresh\": 6.5, \"op\": \">=\", \"condition\": \"diabetes\",       \"icd_pfx\": \"E11\", \"hccs\": [17,18,19]},\n",{"type":67,"tag":178,"props":1746,"children":1747},{"class":180,"line":216},[1748],{"type":67,"tag":178,"props":1749,"children":1750},{},[1751],{"type":73,"value":1752},"    \"eGFR\":  {\"thresh\": 60,  \"op\": \"\u003C\",  \"condition\": \"ckd\",            \"icd_pfx\": \"N18\", \"hccs\": [136,137,138]},\n",{"type":67,"tag":178,"props":1754,"children":1755},{"class":180,"line":225},[1756],{"type":67,"tag":178,"props":1757,"children":1758},{},[1759],{"type":73,"value":1760},"    \"BNP\":   {\"thresh\": 100, \"op\": \">=\", \"condition\": \"heart_failure\",  \"icd_pfx\": \"I50\", \"hccs\": [85,86,87]},\n",{"type":67,"tag":178,"props":1762,"children":1763},{"class":180,"line":234},[1764],{"type":67,"tag":178,"props":1765,"children":1766},{},[1767],{"type":73,"value":1768},"    \"BMI\":   {\"thresh\": 40,  \"op\": \">=\", \"condition\": \"morbid_obesity\", \"icd_pfx\": \"E66\", \"hccs\": [22]},\n",{"type":67,"tag":178,"props":1770,"children":1771},{"class":180,"line":243},[1772],{"type":67,"tag":178,"props":1773,"children":1774},{},[1775],{"type":73,"value":610},{"type":67,"tag":178,"props":1777,"children":1778},{"class":180,"line":252},[1779],{"type":67,"tag":178,"props":1780,"children":1781},{"emptyLinePlaceholder":194},[1782],{"type":73,"value":197},{"type":67,"tag":178,"props":1784,"children":1785},{"class":180,"line":261},[1786],{"type":67,"tag":178,"props":1787,"children":1788},{"emptyLinePlaceholder":194},[1789],{"type":73,"value":197},{"type":67,"tag":178,"props":1791,"children":1792},{"class":180,"line":270},[1793],{"type":67,"tag":178,"props":1794,"children":1795},{},[1796],{"type":73,"value":1797},"def identify_lab_gaps(labs: pd.DataFrame, dx_df: pd.DataFrame, year: int) -> pd.DataFrame:\n",{"type":67,"tag":178,"props":1799,"children":1800},{"class":180,"line":278},[1801],{"type":67,"tag":178,"props":1802,"children":1803},{},[1804],{"type":73,"value":1805},"    \"\"\"Members with abnormal labs but no matching diagnosis.\"\"\"\n",{"type":67,"tag":178,"props":1807,"children":1808},{"class":180,"line":286},[1809],{"type":67,"tag":178,"props":1810,"children":1811},{},[1812],{"type":73,"value":1813},"    labs_yr = labs[labs[\"result_date\"].dt.year == year]\n",{"type":67,"tag":178,"props":1815,"children":1816},{"class":180,"line":295},[1817],{"type":67,"tag":178,"props":1818,"children":1819},{},[1820],{"type":73,"value":1622},{"type":67,"tag":178,"props":1822,"children":1823},{"class":180,"line":304},[1824],{"type":67,"tag":178,"props":1825,"children":1826},{},[1827],{"type":73,"value":1630},{"type":67,"tag":178,"props":1829,"children":1830},{"class":180,"line":312},[1831],{"type":67,"tag":178,"props":1832,"children":1833},{"emptyLinePlaceholder":194},[1834],{"type":73,"value":197},{"type":67,"tag":178,"props":1836,"children":1837},{"class":180,"line":321},[1838],{"type":67,"tag":178,"props":1839,"children":1840},{},[1841],{"type":73,"value":1645},{"type":67,"tag":178,"props":1843,"children":1844},{"class":180,"line":330},[1845],{"type":67,"tag":178,"props":1846,"children":1847},{},[1848],{"type":73,"value":1849},"    for test, m in LAB_MAP.items():\n",{"type":67,"tag":178,"props":1851,"children":1852},{"class":180,"line":339},[1853],{"type":67,"tag":178,"props":1854,"children":1855},{},[1856],{"type":73,"value":1857},"        t = labs_yr[labs_yr[\"test_name\"].str.upper() == test.upper()].copy()\n",{"type":67,"tag":178,"props":1859,"children":1860},{"class":180,"line":348},[1861],{"type":67,"tag":178,"props":1862,"children":1863},{},[1864],{"type":73,"value":1865},"        t[\"val\"] = pd.to_numeric(t[\"result_value\"], errors=\"coerce\")\n",{"type":67,"tag":178,"props":1867,"children":1868},{"class":180,"line":357},[1869],{"type":67,"tag":178,"props":1870,"children":1871},{},[1872],{"type":73,"value":1873},"        abn = t[t[\"val\"] >= m[\"thresh\"]] if m[\"op\"] == \">=\" else t[t[\"val\"] \u003C m[\"thresh\"]]\n",{"type":67,"tag":178,"props":1875,"children":1876},{"class":180,"line":366},[1877],{"type":67,"tag":178,"props":1878,"children":1879},{},[1880],{"type":73,"value":1669},{"type":67,"tag":178,"props":1882,"children":1883},{"class":180,"line":375},[1884],{"type":67,"tag":178,"props":1885,"children":1886},{},[1887],{"type":73,"value":1888},"        for mid in set(abn[\"member_id\"]) - with_dx:\n",{"type":67,"tag":178,"props":1890,"children":1891},{"class":180,"line":384},[1892],{"type":67,"tag":178,"props":1893,"children":1894},{},[1895],{"type":73,"value":1685},{"type":67,"tag":178,"props":1897,"children":1898},{"class":180,"line":393},[1899],{"type":67,"tag":178,"props":1900,"children":1901},{},[1902],{"type":73,"value":1903},"                         \"evidence\": test, \"target_hccs\": m[\"hccs\"], \"gap_type\": \"lab_proxy\"})\n",{"type":67,"tag":178,"props":1905,"children":1906},{"class":180,"line":402},[1907],{"type":67,"tag":178,"props":1908,"children":1909},{},[1910],{"type":73,"value":1701},{"type":67,"tag":160,"props":1912,"children":1914},{"id":1913},"sql-rx-gap-detection",[1915],{"type":73,"value":1916},"SQL — Rx Gap Detection",{"type":67,"tag":167,"props":1918,"children":1920},{"className":426,"code":1919,"language":420,"meta":171,"style":171},"WITH rx_diabetes AS (\n    SELECT DISTINCT member_id FROM rx_claims\n    WHERE LOWER(drug_name) IN ('metformin','glipizide','insulin glargine','insulin lispro')\n      AND fill_date BETWEEN '2025-01-01' AND '2025-12-31'\n),\ndx_diabetes AS (\n    SELECT DISTINCT member_id FROM diagnoses\n    WHERE icd10 LIKE 'E11%' AND service_date BETWEEN '2025-01-01' AND '2025-12-31'\n      AND provider_type IN ('MD','DO','NP','PA')\n)\nSELECT r.member_id, 'diabetes' AS condition, 'rx_proxy' AS gap_type\nFROM rx_diabetes r LEFT JOIN dx_diabetes d ON r.member_id = d.member_id\nWHERE d.member_id IS NULL;\n",[1921],{"type":67,"tag":174,"props":1922,"children":1923},{"__ignoreMap":171},[1924,1932,1940,1948,1956,1963,1971,1979,1987,1995,2002,2010,2018],{"type":67,"tag":178,"props":1925,"children":1926},{"class":180,"line":181},[1927],{"type":67,"tag":178,"props":1928,"children":1929},{},[1930],{"type":73,"value":1931},"WITH rx_diabetes AS (\n",{"type":67,"tag":178,"props":1933,"children":1934},{"class":180,"line":190},[1935],{"type":67,"tag":178,"props":1936,"children":1937},{},[1938],{"type":73,"value":1939},"    SELECT DISTINCT member_id FROM rx_claims\n",{"type":67,"tag":178,"props":1941,"children":1942},{"class":180,"line":200},[1943],{"type":67,"tag":178,"props":1944,"children":1945},{},[1946],{"type":73,"value":1947},"    WHERE LOWER(drug_name) IN ('metformin','glipizide','insulin glargine','insulin lispro')\n",{"type":67,"tag":178,"props":1949,"children":1950},{"class":180,"line":26},[1951],{"type":67,"tag":178,"props":1952,"children":1953},{},[1954],{"type":73,"value":1955},"      AND fill_date BETWEEN '2025-01-01' AND '2025-12-31'\n",{"type":67,"tag":178,"props":1957,"children":1958},{"class":180,"line":216},[1959],{"type":67,"tag":178,"props":1960,"children":1961},{},[1962],{"type":73,"value":885},{"type":67,"tag":178,"props":1964,"children":1965},{"class":180,"line":225},[1966],{"type":67,"tag":178,"props":1967,"children":1968},{},[1969],{"type":73,"value":1970},"dx_diabetes AS (\n",{"type":67,"tag":178,"props":1972,"children":1973},{"class":180,"line":234},[1974],{"type":67,"tag":178,"props":1975,"children":1976},{},[1977],{"type":73,"value":1978},"    SELECT DISTINCT member_id FROM diagnoses\n",{"type":67,"tag":178,"props":1980,"children":1981},{"class":180,"line":243},[1982],{"type":67,"tag":178,"props":1983,"children":1984},{},[1985],{"type":73,"value":1986},"    WHERE icd10 LIKE 'E11%' AND service_date BETWEEN '2025-01-01' AND '2025-12-31'\n",{"type":67,"tag":178,"props":1988,"children":1989},{"class":180,"line":252},[1990],{"type":67,"tag":178,"props":1991,"children":1992},{},[1993],{"type":73,"value":1994},"      AND provider_type IN ('MD','DO','NP','PA')\n",{"type":67,"tag":178,"props":1996,"children":1997},{"class":180,"line":261},[1998],{"type":67,"tag":178,"props":1999,"children":2000},{},[2001],{"type":73,"value":933},{"type":67,"tag":178,"props":2003,"children":2004},{"class":180,"line":270},[2005],{"type":67,"tag":178,"props":2006,"children":2007},{},[2008],{"type":73,"value":2009},"SELECT r.member_id, 'diabetes' AS condition, 'rx_proxy' AS gap_type\n",{"type":67,"tag":178,"props":2011,"children":2012},{"class":180,"line":278},[2013],{"type":67,"tag":178,"props":2014,"children":2015},{},[2016],{"type":73,"value":2017},"FROM rx_diabetes r LEFT JOIN dx_diabetes d ON r.member_id = d.member_id\n",{"type":67,"tag":178,"props":2019,"children":2020},{"class":180,"line":286},[2021],{"type":67,"tag":178,"props":2022,"children":2023},{},[2024],{"type":73,"value":2025},"WHERE d.member_id IS NULL;\n",{"type":67,"tag":116,"props":2027,"children":2028},{},[],{"type":67,"tag":76,"props":2030,"children":2032},{"id":2031},"_5-end-to-end-pipeline",[2033],{"type":73,"value":2034},"5. End-to-End Pipeline",{"type":67,"tag":167,"props":2036,"children":2038},{"className":169,"code":2037,"language":162,"meta":171,"style":171},"def project_risk_scores(dx_df, xwalk_df, demo_df, hierarchies=None):\n    \"\"\"Full pipeline: crosswalk → hierarchy → RAF → summary.\"\"\"\n    ccs = map_diagnoses_to_ccs(dx_df, xwalk_df)\n    hccs = resolve_hierarchies(ccs, hierarchies)\n    scores = calculate_raf(demo_df, hccs)\n    print(f\"Members: {len(scores)}, Mean RAF: {scores['total_raf'].mean():.3f}, \"\n          f\"Median: {scores['total_raf'].median():.3f}\")\n    return scores\n",[2039],{"type":67,"tag":174,"props":2040,"children":2041},{"__ignoreMap":171},[2042,2050,2058,2066,2074,2082,2090,2098],{"type":67,"tag":178,"props":2043,"children":2044},{"class":180,"line":181},[2045],{"type":67,"tag":178,"props":2046,"children":2047},{},[2048],{"type":73,"value":2049},"def project_risk_scores(dx_df, xwalk_df, demo_df, hierarchies=None):\n",{"type":67,"tag":178,"props":2051,"children":2052},{"class":180,"line":190},[2053],{"type":67,"tag":178,"props":2054,"children":2055},{},[2056],{"type":73,"value":2057},"    \"\"\"Full pipeline: crosswalk → hierarchy → RAF → summary.\"\"\"\n",{"type":67,"tag":178,"props":2059,"children":2060},{"class":180,"line":200},[2061],{"type":67,"tag":178,"props":2062,"children":2063},{},[2064],{"type":73,"value":2065},"    ccs = map_diagnoses_to_ccs(dx_df, xwalk_df)\n",{"type":67,"tag":178,"props":2067,"children":2068},{"class":180,"line":26},[2069],{"type":67,"tag":178,"props":2070,"children":2071},{},[2072],{"type":73,"value":2073},"    hccs = resolve_hierarchies(ccs, hierarchies)\n",{"type":67,"tag":178,"props":2075,"children":2076},{"class":180,"line":216},[2077],{"type":67,"tag":178,"props":2078,"children":2079},{},[2080],{"type":73,"value":2081},"    scores = calculate_raf(demo_df, hccs)\n",{"type":67,"tag":178,"props":2083,"children":2084},{"class":180,"line":225},[2085],{"type":67,"tag":178,"props":2086,"children":2087},{},[2088],{"type":73,"value":2089},"    print(f\"Members: {len(scores)}, Mean RAF: {scores['total_raf'].mean():.3f}, \"\n",{"type":67,"tag":178,"props":2091,"children":2092},{"class":180,"line":234},[2093],{"type":67,"tag":178,"props":2094,"children":2095},{},[2096],{"type":73,"value":2097},"          f\"Median: {scores['total_raf'].median():.3f}\")\n",{"type":67,"tag":178,"props":2099,"children":2100},{"class":180,"line":243},[2101],{"type":67,"tag":178,"props":2102,"children":2103},{},[2104],{"type":73,"value":2105},"    return scores\n",{"type":67,"tag":116,"props":2107,"children":2108},{},[],{"type":67,"tag":76,"props":2110,"children":2112},{"id":2111},"_6-parameter-reference",[2113],{"type":73,"value":2114},"6. Parameter Reference",{"type":67,"tag":2116,"props":2117,"children":2118},"table",{},[2119,2148],{"type":67,"tag":2120,"props":2121,"children":2122},"thead",{},[2123],{"type":67,"tag":2124,"props":2125,"children":2126},"tr",{},[2127,2133,2138,2143],{"type":67,"tag":2128,"props":2129,"children":2130},"th",{},[2131],{"type":73,"value":2132},"Function",{"type":67,"tag":2128,"props":2134,"children":2135},{},[2136],{"type":73,"value":2137},"Key Parameter",{"type":67,"tag":2128,"props":2139,"children":2140},{},[2141],{"type":73,"value":2142},"Default",{"type":67,"tag":2128,"props":2144,"children":2145},{},[2146],{"type":73,"value":2147},"Guidance",{"type":67,"tag":2149,"props":2150,"children":2151},"tbody",{},[2152,2180,2211,2238,2269],{"type":67,"tag":2124,"props":2153,"children":2154},{},[2155,2165,2170,2175],{"type":67,"tag":2156,"props":2157,"children":2158},"td",{},[2159],{"type":67,"tag":174,"props":2160,"children":2162},{"className":2161},[],[2163],{"type":73,"value":2164},"load_crosswalk",{"type":67,"tag":2156,"props":2166,"children":2167},{},[2168],{"type":73,"value":2169},"CMS file",{"type":67,"tag":2156,"props":2171,"children":2172},{},[2173],{"type":73,"value":2174},"Annual release",{"type":67,"tag":2156,"props":2176,"children":2177},{},[2178],{"type":73,"value":2179},"Verify payment year match",{"type":67,"tag":2124,"props":2181,"children":2182},{},[2183,2192,2201,2206],{"type":67,"tag":2156,"props":2184,"children":2185},{},[2186],{"type":67,"tag":174,"props":2187,"children":2189},{"className":2188},[],[2190],{"type":73,"value":2191},"resolve_hierarchies",{"type":67,"tag":2156,"props":2193,"children":2194},{},[2195],{"type":67,"tag":174,"props":2196,"children":2198},{"className":2197},[],[2199],{"type":73,"value":2200},"hierarchies",{"type":67,"tag":2156,"props":2202,"children":2203},{},[2204],{"type":73,"value":2205},"V24",{"type":67,"tag":2156,"props":2207,"children":2208},{},[2209],{"type":73,"value":2210},"Use V28 for PY 2026+; both during transition",{"type":67,"tag":2124,"props":2212,"children":2213},{},[2214,2223,2228,2233],{"type":67,"tag":2156,"props":2215,"children":2216},{},[2217],{"type":67,"tag":174,"props":2218,"children":2220},{"className":2219},[],[2221],{"type":73,"value":2222},"calculate_raf",{"type":67,"tag":2156,"props":2224,"children":2225},{},[2226],{"type":73,"value":2227},"Coefficient tables",{"type":67,"tag":2156,"props":2229,"children":2230},{},[2231],{"type":73,"value":2232},"V24 CNA",{"type":67,"tag":2156,"props":2234,"children":2235},{},[2236],{"type":73,"value":2237},"Match to population segment",{"type":67,"tag":2124,"props":2239,"children":2240},{},[2241,2250,2259,2264],{"type":67,"tag":2156,"props":2242,"children":2243},{},[2244],{"type":67,"tag":174,"props":2245,"children":2247},{"className":2246},[],[2248],{"type":73,"value":2249},"identify_rx_gaps",{"type":67,"tag":2156,"props":2251,"children":2252},{},[2253],{"type":67,"tag":174,"props":2254,"children":2256},{"className":2255},[],[2257],{"type":73,"value":2258},"year",{"type":67,"tag":2156,"props":2260,"children":2261},{},[2262],{"type":73,"value":2263},"Current",{"type":67,"tag":2156,"props":2265,"children":2266},{},[2267],{"type":73,"value":2268},"Gaps are year-specific",{"type":67,"tag":2124,"props":2270,"children":2271},{},[2272,2281,2286,2291],{"type":67,"tag":2156,"props":2273,"children":2274},{},[2275],{"type":67,"tag":174,"props":2276,"children":2278},{"className":2277},[],[2279],{"type":73,"value":2280},"identify_lab_gaps",{"type":67,"tag":2156,"props":2282,"children":2283},{},[2284],{"type":73,"value":2285},"Lab thresholds",{"type":67,"tag":2156,"props":2287,"children":2288},{},[2289],{"type":73,"value":2290},"Clinical standards",{"type":67,"tag":2156,"props":2292,"children":2293},{},[2294],{"type":73,"value":2295},"Adjust per guidelines",{"type":67,"tag":116,"props":2297,"children":2298},{},[],{"type":67,"tag":76,"props":2300,"children":2302},{"id":2301},"common-mistakes",[2303],{"type":73,"value":2304},"Common Mistakes",{"type":67,"tag":95,"props":2306,"children":2307},{},[2308,2357,2386,2407,2428,2449],{"type":67,"tag":99,"props":2309,"children":2310},{},[2311,2317,2319,2324,2326,2332,2334,2339,2341,2347,2349,2355],{"type":67,"tag":2312,"props":2313,"children":2314},"strong",{},[2315],{"type":73,"value":2316},"Wrong:",{"type":73,"value":2318}," Applying the ICD-10-to-HCC crosswalk without stripping periods from ICD-10 codes\n",{"type":67,"tag":2312,"props":2320,"children":2321},{},[2322],{"type":73,"value":2323},"Right:",{"type":73,"value":2325}," Normalize codes with ",{"type":67,"tag":174,"props":2327,"children":2329},{"className":2328},[],[2330],{"type":73,"value":2331},"str.replace(\".\", \"\").upper()",{"type":73,"value":2333}," before joining to the crosswalk\n",{"type":67,"tag":2312,"props":2335,"children":2336},{},[2337],{"type":73,"value":2338},"Why:",{"type":73,"value":2340}," CMS crosswalk files use unformatted codes (e.g., ",{"type":67,"tag":174,"props":2342,"children":2344},{"className":2343},[],[2345],{"type":73,"value":2346},"E119",{"type":73,"value":2348}," not ",{"type":67,"tag":174,"props":2350,"children":2352},{"className":2351},[],[2353],{"type":73,"value":2354},"E11.9",{"type":73,"value":2356},"); mismatches silently drop valid mappings",{"type":67,"tag":99,"props":2358,"children":2359},{},[2360,2364,2366,2370,2372,2378,2380,2384],{"type":67,"tag":2312,"props":2361,"children":2362},{},[2363],{"type":73,"value":2316},{"type":73,"value":2365}," Summing all CC coefficients without running hierarchy resolution first\n",{"type":67,"tag":2312,"props":2367,"children":2368},{},[2369],{"type":73,"value":2323},{"type":73,"value":2371}," Always call ",{"type":67,"tag":174,"props":2373,"children":2375},{"className":2374},[],[2376],{"type":73,"value":2377},"resolve_hierarchies()",{"type":73,"value":2379}," to retain only the highest-severity CC per hierarchy group before scoring\n",{"type":67,"tag":2312,"props":2381,"children":2382},{},[2383],{"type":73,"value":2338},{"type":73,"value":2385}," Counting superseded CCs inflates RAF scores and produces incorrect revenue projections",{"type":67,"tag":99,"props":2387,"children":2388},{},[2389,2393,2395,2399,2401,2405],{"type":67,"tag":2312,"props":2390,"children":2391},{},[2392],{"type":73,"value":2316},{"type":73,"value":2394}," Using V24 hierarchies and coefficients for payment year 2026+\n",{"type":67,"tag":2312,"props":2396,"children":2397},{},[2398],{"type":73,"value":2323},{"type":73,"value":2400}," Use V28 tables for PY 2026+; use blended weights (33% V24 \u002F 67% V28) for PY 2025\n",{"type":67,"tag":2312,"props":2402,"children":2403},{},[2404],{"type":73,"value":2338},{"type":73,"value":2406}," CMS transitions to V28 full-weight in 2026; stale coefficients produce materially wrong scores",{"type":67,"tag":99,"props":2408,"children":2409},{},[2410,2414,2416,2420,2422,2426],{"type":67,"tag":2312,"props":2411,"children":2412},{},[2413],{"type":73,"value":2316},{"type":73,"value":2415}," Including diagnoses from any provider type in the crosswalk mapping\n",{"type":67,"tag":2312,"props":2417,"children":2418},{},[2419],{"type":73,"value":2323},{"type":73,"value":2421}," Filter to qualifying provider types (MD, DO, NP, PA, CNS) before mapping\n",{"type":67,"tag":2312,"props":2423,"children":2424},{},[2425],{"type":73,"value":2338},{"type":73,"value":2427}," CMS only accepts diagnoses from face-to-face encounters with eligible providers for risk adjustment",{"type":67,"tag":99,"props":2429,"children":2430},{},[2431,2435,2437,2441,2443,2447],{"type":67,"tag":2312,"props":2432,"children":2433},{},[2434],{"type":73,"value":2316},{"type":73,"value":2436}," Treating Rx proxy gaps as confirmed diagnoses and coding them directly\n",{"type":67,"tag":2312,"props":2438,"children":2439},{},[2440],{"type":73,"value":2323},{"type":73,"value":2442}," Use Rx\u002Flab proxies to identify suspected gaps that require provider documentation on a qualifying encounter\n",{"type":67,"tag":2312,"props":2444,"children":2445},{},[2446],{"type":73,"value":2338},{"type":73,"value":2448}," Proxies are screening signals, not diagnosis sources — submitting without documentation fails RADV audit",{"type":67,"tag":99,"props":2450,"children":2451},{},[2452,2456,2458,2463,2465,2471,2473,2477,2479,2485,2487,2491],{"type":67,"tag":2312,"props":2453,"children":2454},{},[2455],{"type":73,"value":2316},{"type":73,"value":2457}," Running ",{"type":67,"tag":174,"props":2459,"children":2461},{"className":2460},[],[2462],{"type":73,"value":2280},{"type":73,"value":2464}," without converting ",{"type":67,"tag":174,"props":2466,"children":2468},{"className":2467},[],[2469],{"type":73,"value":2470},"result_value",{"type":73,"value":2472}," to numeric first\n",{"type":67,"tag":2312,"props":2474,"children":2475},{},[2476],{"type":73,"value":2323},{"type":73,"value":2478}," Cast with ",{"type":67,"tag":174,"props":2480,"children":2482},{"className":2481},[],[2483],{"type":73,"value":2484},"pd.to_numeric(errors=\"coerce\")",{"type":73,"value":2486}," and handle NaN before threshold comparison\n",{"type":67,"tag":2312,"props":2488,"children":2489},{},[2490],{"type":73,"value":2338},{"type":73,"value":2492}," Lab values often contain text qualifiers (\">100\", \"see note\"); string comparison produces wrong results",{"type":67,"tag":2494,"props":2495,"children":2496},"style",{},[2497],{"type":73,"value":2498},"html .light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html.light .shiki span {color: var(--shiki-light);background: var(--shiki-light-bg);font-style: var(--shiki-light-font-style);font-weight: var(--shiki-light-font-weight);text-decoration: var(--shiki-light-text-decoration);}html .default .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .shiki span {color: var(--shiki-default);background: var(--shiki-default-bg);font-style: var(--shiki-default-font-style);font-weight: var(--shiki-default-font-weight);text-decoration: var(--shiki-default-text-decoration);}html .dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}html.dark .shiki span {color: var(--shiki-dark);background: var(--shiki-dark-bg);font-style: var(--shiki-dark-font-style);font-weight: var(--shiki-dark-font-weight);text-decoration: var(--shiki-dark-text-decoration);}",{"items":2500,"total":2676},[2501,2522,2541,2551,2564,2577,2587,2597,2618,2633,2648,2663],{"slug":2502,"name":2502,"fn":2503,"description":2504,"org":2505,"tags":2506,"stars":2519,"repoUrl":2520,"updatedAt":2521},"agentcore-investigation","investigate Bedrock AgentCore runtime sessions","Investigate Bedrock AgentCore runtime sessions via CloudWatch Logs Insights — resolve session\u002Ftrace IDs, query OTEL spans, filter noise, build timelines. Use when debugging AgentCore agent sessions, tracing tool calls, or analyzing latency.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2507,2510,2513,2516],{"name":2508,"slug":2509,"type":16},"AWS","aws",{"name":2511,"slug":2512,"type":16},"Debugging","debugging",{"name":2514,"slug":2515,"type":16},"Logs","logs",{"name":2517,"slug":2518,"type":16},"Observability","observability",9427,"https:\u002F\u002Fgithub.com\u002Fawslabs\u002Fmcp","2026-07-12T08:37:22.601527",{"slug":2523,"name":2524,"fn":2525,"description":2526,"org":2527,"tags":2528,"stars":2519,"repoUrl":2520,"updatedAt":2540},"amazon-aurora-dsql","amazon aurora dsql","build applications with Aurora DSQL","Build with Aurora DSQL — manage schemas, execute queries, handle migrations, diagnose query plans, load data, and develop applications with a serverless, distributed SQL database. Covers IAM auth, multi-tenant patterns, MySQL-to-DSQL and PostgreSQL-to-DSQL schema conversion, FK replacement code generation, OCC retry patterns, ORM migration (Django\u002FHibernate\u002FRails), DDL operations, query plan explainability, SQL compatibility validation, and bulk data loading. Triggers on phrases like: DSQL, Aurora DSQL, create DSQL table, DSQL schema, migrate to DSQL, distributed SQL database, serverless PostgreSQL-compatible database, DSQL query plan, DSQL EXPLAIN ANALYZE, why is my DSQL query slow, DSQL foreign key, DSQL OCC retry, DSQL multi-region, load into DSQL, load CSV into DSQL, bulk load DSQL, aurora-dsql-loader.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2529,2532,2533,2536,2539],{"name":2530,"slug":2531,"type":16},"Aurora","aurora",{"name":2508,"slug":2509,"type":16},{"name":2534,"slug":2535,"type":16},"Database","database",{"name":2537,"slug":2538,"type":16},"Serverless","serverless",{"name":423,"slug":420,"type":16},"2026-07-12T08:36:45.053393",{"slug":2542,"name":2543,"fn":2525,"description":2526,"org":2544,"tags":2545,"stars":2519,"repoUrl":2520,"updatedAt":2550},"aurora-dsql","aurora dsql",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2546,2547,2548,2549],{"name":2508,"slug":2509,"type":16},{"name":2534,"slug":2535,"type":16},{"name":2537,"slug":2538,"type":16},{"name":423,"slug":420,"type":16},"2026-07-12T08:36:42.694299",{"slug":2552,"name":2553,"fn":2525,"description":2526,"org":2554,"tags":2555,"stars":2519,"repoUrl":2520,"updatedAt":2563},"aws-dsql","aws dsql",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2556,2557,2558,2561,2562],{"name":2508,"slug":2509,"type":16},{"name":2534,"slug":2535,"type":16},{"name":2559,"slug":2560,"type":16},"Migration","migration",{"name":2537,"slug":2538,"type":16},{"name":423,"slug":420,"type":16},"2026-07-12T08:36:38.584057",{"slug":2565,"name":2566,"fn":2525,"description":2526,"org":2567,"tags":2568,"stars":2519,"repoUrl":2520,"updatedAt":2576},"distributed-postgres","distributed postgres",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2569,2570,2571,2574,2575],{"name":2508,"slug":2509,"type":16},{"name":2534,"slug":2535,"type":16},{"name":2572,"slug":2573,"type":16},"PostgreSQL","postgresql",{"name":2537,"slug":2538,"type":16},{"name":423,"slug":420,"type":16},"2026-07-12T08:36:46.530743",{"slug":2578,"name":2579,"fn":2525,"description":2526,"org":2580,"tags":2581,"stars":2519,"repoUrl":2520,"updatedAt":2586},"distributed-sql","distributed sql",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2582,2583,2584,2585],{"name":2508,"slug":2509,"type":16},{"name":2534,"slug":2535,"type":16},{"name":2537,"slug":2538,"type":16},{"name":423,"slug":420,"type":16},"2026-07-12T08:36:48.104182",{"slug":2588,"name":2588,"fn":2525,"description":2526,"org":2589,"tags":2590,"stars":2519,"repoUrl":2520,"updatedAt":2596},"dsql",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2591,2592,2593,2594,2595],{"name":2508,"slug":2509,"type":16},{"name":2534,"slug":2535,"type":16},{"name":2559,"slug":2560,"type":16},{"name":2537,"slug":2538,"type":16},{"name":423,"slug":420,"type":16},"2026-07-12T08:36:36.374512",{"slug":2598,"name":2598,"fn":2599,"description":2600,"org":2601,"tags":2602,"stars":2615,"repoUrl":2616,"updatedAt":2617},"cost-efficiency-analyzer","analyze cost efficiency and expenses","Analyzes cost structure, cost efficiency, and expense management from P&L data. Use when the user asks about costs, expenses, COGS, operating expenses, cost ratios, cost control, spending efficiency, margin compression from cost side, or wants to understand where money is going. Also use for \"are we spending too much\", \"cost breakdown\", \"expense analysis\", or \"how efficient are our operations\". NOT for revenue or top-line analysis.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2603,2606,2609,2612],{"name":2604,"slug":2605,"type":16},"Accounting","accounting",{"name":2607,"slug":2608,"type":16},"Analytics","analytics",{"name":2610,"slug":2611,"type":16},"Cost Optimization","cost-optimization",{"name":2613,"slug":2614,"type":16},"Finance","finance",3176,"https:\u002F\u002Fgithub.com\u002Fawslabs\u002Fagentcore-samples","2026-07-12T08:40:03.29555",{"slug":2619,"name":2619,"fn":2620,"description":2621,"org":2622,"tags":2623,"stars":2615,"repoUrl":2616,"updatedAt":2632},"executive-financial-briefing","generate executive financial briefings","Generates a concise executive-level financial briefing or summary suitable for a CEO, CFO, or board presentation. Use when the user asks for a summary, briefing, executive summary, board update, financial overview, financial health check, or \"how is the business doing\". Covers the full P&L picture in one page. Also use for \"give me the highlights\", \"what do I need to know\", or \"quick financial update\".",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2624,2625,2626,2629],{"name":2508,"slug":2509,"type":16},{"name":2613,"slug":2614,"type":16},{"name":2627,"slug":2628,"type":16},"Management","management",{"name":2630,"slug":2631,"type":16},"Reporting","reporting","2026-07-12T08:40:02.066471",{"slug":2634,"name":2634,"fn":2635,"description":2636,"org":2637,"tags":2638,"stars":2615,"repoUrl":2616,"updatedAt":2647},"multi-quarter-trend-analysis","analyze multi-quarter financial trends","Analyzes financial trends across multiple quarters by comparing P&L metrics over time. Use when the user wants to see trends, patterns, trajectories, or directional movement across 3 or more quarters. Also use for \"how are we trending\", \"show me the trend\", \"track performance over time\", \"quarter over quarter comparison across all quarters\", or any multi-period longitudinal analysis.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2639,2640,2641,2644],{"name":2607,"slug":2608,"type":16},{"name":2613,"slug":2614,"type":16},{"name":2642,"slug":2643,"type":16},"Financial Statements","financial-statements",{"name":2645,"slug":2646,"type":16},"Variance Analysis","variance-analysis","2026-07-12T08:40:00.79141",{"slug":2649,"name":2649,"fn":2650,"description":2651,"org":2652,"tags":2653,"stars":2615,"repoUrl":2616,"updatedAt":2662},"pdf","process and manipulate PDF documents","Use this skill whenever the user wants to do anything with PDF files. This includes reading or extracting text\u002Ftables from PDFs, combining or merging multiple PDFs into one, splitting PDFs apart, rotating pages, adding watermarks, creating new PDFs, filling PDF forms, encrypting\u002Fdecrypting PDFs, extracting images, and OCR on scanned PDFs to make them searchable. If the user mentions a .pdf file or asks to produce one, use this skill.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2654,2657,2660],{"name":2655,"slug":2656,"type":16},"Automation","automation",{"name":2658,"slug":2659,"type":16},"Documents","documents",{"name":2661,"slug":2649,"type":16},"PDF","2026-07-12T08:41:44.135656",{"slug":2664,"name":2664,"fn":2665,"description":2666,"org":2667,"tags":2668,"stars":2615,"repoUrl":2616,"updatedAt":2675},"quarterly-kpi-calculator","calculate quarterly financial KPIs","Calculates quarterly financial KPIs from P&L data. P&L figures can be provided directly by the user or fetched from the financial data MCP server. Use when the user wants KPI calculations such as Gross Margin %, EBITDA Margin %, Operating Expense Ratio, or Revenue Growth % QoQ. Also use for quarterly performance review, P&L analysis, or interpreting financial ratios against benchmarks.",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2669,2670,2671,2672],{"name":2604,"slug":2605,"type":16},{"name":18,"slug":19,"type":16},{"name":2613,"slug":2614,"type":16},{"name":2673,"slug":2674,"type":16},"KPI","kpi","2026-07-12T08:39:59.54971",150,{"items":2678,"total":809},[2679,2696,2711,2723,2736,2749,2760],{"slug":2680,"name":2680,"fn":2681,"description":2682,"org":2683,"tags":2684,"stars":26,"repoUrl":27,"updatedAt":2695},"aws-genai-ml-architect","design AWS GenAI and ML architectures","Reasoning skill for designing AWS GenAI and ML architectures for healthcare and life sciences workloads. Use when the user asks to choose between SageMaker and Bedrock, design a RAG system over medical literature, architect clinical NLP or medical imaging inference, plan genomics or drug discovery pipelines on AWS, address HIPAA\u002FPHI compliance in ML systems, design MLOps for regulated clinical models, or optimize cost for HCLS ML workloads. Triggers include \"AWS architecture\", \"SageMaker vs Bedrock\", \"HIPAA ML\", \"clinical RAG\", \"medical imaging inference\", \"genomics on AWS\", \"PHI training\", \"MLOps healthcare\", \"Bedrock guardrails\", \"HealthLake\", \"HCLS cloud architecture\", \"BAA compliance\", \"SageMaker endpoint\", \"Bedrock knowledge base\", \"clinical NLP on AWS\", \"FDA SaMD on AWS\".",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2685,2688,2689,2690,2692],{"name":2686,"slug":2687,"type":16},"Architecture","architecture",{"name":2508,"slug":2509,"type":16},{"name":14,"slug":15,"type":16},{"name":2691,"slug":41,"type":16},"Life Sciences",{"name":2693,"slug":2694,"type":16},"LLM","llm","2026-07-12T08:38:07.975937",{"slug":2697,"name":2697,"fn":2698,"description":2699,"org":2700,"tags":2701,"stars":26,"repoUrl":27,"updatedAt":2710},"biomarker-discovery","guide biomarker discovery and validation","Reason about biomarker discovery and validation in HCLS — classifying biomarker intent, choosing feature-selection and cross-validation strategies, avoiding leakage, and planning external replication. Use when the user asks to discover, develop, or validate a biomarker; select features from high-dimensional omics or clinical data; design a validation study; choose evaluation metrics; justify sample size; combine multi-omics signals; or assess clinical utility. Triggers include \"discover a biomarker\", \"validate biomarker\", \"prognostic vs predictive\", \"feature selection\", \"LASSO vs elastic net\", \"nested cross-validation\", \"data leakage\", \"C-index\", \"time-dependent AUC\", \"decision curve analysis\", \"external validation cohort\", \"events per variable\", \"optimism-corrected\", \"multi-omics integration\", \"clinical utility of a biomarker\", \"is this biomarker ready\".",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2702,2703,2706,2707],{"name":2508,"slug":2509,"type":16},{"name":2704,"slug":2705,"type":16},"Bioinformatics","bioinformatics",{"name":2691,"slug":41,"type":16},{"name":2708,"slug":2709,"type":16},"Research","research","2026-07-12T08:37:49.295301",{"slug":2712,"name":2712,"fn":2713,"description":2714,"org":2715,"tags":2716,"stars":26,"repoUrl":27,"updatedAt":2722},"cdisc-compliance","reason about CDISC SDTM and ADaM implementation","Reason about CDISC SDTM and ADaM implementation for regulatory submissions. Use when the user asks about SDTM domain mapping, ADaM dataset design, controlled terminology versioning, define.xml completeness, FDA or PMDA submission requirements, query prioritization by clinical impact, SUPPQUAL usage, or CDISC compliance review. Triggers include \"SDTM mapping\", \"ADaM dataset\", \"CDISC compliance\", \"controlled terminology\", \"define.xml\", \"FDA submission data\", \"PMDA submission\", \"SDTM domain\", \"ADSL\", \"ADAE\", \"ADLB\", \"BDS structure\", \"SUPPQUAL\", \"RELREC\", \"value-level metadata\", \"CDISC CT\", \"regulatory submission data standards\", \"eCTD datasets\", \"SDTM 3.3\", \"ADaM 1.1\", \"query prioritization\", \"clinical data review\".\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2717,2720,2721],{"name":2718,"slug":2719,"type":16},"Clinical Trials","clinical-trials",{"name":2691,"slug":41,"type":16},{"name":21,"slug":22,"type":16},"2026-07-12T08:37:33.35594",{"slug":2724,"name":2724,"fn":2725,"description":2726,"org":2727,"tags":2728,"stars":26,"repoUrl":27,"updatedAt":2735},"cell-type-annotation","annotate single-cell RNA-seq clusters","Generate code to assign cell type labels to single-cell RNA-seq clusters using CellTypist, SingleR, marker-based annotation, or reference label transfer (scANVI\u002Fingest). Triggers on requests to \"annotate cell types\", \"label clusters\", \"run CellTypist\", \"SingleR annotation\", \"marker gene dotplot\", \"transfer labels from reference atlas\", \"cell identity\", \"automated annotation\", \"reference mapping\", \"scANVI label transfer\", \"canonical markers\", \"immune cell types\", \"hierarchical annotation\", \"majority voting CellTypist\", \"over-clustering annotation\".",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2729,2730,2731,2732],{"name":2704,"slug":2705,"type":16},{"name":18,"slug":19,"type":16},{"name":2691,"slug":41,"type":16},{"name":2733,"slug":2734,"type":16},"RNA-seq","rna-seq","2026-07-12T08:38:05.443454",{"slug":2737,"name":2737,"fn":2738,"description":2739,"org":2740,"tags":2741,"stars":26,"repoUrl":27,"updatedAt":2748},"cheminformatics","calculate molecular properties with RDKit","Cheminformatics pipeline for small-molecule property calculation, filtering, and similarity analysis using RDKit. Use when the user asks to compute molecular descriptors, filter compounds by Lipinski or Veber rules, detect PAINS, calculate fingerprint similarity, run matched molecular pair analysis, generate ADMET descriptors, or process SMILES. Triggers include \"RDKit\", \"molecular descriptors\", \"Lipinski\", \"rule of five\", \"Veber\", \"PAINS\", \"pan-assay interference\", \"Morgan fingerprint\", \"Tanimoto\", \"fingerprint similarity\", \"matched molecular pair\", \"MMP\", \"mmpdb\", \"ADMET\", \"druglikeness\", \"SMILES\", \"cheminformatics\", \"compound filtering\", \"chemical similarity\".",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2742,2743,2746,2747],{"name":2704,"slug":2705,"type":16},{"name":2744,"slug":2745,"type":16},"Chemistry","chemistry",{"name":18,"slug":19,"type":16},{"name":2708,"slug":2709,"type":16},"2026-07-12T08:37:28.334619",{"slug":2750,"name":2750,"fn":2751,"description":2752,"org":2753,"tags":2754,"stars":26,"repoUrl":27,"updatedAt":2759},"claims-analytics","analyze and parse healthcare claims data","Pipeline skill for healthcare claims data parsing, analysis, and fraud detection. Use when the user asks to parse X12 837 or 835 claim files, manipulate ICD-10 CPT or HCPCS codes, detect billing pattern anomalies, profile providers against specialty peers, identify outlier billing behavior, validate NCCI edits programmatically, detect duplicate claims, run Benford's law analysis on charges, build claims data pipelines, or analyze E&M code distributions. Triggers include \"parse X12 837\", \"parse 835\", \"claims SQL\", \"ICD-10 manipulation\", \"CPT code analysis\", \"provider profiling\", \"billing outlier\", \"NCCI validation code\", \"duplicate claim detection\", \"Benford's law charges\", \"claims ETL\", \"E&M distribution analysis\", \"claims analytics pipeline\".\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2755,2756,2757,2758],{"name":18,"slug":19,"type":16},{"name":14,"slug":15,"type":16},{"name":24,"slug":25,"type":16},{"name":2691,"slug":41,"type":16},"2026-07-12T08:37:34.815088",{"slug":2761,"name":2761,"fn":2762,"description":2763,"org":2764,"tags":2765,"stars":26,"repoUrl":27,"updatedAt":2769},"claims-billing-rules","analyze healthcare claims billing rules","Reasoning skill for healthcare claims billing rules and fraud detection logic. Use when the user asks about CMS billing rules, place of service codes, global surgery periods, modifier usage (25 59 76 77), NCCI edit logic, column 1 column 2 code pairs, mutually exclusive procedures, modifier indicators, fraud waste and abuse patterns, E&M upcoding, unbundling, phantom billing, impossible day detection, coding error versus fraud distinction, FWA investigation methodology, or claims audit logic. Triggers include \"CMS billing rules\", \"NCCI edits\", \"modifier 25\", \"modifier 59\", \"global surgery period\", \"upcoding\", \"unbundling\", \"phantom billing\", \"impossible day\", \"FWA\", \"fraud waste abuse\", \"coding error vs fraud\", \"claims audit\", \"billing compliance\", \"E&M level selection\".\n",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2766,2767,2768],{"name":14,"slug":15,"type":16},{"name":24,"slug":25,"type":16},{"name":21,"slug":22,"type":16},"2026-07-12T08:38:28.210856"]