{
  "kind": "alaskan.workflow",
  "version": 1,
  "slug": "insurance-claim-follow-up",
  "name": "Insurance claim follow-up",
  "summary": "Twice a week the insurance dog checks every open claim on the payer portals, works out what's missing from the denied ones, and resubmits and chases once you approve.",
  "for": "Dental and medical clinics",
  "author": {
    "name": "Alaskan Labs"
  },
  "license": "MIT",
  "dog": "denali",
  "trigger": {
    "type": "schedule",
    "when": "tue,thu 10:00"
  },
  "nodes": [
    {
      "id": "claims",
      "type": "app",
      "title": "Read the open claims",
      "app": "googlesheets",
      "action": "GOOGLESHEETS_BATCH_GET",
      "input": {
        "ranges": [
          "Claims!A:H"
        ]
      }
    },
    {
      "id": "status",
      "type": "computer",
      "title": "Check each claim's status on the payer portals"
    },
    {
      "id": "sort",
      "type": "think",
      "title": "Sort paid, pending and denied",
      "prompt": "Sort the claims into paid, pending under 30 days, pending over 30 days and denied. For each denied claim, say why and what would fix it (a missing X-ray, a code, a narrative)."
    },
    {
      "id": "approve",
      "type": "decide",
      "kind": "send",
      "title": "Resubmit the denied claims and chase the late ones?",
      "prompt": "{{sort}}",
      "options": [
        {
          "key": "both",
          "label": "Resubmit and chase"
        },
        {
          "key": "chase",
          "label": "Only chase the late ones"
        },
        {
          "key": "skip",
          "label": "Not now",
          "effect": "decline"
        }
      ]
    },
    {
      "id": "resubmit",
      "type": "computer",
      "title": "Resubmit the denied claims with what was missing"
    },
    {
      "id": "chase",
      "type": "app",
      "title": "Email the payers about claims over 30 days",
      "app": "gmail",
      "action": "GMAIL_SEND_EMAIL",
      "write": true,
      "input": {
        "claims": "{{sort}}"
      }
    },
    {
      "id": "update",
      "type": "app",
      "title": "Update the claims sheet",
      "app": "googlesheets",
      "action": "GOOGLESHEETS_BATCH_UPDATE",
      "write": true,
      "input": {
        "column": "Last chased",
        "value": "{{today}}"
      }
    },
    {
      "id": "log",
      "type": "write",
      "title": "Log the claim check"
    }
  ],
  "edges": [
    [
      "claims",
      "status"
    ],
    [
      "status",
      "sort"
    ],
    [
      "sort",
      "approve"
    ],
    [
      "approve",
      "resubmit",
      "both"
    ],
    [
      "resubmit",
      "chase"
    ],
    [
      "approve",
      "chase",
      "chase"
    ],
    [
      "chase",
      "update"
    ],
    [
      "update",
      "log"
    ],
    [
      "approve",
      "log",
      "skip"
    ]
  ]
}
