[{"data":1,"prerenderedAt":-1},["ShallowReactive",2],{"skill-aws-labs-claims-analytics":3,"mdc--zbr210-key":49,"related-org-aws-labs-claims-analytics":2412,"related-repo-aws-labs-claims-analytics":2589},{"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},"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},"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},"Life Sciences","life-sciences",{"name":24,"slug":25,"type":16},"Insurance","insurance",4,"https:\u002F\u002Fgithub.com\u002Fawslabs\u002Fhcls-agent-skills","2026-07-12T08:37:34.815088",null,0,[32,33,34,35,36,37,38,39,40,22,41,42,43],"agent-skills","agentcore","ai-agents","amazon-quick-desktop","claims-processing","drug-discovery","genomics","healthcare-ai","kiro","medical-imaging","risk-adjustment","strands-agents",{"repoUrl":27,"stars":26,"forks":30,"topics":45,"description":46},[32,33,34,35,36,37,38,39,40,22,41,42,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\u002Fclaims-analytics","---\nname: claims-analytics\ndescription: >\n  Pipeline skill for healthcare claims data parsing, analysis, and fraud detection. Use when\n  the user asks to parse X12 837 or 835 claim files, manipulate ICD-10 CPT or HCPCS codes,\n  detect billing pattern anomalies, profile providers against specialty peers, identify\n  outlier billing behavior, validate NCCI edits programmatically, detect duplicate claims,\n  run Benford's law analysis on charges, build claims data pipelines, or analyze E&M code\n  distributions. Triggers include \"parse X12 837\", \"parse 835\", \"claims SQL\", \"ICD-10\n  manipulation\", \"CPT code analysis\", \"provider profiling\", \"billing outlier\", \"NCCI\n  validation code\", \"duplicate claim detection\", \"Benford's law charges\", \"claims ETL\",\n  \"E&M distribution analysis\", \"claims analytics pipeline\".\nusage: Invoke to generate executable Python and SQL code for claims data parsing, billing pattern detection, provider profiling, and NCCI edit validation.\nversion: 1.0.0\nvalidated_against:\n  date: 2025-01-15\n  packages: {pandas: \"2.2\", pyx12: \"2.3\"}\ntags: [skill, category:pipeline, claims, analytics, hcls]\n---\n\n# Claims Analytics — Pipeline Skill\n\n## Overview\n\nProvide deterministic, copy-paste-ready Python and SQL code for healthcare claims data\nprocessing: X12 parsing, code manipulation, provider profiling, outlier detection, NCCI\nedit validation, and duplicate claim identification.\n\n## Usage\n\n- Parse X12 837\u002F835 claim files into structured DataFrames\n- Profile provider billing patterns and detect outliers (E&M upcoding, impossible days)\n- Validate claims against NCCI edits and detect duplicate submissions\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. X12 837 Professional Claim Parsing\n\n```python\nimport pandas as pd\nfrom typing import Generator\n\n\ndef parse_x12_837(filepath: str) -> Generator[dict, None, None]:\n    \"\"\"Parse X12 837P file into claim records.\n\n    Yields:\n        dict with claim_id, charge_amount, place_of_service, dx_codes, proc_codes,\n        provider_npi, member_id, service_date.\n    \"\"\"\n    with open(filepath, \"r\") as f:\n        content = f.read()\n\n    seg_term = content[105] if len(content) > 105 else \"~\"\n    elem_sep = content[3] if len(content) > 3 else \"*\"\n    segments = content.split(seg_term)\n\n    claim = {}\n    for seg in segments:\n        el = seg.strip().split(elem_sep)\n        sid = el[0] if el else \"\"\n\n        if sid == \"CLM\":\n            if claim:\n                yield claim\n            claim = {\n                \"claim_id\": el[1] if len(el) > 1 else None,\n                \"charge_amount\": float(el[2]) if len(el) > 2 else 0.0,\n                \"place_of_service\": el[5].split(\":\")[0] if len(el) > 5 else None,\n                \"dx_codes\": [], \"proc_codes\": [],\n            }\n        elif sid == \"HI\" and claim:\n            for e in el[1:]:\n                parts = e.split(\":\")\n                if len(parts) >= 2:\n                    claim[\"dx_codes\"].append(parts[1])\n        elif sid == \"SV1\" and claim:\n            pp = el[1].split(\":\") if len(el) > 1 else []\n            claim[\"proc_codes\"].append({\n                \"cpt\": pp[1] if len(pp) > 1 else None,\n                \"modifiers\": [m for m in pp[2:6] if m] if len(pp) > 2 else [],\n                \"charge\": float(el[2]) if len(el) > 2 else 0.0,\n                \"units\": int(el[4]) if len(el) > 4 else 1,\n            })\n        elif sid == \"NM1\" and claim:\n            q = el[1] if len(el) > 1 else \"\"\n            if q == \"82\":\n                claim[\"provider_npi\"] = el[9] if len(el) > 9 else None\n            elif q == \"IL\":\n                claim[\"member_id\"] = el[9] if len(el) > 9 else None\n        elif sid == \"DTP\" and claim:\n            if len(el) > 1 and el[1] == \"472\":\n                claim[\"service_date\"] = el[3] if len(el) > 3 else None\n    if claim:\n        yield claim\n\n# Usage\nclaims = pd.json_normalize(list(parse_x12_837(\"claims_837p.txt\")))\n```\n\n---\n\n## 2. E&M Provider Profiling\n\n### Python\n\n```python\nimport pandas as pd\nimport numpy as np\n\nEM_CODES = [\"99202\",\"99203\",\"99204\",\"99205\",\"99211\",\"99212\",\"99213\",\"99214\",\"99215\"]\n\n\ndef profile_em_distribution(claims_df: pd.DataFrame) -> pd.DataFrame:\n    \"\"\"Compare each provider's E&M distribution to specialty peers via z-scores.\"\"\"\n    em = claims_df[claims_df[\"proc_code\"].isin(EM_CODES)].copy()\n\n    prov_dist = em.groupby([\"provider_id\", \"specialty\", \"proc_code\"]).size().unstack(fill_value=0)\n    prov_pct = prov_dist.div(prov_dist.sum(axis=1), axis=0)\n\n    spec_mean = prov_pct.groupby(\"specialty\").mean()\n    spec_std = prov_pct.groupby(\"specialty\").std()\n\n    results = []\n    for (prov, spec), row in prov_pct.iterrows():\n        if spec not in spec_mean.index:\n            continue\n        z = (row - spec_mean.loc[spec]) \u002F spec_std.loc[spec].replace(0, np.nan)\n        results.append({\n            \"provider_id\": prov, \"specialty\": spec,\n            \"total_em\": int(prov_dist.loc[(prov, spec)].sum()),\n            \"pct_99214_99215\": row.get(\"99214\", 0) + row.get(\"99215\", 0),\n            \"z_99214\": z.get(\"99214\", np.nan), \"z_99215\": z.get(\"99215\", np.nan),\n            \"flag_upcoding\": z.get(\"99214\", 0) > 2.0 or z.get(\"99215\", 0) > 2.0,\n        })\n    return pd.DataFrame(results).sort_values(\"z_99215\", ascending=False)\n```\n\n### SQL\n\n```sql\nWITH provider_em AS (\n    SELECT provider_id, specialty, proc_code, COUNT(*) AS cnt\n    FROM claims\n    WHERE proc_code IN ('99202','99203','99204','99205','99211','99212','99213','99214','99215')\n    GROUP BY provider_id, specialty, proc_code\n),\nprovider_total AS (\n    SELECT provider_id, specialty, SUM(cnt) AS total FROM provider_em GROUP BY provider_id, specialty\n),\nprovider_pct AS (\n    SELECT e.provider_id, e.specialty, e.proc_code, t.total,\n           ROUND(e.cnt * 100.0 \u002F t.total, 2) AS pct\n    FROM provider_em e JOIN provider_total t ON e.provider_id = t.provider_id\n),\nbenchmark AS (\n    SELECT specialty, proc_code, AVG(pct) AS avg_pct, STDDEV(pct) AS std_pct\n    FROM provider_pct GROUP BY specialty, proc_code\n)\nSELECT p.provider_id, p.specialty, p.proc_code, p.pct, b.avg_pct,\n       ROUND((p.pct - b.avg_pct) \u002F NULLIF(b.std_pct, 0), 2) AS z_score\nFROM provider_pct p\nJOIN benchmark b ON p.specialty = b.specialty AND p.proc_code = b.proc_code\nWHERE ABS((p.pct - b.avg_pct) \u002F NULLIF(b.std_pct, 0)) > 2.0\nORDER BY z_score DESC;\n```\n\n---\n\n## 3. NCCI Edit Validation\n\n```python\nimport pandas as pd\n\n\ndef validate_ncci(claims_df: pd.DataFrame, ncci_edits: pd.DataFrame) -> pd.DataFrame:\n    \"\"\"Validate claims against NCCI edits. Returns violations.\n\n    Args:\n        claims_df: [claim_id, provider_id, member_id, service_date, proc_code, modifier_1].\n        ncci_edits: [column1_cpt, column2_cpt, modifier_indicator, effective_date, deletion_date].\n    \"\"\"\n    violations = []\n    for (prov, mem, dt), grp in claims_df.groupby([\"provider_id\", \"member_id\", \"service_date\"]):\n        codes = grp[\"proc_code\"].tolist()\n        mods = grp[\"modifier_1\"].fillna(\"\").tolist()\n\n        for i, c1 in enumerate(codes):\n            for j, c2 in enumerate(codes):\n                if i >= j:\n                    continue\n                for col1, col2, mi in [(c1, c2, j), (c2, c1, i)]:\n                    match = ncci_edits[\n                        (ncci_edits[\"column1_cpt\"] == col1) & (ncci_edits[\"column2_cpt\"] == col2) &\n                        (ncci_edits[\"effective_date\"] \u003C= dt) &\n                        (ncci_edits[\"deletion_date\"].isna() | (ncci_edits[\"deletion_date\"] > dt))\n                    ]\n                    if match.empty:\n                        continue\n                    ind = match.iloc[0][\"modifier_indicator\"]\n                    has_mod = mods[mi] in (\"59\", \"XE\", \"XS\", \"XP\", \"XU\")\n                    if ind == \"0\" or (ind == \"1\" and not has_mod):\n                        violations.append({\n                            \"provider_id\": prov, \"member_id\": mem, \"service_date\": dt,\n                            \"column1_cpt\": col1, \"column2_cpt\": col2,\n                            \"modifier_indicator\": ind,\n                            \"status\": \"DENIED\" if ind == \"0\" else \"DENIED — modifier required\",\n                        })\n    return pd.DataFrame(violations)\n```\n\n---\n\n## 4. Duplicate Claim Detection\n\n### Python\n\n```python\nimport pandas as pd\n\n\ndef detect_duplicates(claims_df: pd.DataFrame, fuzzy_window_days: int = 3) -> pd.DataFrame:\n    \"\"\"Detect exact and near-duplicate claims.\"\"\"\n    key_cols = [\"member_id\", \"provider_id\", \"proc_code\", \"service_date\"]\n    exact = claims_df[claims_df.duplicated(subset=key_cols, keep=False)].copy()\n    exact[\"dup_type\"] = \"exact\"\n\n    s = claims_df.sort_values(key_cols)\n    s[\"prev_date\"] = s.groupby(key_cols[:3])[\"service_date\"].shift(1)\n    s[\"gap\"] = (s[\"service_date\"] - s[\"prev_date\"]).dt.days\n    near = s[(s[\"gap\"] > 0) & (s[\"gap\"] \u003C= fuzzy_window_days)].copy()\n    near[\"dup_type\"] = \"near\"\n\n    cols = [\"claim_id\", \"member_id\", \"provider_id\", \"proc_code\", \"service_date\", \"dup_type\"]\n    return pd.concat([exact[cols], near[cols]])\n```\n\n### SQL\n\n```sql\n-- Exact duplicates\nSELECT a.claim_id AS id_1, b.claim_id AS id_2, a.member_id, a.proc_code, a.service_date\nFROM claims a JOIN claims b\n  ON a.member_id = b.member_id AND a.provider_id = b.provider_id\n  AND a.proc_code = b.proc_code AND a.service_date = b.service_date\n  AND a.claim_id \u003C b.claim_id;\n\n-- Near-duplicates (within 3 days)\nSELECT a.claim_id AS id_1, b.claim_id AS id_2, a.member_id, a.proc_code,\n       a.service_date AS date_1, b.service_date AS date_2\nFROM claims a JOIN claims b\n  ON a.member_id = b.member_id AND a.provider_id = b.provider_id\n  AND a.proc_code = b.proc_code AND a.claim_id \u003C b.claim_id\n  AND ABS(DATEDIFF(a.service_date, b.service_date)) BETWEEN 1 AND 3;\n```\n\n---\n\n## 5. Benford's Law Analysis\n\n```python\nimport pandas as pd\nimport numpy as np\nfrom scipy.stats import chisquare\n\nBENFORD = {1: 0.301, 2: 0.176, 3: 0.125, 4: 0.097,\n           5: 0.079, 6: 0.067, 7: 0.058, 8: 0.051, 9: 0.046}\n\n\ndef benfords_test(charges: pd.Series, provider_id: str = \"\") -> dict:\n    \"\"\"Test charge first-digit distribution against Benford's Law.\"\"\"\n    first = charges[charges > 0].apply(lambda x: int(str(x).lstrip(\"0\").lstrip(\".\")[0]))\n    first = first[first.between(1, 9)]\n    counts = first.value_counts().sort_index()\n    n = counts.sum()\n    obs = np.array([counts.get(d, 0) for d in range(1, 10)])\n    exp = np.array([BENFORD[d] * n for d in range(1, 10)])\n    chi2, p = chisquare(obs, exp)\n    return {\"provider_id\": provider_id, \"chi2\": round(chi2, 2),\n            \"p_value\": round(p, 4), \"flag\": p \u003C 0.01}\n```\n\n---\n\n## 6. Impossible Day Detection\n\n```python\nimport pandas as pd\n\nCPT_MINUTES = {\n    \"99213\": 15, \"99214\": 25, \"99215\": 40, \"99203\": 30, \"99204\": 45, \"99205\": 60,\n    \"90837\": 53, \"90834\": 38, \"97110\": 15, \"97140\": 15, \"99291\": 74, \"99292\": 30,\n}\n\n\ndef detect_impossible_days(claims_df: pd.DataFrame, max_min: int = 1440) -> pd.DataFrame:\n    \"\"\"Flag providers billing >24 hours of services in a single day.\"\"\"\n    df = claims_df.copy()\n    df[\"est_min\"] = df[\"proc_code\"].map(CPT_MINUTES).fillna(0) * df[\"units\"].fillna(1)\n    daily = df.groupby([\"provider_id\", \"service_date\"]).agg(\n        total_min=(\"est_min\", \"sum\"), claims=(\"claim_id\", \"nunique\")\n    ).reset_index()\n    return daily[daily[\"total_min\"] > max_min].sort_values(\"total_min\", ascending=False)\n```\n\n---\n\n## 7. Parameter Reference\n\n| Function | Key Parameter | Default | Guidance |\n|---|---|---|---|\n| `profile_em_distribution` | z-score threshold | 2.0 | Lower to 1.5 for sensitive screening |\n| `validate_ncci` | NCCI edit file | CMS quarterly | Update quarterly from CMS |\n| `detect_duplicates` | `fuzzy_window_days` | 3 | Increase to 7 for post-acute care |\n| `benfords_test` | p-value threshold | 0.01 | Use 0.05 for initial screening |\n| `detect_impossible_days` | `max_min` | 1440 | Reduce to 960 for stricter threshold |\n\n---\n\n## Common Mistakes\n\n- **Wrong:** Parsing X12 837 files using the newline character as segment terminator\n  **Right:** Read the segment terminator from position 105 of the ISA segment (the character after the last ISA element)\n  **Why:** X12 segment terminators are defined in the interchange header — they can be `~`, `\\n`, or any character; assuming `~` breaks on files using other terminators\n\n- **Wrong:** Comparing provider E&M distributions to a single national benchmark\n  **Right:** Benchmark against same-specialty, same-region, same-payer-mix peers\n  **Why:** Specialty and geography drive legitimate variation — a cardiologist's 99214 rate is naturally higher than a pediatrician's\n\n- **Wrong:** Flagging all exact duplicate claims as fraud\n  **Right:** Distinguish true duplicates (same claim resubmitted) from legitimate corrections (different claim IDs, adjustment codes)\n  **Why:** Payers routinely reprocess claims with new claim IDs after corrections — only same-claim-ID resubmissions without adjustment reason codes are suspect\n\n- **Wrong:** Running Benford's Law analysis on charge amounts below $10\n  **Right:** Filter to charges ≥ $10 before first-digit analysis; small charges cluster around fee-schedule amounts and naturally violate Benford's\n  **Why:** Benford's Law applies to data spanning multiple orders of magnitude — low-value charges are constrained by fee schedules and produce false positives\n\n- **Wrong:** Using NCCI edit tables without checking effective and deletion dates\n  **Right:** Filter NCCI edits to those active on the claim's date of service using `effective_date \u003C= service_date` and `(deletion_date IS NULL OR deletion_date > service_date)`\n  **Why:** NCCI edits are versioned quarterly — applying current edits to historical claims produces false violations for pairs that were valid at the time of service\n\n- **Wrong:** Detecting impossible days using only CPT time estimates without accounting for concurrent services\n  **Right:** Distinguish sequential time-based services from concurrent ones (e.g., infusion supervision during E&M); only sum non-overlapping service minutes\n  **Why:** Some services legitimately overlap (monitoring during infusion, teaching physician attestation) — naive summation inflates minutes and produces false flags\n",{"data":50,"body":64},{"name":4,"description":6,"usage":51,"version":52,"validated_against":53,"tags":58},"Invoke to generate executable Python and SQL code for claims data parsing, billing pattern detection, provider profiling, and NCCI edit validation.","1.0.0",{"date":54,"packages":55},"2025-01-15",{"pandas":56,"pyx12":57},"2.2","2.3",[59,60,61,62,63],"skill","category:pipeline","claims","analytics","hcls",{"type":65,"children":66},"root",[67,76,83,89,95,115,121,125,131,159,165,704,707,713,719,951,957,1155,1158,1164,1461,1464,1470,1475,1613,1618,1734,1737,1743,1897,1900,1906,2037,2040,2046,2227,2230,2236,2406],{"type":68,"tag":69,"props":70,"children":72},"element","h1",{"id":71},"claims-analytics-pipeline-skill",[73],{"type":74,"value":75},"text","Claims Analytics — Pipeline Skill",{"type":68,"tag":77,"props":78,"children":80},"h2",{"id":79},"overview",[81],{"type":74,"value":82},"Overview",{"type":68,"tag":84,"props":85,"children":86},"p",{},[87],{"type":74,"value":88},"Provide deterministic, copy-paste-ready Python and SQL code for healthcare claims data\nprocessing: X12 parsing, code manipulation, provider profiling, outlier detection, NCCI\nedit validation, and duplicate claim identification.",{"type":68,"tag":77,"props":90,"children":92},{"id":91},"usage",[93],{"type":74,"value":94},"Usage",{"type":68,"tag":96,"props":97,"children":98},"ul",{},[99,105,110],{"type":68,"tag":100,"props":101,"children":102},"li",{},[103],{"type":74,"value":104},"Parse X12 837\u002F835 claim files into structured DataFrames",{"type":68,"tag":100,"props":106,"children":107},{},[108],{"type":74,"value":109},"Profile provider billing patterns and detect outliers (E&M upcoding, impossible days)",{"type":68,"tag":100,"props":111,"children":112},{},[113],{"type":74,"value":114},"Validate claims against NCCI edits and detect duplicate submissions",{"type":68,"tag":77,"props":116,"children":118},{"id":117},"core-concepts",[119],{"type":74,"value":120},"Core Concepts",{"type":68,"tag":122,"props":123,"children":124},"hr",{},[],{"type":68,"tag":77,"props":126,"children":128},{"id":127},"response-format",[129],{"type":74,"value":130},"Response Format",{"type":68,"tag":96,"props":132,"children":133},{},[134,139,144,149,154],{"type":68,"tag":100,"props":135,"children":136},{},[137],{"type":74,"value":138},"Lead with the command or code the user needs — explain after",{"type":68,"tag":100,"props":140,"children":141},{},[142],{"type":74,"value":143},"Structure as: confirm inputs → working code → key parameters explained → gotchas",{"type":68,"tag":100,"props":145,"children":146},{},[147],{"type":74,"value":148},"One complete working example per task; do not show every alternative",{"type":68,"tag":100,"props":150,"children":151},{},[152],{"type":74,"value":153},"Keep code comments minimal and functional (what, not why-it-exists)",{"type":68,"tag":100,"props":155,"children":156},{},[157],{"type":74,"value":158},"Target: 50-100 lines of code with brief surrounding explanation",{"type":68,"tag":77,"props":160,"children":162},{"id":161},"_1-x12-837-professional-claim-parsing",[163],{"type":74,"value":164},"1. X12 837 Professional Claim Parsing",{"type":68,"tag":166,"props":167,"children":172},"pre",{"className":168,"code":169,"language":170,"meta":171,"style":171},"language-python shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","import pandas as pd\nfrom typing import Generator\n\n\ndef parse_x12_837(filepath: str) -> Generator[dict, None, None]:\n    \"\"\"Parse X12 837P file into claim records.\n\n    Yields:\n        dict with claim_id, charge_amount, place_of_service, dx_codes, proc_codes,\n        provider_npi, member_id, service_date.\n    \"\"\"\n    with open(filepath, \"r\") as f:\n        content = f.read()\n\n    seg_term = content[105] if len(content) > 105 else \"~\"\n    elem_sep = content[3] if len(content) > 3 else \"*\"\n    segments = content.split(seg_term)\n\n    claim = {}\n    for seg in segments:\n        el = seg.strip().split(elem_sep)\n        sid = el[0] if el else \"\"\n\n        if sid == \"CLM\":\n            if claim:\n                yield claim\n            claim = {\n                \"claim_id\": el[1] if len(el) > 1 else None,\n                \"charge_amount\": float(el[2]) if len(el) > 2 else 0.0,\n                \"place_of_service\": el[5].split(\":\")[0] if len(el) > 5 else None,\n                \"dx_codes\": [], \"proc_codes\": [],\n            }\n        elif sid == \"HI\" and claim:\n            for e in el[1:]:\n                parts = e.split(\":\")\n                if len(parts) >= 2:\n                    claim[\"dx_codes\"].append(parts[1])\n        elif sid == \"SV1\" and claim:\n            pp = el[1].split(\":\") if len(el) > 1 else []\n            claim[\"proc_codes\"].append({\n                \"cpt\": pp[1] if len(pp) > 1 else None,\n                \"modifiers\": [m for m in pp[2:6] if m] if len(pp) > 2 else [],\n                \"charge\": float(el[2]) if len(el) > 2 else 0.0,\n                \"units\": int(el[4]) if len(el) > 4 else 1,\n            })\n        elif sid == \"NM1\" and claim:\n            q = el[1] if len(el) > 1 else \"\"\n            if q == \"82\":\n                claim[\"provider_npi\"] = el[9] if len(el) > 9 else None\n            elif q == \"IL\":\n                claim[\"member_id\"] = el[9] if len(el) > 9 else None\n        elif sid == \"DTP\" and claim:\n            if len(el) > 1 and el[1] == \"472\":\n                claim[\"service_date\"] = el[3] if len(el) > 3 else None\n    if claim:\n        yield claim\n\n# Usage\nclaims = pd.json_normalize(list(parse_x12_837(\"claims_837p.txt\")))\n","python","",[173],{"type":68,"tag":174,"props":175,"children":176},"code",{"__ignoreMap":171},[177,188,197,207,214,223,232,240,249,258,267,276,285,294,302,311,320,329,337,346,355,364,373,381,390,399,408,417,426,435,444,453,462,471,480,489,498,507,516,525,534,543,552,561,570,579,588,597,606,615,624,633,642,651,660,669,678,686,695],{"type":68,"tag":178,"props":179,"children":182},"span",{"class":180,"line":181},"line",1,[183],{"type":68,"tag":178,"props":184,"children":185},{},[186],{"type":74,"value":187},"import pandas as pd\n",{"type":68,"tag":178,"props":189,"children":191},{"class":180,"line":190},2,[192],{"type":68,"tag":178,"props":193,"children":194},{},[195],{"type":74,"value":196},"from typing import Generator\n",{"type":68,"tag":178,"props":198,"children":200},{"class":180,"line":199},3,[201],{"type":68,"tag":178,"props":202,"children":204},{"emptyLinePlaceholder":203},true,[205],{"type":74,"value":206},"\n",{"type":68,"tag":178,"props":208,"children":209},{"class":180,"line":26},[210],{"type":68,"tag":178,"props":211,"children":212},{"emptyLinePlaceholder":203},[213],{"type":74,"value":206},{"type":68,"tag":178,"props":215,"children":217},{"class":180,"line":216},5,[218],{"type":68,"tag":178,"props":219,"children":220},{},[221],{"type":74,"value":222},"def parse_x12_837(filepath: str) -> Generator[dict, None, None]:\n",{"type":68,"tag":178,"props":224,"children":226},{"class":180,"line":225},6,[227],{"type":68,"tag":178,"props":228,"children":229},{},[230],{"type":74,"value":231},"    \"\"\"Parse X12 837P file into claim records.\n",{"type":68,"tag":178,"props":233,"children":235},{"class":180,"line":234},7,[236],{"type":68,"tag":178,"props":237,"children":238},{"emptyLinePlaceholder":203},[239],{"type":74,"value":206},{"type":68,"tag":178,"props":241,"children":243},{"class":180,"line":242},8,[244],{"type":68,"tag":178,"props":245,"children":246},{},[247],{"type":74,"value":248},"    Yields:\n",{"type":68,"tag":178,"props":250,"children":252},{"class":180,"line":251},9,[253],{"type":68,"tag":178,"props":254,"children":255},{},[256],{"type":74,"value":257},"        dict with claim_id, charge_amount, place_of_service, dx_codes, proc_codes,\n",{"type":68,"tag":178,"props":259,"children":261},{"class":180,"line":260},10,[262],{"type":68,"tag":178,"props":263,"children":264},{},[265],{"type":74,"value":266},"        provider_npi, member_id, service_date.\n",{"type":68,"tag":178,"props":268,"children":270},{"class":180,"line":269},11,[271],{"type":68,"tag":178,"props":272,"children":273},{},[274],{"type":74,"value":275},"    \"\"\"\n",{"type":68,"tag":178,"props":277,"children":279},{"class":180,"line":278},12,[280],{"type":68,"tag":178,"props":281,"children":282},{},[283],{"type":74,"value":284},"    with open(filepath, \"r\") as f:\n",{"type":68,"tag":178,"props":286,"children":288},{"class":180,"line":287},13,[289],{"type":68,"tag":178,"props":290,"children":291},{},[292],{"type":74,"value":293},"        content = f.read()\n",{"type":68,"tag":178,"props":295,"children":297},{"class":180,"line":296},14,[298],{"type":68,"tag":178,"props":299,"children":300},{"emptyLinePlaceholder":203},[301],{"type":74,"value":206},{"type":68,"tag":178,"props":303,"children":305},{"class":180,"line":304},15,[306],{"type":68,"tag":178,"props":307,"children":308},{},[309],{"type":74,"value":310},"    seg_term = content[105] if len(content) > 105 else \"~\"\n",{"type":68,"tag":178,"props":312,"children":314},{"class":180,"line":313},16,[315],{"type":68,"tag":178,"props":316,"children":317},{},[318],{"type":74,"value":319},"    elem_sep = content[3] if len(content) > 3 else \"*\"\n",{"type":68,"tag":178,"props":321,"children":323},{"class":180,"line":322},17,[324],{"type":68,"tag":178,"props":325,"children":326},{},[327],{"type":74,"value":328},"    segments = content.split(seg_term)\n",{"type":68,"tag":178,"props":330,"children":332},{"class":180,"line":331},18,[333],{"type":68,"tag":178,"props":334,"children":335},{"emptyLinePlaceholder":203},[336],{"type":74,"value":206},{"type":68,"tag":178,"props":338,"children":340},{"class":180,"line":339},19,[341],{"type":68,"tag":178,"props":342,"children":343},{},[344],{"type":74,"value":345},"    claim = {}\n",{"type":68,"tag":178,"props":347,"children":349},{"class":180,"line":348},20,[350],{"type":68,"tag":178,"props":351,"children":352},{},[353],{"type":74,"value":354},"    for seg in segments:\n",{"type":68,"tag":178,"props":356,"children":358},{"class":180,"line":357},21,[359],{"type":68,"tag":178,"props":360,"children":361},{},[362],{"type":74,"value":363},"        el = seg.strip().split(elem_sep)\n",{"type":68,"tag":178,"props":365,"children":367},{"class":180,"line":366},22,[368],{"type":68,"tag":178,"props":369,"children":370},{},[371],{"type":74,"value":372},"        sid = el[0] if el else \"\"\n",{"type":68,"tag":178,"props":374,"children":376},{"class":180,"line":375},23,[377],{"type":68,"tag":178,"props":378,"children":379},{"emptyLinePlaceholder":203},[380],{"type":74,"value":206},{"type":68,"tag":178,"props":382,"children":384},{"class":180,"line":383},24,[385],{"type":68,"tag":178,"props":386,"children":387},{},[388],{"type":74,"value":389},"        if sid == \"CLM\":\n",{"type":68,"tag":178,"props":391,"children":393},{"class":180,"line":392},25,[394],{"type":68,"tag":178,"props":395,"children":396},{},[397],{"type":74,"value":398},"            if claim:\n",{"type":68,"tag":178,"props":400,"children":402},{"class":180,"line":401},26,[403],{"type":68,"tag":178,"props":404,"children":405},{},[406],{"type":74,"value":407},"                yield claim\n",{"type":68,"tag":178,"props":409,"children":411},{"class":180,"line":410},27,[412],{"type":68,"tag":178,"props":413,"children":414},{},[415],{"type":74,"value":416},"            claim = {\n",{"type":68,"tag":178,"props":418,"children":420},{"class":180,"line":419},28,[421],{"type":68,"tag":178,"props":422,"children":423},{},[424],{"type":74,"value":425},"                \"claim_id\": el[1] if len(el) > 1 else None,\n",{"type":68,"tag":178,"props":427,"children":429},{"class":180,"line":428},29,[430],{"type":68,"tag":178,"props":431,"children":432},{},[433],{"type":74,"value":434},"                \"charge_amount\": float(el[2]) if len(el) > 2 else 0.0,\n",{"type":68,"tag":178,"props":436,"children":438},{"class":180,"line":437},30,[439],{"type":68,"tag":178,"props":440,"children":441},{},[442],{"type":74,"value":443},"                \"place_of_service\": el[5].split(\":\")[0] if len(el) > 5 else None,\n",{"type":68,"tag":178,"props":445,"children":447},{"class":180,"line":446},31,[448],{"type":68,"tag":178,"props":449,"children":450},{},[451],{"type":74,"value":452},"                \"dx_codes\": [], \"proc_codes\": [],\n",{"type":68,"tag":178,"props":454,"children":456},{"class":180,"line":455},32,[457],{"type":68,"tag":178,"props":458,"children":459},{},[460],{"type":74,"value":461},"            }\n",{"type":68,"tag":178,"props":463,"children":465},{"class":180,"line":464},33,[466],{"type":68,"tag":178,"props":467,"children":468},{},[469],{"type":74,"value":470},"        elif sid == \"HI\" and claim:\n",{"type":68,"tag":178,"props":472,"children":474},{"class":180,"line":473},34,[475],{"type":68,"tag":178,"props":476,"children":477},{},[478],{"type":74,"value":479},"            for e in el[1:]:\n",{"type":68,"tag":178,"props":481,"children":483},{"class":180,"line":482},35,[484],{"type":68,"tag":178,"props":485,"children":486},{},[487],{"type":74,"value":488},"                parts = e.split(\":\")\n",{"type":68,"tag":178,"props":490,"children":492},{"class":180,"line":491},36,[493],{"type":68,"tag":178,"props":494,"children":495},{},[496],{"type":74,"value":497},"                if len(parts) >= 2:\n",{"type":68,"tag":178,"props":499,"children":501},{"class":180,"line":500},37,[502],{"type":68,"tag":178,"props":503,"children":504},{},[505],{"type":74,"value":506},"                    claim[\"dx_codes\"].append(parts[1])\n",{"type":68,"tag":178,"props":508,"children":510},{"class":180,"line":509},38,[511],{"type":68,"tag":178,"props":512,"children":513},{},[514],{"type":74,"value":515},"        elif sid == \"SV1\" and claim:\n",{"type":68,"tag":178,"props":517,"children":519},{"class":180,"line":518},39,[520],{"type":68,"tag":178,"props":521,"children":522},{},[523],{"type":74,"value":524},"            pp = el[1].split(\":\") if len(el) > 1 else []\n",{"type":68,"tag":178,"props":526,"children":528},{"class":180,"line":527},40,[529],{"type":68,"tag":178,"props":530,"children":531},{},[532],{"type":74,"value":533},"            claim[\"proc_codes\"].append({\n",{"type":68,"tag":178,"props":535,"children":537},{"class":180,"line":536},41,[538],{"type":68,"tag":178,"props":539,"children":540},{},[541],{"type":74,"value":542},"                \"cpt\": pp[1] if len(pp) > 1 else None,\n",{"type":68,"tag":178,"props":544,"children":546},{"class":180,"line":545},42,[547],{"type":68,"tag":178,"props":548,"children":549},{},[550],{"type":74,"value":551},"                \"modifiers\": [m for m in pp[2:6] if m] if len(pp) > 2 else [],\n",{"type":68,"tag":178,"props":553,"children":555},{"class":180,"line":554},43,[556],{"type":68,"tag":178,"props":557,"children":558},{},[559],{"type":74,"value":560},"                \"charge\": float(el[2]) if len(el) > 2 else 0.0,\n",{"type":68,"tag":178,"props":562,"children":564},{"class":180,"line":563},44,[565],{"type":68,"tag":178,"props":566,"children":567},{},[568],{"type":74,"value":569},"                \"units\": int(el[4]) if len(el) > 4 else 1,\n",{"type":68,"tag":178,"props":571,"children":573},{"class":180,"line":572},45,[574],{"type":68,"tag":178,"props":575,"children":576},{},[577],{"type":74,"value":578},"            })\n",{"type":68,"tag":178,"props":580,"children":582},{"class":180,"line":581},46,[583],{"type":68,"tag":178,"props":584,"children":585},{},[586],{"type":74,"value":587},"        elif sid == \"NM1\" and claim:\n",{"type":68,"tag":178,"props":589,"children":591},{"class":180,"line":590},47,[592],{"type":68,"tag":178,"props":593,"children":594},{},[595],{"type":74,"value":596},"            q = el[1] if len(el) > 1 else \"\"\n",{"type":68,"tag":178,"props":598,"children":600},{"class":180,"line":599},48,[601],{"type":68,"tag":178,"props":602,"children":603},{},[604],{"type":74,"value":605},"            if q == \"82\":\n",{"type":68,"tag":178,"props":607,"children":609},{"class":180,"line":608},49,[610],{"type":68,"tag":178,"props":611,"children":612},{},[613],{"type":74,"value":614},"                claim[\"provider_npi\"] = el[9] if len(el) > 9 else None\n",{"type":68,"tag":178,"props":616,"children":618},{"class":180,"line":617},50,[619],{"type":68,"tag":178,"props":620,"children":621},{},[622],{"type":74,"value":623},"            elif q == \"IL\":\n",{"type":68,"tag":178,"props":625,"children":627},{"class":180,"line":626},51,[628],{"type":68,"tag":178,"props":629,"children":630},{},[631],{"type":74,"value":632},"                claim[\"member_id\"] = el[9] if len(el) > 9 else None\n",{"type":68,"tag":178,"props":634,"children":636},{"class":180,"line":635},52,[637],{"type":68,"tag":178,"props":638,"children":639},{},[640],{"type":74,"value":641},"        elif sid == \"DTP\" and claim:\n",{"type":68,"tag":178,"props":643,"children":645},{"class":180,"line":644},53,[646],{"type":68,"tag":178,"props":647,"children":648},{},[649],{"type":74,"value":650},"            if len(el) > 1 and el[1] == \"472\":\n",{"type":68,"tag":178,"props":652,"children":654},{"class":180,"line":653},54,[655],{"type":68,"tag":178,"props":656,"children":657},{},[658],{"type":74,"value":659},"                claim[\"service_date\"] = el[3] if len(el) > 3 else None\n",{"type":68,"tag":178,"props":661,"children":663},{"class":180,"line":662},55,[664],{"type":68,"tag":178,"props":665,"children":666},{},[667],{"type":74,"value":668},"    if claim:\n",{"type":68,"tag":178,"props":670,"children":672},{"class":180,"line":671},56,[673],{"type":68,"tag":178,"props":674,"children":675},{},[676],{"type":74,"value":677},"        yield claim\n",{"type":68,"tag":178,"props":679,"children":681},{"class":180,"line":680},57,[682],{"type":68,"tag":178,"props":683,"children":684},{"emptyLinePlaceholder":203},[685],{"type":74,"value":206},{"type":68,"tag":178,"props":687,"children":689},{"class":180,"line":688},58,[690],{"type":68,"tag":178,"props":691,"children":692},{},[693],{"type":74,"value":694},"# Usage\n",{"type":68,"tag":178,"props":696,"children":698},{"class":180,"line":697},59,[699],{"type":68,"tag":178,"props":700,"children":701},{},[702],{"type":74,"value":703},"claims = pd.json_normalize(list(parse_x12_837(\"claims_837p.txt\")))\n",{"type":68,"tag":122,"props":705,"children":706},{},[],{"type":68,"tag":77,"props":708,"children":710},{"id":709},"_2-em-provider-profiling",[711],{"type":74,"value":712},"2. E&M Provider Profiling",{"type":68,"tag":714,"props":715,"children":716},"h3",{"id":170},[717],{"type":74,"value":718},"Python",{"type":68,"tag":166,"props":720,"children":722},{"className":168,"code":721,"language":170,"meta":171,"style":171},"import pandas as pd\nimport numpy as np\n\nEM_CODES = [\"99202\",\"99203\",\"99204\",\"99205\",\"99211\",\"99212\",\"99213\",\"99214\",\"99215\"]\n\n\ndef profile_em_distribution(claims_df: pd.DataFrame) -> pd.DataFrame:\n    \"\"\"Compare each provider's E&M distribution to specialty peers via z-scores.\"\"\"\n    em = claims_df[claims_df[\"proc_code\"].isin(EM_CODES)].copy()\n\n    prov_dist = em.groupby([\"provider_id\", \"specialty\", \"proc_code\"]).size().unstack(fill_value=0)\n    prov_pct = prov_dist.div(prov_dist.sum(axis=1), axis=0)\n\n    spec_mean = prov_pct.groupby(\"specialty\").mean()\n    spec_std = prov_pct.groupby(\"specialty\").std()\n\n    results = []\n    for (prov, spec), row in prov_pct.iterrows():\n        if spec not in spec_mean.index:\n            continue\n        z = (row - spec_mean.loc[spec]) \u002F spec_std.loc[spec].replace(0, np.nan)\n        results.append({\n            \"provider_id\": prov, \"specialty\": spec,\n            \"total_em\": int(prov_dist.loc[(prov, spec)].sum()),\n            \"pct_99214_99215\": row.get(\"99214\", 0) + row.get(\"99215\", 0),\n            \"z_99214\": z.get(\"99214\", np.nan), \"z_99215\": z.get(\"99215\", np.nan),\n            \"flag_upcoding\": z.get(\"99214\", 0) > 2.0 or z.get(\"99215\", 0) > 2.0,\n        })\n    return pd.DataFrame(results).sort_values(\"z_99215\", ascending=False)\n",[723],{"type":68,"tag":174,"props":724,"children":725},{"__ignoreMap":171},[726,733,741,748,756,763,770,778,786,794,801,809,817,824,832,840,847,855,863,871,879,887,895,903,911,919,927,935,943],{"type":68,"tag":178,"props":727,"children":728},{"class":180,"line":181},[729],{"type":68,"tag":178,"props":730,"children":731},{},[732],{"type":74,"value":187},{"type":68,"tag":178,"props":734,"children":735},{"class":180,"line":190},[736],{"type":68,"tag":178,"props":737,"children":738},{},[739],{"type":74,"value":740},"import numpy as np\n",{"type":68,"tag":178,"props":742,"children":743},{"class":180,"line":199},[744],{"type":68,"tag":178,"props":745,"children":746},{"emptyLinePlaceholder":203},[747],{"type":74,"value":206},{"type":68,"tag":178,"props":749,"children":750},{"class":180,"line":26},[751],{"type":68,"tag":178,"props":752,"children":753},{},[754],{"type":74,"value":755},"EM_CODES = [\"99202\",\"99203\",\"99204\",\"99205\",\"99211\",\"99212\",\"99213\",\"99214\",\"99215\"]\n",{"type":68,"tag":178,"props":757,"children":758},{"class":180,"line":216},[759],{"type":68,"tag":178,"props":760,"children":761},{"emptyLinePlaceholder":203},[762],{"type":74,"value":206},{"type":68,"tag":178,"props":764,"children":765},{"class":180,"line":225},[766],{"type":68,"tag":178,"props":767,"children":768},{"emptyLinePlaceholder":203},[769],{"type":74,"value":206},{"type":68,"tag":178,"props":771,"children":772},{"class":180,"line":234},[773],{"type":68,"tag":178,"props":774,"children":775},{},[776],{"type":74,"value":777},"def profile_em_distribution(claims_df: pd.DataFrame) -> pd.DataFrame:\n",{"type":68,"tag":178,"props":779,"children":780},{"class":180,"line":242},[781],{"type":68,"tag":178,"props":782,"children":783},{},[784],{"type":74,"value":785},"    \"\"\"Compare each provider's E&M distribution to specialty peers via z-scores.\"\"\"\n",{"type":68,"tag":178,"props":787,"children":788},{"class":180,"line":251},[789],{"type":68,"tag":178,"props":790,"children":791},{},[792],{"type":74,"value":793},"    em = claims_df[claims_df[\"proc_code\"].isin(EM_CODES)].copy()\n",{"type":68,"tag":178,"props":795,"children":796},{"class":180,"line":260},[797],{"type":68,"tag":178,"props":798,"children":799},{"emptyLinePlaceholder":203},[800],{"type":74,"value":206},{"type":68,"tag":178,"props":802,"children":803},{"class":180,"line":269},[804],{"type":68,"tag":178,"props":805,"children":806},{},[807],{"type":74,"value":808},"    prov_dist = em.groupby([\"provider_id\", \"specialty\", \"proc_code\"]).size().unstack(fill_value=0)\n",{"type":68,"tag":178,"props":810,"children":811},{"class":180,"line":278},[812],{"type":68,"tag":178,"props":813,"children":814},{},[815],{"type":74,"value":816},"    prov_pct = prov_dist.div(prov_dist.sum(axis=1), axis=0)\n",{"type":68,"tag":178,"props":818,"children":819},{"class":180,"line":287},[820],{"type":68,"tag":178,"props":821,"children":822},{"emptyLinePlaceholder":203},[823],{"type":74,"value":206},{"type":68,"tag":178,"props":825,"children":826},{"class":180,"line":296},[827],{"type":68,"tag":178,"props":828,"children":829},{},[830],{"type":74,"value":831},"    spec_mean = prov_pct.groupby(\"specialty\").mean()\n",{"type":68,"tag":178,"props":833,"children":834},{"class":180,"line":304},[835],{"type":68,"tag":178,"props":836,"children":837},{},[838],{"type":74,"value":839},"    spec_std = prov_pct.groupby(\"specialty\").std()\n",{"type":68,"tag":178,"props":841,"children":842},{"class":180,"line":313},[843],{"type":68,"tag":178,"props":844,"children":845},{"emptyLinePlaceholder":203},[846],{"type":74,"value":206},{"type":68,"tag":178,"props":848,"children":849},{"class":180,"line":322},[850],{"type":68,"tag":178,"props":851,"children":852},{},[853],{"type":74,"value":854},"    results = []\n",{"type":68,"tag":178,"props":856,"children":857},{"class":180,"line":331},[858],{"type":68,"tag":178,"props":859,"children":860},{},[861],{"type":74,"value":862},"    for (prov, spec), row in prov_pct.iterrows():\n",{"type":68,"tag":178,"props":864,"children":865},{"class":180,"line":339},[866],{"type":68,"tag":178,"props":867,"children":868},{},[869],{"type":74,"value":870},"        if spec not in spec_mean.index:\n",{"type":68,"tag":178,"props":872,"children":873},{"class":180,"line":348},[874],{"type":68,"tag":178,"props":875,"children":876},{},[877],{"type":74,"value":878},"            continue\n",{"type":68,"tag":178,"props":880,"children":881},{"class":180,"line":357},[882],{"type":68,"tag":178,"props":883,"children":884},{},[885],{"type":74,"value":886},"        z = (row - spec_mean.loc[spec]) \u002F spec_std.loc[spec].replace(0, np.nan)\n",{"type":68,"tag":178,"props":888,"children":889},{"class":180,"line":366},[890],{"type":68,"tag":178,"props":891,"children":892},{},[893],{"type":74,"value":894},"        results.append({\n",{"type":68,"tag":178,"props":896,"children":897},{"class":180,"line":375},[898],{"type":68,"tag":178,"props":899,"children":900},{},[901],{"type":74,"value":902},"            \"provider_id\": prov, \"specialty\": spec,\n",{"type":68,"tag":178,"props":904,"children":905},{"class":180,"line":383},[906],{"type":68,"tag":178,"props":907,"children":908},{},[909],{"type":74,"value":910},"            \"total_em\": int(prov_dist.loc[(prov, spec)].sum()),\n",{"type":68,"tag":178,"props":912,"children":913},{"class":180,"line":392},[914],{"type":68,"tag":178,"props":915,"children":916},{},[917],{"type":74,"value":918},"            \"pct_99214_99215\": row.get(\"99214\", 0) + row.get(\"99215\", 0),\n",{"type":68,"tag":178,"props":920,"children":921},{"class":180,"line":401},[922],{"type":68,"tag":178,"props":923,"children":924},{},[925],{"type":74,"value":926},"            \"z_99214\": z.get(\"99214\", np.nan), \"z_99215\": z.get(\"99215\", np.nan),\n",{"type":68,"tag":178,"props":928,"children":929},{"class":180,"line":410},[930],{"type":68,"tag":178,"props":931,"children":932},{},[933],{"type":74,"value":934},"            \"flag_upcoding\": z.get(\"99214\", 0) > 2.0 or z.get(\"99215\", 0) > 2.0,\n",{"type":68,"tag":178,"props":936,"children":937},{"class":180,"line":419},[938],{"type":68,"tag":178,"props":939,"children":940},{},[941],{"type":74,"value":942},"        })\n",{"type":68,"tag":178,"props":944,"children":945},{"class":180,"line":428},[946],{"type":68,"tag":178,"props":947,"children":948},{},[949],{"type":74,"value":950},"    return pd.DataFrame(results).sort_values(\"z_99215\", ascending=False)\n",{"type":68,"tag":714,"props":952,"children":954},{"id":953},"sql",[955],{"type":74,"value":956},"SQL",{"type":68,"tag":166,"props":958,"children":961},{"className":959,"code":960,"language":953,"meta":171,"style":171},"language-sql shiki shiki-themes material-theme-lighter material-theme material-theme-palenight","WITH provider_em AS (\n    SELECT provider_id, specialty, proc_code, COUNT(*) AS cnt\n    FROM claims\n    WHERE proc_code IN ('99202','99203','99204','99205','99211','99212','99213','99214','99215')\n    GROUP BY provider_id, specialty, proc_code\n),\nprovider_total AS (\n    SELECT provider_id, specialty, SUM(cnt) AS total FROM provider_em GROUP BY provider_id, specialty\n),\nprovider_pct AS (\n    SELECT e.provider_id, e.specialty, e.proc_code, t.total,\n           ROUND(e.cnt * 100.0 \u002F t.total, 2) AS pct\n    FROM provider_em e JOIN provider_total t ON e.provider_id = t.provider_id\n),\nbenchmark AS (\n    SELECT specialty, proc_code, AVG(pct) AS avg_pct, STDDEV(pct) AS std_pct\n    FROM provider_pct GROUP BY specialty, proc_code\n)\nSELECT p.provider_id, p.specialty, p.proc_code, p.pct, b.avg_pct,\n       ROUND((p.pct - b.avg_pct) \u002F NULLIF(b.std_pct, 0), 2) AS z_score\nFROM provider_pct p\nJOIN benchmark b ON p.specialty = b.specialty AND p.proc_code = b.proc_code\nWHERE ABS((p.pct - b.avg_pct) \u002F NULLIF(b.std_pct, 0)) > 2.0\nORDER BY z_score DESC;\n",[962],{"type":68,"tag":174,"props":963,"children":964},{"__ignoreMap":171},[965,973,981,989,997,1005,1013,1021,1029,1036,1044,1052,1060,1068,1075,1083,1091,1099,1107,1115,1123,1131,1139,1147],{"type":68,"tag":178,"props":966,"children":967},{"class":180,"line":181},[968],{"type":68,"tag":178,"props":969,"children":970},{},[971],{"type":74,"value":972},"WITH provider_em AS (\n",{"type":68,"tag":178,"props":974,"children":975},{"class":180,"line":190},[976],{"type":68,"tag":178,"props":977,"children":978},{},[979],{"type":74,"value":980},"    SELECT provider_id, specialty, proc_code, COUNT(*) AS cnt\n",{"type":68,"tag":178,"props":982,"children":983},{"class":180,"line":199},[984],{"type":68,"tag":178,"props":985,"children":986},{},[987],{"type":74,"value":988},"    FROM claims\n",{"type":68,"tag":178,"props":990,"children":991},{"class":180,"line":26},[992],{"type":68,"tag":178,"props":993,"children":994},{},[995],{"type":74,"value":996},"    WHERE proc_code IN ('99202','99203','99204','99205','99211','99212','99213','99214','99215')\n",{"type":68,"tag":178,"props":998,"children":999},{"class":180,"line":216},[1000],{"type":68,"tag":178,"props":1001,"children":1002},{},[1003],{"type":74,"value":1004},"    GROUP BY provider_id, specialty, proc_code\n",{"type":68,"tag":178,"props":1006,"children":1007},{"class":180,"line":225},[1008],{"type":68,"tag":178,"props":1009,"children":1010},{},[1011],{"type":74,"value":1012},"),\n",{"type":68,"tag":178,"props":1014,"children":1015},{"class":180,"line":234},[1016],{"type":68,"tag":178,"props":1017,"children":1018},{},[1019],{"type":74,"value":1020},"provider_total AS (\n",{"type":68,"tag":178,"props":1022,"children":1023},{"class":180,"line":242},[1024],{"type":68,"tag":178,"props":1025,"children":1026},{},[1027],{"type":74,"value":1028},"    SELECT provider_id, specialty, SUM(cnt) AS total FROM provider_em GROUP BY provider_id, specialty\n",{"type":68,"tag":178,"props":1030,"children":1031},{"class":180,"line":251},[1032],{"type":68,"tag":178,"props":1033,"children":1034},{},[1035],{"type":74,"value":1012},{"type":68,"tag":178,"props":1037,"children":1038},{"class":180,"line":260},[1039],{"type":68,"tag":178,"props":1040,"children":1041},{},[1042],{"type":74,"value":1043},"provider_pct AS (\n",{"type":68,"tag":178,"props":1045,"children":1046},{"class":180,"line":269},[1047],{"type":68,"tag":178,"props":1048,"children":1049},{},[1050],{"type":74,"value":1051},"    SELECT e.provider_id, e.specialty, e.proc_code, t.total,\n",{"type":68,"tag":178,"props":1053,"children":1054},{"class":180,"line":278},[1055],{"type":68,"tag":178,"props":1056,"children":1057},{},[1058],{"type":74,"value":1059},"           ROUND(e.cnt * 100.0 \u002F t.total, 2) AS pct\n",{"type":68,"tag":178,"props":1061,"children":1062},{"class":180,"line":287},[1063],{"type":68,"tag":178,"props":1064,"children":1065},{},[1066],{"type":74,"value":1067},"    FROM provider_em e JOIN provider_total t ON e.provider_id = t.provider_id\n",{"type":68,"tag":178,"props":1069,"children":1070},{"class":180,"line":296},[1071],{"type":68,"tag":178,"props":1072,"children":1073},{},[1074],{"type":74,"value":1012},{"type":68,"tag":178,"props":1076,"children":1077},{"class":180,"line":304},[1078],{"type":68,"tag":178,"props":1079,"children":1080},{},[1081],{"type":74,"value":1082},"benchmark AS (\n",{"type":68,"tag":178,"props":1084,"children":1085},{"class":180,"line":313},[1086],{"type":68,"tag":178,"props":1087,"children":1088},{},[1089],{"type":74,"value":1090},"    SELECT specialty, proc_code, AVG(pct) AS avg_pct, STDDEV(pct) AS std_pct\n",{"type":68,"tag":178,"props":1092,"children":1093},{"class":180,"line":322},[1094],{"type":68,"tag":178,"props":1095,"children":1096},{},[1097],{"type":74,"value":1098},"    FROM provider_pct GROUP BY specialty, proc_code\n",{"type":68,"tag":178,"props":1100,"children":1101},{"class":180,"line":331},[1102],{"type":68,"tag":178,"props":1103,"children":1104},{},[1105],{"type":74,"value":1106},")\n",{"type":68,"tag":178,"props":1108,"children":1109},{"class":180,"line":339},[1110],{"type":68,"tag":178,"props":1111,"children":1112},{},[1113],{"type":74,"value":1114},"SELECT p.provider_id, p.specialty, p.proc_code, p.pct, b.avg_pct,\n",{"type":68,"tag":178,"props":1116,"children":1117},{"class":180,"line":348},[1118],{"type":68,"tag":178,"props":1119,"children":1120},{},[1121],{"type":74,"value":1122},"       ROUND((p.pct - b.avg_pct) \u002F NULLIF(b.std_pct, 0), 2) AS z_score\n",{"type":68,"tag":178,"props":1124,"children":1125},{"class":180,"line":357},[1126],{"type":68,"tag":178,"props":1127,"children":1128},{},[1129],{"type":74,"value":1130},"FROM provider_pct p\n",{"type":68,"tag":178,"props":1132,"children":1133},{"class":180,"line":366},[1134],{"type":68,"tag":178,"props":1135,"children":1136},{},[1137],{"type":74,"value":1138},"JOIN benchmark b ON p.specialty = b.specialty AND p.proc_code = b.proc_code\n",{"type":68,"tag":178,"props":1140,"children":1141},{"class":180,"line":375},[1142],{"type":68,"tag":178,"props":1143,"children":1144},{},[1145],{"type":74,"value":1146},"WHERE ABS((p.pct - b.avg_pct) \u002F NULLIF(b.std_pct, 0)) > 2.0\n",{"type":68,"tag":178,"props":1148,"children":1149},{"class":180,"line":383},[1150],{"type":68,"tag":178,"props":1151,"children":1152},{},[1153],{"type":74,"value":1154},"ORDER BY z_score DESC;\n",{"type":68,"tag":122,"props":1156,"children":1157},{},[],{"type":68,"tag":77,"props":1159,"children":1161},{"id":1160},"_3-ncci-edit-validation",[1162],{"type":74,"value":1163},"3. NCCI Edit Validation",{"type":68,"tag":166,"props":1165,"children":1167},{"className":168,"code":1166,"language":170,"meta":171,"style":171},"import pandas as pd\n\n\ndef validate_ncci(claims_df: pd.DataFrame, ncci_edits: pd.DataFrame) -> pd.DataFrame:\n    \"\"\"Validate claims against NCCI edits. Returns violations.\n\n    Args:\n        claims_df: [claim_id, provider_id, member_id, service_date, proc_code, modifier_1].\n        ncci_edits: [column1_cpt, column2_cpt, modifier_indicator, effective_date, deletion_date].\n    \"\"\"\n    violations = []\n    for (prov, mem, dt), grp in claims_df.groupby([\"provider_id\", \"member_id\", \"service_date\"]):\n        codes = grp[\"proc_code\"].tolist()\n        mods = grp[\"modifier_1\"].fillna(\"\").tolist()\n\n        for i, c1 in enumerate(codes):\n            for j, c2 in enumerate(codes):\n                if i >= j:\n                    continue\n                for col1, col2, mi in [(c1, c2, j), (c2, c1, i)]:\n                    match = ncci_edits[\n                        (ncci_edits[\"column1_cpt\"] == col1) & (ncci_edits[\"column2_cpt\"] == col2) &\n                        (ncci_edits[\"effective_date\"] \u003C= dt) &\n                        (ncci_edits[\"deletion_date\"].isna() | (ncci_edits[\"deletion_date\"] > dt))\n                    ]\n                    if match.empty:\n                        continue\n                    ind = match.iloc[0][\"modifier_indicator\"]\n                    has_mod = mods[mi] in (\"59\", \"XE\", \"XS\", \"XP\", \"XU\")\n                    if ind == \"0\" or (ind == \"1\" and not has_mod):\n                        violations.append({\n                            \"provider_id\": prov, \"member_id\": mem, \"service_date\": dt,\n                            \"column1_cpt\": col1, \"column2_cpt\": col2,\n                            \"modifier_indicator\": ind,\n                            \"status\": \"DENIED\" if ind == \"0\" else \"DENIED — modifier required\",\n                        })\n    return pd.DataFrame(violations)\n",[1168],{"type":68,"tag":174,"props":1169,"children":1170},{"__ignoreMap":171},[1171,1178,1185,1192,1200,1208,1215,1223,1231,1239,1246,1254,1262,1270,1278,1285,1293,1301,1309,1317,1325,1333,1341,1349,1357,1365,1373,1381,1389,1397,1405,1413,1421,1429,1437,1445,1453],{"type":68,"tag":178,"props":1172,"children":1173},{"class":180,"line":181},[1174],{"type":68,"tag":178,"props":1175,"children":1176},{},[1177],{"type":74,"value":187},{"type":68,"tag":178,"props":1179,"children":1180},{"class":180,"line":190},[1181],{"type":68,"tag":178,"props":1182,"children":1183},{"emptyLinePlaceholder":203},[1184],{"type":74,"value":206},{"type":68,"tag":178,"props":1186,"children":1187},{"class":180,"line":199},[1188],{"type":68,"tag":178,"props":1189,"children":1190},{"emptyLinePlaceholder":203},[1191],{"type":74,"value":206},{"type":68,"tag":178,"props":1193,"children":1194},{"class":180,"line":26},[1195],{"type":68,"tag":178,"props":1196,"children":1197},{},[1198],{"type":74,"value":1199},"def validate_ncci(claims_df: pd.DataFrame, ncci_edits: pd.DataFrame) -> pd.DataFrame:\n",{"type":68,"tag":178,"props":1201,"children":1202},{"class":180,"line":216},[1203],{"type":68,"tag":178,"props":1204,"children":1205},{},[1206],{"type":74,"value":1207},"    \"\"\"Validate claims against NCCI edits. Returns violations.\n",{"type":68,"tag":178,"props":1209,"children":1210},{"class":180,"line":225},[1211],{"type":68,"tag":178,"props":1212,"children":1213},{"emptyLinePlaceholder":203},[1214],{"type":74,"value":206},{"type":68,"tag":178,"props":1216,"children":1217},{"class":180,"line":234},[1218],{"type":68,"tag":178,"props":1219,"children":1220},{},[1221],{"type":74,"value":1222},"    Args:\n",{"type":68,"tag":178,"props":1224,"children":1225},{"class":180,"line":242},[1226],{"type":68,"tag":178,"props":1227,"children":1228},{},[1229],{"type":74,"value":1230},"        claims_df: [claim_id, provider_id, member_id, service_date, proc_code, modifier_1].\n",{"type":68,"tag":178,"props":1232,"children":1233},{"class":180,"line":251},[1234],{"type":68,"tag":178,"props":1235,"children":1236},{},[1237],{"type":74,"value":1238},"        ncci_edits: [column1_cpt, column2_cpt, modifier_indicator, effective_date, deletion_date].\n",{"type":68,"tag":178,"props":1240,"children":1241},{"class":180,"line":260},[1242],{"type":68,"tag":178,"props":1243,"children":1244},{},[1245],{"type":74,"value":275},{"type":68,"tag":178,"props":1247,"children":1248},{"class":180,"line":269},[1249],{"type":68,"tag":178,"props":1250,"children":1251},{},[1252],{"type":74,"value":1253},"    violations = []\n",{"type":68,"tag":178,"props":1255,"children":1256},{"class":180,"line":278},[1257],{"type":68,"tag":178,"props":1258,"children":1259},{},[1260],{"type":74,"value":1261},"    for (prov, mem, dt), grp in claims_df.groupby([\"provider_id\", \"member_id\", \"service_date\"]):\n",{"type":68,"tag":178,"props":1263,"children":1264},{"class":180,"line":287},[1265],{"type":68,"tag":178,"props":1266,"children":1267},{},[1268],{"type":74,"value":1269},"        codes = grp[\"proc_code\"].tolist()\n",{"type":68,"tag":178,"props":1271,"children":1272},{"class":180,"line":296},[1273],{"type":68,"tag":178,"props":1274,"children":1275},{},[1276],{"type":74,"value":1277},"        mods = grp[\"modifier_1\"].fillna(\"\").tolist()\n",{"type":68,"tag":178,"props":1279,"children":1280},{"class":180,"line":304},[1281],{"type":68,"tag":178,"props":1282,"children":1283},{"emptyLinePlaceholder":203},[1284],{"type":74,"value":206},{"type":68,"tag":178,"props":1286,"children":1287},{"class":180,"line":313},[1288],{"type":68,"tag":178,"props":1289,"children":1290},{},[1291],{"type":74,"value":1292},"        for i, c1 in enumerate(codes):\n",{"type":68,"tag":178,"props":1294,"children":1295},{"class":180,"line":322},[1296],{"type":68,"tag":178,"props":1297,"children":1298},{},[1299],{"type":74,"value":1300},"            for j, c2 in enumerate(codes):\n",{"type":68,"tag":178,"props":1302,"children":1303},{"class":180,"line":331},[1304],{"type":68,"tag":178,"props":1305,"children":1306},{},[1307],{"type":74,"value":1308},"                if i >= j:\n",{"type":68,"tag":178,"props":1310,"children":1311},{"class":180,"line":339},[1312],{"type":68,"tag":178,"props":1313,"children":1314},{},[1315],{"type":74,"value":1316},"                    continue\n",{"type":68,"tag":178,"props":1318,"children":1319},{"class":180,"line":348},[1320],{"type":68,"tag":178,"props":1321,"children":1322},{},[1323],{"type":74,"value":1324},"                for col1, col2, mi in [(c1, c2, j), (c2, c1, i)]:\n",{"type":68,"tag":178,"props":1326,"children":1327},{"class":180,"line":357},[1328],{"type":68,"tag":178,"props":1329,"children":1330},{},[1331],{"type":74,"value":1332},"                    match = ncci_edits[\n",{"type":68,"tag":178,"props":1334,"children":1335},{"class":180,"line":366},[1336],{"type":68,"tag":178,"props":1337,"children":1338},{},[1339],{"type":74,"value":1340},"                        (ncci_edits[\"column1_cpt\"] == col1) & (ncci_edits[\"column2_cpt\"] == col2) &\n",{"type":68,"tag":178,"props":1342,"children":1343},{"class":180,"line":375},[1344],{"type":68,"tag":178,"props":1345,"children":1346},{},[1347],{"type":74,"value":1348},"                        (ncci_edits[\"effective_date\"] \u003C= dt) &\n",{"type":68,"tag":178,"props":1350,"children":1351},{"class":180,"line":383},[1352],{"type":68,"tag":178,"props":1353,"children":1354},{},[1355],{"type":74,"value":1356},"                        (ncci_edits[\"deletion_date\"].isna() | (ncci_edits[\"deletion_date\"] > dt))\n",{"type":68,"tag":178,"props":1358,"children":1359},{"class":180,"line":392},[1360],{"type":68,"tag":178,"props":1361,"children":1362},{},[1363],{"type":74,"value":1364},"                    ]\n",{"type":68,"tag":178,"props":1366,"children":1367},{"class":180,"line":401},[1368],{"type":68,"tag":178,"props":1369,"children":1370},{},[1371],{"type":74,"value":1372},"                    if match.empty:\n",{"type":68,"tag":178,"props":1374,"children":1375},{"class":180,"line":410},[1376],{"type":68,"tag":178,"props":1377,"children":1378},{},[1379],{"type":74,"value":1380},"                        continue\n",{"type":68,"tag":178,"props":1382,"children":1383},{"class":180,"line":419},[1384],{"type":68,"tag":178,"props":1385,"children":1386},{},[1387],{"type":74,"value":1388},"                    ind = match.iloc[0][\"modifier_indicator\"]\n",{"type":68,"tag":178,"props":1390,"children":1391},{"class":180,"line":428},[1392],{"type":68,"tag":178,"props":1393,"children":1394},{},[1395],{"type":74,"value":1396},"                    has_mod = mods[mi] in (\"59\", \"XE\", \"XS\", \"XP\", \"XU\")\n",{"type":68,"tag":178,"props":1398,"children":1399},{"class":180,"line":437},[1400],{"type":68,"tag":178,"props":1401,"children":1402},{},[1403],{"type":74,"value":1404},"                    if ind == \"0\" or (ind == \"1\" and not has_mod):\n",{"type":68,"tag":178,"props":1406,"children":1407},{"class":180,"line":446},[1408],{"type":68,"tag":178,"props":1409,"children":1410},{},[1411],{"type":74,"value":1412},"                        violations.append({\n",{"type":68,"tag":178,"props":1414,"children":1415},{"class":180,"line":455},[1416],{"type":68,"tag":178,"props":1417,"children":1418},{},[1419],{"type":74,"value":1420},"                            \"provider_id\": prov, \"member_id\": mem, \"service_date\": dt,\n",{"type":68,"tag":178,"props":1422,"children":1423},{"class":180,"line":464},[1424],{"type":68,"tag":178,"props":1425,"children":1426},{},[1427],{"type":74,"value":1428},"                            \"column1_cpt\": col1, \"column2_cpt\": col2,\n",{"type":68,"tag":178,"props":1430,"children":1431},{"class":180,"line":473},[1432],{"type":68,"tag":178,"props":1433,"children":1434},{},[1435],{"type":74,"value":1436},"                            \"modifier_indicator\": ind,\n",{"type":68,"tag":178,"props":1438,"children":1439},{"class":180,"line":482},[1440],{"type":68,"tag":178,"props":1441,"children":1442},{},[1443],{"type":74,"value":1444},"                            \"status\": \"DENIED\" if ind == \"0\" else \"DENIED — modifier required\",\n",{"type":68,"tag":178,"props":1446,"children":1447},{"class":180,"line":491},[1448],{"type":68,"tag":178,"props":1449,"children":1450},{},[1451],{"type":74,"value":1452},"                        })\n",{"type":68,"tag":178,"props":1454,"children":1455},{"class":180,"line":500},[1456],{"type":68,"tag":178,"props":1457,"children":1458},{},[1459],{"type":74,"value":1460},"    return pd.DataFrame(violations)\n",{"type":68,"tag":122,"props":1462,"children":1463},{},[],{"type":68,"tag":77,"props":1465,"children":1467},{"id":1466},"_4-duplicate-claim-detection",[1468],{"type":74,"value":1469},"4. Duplicate Claim Detection",{"type":68,"tag":714,"props":1471,"children":1473},{"id":1472},"python-1",[1474],{"type":74,"value":718},{"type":68,"tag":166,"props":1476,"children":1478},{"className":168,"code":1477,"language":170,"meta":171,"style":171},"import pandas as pd\n\n\ndef detect_duplicates(claims_df: pd.DataFrame, fuzzy_window_days: int = 3) -> pd.DataFrame:\n    \"\"\"Detect exact and near-duplicate claims.\"\"\"\n    key_cols = [\"member_id\", \"provider_id\", \"proc_code\", \"service_date\"]\n    exact = claims_df[claims_df.duplicated(subset=key_cols, keep=False)].copy()\n    exact[\"dup_type\"] = \"exact\"\n\n    s = claims_df.sort_values(key_cols)\n    s[\"prev_date\"] = s.groupby(key_cols[:3])[\"service_date\"].shift(1)\n    s[\"gap\"] = (s[\"service_date\"] - s[\"prev_date\"]).dt.days\n    near = s[(s[\"gap\"] > 0) & (s[\"gap\"] \u003C= fuzzy_window_days)].copy()\n    near[\"dup_type\"] = \"near\"\n\n    cols = [\"claim_id\", \"member_id\", \"provider_id\", \"proc_code\", \"service_date\", \"dup_type\"]\n    return pd.concat([exact[cols], near[cols]])\n",[1479],{"type":68,"tag":174,"props":1480,"children":1481},{"__ignoreMap":171},[1482,1489,1496,1503,1511,1519,1527,1535,1543,1550,1558,1566,1574,1582,1590,1597,1605],{"type":68,"tag":178,"props":1483,"children":1484},{"class":180,"line":181},[1485],{"type":68,"tag":178,"props":1486,"children":1487},{},[1488],{"type":74,"value":187},{"type":68,"tag":178,"props":1490,"children":1491},{"class":180,"line":190},[1492],{"type":68,"tag":178,"props":1493,"children":1494},{"emptyLinePlaceholder":203},[1495],{"type":74,"value":206},{"type":68,"tag":178,"props":1497,"children":1498},{"class":180,"line":199},[1499],{"type":68,"tag":178,"props":1500,"children":1501},{"emptyLinePlaceholder":203},[1502],{"type":74,"value":206},{"type":68,"tag":178,"props":1504,"children":1505},{"class":180,"line":26},[1506],{"type":68,"tag":178,"props":1507,"children":1508},{},[1509],{"type":74,"value":1510},"def detect_duplicates(claims_df: pd.DataFrame, fuzzy_window_days: int = 3) -> pd.DataFrame:\n",{"type":68,"tag":178,"props":1512,"children":1513},{"class":180,"line":216},[1514],{"type":68,"tag":178,"props":1515,"children":1516},{},[1517],{"type":74,"value":1518},"    \"\"\"Detect exact and near-duplicate claims.\"\"\"\n",{"type":68,"tag":178,"props":1520,"children":1521},{"class":180,"line":225},[1522],{"type":68,"tag":178,"props":1523,"children":1524},{},[1525],{"type":74,"value":1526},"    key_cols = [\"member_id\", \"provider_id\", \"proc_code\", \"service_date\"]\n",{"type":68,"tag":178,"props":1528,"children":1529},{"class":180,"line":234},[1530],{"type":68,"tag":178,"props":1531,"children":1532},{},[1533],{"type":74,"value":1534},"    exact = claims_df[claims_df.duplicated(subset=key_cols, keep=False)].copy()\n",{"type":68,"tag":178,"props":1536,"children":1537},{"class":180,"line":242},[1538],{"type":68,"tag":178,"props":1539,"children":1540},{},[1541],{"type":74,"value":1542},"    exact[\"dup_type\"] = \"exact\"\n",{"type":68,"tag":178,"props":1544,"children":1545},{"class":180,"line":251},[1546],{"type":68,"tag":178,"props":1547,"children":1548},{"emptyLinePlaceholder":203},[1549],{"type":74,"value":206},{"type":68,"tag":178,"props":1551,"children":1552},{"class":180,"line":260},[1553],{"type":68,"tag":178,"props":1554,"children":1555},{},[1556],{"type":74,"value":1557},"    s = claims_df.sort_values(key_cols)\n",{"type":68,"tag":178,"props":1559,"children":1560},{"class":180,"line":269},[1561],{"type":68,"tag":178,"props":1562,"children":1563},{},[1564],{"type":74,"value":1565},"    s[\"prev_date\"] = s.groupby(key_cols[:3])[\"service_date\"].shift(1)\n",{"type":68,"tag":178,"props":1567,"children":1568},{"class":180,"line":278},[1569],{"type":68,"tag":178,"props":1570,"children":1571},{},[1572],{"type":74,"value":1573},"    s[\"gap\"] = (s[\"service_date\"] - s[\"prev_date\"]).dt.days\n",{"type":68,"tag":178,"props":1575,"children":1576},{"class":180,"line":287},[1577],{"type":68,"tag":178,"props":1578,"children":1579},{},[1580],{"type":74,"value":1581},"    near = s[(s[\"gap\"] > 0) & (s[\"gap\"] \u003C= fuzzy_window_days)].copy()\n",{"type":68,"tag":178,"props":1583,"children":1584},{"class":180,"line":296},[1585],{"type":68,"tag":178,"props":1586,"children":1587},{},[1588],{"type":74,"value":1589},"    near[\"dup_type\"] = \"near\"\n",{"type":68,"tag":178,"props":1591,"children":1592},{"class":180,"line":304},[1593],{"type":68,"tag":178,"props":1594,"children":1595},{"emptyLinePlaceholder":203},[1596],{"type":74,"value":206},{"type":68,"tag":178,"props":1598,"children":1599},{"class":180,"line":313},[1600],{"type":68,"tag":178,"props":1601,"children":1602},{},[1603],{"type":74,"value":1604},"    cols = [\"claim_id\", \"member_id\", \"provider_id\", \"proc_code\", \"service_date\", \"dup_type\"]\n",{"type":68,"tag":178,"props":1606,"children":1607},{"class":180,"line":322},[1608],{"type":68,"tag":178,"props":1609,"children":1610},{},[1611],{"type":74,"value":1612},"    return pd.concat([exact[cols], near[cols]])\n",{"type":68,"tag":714,"props":1614,"children":1616},{"id":1615},"sql-1",[1617],{"type":74,"value":956},{"type":68,"tag":166,"props":1619,"children":1621},{"className":959,"code":1620,"language":953,"meta":171,"style":171},"-- Exact duplicates\nSELECT a.claim_id AS id_1, b.claim_id AS id_2, a.member_id, a.proc_code, a.service_date\nFROM claims a JOIN claims b\n  ON a.member_id = b.member_id AND a.provider_id = b.provider_id\n  AND a.proc_code = b.proc_code AND a.service_date = b.service_date\n  AND a.claim_id \u003C b.claim_id;\n\n-- Near-duplicates (within 3 days)\nSELECT a.claim_id AS id_1, b.claim_id AS id_2, a.member_id, a.proc_code,\n       a.service_date AS date_1, b.service_date AS date_2\nFROM claims a JOIN claims b\n  ON a.member_id = b.member_id AND a.provider_id = b.provider_id\n  AND a.proc_code = b.proc_code AND a.claim_id \u003C b.claim_id\n  AND ABS(DATEDIFF(a.service_date, b.service_date)) BETWEEN 1 AND 3;\n",[1622],{"type":68,"tag":174,"props":1623,"children":1624},{"__ignoreMap":171},[1625,1633,1641,1649,1657,1665,1673,1680,1688,1696,1704,1711,1718,1726],{"type":68,"tag":178,"props":1626,"children":1627},{"class":180,"line":181},[1628],{"type":68,"tag":178,"props":1629,"children":1630},{},[1631],{"type":74,"value":1632},"-- Exact duplicates\n",{"type":68,"tag":178,"props":1634,"children":1635},{"class":180,"line":190},[1636],{"type":68,"tag":178,"props":1637,"children":1638},{},[1639],{"type":74,"value":1640},"SELECT a.claim_id AS id_1, b.claim_id AS id_2, a.member_id, a.proc_code, a.service_date\n",{"type":68,"tag":178,"props":1642,"children":1643},{"class":180,"line":199},[1644],{"type":68,"tag":178,"props":1645,"children":1646},{},[1647],{"type":74,"value":1648},"FROM claims a JOIN claims b\n",{"type":68,"tag":178,"props":1650,"children":1651},{"class":180,"line":26},[1652],{"type":68,"tag":178,"props":1653,"children":1654},{},[1655],{"type":74,"value":1656},"  ON a.member_id = b.member_id AND a.provider_id = b.provider_id\n",{"type":68,"tag":178,"props":1658,"children":1659},{"class":180,"line":216},[1660],{"type":68,"tag":178,"props":1661,"children":1662},{},[1663],{"type":74,"value":1664},"  AND a.proc_code = b.proc_code AND a.service_date = b.service_date\n",{"type":68,"tag":178,"props":1666,"children":1667},{"class":180,"line":225},[1668],{"type":68,"tag":178,"props":1669,"children":1670},{},[1671],{"type":74,"value":1672},"  AND a.claim_id \u003C b.claim_id;\n",{"type":68,"tag":178,"props":1674,"children":1675},{"class":180,"line":234},[1676],{"type":68,"tag":178,"props":1677,"children":1678},{"emptyLinePlaceholder":203},[1679],{"type":74,"value":206},{"type":68,"tag":178,"props":1681,"children":1682},{"class":180,"line":242},[1683],{"type":68,"tag":178,"props":1684,"children":1685},{},[1686],{"type":74,"value":1687},"-- Near-duplicates (within 3 days)\n",{"type":68,"tag":178,"props":1689,"children":1690},{"class":180,"line":251},[1691],{"type":68,"tag":178,"props":1692,"children":1693},{},[1694],{"type":74,"value":1695},"SELECT a.claim_id AS id_1, b.claim_id AS id_2, a.member_id, a.proc_code,\n",{"type":68,"tag":178,"props":1697,"children":1698},{"class":180,"line":260},[1699],{"type":68,"tag":178,"props":1700,"children":1701},{},[1702],{"type":74,"value":1703},"       a.service_date AS date_1, b.service_date AS date_2\n",{"type":68,"tag":178,"props":1705,"children":1706},{"class":180,"line":269},[1707],{"type":68,"tag":178,"props":1708,"children":1709},{},[1710],{"type":74,"value":1648},{"type":68,"tag":178,"props":1712,"children":1713},{"class":180,"line":278},[1714],{"type":68,"tag":178,"props":1715,"children":1716},{},[1717],{"type":74,"value":1656},{"type":68,"tag":178,"props":1719,"children":1720},{"class":180,"line":287},[1721],{"type":68,"tag":178,"props":1722,"children":1723},{},[1724],{"type":74,"value":1725},"  AND a.proc_code = b.proc_code AND a.claim_id \u003C b.claim_id\n",{"type":68,"tag":178,"props":1727,"children":1728},{"class":180,"line":296},[1729],{"type":68,"tag":178,"props":1730,"children":1731},{},[1732],{"type":74,"value":1733},"  AND ABS(DATEDIFF(a.service_date, b.service_date)) BETWEEN 1 AND 3;\n",{"type":68,"tag":122,"props":1735,"children":1736},{},[],{"type":68,"tag":77,"props":1738,"children":1740},{"id":1739},"_5-benfords-law-analysis",[1741],{"type":74,"value":1742},"5. Benford's Law Analysis",{"type":68,"tag":166,"props":1744,"children":1746},{"className":168,"code":1745,"language":170,"meta":171,"style":171},"import pandas as pd\nimport numpy as np\nfrom scipy.stats import chisquare\n\nBENFORD = {1: 0.301, 2: 0.176, 3: 0.125, 4: 0.097,\n           5: 0.079, 6: 0.067, 7: 0.058, 8: 0.051, 9: 0.046}\n\n\ndef benfords_test(charges: pd.Series, provider_id: str = \"\") -> dict:\n    \"\"\"Test charge first-digit distribution against Benford's Law.\"\"\"\n    first = charges[charges > 0].apply(lambda x: int(str(x).lstrip(\"0\").lstrip(\".\")[0]))\n    first = first[first.between(1, 9)]\n    counts = first.value_counts().sort_index()\n    n = counts.sum()\n    obs = np.array([counts.get(d, 0) for d in range(1, 10)])\n    exp = np.array([BENFORD[d] * n for d in range(1, 10)])\n    chi2, p = chisquare(obs, exp)\n    return {\"provider_id\": provider_id, \"chi2\": round(chi2, 2),\n            \"p_value\": round(p, 4), \"flag\": p \u003C 0.01}\n",[1747],{"type":68,"tag":174,"props":1748,"children":1749},{"__ignoreMap":171},[1750,1757,1764,1772,1779,1787,1795,1802,1809,1817,1825,1833,1841,1849,1857,1865,1873,1881,1889],{"type":68,"tag":178,"props":1751,"children":1752},{"class":180,"line":181},[1753],{"type":68,"tag":178,"props":1754,"children":1755},{},[1756],{"type":74,"value":187},{"type":68,"tag":178,"props":1758,"children":1759},{"class":180,"line":190},[1760],{"type":68,"tag":178,"props":1761,"children":1762},{},[1763],{"type":74,"value":740},{"type":68,"tag":178,"props":1765,"children":1766},{"class":180,"line":199},[1767],{"type":68,"tag":178,"props":1768,"children":1769},{},[1770],{"type":74,"value":1771},"from scipy.stats import chisquare\n",{"type":68,"tag":178,"props":1773,"children":1774},{"class":180,"line":26},[1775],{"type":68,"tag":178,"props":1776,"children":1777},{"emptyLinePlaceholder":203},[1778],{"type":74,"value":206},{"type":68,"tag":178,"props":1780,"children":1781},{"class":180,"line":216},[1782],{"type":68,"tag":178,"props":1783,"children":1784},{},[1785],{"type":74,"value":1786},"BENFORD = {1: 0.301, 2: 0.176, 3: 0.125, 4: 0.097,\n",{"type":68,"tag":178,"props":1788,"children":1789},{"class":180,"line":225},[1790],{"type":68,"tag":178,"props":1791,"children":1792},{},[1793],{"type":74,"value":1794},"           5: 0.079, 6: 0.067, 7: 0.058, 8: 0.051, 9: 0.046}\n",{"type":68,"tag":178,"props":1796,"children":1797},{"class":180,"line":234},[1798],{"type":68,"tag":178,"props":1799,"children":1800},{"emptyLinePlaceholder":203},[1801],{"type":74,"value":206},{"type":68,"tag":178,"props":1803,"children":1804},{"class":180,"line":242},[1805],{"type":68,"tag":178,"props":1806,"children":1807},{"emptyLinePlaceholder":203},[1808],{"type":74,"value":206},{"type":68,"tag":178,"props":1810,"children":1811},{"class":180,"line":251},[1812],{"type":68,"tag":178,"props":1813,"children":1814},{},[1815],{"type":74,"value":1816},"def benfords_test(charges: pd.Series, provider_id: str = \"\") -> dict:\n",{"type":68,"tag":178,"props":1818,"children":1819},{"class":180,"line":260},[1820],{"type":68,"tag":178,"props":1821,"children":1822},{},[1823],{"type":74,"value":1824},"    \"\"\"Test charge first-digit distribution against Benford's Law.\"\"\"\n",{"type":68,"tag":178,"props":1826,"children":1827},{"class":180,"line":269},[1828],{"type":68,"tag":178,"props":1829,"children":1830},{},[1831],{"type":74,"value":1832},"    first = charges[charges > 0].apply(lambda x: int(str(x).lstrip(\"0\").lstrip(\".\")[0]))\n",{"type":68,"tag":178,"props":1834,"children":1835},{"class":180,"line":278},[1836],{"type":68,"tag":178,"props":1837,"children":1838},{},[1839],{"type":74,"value":1840},"    first = first[first.between(1, 9)]\n",{"type":68,"tag":178,"props":1842,"children":1843},{"class":180,"line":287},[1844],{"type":68,"tag":178,"props":1845,"children":1846},{},[1847],{"type":74,"value":1848},"    counts = first.value_counts().sort_index()\n",{"type":68,"tag":178,"props":1850,"children":1851},{"class":180,"line":296},[1852],{"type":68,"tag":178,"props":1853,"children":1854},{},[1855],{"type":74,"value":1856},"    n = counts.sum()\n",{"type":68,"tag":178,"props":1858,"children":1859},{"class":180,"line":304},[1860],{"type":68,"tag":178,"props":1861,"children":1862},{},[1863],{"type":74,"value":1864},"    obs = np.array([counts.get(d, 0) for d in range(1, 10)])\n",{"type":68,"tag":178,"props":1866,"children":1867},{"class":180,"line":313},[1868],{"type":68,"tag":178,"props":1869,"children":1870},{},[1871],{"type":74,"value":1872},"    exp = np.array([BENFORD[d] * n for d in range(1, 10)])\n",{"type":68,"tag":178,"props":1874,"children":1875},{"class":180,"line":322},[1876],{"type":68,"tag":178,"props":1877,"children":1878},{},[1879],{"type":74,"value":1880},"    chi2, p = chisquare(obs, exp)\n",{"type":68,"tag":178,"props":1882,"children":1883},{"class":180,"line":331},[1884],{"type":68,"tag":178,"props":1885,"children":1886},{},[1887],{"type":74,"value":1888},"    return {\"provider_id\": provider_id, \"chi2\": round(chi2, 2),\n",{"type":68,"tag":178,"props":1890,"children":1891},{"class":180,"line":339},[1892],{"type":68,"tag":178,"props":1893,"children":1894},{},[1895],{"type":74,"value":1896},"            \"p_value\": round(p, 4), \"flag\": p \u003C 0.01}\n",{"type":68,"tag":122,"props":1898,"children":1899},{},[],{"type":68,"tag":77,"props":1901,"children":1903},{"id":1902},"_6-impossible-day-detection",[1904],{"type":74,"value":1905},"6. Impossible Day Detection",{"type":68,"tag":166,"props":1907,"children":1909},{"className":168,"code":1908,"language":170,"meta":171,"style":171},"import pandas as pd\n\nCPT_MINUTES = {\n    \"99213\": 15, \"99214\": 25, \"99215\": 40, \"99203\": 30, \"99204\": 45, \"99205\": 60,\n    \"90837\": 53, \"90834\": 38, \"97110\": 15, \"97140\": 15, \"99291\": 74, \"99292\": 30,\n}\n\n\ndef detect_impossible_days(claims_df: pd.DataFrame, max_min: int = 1440) -> pd.DataFrame:\n    \"\"\"Flag providers billing >24 hours of services in a single day.\"\"\"\n    df = claims_df.copy()\n    df[\"est_min\"] = df[\"proc_code\"].map(CPT_MINUTES).fillna(0) * df[\"units\"].fillna(1)\n    daily = df.groupby([\"provider_id\", \"service_date\"]).agg(\n        total_min=(\"est_min\", \"sum\"), claims=(\"claim_id\", \"nunique\")\n    ).reset_index()\n    return daily[daily[\"total_min\"] > max_min].sort_values(\"total_min\", ascending=False)\n",[1910],{"type":68,"tag":174,"props":1911,"children":1912},{"__ignoreMap":171},[1913,1920,1927,1935,1943,1951,1959,1966,1973,1981,1989,1997,2005,2013,2021,2029],{"type":68,"tag":178,"props":1914,"children":1915},{"class":180,"line":181},[1916],{"type":68,"tag":178,"props":1917,"children":1918},{},[1919],{"type":74,"value":187},{"type":68,"tag":178,"props":1921,"children":1922},{"class":180,"line":190},[1923],{"type":68,"tag":178,"props":1924,"children":1925},{"emptyLinePlaceholder":203},[1926],{"type":74,"value":206},{"type":68,"tag":178,"props":1928,"children":1929},{"class":180,"line":199},[1930],{"type":68,"tag":178,"props":1931,"children":1932},{},[1933],{"type":74,"value":1934},"CPT_MINUTES = {\n",{"type":68,"tag":178,"props":1936,"children":1937},{"class":180,"line":26},[1938],{"type":68,"tag":178,"props":1939,"children":1940},{},[1941],{"type":74,"value":1942},"    \"99213\": 15, \"99214\": 25, \"99215\": 40, \"99203\": 30, \"99204\": 45, \"99205\": 60,\n",{"type":68,"tag":178,"props":1944,"children":1945},{"class":180,"line":216},[1946],{"type":68,"tag":178,"props":1947,"children":1948},{},[1949],{"type":74,"value":1950},"    \"90837\": 53, \"90834\": 38, \"97110\": 15, \"97140\": 15, \"99291\": 74, \"99292\": 30,\n",{"type":68,"tag":178,"props":1952,"children":1953},{"class":180,"line":225},[1954],{"type":68,"tag":178,"props":1955,"children":1956},{},[1957],{"type":74,"value":1958},"}\n",{"type":68,"tag":178,"props":1960,"children":1961},{"class":180,"line":234},[1962],{"type":68,"tag":178,"props":1963,"children":1964},{"emptyLinePlaceholder":203},[1965],{"type":74,"value":206},{"type":68,"tag":178,"props":1967,"children":1968},{"class":180,"line":242},[1969],{"type":68,"tag":178,"props":1970,"children":1971},{"emptyLinePlaceholder":203},[1972],{"type":74,"value":206},{"type":68,"tag":178,"props":1974,"children":1975},{"class":180,"line":251},[1976],{"type":68,"tag":178,"props":1977,"children":1978},{},[1979],{"type":74,"value":1980},"def detect_impossible_days(claims_df: pd.DataFrame, max_min: int = 1440) -> pd.DataFrame:\n",{"type":68,"tag":178,"props":1982,"children":1983},{"class":180,"line":260},[1984],{"type":68,"tag":178,"props":1985,"children":1986},{},[1987],{"type":74,"value":1988},"    \"\"\"Flag providers billing >24 hours of services in a single day.\"\"\"\n",{"type":68,"tag":178,"props":1990,"children":1991},{"class":180,"line":269},[1992],{"type":68,"tag":178,"props":1993,"children":1994},{},[1995],{"type":74,"value":1996},"    df = claims_df.copy()\n",{"type":68,"tag":178,"props":1998,"children":1999},{"class":180,"line":278},[2000],{"type":68,"tag":178,"props":2001,"children":2002},{},[2003],{"type":74,"value":2004},"    df[\"est_min\"] = df[\"proc_code\"].map(CPT_MINUTES).fillna(0) * df[\"units\"].fillna(1)\n",{"type":68,"tag":178,"props":2006,"children":2007},{"class":180,"line":287},[2008],{"type":68,"tag":178,"props":2009,"children":2010},{},[2011],{"type":74,"value":2012},"    daily = df.groupby([\"provider_id\", \"service_date\"]).agg(\n",{"type":68,"tag":178,"props":2014,"children":2015},{"class":180,"line":296},[2016],{"type":68,"tag":178,"props":2017,"children":2018},{},[2019],{"type":74,"value":2020},"        total_min=(\"est_min\", \"sum\"), claims=(\"claim_id\", \"nunique\")\n",{"type":68,"tag":178,"props":2022,"children":2023},{"class":180,"line":304},[2024],{"type":68,"tag":178,"props":2025,"children":2026},{},[2027],{"type":74,"value":2028},"    ).reset_index()\n",{"type":68,"tag":178,"props":2030,"children":2031},{"class":180,"line":313},[2032],{"type":68,"tag":178,"props":2033,"children":2034},{},[2035],{"type":74,"value":2036},"    return daily[daily[\"total_min\"] > max_min].sort_values(\"total_min\", ascending=False)\n",{"type":68,"tag":122,"props":2038,"children":2039},{},[],{"type":68,"tag":77,"props":2041,"children":2043},{"id":2042},"_7-parameter-reference",[2044],{"type":74,"value":2045},"7. Parameter Reference",{"type":68,"tag":2047,"props":2048,"children":2049},"table",{},[2050,2079],{"type":68,"tag":2051,"props":2052,"children":2053},"thead",{},[2054],{"type":68,"tag":2055,"props":2056,"children":2057},"tr",{},[2058,2064,2069,2074],{"type":68,"tag":2059,"props":2060,"children":2061},"th",{},[2062],{"type":74,"value":2063},"Function",{"type":68,"tag":2059,"props":2065,"children":2066},{},[2067],{"type":74,"value":2068},"Key Parameter",{"type":68,"tag":2059,"props":2070,"children":2071},{},[2072],{"type":74,"value":2073},"Default",{"type":68,"tag":2059,"props":2075,"children":2076},{},[2077],{"type":74,"value":2078},"Guidance",{"type":68,"tag":2080,"props":2081,"children":2082},"tbody",{},[2083,2111,2138,2169,2196],{"type":68,"tag":2055,"props":2084,"children":2085},{},[2086,2096,2101,2106],{"type":68,"tag":2087,"props":2088,"children":2089},"td",{},[2090],{"type":68,"tag":174,"props":2091,"children":2093},{"className":2092},[],[2094],{"type":74,"value":2095},"profile_em_distribution",{"type":68,"tag":2087,"props":2097,"children":2098},{},[2099],{"type":74,"value":2100},"z-score threshold",{"type":68,"tag":2087,"props":2102,"children":2103},{},[2104],{"type":74,"value":2105},"2.0",{"type":68,"tag":2087,"props":2107,"children":2108},{},[2109],{"type":74,"value":2110},"Lower to 1.5 for sensitive screening",{"type":68,"tag":2055,"props":2112,"children":2113},{},[2114,2123,2128,2133],{"type":68,"tag":2087,"props":2115,"children":2116},{},[2117],{"type":68,"tag":174,"props":2118,"children":2120},{"className":2119},[],[2121],{"type":74,"value":2122},"validate_ncci",{"type":68,"tag":2087,"props":2124,"children":2125},{},[2126],{"type":74,"value":2127},"NCCI edit file",{"type":68,"tag":2087,"props":2129,"children":2130},{},[2131],{"type":74,"value":2132},"CMS quarterly",{"type":68,"tag":2087,"props":2134,"children":2135},{},[2136],{"type":74,"value":2137},"Update quarterly from CMS",{"type":68,"tag":2055,"props":2139,"children":2140},{},[2141,2150,2159,2164],{"type":68,"tag":2087,"props":2142,"children":2143},{},[2144],{"type":68,"tag":174,"props":2145,"children":2147},{"className":2146},[],[2148],{"type":74,"value":2149},"detect_duplicates",{"type":68,"tag":2087,"props":2151,"children":2152},{},[2153],{"type":68,"tag":174,"props":2154,"children":2156},{"className":2155},[],[2157],{"type":74,"value":2158},"fuzzy_window_days",{"type":68,"tag":2087,"props":2160,"children":2161},{},[2162],{"type":74,"value":2163},"3",{"type":68,"tag":2087,"props":2165,"children":2166},{},[2167],{"type":74,"value":2168},"Increase to 7 for post-acute care",{"type":68,"tag":2055,"props":2170,"children":2171},{},[2172,2181,2186,2191],{"type":68,"tag":2087,"props":2173,"children":2174},{},[2175],{"type":68,"tag":174,"props":2176,"children":2178},{"className":2177},[],[2179],{"type":74,"value":2180},"benfords_test",{"type":68,"tag":2087,"props":2182,"children":2183},{},[2184],{"type":74,"value":2185},"p-value threshold",{"type":68,"tag":2087,"props":2187,"children":2188},{},[2189],{"type":74,"value":2190},"0.01",{"type":68,"tag":2087,"props":2192,"children":2193},{},[2194],{"type":74,"value":2195},"Use 0.05 for initial screening",{"type":68,"tag":2055,"props":2197,"children":2198},{},[2199,2208,2217,2222],{"type":68,"tag":2087,"props":2200,"children":2201},{},[2202],{"type":68,"tag":174,"props":2203,"children":2205},{"className":2204},[],[2206],{"type":74,"value":2207},"detect_impossible_days",{"type":68,"tag":2087,"props":2209,"children":2210},{},[2211],{"type":68,"tag":174,"props":2212,"children":2214},{"className":2213},[],[2215],{"type":74,"value":2216},"max_min",{"type":68,"tag":2087,"props":2218,"children":2219},{},[2220],{"type":74,"value":2221},"1440",{"type":68,"tag":2087,"props":2223,"children":2224},{},[2225],{"type":74,"value":2226},"Reduce to 960 for stricter threshold",{"type":68,"tag":122,"props":2228,"children":2229},{},[],{"type":68,"tag":77,"props":2231,"children":2233},{"id":2232},"common-mistakes",[2234],{"type":74,"value":2235},"Common Mistakes",{"type":68,"tag":96,"props":2237,"children":2238},{},[2239,2287,2308,2329,2350,2385],{"type":68,"tag":100,"props":2240,"children":2241},{},[2242,2248,2250,2255,2257,2262,2264,2270,2272,2278,2280,2285],{"type":68,"tag":2243,"props":2244,"children":2245},"strong",{},[2246],{"type":74,"value":2247},"Wrong:",{"type":74,"value":2249}," Parsing X12 837 files using the newline character as segment terminator\n",{"type":68,"tag":2243,"props":2251,"children":2252},{},[2253],{"type":74,"value":2254},"Right:",{"type":74,"value":2256}," Read the segment terminator from position 105 of the ISA segment (the character after the last ISA element)\n",{"type":68,"tag":2243,"props":2258,"children":2259},{},[2260],{"type":74,"value":2261},"Why:",{"type":74,"value":2263}," X12 segment terminators are defined in the interchange header — they can be ",{"type":68,"tag":174,"props":2265,"children":2267},{"className":2266},[],[2268],{"type":74,"value":2269},"~",{"type":74,"value":2271},", ",{"type":68,"tag":174,"props":2273,"children":2275},{"className":2274},[],[2276],{"type":74,"value":2277},"\\n",{"type":74,"value":2279},", or any character; assuming ",{"type":68,"tag":174,"props":2281,"children":2283},{"className":2282},[],[2284],{"type":74,"value":2269},{"type":74,"value":2286}," breaks on files using other terminators",{"type":68,"tag":100,"props":2288,"children":2289},{},[2290,2294,2296,2300,2302,2306],{"type":68,"tag":2243,"props":2291,"children":2292},{},[2293],{"type":74,"value":2247},{"type":74,"value":2295}," Comparing provider E&M distributions to a single national benchmark\n",{"type":68,"tag":2243,"props":2297,"children":2298},{},[2299],{"type":74,"value":2254},{"type":74,"value":2301}," Benchmark against same-specialty, same-region, same-payer-mix peers\n",{"type":68,"tag":2243,"props":2303,"children":2304},{},[2305],{"type":74,"value":2261},{"type":74,"value":2307}," Specialty and geography drive legitimate variation — a cardiologist's 99214 rate is naturally higher than a pediatrician's",{"type":68,"tag":100,"props":2309,"children":2310},{},[2311,2315,2317,2321,2323,2327],{"type":68,"tag":2243,"props":2312,"children":2313},{},[2314],{"type":74,"value":2247},{"type":74,"value":2316}," Flagging all exact duplicate claims as fraud\n",{"type":68,"tag":2243,"props":2318,"children":2319},{},[2320],{"type":74,"value":2254},{"type":74,"value":2322}," Distinguish true duplicates (same claim resubmitted) from legitimate corrections (different claim IDs, adjustment codes)\n",{"type":68,"tag":2243,"props":2324,"children":2325},{},[2326],{"type":74,"value":2261},{"type":74,"value":2328}," Payers routinely reprocess claims with new claim IDs after corrections — only same-claim-ID resubmissions without adjustment reason codes are suspect",{"type":68,"tag":100,"props":2330,"children":2331},{},[2332,2336,2338,2342,2344,2348],{"type":68,"tag":2243,"props":2333,"children":2334},{},[2335],{"type":74,"value":2247},{"type":74,"value":2337}," Running Benford's Law analysis on charge amounts below $10\n",{"type":68,"tag":2243,"props":2339,"children":2340},{},[2341],{"type":74,"value":2254},{"type":74,"value":2343}," Filter to charges ≥ $10 before first-digit analysis; small charges cluster around fee-schedule amounts and naturally violate Benford's\n",{"type":68,"tag":2243,"props":2345,"children":2346},{},[2347],{"type":74,"value":2261},{"type":74,"value":2349}," Benford's Law applies to data spanning multiple orders of magnitude — low-value charges are constrained by fee schedules and produce false positives",{"type":68,"tag":100,"props":2351,"children":2352},{},[2353,2357,2359,2363,2365,2371,2373,2379,2383],{"type":68,"tag":2243,"props":2354,"children":2355},{},[2356],{"type":74,"value":2247},{"type":74,"value":2358}," Using NCCI edit tables without checking effective and deletion dates\n",{"type":68,"tag":2243,"props":2360,"children":2361},{},[2362],{"type":74,"value":2254},{"type":74,"value":2364}," Filter NCCI edits to those active on the claim's date of service using ",{"type":68,"tag":174,"props":2366,"children":2368},{"className":2367},[],[2369],{"type":74,"value":2370},"effective_date \u003C= service_date",{"type":74,"value":2372}," and ",{"type":68,"tag":174,"props":2374,"children":2376},{"className":2375},[],[2377],{"type":74,"value":2378},"(deletion_date IS NULL OR deletion_date > service_date)",{"type":68,"tag":2243,"props":2380,"children":2381},{},[2382],{"type":74,"value":2261},{"type":74,"value":2384}," NCCI edits are versioned quarterly — applying current edits to historical claims produces false violations for pairs that were valid at the time of service",{"type":68,"tag":100,"props":2386,"children":2387},{},[2388,2392,2394,2398,2400,2404],{"type":68,"tag":2243,"props":2389,"children":2390},{},[2391],{"type":74,"value":2247},{"type":74,"value":2393}," Detecting impossible days using only CPT time estimates without accounting for concurrent services\n",{"type":68,"tag":2243,"props":2395,"children":2396},{},[2397],{"type":74,"value":2254},{"type":74,"value":2399}," Distinguish sequential time-based services from concurrent ones (e.g., infusion supervision during E&M); only sum non-overlapping service minutes\n",{"type":68,"tag":2243,"props":2401,"children":2402},{},[2403],{"type":74,"value":2261},{"type":74,"value":2405}," Some services legitimately overlap (monitoring during infusion, teaching physician attestation) — naive summation inflates minutes and produces false flags",{"type":68,"tag":2407,"props":2408,"children":2409},"style",{},[2410],{"type":74,"value":2411},"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":2413,"total":2588},[2414,2435,2454,2464,2477,2490,2500,2510,2530,2545,2560,2575],{"slug":2415,"name":2415,"fn":2416,"description":2417,"org":2418,"tags":2419,"stars":2432,"repoUrl":2433,"updatedAt":2434},"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},[2420,2423,2426,2429],{"name":2421,"slug":2422,"type":16},"AWS","aws",{"name":2424,"slug":2425,"type":16},"Debugging","debugging",{"name":2427,"slug":2428,"type":16},"Logs","logs",{"name":2430,"slug":2431,"type":16},"Observability","observability",9427,"https:\u002F\u002Fgithub.com\u002Fawslabs\u002Fmcp","2026-07-12T08:37:22.601527",{"slug":2436,"name":2437,"fn":2438,"description":2439,"org":2440,"tags":2441,"stars":2432,"repoUrl":2433,"updatedAt":2453},"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},[2442,2445,2446,2449,2452],{"name":2443,"slug":2444,"type":16},"Aurora","aurora",{"name":2421,"slug":2422,"type":16},{"name":2447,"slug":2448,"type":16},"Database","database",{"name":2450,"slug":2451,"type":16},"Serverless","serverless",{"name":956,"slug":953,"type":16},"2026-07-12T08:36:45.053393",{"slug":2455,"name":2456,"fn":2438,"description":2439,"org":2457,"tags":2458,"stars":2432,"repoUrl":2433,"updatedAt":2463},"aurora-dsql","aurora dsql",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2459,2460,2461,2462],{"name":2421,"slug":2422,"type":16},{"name":2447,"slug":2448,"type":16},{"name":2450,"slug":2451,"type":16},{"name":956,"slug":953,"type":16},"2026-07-12T08:36:42.694299",{"slug":2465,"name":2466,"fn":2438,"description":2439,"org":2467,"tags":2468,"stars":2432,"repoUrl":2433,"updatedAt":2476},"aws-dsql","aws dsql",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2469,2470,2471,2474,2475],{"name":2421,"slug":2422,"type":16},{"name":2447,"slug":2448,"type":16},{"name":2472,"slug":2473,"type":16},"Migration","migration",{"name":2450,"slug":2451,"type":16},{"name":956,"slug":953,"type":16},"2026-07-12T08:36:38.584057",{"slug":2478,"name":2479,"fn":2438,"description":2439,"org":2480,"tags":2481,"stars":2432,"repoUrl":2433,"updatedAt":2489},"distributed-postgres","distributed postgres",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2482,2483,2484,2487,2488],{"name":2421,"slug":2422,"type":16},{"name":2447,"slug":2448,"type":16},{"name":2485,"slug":2486,"type":16},"PostgreSQL","postgresql",{"name":2450,"slug":2451,"type":16},{"name":956,"slug":953,"type":16},"2026-07-12T08:36:46.530743",{"slug":2491,"name":2492,"fn":2438,"description":2439,"org":2493,"tags":2494,"stars":2432,"repoUrl":2433,"updatedAt":2499},"distributed-sql","distributed sql",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2495,2496,2497,2498],{"name":2421,"slug":2422,"type":16},{"name":2447,"slug":2448,"type":16},{"name":2450,"slug":2451,"type":16},{"name":956,"slug":953,"type":16},"2026-07-12T08:36:48.104182",{"slug":2501,"name":2501,"fn":2438,"description":2439,"org":2502,"tags":2503,"stars":2432,"repoUrl":2433,"updatedAt":2509},"dsql",{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2504,2505,2506,2507,2508],{"name":2421,"slug":2422,"type":16},{"name":2447,"slug":2448,"type":16},{"name":2472,"slug":2473,"type":16},{"name":2450,"slug":2451,"type":16},{"name":956,"slug":953,"type":16},"2026-07-12T08:36:36.374512",{"slug":2511,"name":2511,"fn":2512,"description":2513,"org":2514,"tags":2515,"stars":2527,"repoUrl":2528,"updatedAt":2529},"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},[2516,2519,2521,2524],{"name":2517,"slug":2518,"type":16},"Accounting","accounting",{"name":2520,"slug":62,"type":16},"Analytics",{"name":2522,"slug":2523,"type":16},"Cost Optimization","cost-optimization",{"name":2525,"slug":2526,"type":16},"Finance","finance",3176,"https:\u002F\u002Fgithub.com\u002Fawslabs\u002Fagentcore-samples","2026-07-12T08:40:03.29555",{"slug":2531,"name":2531,"fn":2532,"description":2533,"org":2534,"tags":2535,"stars":2527,"repoUrl":2528,"updatedAt":2544},"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},[2536,2537,2538,2541],{"name":2421,"slug":2422,"type":16},{"name":2525,"slug":2526,"type":16},{"name":2539,"slug":2540,"type":16},"Management","management",{"name":2542,"slug":2543,"type":16},"Reporting","reporting","2026-07-12T08:40:02.066471",{"slug":2546,"name":2546,"fn":2547,"description":2548,"org":2549,"tags":2550,"stars":2527,"repoUrl":2528,"updatedAt":2559},"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},[2551,2552,2553,2556],{"name":2520,"slug":62,"type":16},{"name":2525,"slug":2526,"type":16},{"name":2554,"slug":2555,"type":16},"Financial Statements","financial-statements",{"name":2557,"slug":2558,"type":16},"Variance Analysis","variance-analysis","2026-07-12T08:40:00.79141",{"slug":2561,"name":2561,"fn":2562,"description":2563,"org":2564,"tags":2565,"stars":2527,"repoUrl":2528,"updatedAt":2574},"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},[2566,2569,2572],{"name":2567,"slug":2568,"type":16},"Automation","automation",{"name":2570,"slug":2571,"type":16},"Documents","documents",{"name":2573,"slug":2561,"type":16},"PDF","2026-07-12T08:41:44.135656",{"slug":2576,"name":2576,"fn":2577,"description":2578,"org":2579,"tags":2580,"stars":2527,"repoUrl":2528,"updatedAt":2587},"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},[2581,2582,2583,2584],{"name":2517,"slug":2518,"type":16},{"name":18,"slug":19,"type":16},{"name":2525,"slug":2526,"type":16},{"name":2585,"slug":2586,"type":16},"KPI","kpi","2026-07-12T08:39:59.54971",150,{"items":2590,"total":527},[2591,2607,2622,2636,2649,2662,2669],{"slug":2592,"name":2592,"fn":2593,"description":2594,"org":2595,"tags":2596,"stars":26,"repoUrl":27,"updatedAt":2606},"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},[2597,2600,2601,2602,2603],{"name":2598,"slug":2599,"type":16},"Architecture","architecture",{"name":2421,"slug":2422,"type":16},{"name":14,"slug":15,"type":16},{"name":21,"slug":22,"type":16},{"name":2604,"slug":2605,"type":16},"LLM","llm","2026-07-12T08:38:07.975937",{"slug":2608,"name":2608,"fn":2609,"description":2610,"org":2611,"tags":2612,"stars":26,"repoUrl":27,"updatedAt":2621},"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},[2613,2614,2617,2618],{"name":2421,"slug":2422,"type":16},{"name":2615,"slug":2616,"type":16},"Bioinformatics","bioinformatics",{"name":21,"slug":22,"type":16},{"name":2619,"slug":2620,"type":16},"Research","research","2026-07-12T08:37:49.295301",{"slug":2623,"name":2623,"fn":2624,"description":2625,"org":2626,"tags":2627,"stars":26,"repoUrl":27,"updatedAt":2635},"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},[2628,2631,2632],{"name":2629,"slug":2630,"type":16},"Clinical Trials","clinical-trials",{"name":21,"slug":22,"type":16},{"name":2633,"slug":2634,"type":16},"Regulatory Compliance","regulatory-compliance","2026-07-12T08:37:33.35594",{"slug":2637,"name":2637,"fn":2638,"description":2639,"org":2640,"tags":2641,"stars":26,"repoUrl":27,"updatedAt":2648},"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},[2642,2643,2644,2645],{"name":2615,"slug":2616,"type":16},{"name":18,"slug":19,"type":16},{"name":21,"slug":22,"type":16},{"name":2646,"slug":2647,"type":16},"RNA-seq","rna-seq","2026-07-12T08:38:05.443454",{"slug":2650,"name":2650,"fn":2651,"description":2652,"org":2653,"tags":2654,"stars":26,"repoUrl":27,"updatedAt":2661},"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},[2655,2656,2659,2660],{"name":2615,"slug":2616,"type":16},{"name":2657,"slug":2658,"type":16},"Chemistry","chemistry",{"name":18,"slug":19,"type":16},{"name":2619,"slug":2620,"type":16},"2026-07-12T08:37:28.334619",{"slug":4,"name":4,"fn":5,"description":6,"org":2663,"tags":2664,"stars":26,"repoUrl":27,"updatedAt":28},{"slug":8,"name":9,"logoUrl":10,"githubOrg":11},[2665,2666,2667,2668],{"name":18,"slug":19,"type":16},{"name":14,"slug":15,"type":16},{"name":24,"slug":25,"type":16},{"name":21,"slug":22,"type":16},{"slug":2670,"name":2670,"fn":2671,"description":2672,"org":2673,"tags":2674,"stars":26,"repoUrl":27,"updatedAt":2678},"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},[2675,2676,2677],{"name":14,"slug":15,"type":16},{"name":24,"slug":25,"type":16},{"name":2633,"slug":2634,"type":16},"2026-07-12T08:38:28.210856"]