{
 "use_case": "denial-appeal-packet",
 "title": "Denial appeal packet: two Medicare CPAP denials, one supported by the chart and one not",
 "about": "Two synthetic Medicare CPAP denials (CO-50 N386, AHI under 15) against CMS NCD 240.4. In the first, the home sleep test shows an AHI of 11.2 and the chart documents daytime sleepiness and hypertension, which meets criterion 5b: the packet must recommend an appeal, draft a letter, and compute the redetermination deadline (notice date + 5 days presumed receipt + 120 days). In the second, the AHI is 10.4 and the chart says the patient has no daytime sleepiness, insomnia, hypertension, heart disease or stroke, while a physician letter asserts the criteria are met: the packet must recommend not appealing and draft no letter. The signed packet must verify, and fail once changed.",
 "licence": "Synthetic cases (CC0): the patients, notes, providers and payer are invented (scripts/appeal_cases.py). Policy: an excerpt of CMS NCD 240.4 (US government work, public domain). Part of decosa-api, AGPL-3.0-or-later.",
 "inputs": [
  {
   "file": "inputs/supported-denial.json",
   "what": "The first denial: a Medicare remittance notice with CO-50 N386, and the plan type and level."
  },
  {
   "file": "inputs/supported-records.json",
   "what": "Its chart excerpts: the sleep medicine consultation and the home sleep test report."
  },
  {
   "file": "inputs/unsupported-denial.json",
   "what": "The second denial, same codes."
  },
  {
   "file": "inputs/unsupported-records.json",
   "what": "Its chart excerpts: consultation, sleep test and a physician letter asserting the criteria are met."
  },
  {
   "file": "inputs/policy.json",
   "what": "The coverage criteria: an excerpt of CMS NCD 240.4, section B."
  }
 ],
 "steps": [
  {
   "id": "deadline",
   "method": "POST",
   "path": "/appeal/deadlines",
   "auth": false,
   "body": {
    "plan_type": "medicare_ab",
    "level": "initial",
    "notice_date": "2026-09-08"
   }
  },
  {
   "id": "supported",
   "method": "POST",
   "path": "/appeal/packet",
   "body": {
    "denial": {
     "$file": "inputs/supported-denial.json"
    },
    "records": {
     "$file": "inputs/supported-records.json"
    },
    "policy": {
     "$file": "inputs/policy.json"
    },
    "service": "E0601 continuous positive airway pressure device",
    "title": "Rehearsal: CPAP, supported"
   }
  },
  {
   "id": "verify",
   "method": "POST",
   "path": "/record/verify",
   "auth": false,
   "body": {
    "record": {
     "$ref": "supported.record"
    }
   }
  },
  {
   "id": "tampered",
   "method": "POST",
   "path": "/record/verify",
   "auth": false,
   "body": {
    "record": {
     "$ref": "supported.record"
    }
   },
   "tamper": {
    "at": "record.statement.decision",
    "set": "do_not_appeal"
   }
  },
  {
   "id": "unsupported",
   "method": "POST",
   "path": "/appeal/packet",
   "body": {
    "denial": {
     "$file": "inputs/unsupported-denial.json"
    },
    "records": {
     "$file": "inputs/unsupported-records.json"
    },
    "policy": {
     "$file": "inputs/policy.json"
    },
    "service": "E0601 continuous positive airway pressure device",
    "title": "Rehearsal: CPAP, not supported"
   }
  }
 ],
 "checks": [
  {
   "says": "the redetermination deadline is the notice date + 5 days presumed receipt + 120 days (no model)",
   "path": "deadline.next.deadline",
   "equals": "2027-01-11"
  },
  {
   "says": "the supported case is recommended for appeal",
   "path": "supported.recommendation.decision",
   "equals": "appeal"
  },
  {
   "says": "the notice date is read from the denial and gives the same deadline",
   "path": "supported.deadlines.next.deadline",
   "equals": "2027-01-11"
  },
  {
   "says": "the AHI 5 to 14 criterion is met with the study's AHI quoted",
   "path": "supported.criteria[quote~less than or equal to 14][0].evidence[0].quote",
   "contains": "11.2"
  },
  {
   "says": "a letter is drafted and cites the AHI",
   "path": "supported.letter",
   "contains": "11.2"
  },
  {
   "says": "the unsupported case is not recommended for appeal",
   "path": "unsupported.recommendation.decision",
   "equals": "do_not_appeal"
  },
  {
   "says": "and no letter is drafted for it",
   "path": "unsupported.letter",
   "equals": null
  },
  {
   "says": "the signed packet verifies",
   "path": "verify.ok",
   "equals": true
  },
  {
   "says": "a packet whose recommendation was changed no longer verifies",
   "path": "tampered.ok",
   "equals": false
  },
  {
   "says": "every model call has a signed receipt",
   "receipts": "signed",
   "min": 8
  }
 ]
}