{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/licium-ai/json-schema/licium-ai-payer-follow-up-report-application-schema.json",
  "title": "PayerFollowUpReportApplication",
  "description": "One application in a weekly status report.",
  "x-generated": "2026-11-15",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/licium-ai-openapi.json#/components/schemas/PayerFollowUpReportApplication",
  "type": "object",
  "properties": {
    "id": {
      "type": "string",
      "format": "uuid"
    },
    "clinician": {
      "type": [
        "string",
        "null"
      ]
    },
    "npi": {
      "type": "string"
    },
    "payer": {
      "type": "string"
    },
    "state": {
      "type": "string"
    },
    "submitted_on": {
      "type": [
        "string",
        "null"
      ],
      "format": "date"
    },
    "to_submit": {
      "type": "boolean",
      "description": "An application we write and submit, not submitted yet."
    },
    "status": {
      "enum": [
        "not_checked",
        "received",
        "in_review",
        "needs_documents",
        "approved",
        "denied",
        "no_record"
      ]
    },
    "status_label": {
      "type": "string"
    },
    "payer_words": {
      "type": [
        "string",
        "null"
      ],
      "description": "The status in the payer's own words: its page's words, the representative's, or what was written down."
    },
    "status_date": {
      "type": [
        "string",
        "null"
      ],
      "description": "The date the payer's page gives with that status, as shown."
    },
    "expected_decision": {
      "type": [
        "string",
        "null"
      ],
      "description": "When a representative said a decision is expected, as said."
    },
    "note": {
      "type": [
        "string",
        "null"
      ],
      "description": "What the person who recorded it wrote down, when payer_words came from the payer's page."
    },
    "effective_date": {
      "type": [
        "string",
        "null"
      ],
      "format": "date"
    },
    "reference": {
      "type": [
        "string",
        "null"
      ],
      "description": "The application's number with the payer, or null."
    },
    "source": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "kind": {
          "enum": [
            "status_page",
            "call",
            "email",
            "portal",
            "person"
          ]
        },
        "label": {
          "type": "string"
        },
        "url": {
          "type": [
            "string",
            "null"
          ]
        },
        "at": {
          "type": "string"
        },
        "rep_name": {
          "type": [
            "string",
            "null"
          ]
        },
        "call_reference": {
          "type": [
            "string",
            "null"
          ]
        },
        "note": {
          "type": [
            "string",
            "null"
          ]
        },
        "method": {
          "enum": [
            "portal",
            "phone",
            "email"
          ]
        }
      }
    },
    "missing": {
      "type": [
        "string",
        "null"
      ]
    },
    "waiting_on": {
      "enum": [
        "payer",
        "practice",
        "nobody"
      ]
    },
    "next_step": {
      "type": "string"
    },
    "last_checked_at": {
      "type": [
        "string",
        "null"
      ]
    },
    "next_check_on": {
      "type": [
        "string",
        "null"
      ],
      "format": "date"
    },
    "changed_this_week": {
      "type": "boolean"
    },
    "history": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "checked_at": {
            "type": "string"
          },
          "status": {
            "type": "string"
          },
          "status_label": {
            "type": "string"
          },
          "payer_words": {
            "type": [
              "string",
              "null"
            ]
          },
          "source_kind": {
            "enum": [
              "status_page",
              "call",
              "email",
              "portal",
              "person"
            ]
          },
          "source_label": {
            "type": "string"
          },
          "rep_name": {
            "type": [
              "string",
              "null"
            ]
          },
          "call_reference": {
            "type": [
              "string",
              "null"
            ]
          }
        }
      }
    },
    "status_check_page": {
      "type": [
        "string",
        "null"
      ],
      "description": "The page POST /v1/payer-follow-ups/status-check reads for this payer in this state, or null."
    },
    "reply": {
      "type": [
        "object",
        "null"
      ],
      "description": "The payer's email reply the current status came from, or null.",
      "properties": {
        "received_at": {
          "type": "string"
        },
        "from": {
          "type": [
            "string",
            "null"
          ]
        },
        "from_address": {
          "type": [
            "string",
            "null"
          ]
        },
        "subject": {
          "type": [
            "string",
            "null"
          ]
        },
        "text": {
          "type": [
            "string",
            "null"
          ],
          "description": "The reply's own text, without the quoted question."
        },
        "asked_at": {
          "type": [
            "string",
            "null"
          ]
        },
        "asked_to": {
          "type": [
            "string",
            "null"
          ]
        },
        "inquiry": {
          "type": [
            "string",
            "null"
          ],
          "description": "The status question's number."
        }
      }
    },
    "alert": {
      "type": [
        "object",
        "null"
      ],
      "description": "The missing-documents alert sent for what the payer asked (needs documents only), or null.",
      "properties": {
        "sent_on": {
          "type": "string",
          "format": "date"
        },
        "to": {
          "enum": [
            "firm",
            "practice"
          ]
        }
      }
    },
    "now_doing": {
      "anyOf": [
        {
          "$ref": "#/$defs/PayerFollowUpNowDoing"
        },
        {
          "type": "null"
        }
      ],
      "description": "What is happening on it right now, or the last thing done, with that record's time."
    },
    "receipts": {
      "type": "array",
      "description": "Each message sent to the payer about it, newest first, with sent, arrived and answered.",
      "items": {
        "$ref": "#/$defs/PayerFollowUpMessageReceipt"
      }
    },
    "overlaps": {
      "type": "array",
      "description": "Another open application for the same clinician, payer and state (on the firm's view, also at another of its practices).",
      "items": {
        "$ref": "#/$defs/PayerFollowUpOverlap"
      }
    }
  },
  "$defs": {
    "PayerFollowUpMessageReceipt": {
      "type": "object",
      "required": [
        "channel",
        "what",
        "to",
        "steps"
      ],
      "description": "One message that went to the payer about the application, with its three steps.",
      "properties": {
        "channel": {
          "enum": [
            "email",
            "phone",
            "fax",
            "mail",
            "web"
          ]
        },
        "what": {
          "type": "string",
          "description": "Status question, Automated status call, Status call, or Written application."
        },
        "to": {
          "type": "string",
          "description": "The payer's inbox address, its line's name, or the payer."
        },
        "steps": {
          "type": "array",
          "minItems": 3,
          "maxItems": 3,
          "description": "sent, arrived and answered, in that order.",
          "items": {
            "type": "object",
            "required": [
              "step",
              "label",
              "state",
              "at",
              "words"
            ],
            "properties": {
              "step": {
                "enum": [
                  "sent",
                  "arrived",
                  "answered"
                ]
              },
              "label": {
                "type": "string",
                "description": "The step's name for the channel: Sent, Called, Reached a person, Fax line confirmed, Delivered, Answered, Payer has it."
              },
              "state": {
                "enum": [
                  "done",
                  "waiting",
                  "failed",
                  "not_tracked"
                ],
                "description": "not_tracked: the channel gives no receipt for this step (an email's arrival is known only once the payer replies)."
              },
              "at": {
                "type": [
                  "string",
                  "null"
                ],
                "format": "date-time"
              },
              "words": {
                "type": "string",
                "description": "What the record says about the step, such as \"no one came on the line\" or \"Gave the status: in review\"."
              }
            }
          }
        }
      }
    },
    "PayerFollowUpNowDoing": {
      "type": "object",
      "required": [
        "kind",
        "words",
        "at",
        "live",
        "from"
      ],
      "description": "What is happening on the application right now, or the last thing done, read from the records the checks leave (a call on the line, a status email and its replies, a status page or portal read, the written application's send). Never typed by a person.",
      "properties": {
        "kind": {
          "enum": [
            "dialing",
            "phone_menu",
            "on_hold",
            "on_call",
            "talking",
            "callback_wait",
            "call_recording",
            "call_retry",
            "email_approval",
            "email_sending",
            "email_waiting",
            "email_acknowledged",
            "reply_reading",
            "email_other_way",
            "page_reading",
            "page_read",
            "portal_read",
            "email_answered",
            "call_answered",
            "person_checked",
            "person_confirming",
            "queued",
            "submission",
            "waiting_practice",
            "scheduled",
            "decided",
            "stopped",
            "not_started",
            "paused",
            "ended",
            "faxing",
            "fax_waiting",
            "fax_failed",
            "fax_reading"
          ],
          "description": "For example on_hold, phone_menu, talking (a representative came on), callback_wait, email_waiting, email_acknowledged, reply_reading, page_read, portal_read, call_answered, person_confirming, queued (a check that is due, or one a person makes), submission, waiting_practice, scheduled, decided, stopped, not_started."
        },
        "words": {
          "type": "string",
          "description": "One sentence without a time, such as \"On hold with Aetna provider services\" or \"Read Medicare's status page\"."
        },
        "at": {
          "type": [
            "string",
            "null"
          ],
          "format": "date-time",
          "description": "When it started or happened: the call's start, the email's sending, the page's read. A future time is a planned check. Null when no record carries a time."
        },
        "live": {
          "type": "boolean",
          "description": "true while it is happening (a call on the line, a reply or a page being read, a person confirming an answer)."
        },
        "from": {
          "enum": [
            "call",
            "status_email",
            "email_reply",
            "status_page",
            "portal",
            "check",
            "check_task",
            "submission",
            "follow_up",
            "fax"
          ],
          "description": "The record the line is read from."
        }
      }
    },
    "PayerFollowUpOverlap": {
      "type": "object",
      "required": [
        "application_id",
        "where",
        "practice",
        "started_on",
        "words"
      ],
      "description": "Another open application for the same clinician, payer and state (one started twice). A payer may turn back an application it gets twice.",
      "properties": {
        "application_id": {
          "type": [
            "string",
            "null"
          ],
          "format": "uuid",
          "description": "The other application."
        },
        "where": {
          "enum": [
            "this_follow_up",
            "another_practice"
          ],
          "description": "this_follow_up: listed twice in this follow-up; another_practice: at another practice of the same credentialing firm (the firm's view only)."
        },
        "practice": {
          "type": [
            "string",
            "null"
          ],
          "description": "another_practice: that practice's name."
        },
        "started_on": {
          "type": "string",
          "format": "date",
          "description": "The day the other one was added."
        },
        "words": {
          "type": "string",
          "description": "What to check, in one or two sentences."
        }
      }
    }
  }
}