{
 "use_case": "prior-auth-check",
 "title": "Prior-auth pre-check: two CPAP requests against Aetna CPB 0004, one the chart supports and one it does not",
 "about": "Two synthetic CPAP requests checked against the CPAP section of Aetna Clinical Policy Bulletin 0004 (Obstructive Sleep Apnea in Adults), before sending. In the first, an attended in-lab sleep study shows an AHI of 26.5 over more than 6 hours of sleep: the check must say ready to send, quote the study, and draft a letter of medical necessity. In the second, the home sleep test index is 3.6 events per hour, below the policy minimum, while a physician letter asserts the criteria are met: the check must say not supported on this chart and draft no letter. The signed record must verify, and fail once changed.",
 "licence": "Synthetic charts (CC0): patients, notes and clinicians are invented. Policy: an excerpt of Aetna CPB 0004 (the payer's published medical policy, https://www.aetna.com/cpb/medical/data/1_99/0004.html), quoted for demonstration with its source. Part of decosa-api, AGPL-3.0-or-later.",
 "inputs": [
  {
   "file": "inputs/policy.json",
   "what": "The CPAP criteria section of Aetna CPB 0004 (excerpt)."
  },
  {
   "file": "inputs/ready-records.json",
   "what": "The first chart: sleep consultation, in-lab sleep study, follow-up."
  },
  {
   "file": "inputs/not-supported-records.json",
   "what": "The second chart: consultation, home sleep test with an index of 3.6, and a physician letter."
  }
 ],
 "steps": [
  {
   "id": "ready",
   "method": "POST",
   "path": "/priorauth/check",
   "timeout": 300,
   "body": {
    "service": "CPAP or auto-titrating PAP (APAP) device for obstructive sleep apnea in an adult",
    "codes": {
     "procedure": [
      "E0601"
     ],
     "diagnosis": [
      "G47.33"
     ]
    },
    "payer": "Aetna",
    "plan_type": "erisa_group",
    "patient_ref": "DEMO (synthetic)",
    "policy": {
     "$file": "inputs/policy.json"
    },
    "records": {
     "$file": "inputs/ready-records.json"
    },
    "request_date": "2026-09-14",
    "title": "Rehearsal: CPAP, ready"
   }
  },
  {
   "id": "verify",
   "method": "POST",
   "path": "/record/verify",
   "auth": false,
   "body": {
    "record": {
     "$ref": "ready.record"
    }
   }
  },
  {
   "id": "tampered",
   "method": "POST",
   "path": "/record/verify",
   "auth": false,
   "body": {
    "record": {
     "$ref": "ready.record"
    }
   },
   "tamper": {
    "at": "record.statement.decision",
    "set": "not_supported"
   }
  },
  {
   "id": "notsup",
   "method": "POST",
   "path": "/priorauth/check",
   "timeout": 300,
   "body": {
    "service": "CPAP or auto-titrating PAP (APAP) device for obstructive sleep apnea in an adult",
    "codes": {
     "procedure": [
      "E0601"
     ],
     "diagnosis": [
      "G47.33"
     ]
    },
    "payer": "Aetna",
    "plan_type": "erisa_group",
    "patient_ref": "DEMO (synthetic)",
    "policy": {
     "$file": "inputs/policy.json"
    },
    "records": {
     "$file": "inputs/not-supported-records.json"
    },
    "request_date": "2026-09-03",
    "title": "Rehearsal: CPAP, not supported"
   }
  }
 ],
 "checks": [
  {
   "says": "the supported request is ready to send",
   "path": "ready.recommendation.decision",
   "equals": "ready"
  },
  {
   "says": "a letter of medical necessity is drafted and cites the AHI",
   "path": "ready.letter",
   "contains": "26.5"
  },
  {
   "says": "the unsupported request is not supported on this chart",
   "path": "notsup.recommendation.decision",
   "equals": "not_supported"
  },
  {
   "says": "and no letter is drafted for it",
   "path": "notsup.letter",
   "equals": null
  },
  {
   "says": "the not-met criterion quotes the 3.6 index",
   "path": "notsup.criteria[status=not_met][0].evidence[0].quote",
   "contains": "3.6"
  },
  {
   "says": "the signed record verifies",
   "path": "verify.ok",
   "equals": true
  },
  {
   "says": "a record whose decision was changed no longer verifies",
   "path": "tampered.ok",
   "equals": false
  },
  {
   "says": "every model call has a signed receipt",
   "receipts": "signed",
   "min": 8
  }
 ]
}