{
 "use_case": "clinical",
 "title": "Visit copilot: 29 seconds of a synthetic back-pain visit streamed from a file, plus the clinical considerations lane on a synthetic chest-pain transcript",
 "about": "Two cuts from a synthetic primary-care visit (the patient's complaint of eight weeks of back pain shooting down the right leg, and the doctor's assessment: S1 radiculopathy, MRI of the lumbar spine ordered), streamed over the live WebSocket as if from a microphone. The session must produce captions and a SOAP note whose claims are checked against the transcript, with validated ICD-10 codes for lumbar radiculopathy and a visit level. Then, without the speech model, the clinical considerations lane runs on the typed transcript of a second synthetic visit (chest burning after meals, and tightness on the stairs that goes up into the jaw, which the clinician puts down to reflux): it must show the cardiac warning feature with the patient's own words and a cited CDC source, carry the 'not a diagnosis' label with no directive wording, and one accept decision must seal a signed record that verifies and that the clinical AI monitor's audit finds conforming.",
 "licence": "Synthetic: a script written for Decosa (no real people, patients or companies) read by Decosa house voices (Kokoro-82M stock voicepacks, Apache-2.0), each allowed by the consent ledger for project decosa-clinical-demo. Part of decosa-api, AGPL-3.0-or-later.",
 "inputs": [
  {
   "file": "inputs/back-pain-visit-29s.wav",
   "what": "16 kHz mono 16-bit WAV, up to 30 s for a rehearsal (two cuts joined by half a second of silence). Your own recordings must be in the same format (ffmpeg -i in.m4a -ac 1 -ar 16000 -sample_fmt s16 out.wav)."
  },
  {
   "file": "inputs/back-pain-visit-script.json",
   "what": "The script the clip was cut from (only the turns in the clip, with the cut times), to compare the captions against by eye."
  },
  {
   "file": "inputs/chest-pain-transcript.txt",
   "what": "The transcript of the synthetic chest-pain visit (demo script clinical-chest-pain), one line per turn labelled Clinician: or Patient:. Paste your own synthetic transcript in the same shape; never real patient data."
  }
 ],
 "steps": [
  {
   "id": "session",
   "live": {
    "vertical": "clinical",
    "audio": "inputs/back-pain-visit-29s.wav",
    "speed": 2
   },
   "timeout": 150
  },
  {
   "id": "cons",
   "method": "POST",
   "path": "/clinical/considerations",
   "body": {
    "transcript": {
     "$file": "inputs/chest-pain-transcript.txt"
    }
   },
   "timeout": 180
  },
  {
   "id": "decide",
   "method": "POST",
   "path": "/clinical/considerations/decisions",
   "body": {
    "statement": {
     "$ref": "cons.statement"
    },
    "items": {
     "$ref": "cons.items"
    },
    "decisions": [
     {
      "id": "c1",
      "decision": "accepted",
      "reason": "will document the exertional symptoms and the cardiac assessment"
     }
    ]
   }
  },
  {
   "id": "verify",
   "method": "POST",
   "path": "/record/verify",
   "auth": false,
   "body": {
    "$ref": "decide.record"
   }
  },
  {
   "id": "audit",
   "method": "POST",
   "path": "/monitor/considerations",
   "auth": false,
   "body": {
    "output": {
     "$ref": "cons"
    },
    "transcript": {
     "$file": "inputs/chest-pain-transcript.txt"
    }
   }
  }
 ],
 "checks": [
  {
   "says": "the session ends with a done event",
   "path": "session.done",
   "exists": true
  },
  {
   "says": "the session reports no errors",
   "path": "session.errors",
   "count": 0
  },
  {
   "says": "the captions carry the complaint and the MRI order",
   "path": "session.captions.text",
   "contains": [
    "back",
    "MRI"
   ]
  },
  {
   "says": "the final SOAP note names the radiculopathy and the MRI",
   "path": "session.done.summary.note_markdown",
   "contains": [
    "radiculopathy",
    "MRI"
   ]
  },
  {
   "says": "the note is self-checked before it is final: at least 3 sentences checked and supported by the transcript",
   "path": "session.done.summary.selfcheck.summary.supported",
   "min": 3
  },
  {
   "says": "the transcript comes back with speaker labels: the clinician",
   "path": "session.done.summary.final_transcript.lines.role",
   "contains": "Clinician"
  },
  {
   "says": "and the patient",
   "path": "session.done.summary.final_transcript.lines.role",
   "contains": "Patient"
  },
  {
   "says": "the final note is marked self-checked",
   "path": "session.done.summary.final_note.status",
   "equals": "self-checked"
  },
  {
   "says": "the paperwork drafts never fill a signature",
   "path": "session.done.summary.paperwork.signatures_filled",
   "equals": 0
  },
  {
   "says": "a validated ICD-10 code for radiculopathy is suggested",
   "path": "session.done.summary.codes.icd10[validated=true].name",
   "contains": "radiculopathy"
  },
  {
   "says": "a visit level (E/M) is proposed from the problems addressed",
   "path": "session.done.summary.visit_level.problems.level",
   "in": [
    "minimal",
    "low",
    "moderate",
    "high"
   ]
  },
  {
   "says": "the live session also returns the clinical considerations lane with its label",
   "path": "session.done.summary.considerations.label",
   "contains": "not a diagnosis"
  },
  {
   "says": "the chest-pain visit shows the cardiac warning feature as a consideration",
   "path": "cons.items[kind=red_flag].topic",
   "contains": "rf_acs"
  },
  {
   "says": "the cardiac item quotes the patient's words about the jaw",
   "path": "cons.items[topic=rf_acs].quotes.text",
   "contains": "jaw"
  },
  {
   "says": "the cardiac item cites a CDC or NHLBI page",
   "path": "cons.items[topic=rf_acs].source.url",
   "contains": ".gov"
  },
  {
   "says": "everything the lane wrote passes the directive-language check",
   "path": "cons.directive_lint.ok",
   "equals": true
  },
  {
   "says": "the output is for the clinician only and is never inserted into the note",
   "path": "cons.statement.auto_insert",
   "equals": false
  },
  {
   "says": "the accept decision seals a record that verifies",
   "path": "decide.record_check.ok",
   "equals": true
  },
  {
   "says": "the record verifier accepts it",
   "path": "verify.ok",
   "equals": true
  },
  {
   "says": "the clinical AI monitor's audit finds the output conforming (quotes, citations, wording, labels, signature)",
   "path": "audit.decision",
   "equals": "conforms"
  },
  {
   "says": "every speech and model call has a signed receipt",
   "receipts": "signed"
  }
 ]
}
