{
  "$id": "https://schemas.interoplayer.com/v1/claim-837p-advanced-request.json",
  "title": "Interoplayer expanded 837P translation request v2 (uncertified profile)",
  "type": "object",
  "additionalProperties": false,
  "required": [
    "schemaVersion",
    "transaction",
    "submitter",
    "receiver",
    "claims"
  ],
  "properties": {
    "schemaVersion": {
      "const": "2.0"
    },
    "transaction": {
      "type": "object",
      "additionalProperties": false,
      "required": [
        "controlNumber",
        "submitterTransactionIdentifier",
        "creationDate",
        "creationTime",
        "purposeCode"
      ],
      "properties": {
        "controlNumber": {
          "type": "string",
          "pattern": "^[0-9]{4,9}$"
        },
        "submitterTransactionIdentifier": {
          "type": "string",
          "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,49}$"
        },
        "creationDate": {
          "type": "string",
          "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
        },
        "creationTime": {
          "type": "string",
          "pattern": "^[0-9]{2}:[0-9]{2}(:[0-9]{2})?$"
        },
        "purposeCode": {
          "enum": ["00", "18"]
        }
      }
    },
    "submitter": {
      "type": "object",
      "additionalProperties": false,
      "required": ["organizationName", "identifier", "contact"],
      "properties": {
        "organizationName": {
          "type": "string",
          "minLength": 1,
          "maxLength": 60
        },
        "identifier": {
          "type": "string",
          "pattern": "^[A-Za-z0-9]{2,80}$"
        },
        "contact": {
          "type": "object",
          "additionalProperties": false,
          "required": ["name", "phone"],
          "properties": {
            "name": {
              "type": "string",
              "minLength": 1,
              "maxLength": 60
            },
            "phone": {
              "type": "string",
              "pattern": "^[0-9]{10,15}$"
            },
            "email": {
              "type": "string",
              "minLength": 3,
              "maxLength": 80,
              "pattern": "^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$"
            }
          }
        }
      }
    },
    "receiver": {
      "type": "object",
      "additionalProperties": false,
      "required": ["organizationName", "identifier"],
      "properties": {
        "organizationName": {
          "type": "string",
          "minLength": 1,
          "maxLength": 60
        },
        "identifier": {
          "type": "string",
          "pattern": "^[A-Za-z0-9]{2,80}$"
        }
      }
    },
    "claims": {
      "type": "array",
      "minItems": 1,
      "maxItems": 100,
      "items": {
        "type": "object",
        "additionalProperties": false,
        "required": ["billingProvider", "subscriber", "payer", "claim"],
        "properties": {
          "billingProvider": {
            "oneOf": [
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "entityType",
                  "organizationName",
                  "npi",
                  "taxonomyCode",
                  "taxId",
                  "address"
                ],
                "properties": {
                  "entityType": {
                    "const": "organization"
                  },
                  "organizationName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  },
                  "npi": {
                    "type": "string",
                    "pattern": "^[0-9]{10}$"
                  },
                  "taxonomyCode": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9]{10}$"
                  },
                  "taxId": {
                    "type": "string",
                    "pattern": "^[0-9]{9}$"
                  },
                  "address": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": ["address1", "city", "state", "postalCode"],
                    "properties": {
                      "address1": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 55
                      },
                      "address2": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 55
                      },
                      "city": {
                        "type": "string",
                        "minLength": 2,
                        "maxLength": 30
                      },
                      "state": {
                        "type": "string",
                        "pattern": "^[A-Za-z]{2}$"
                      },
                      "postalCode": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9][A-Za-z0-9 -]{1,13}[A-Za-z0-9]$"
                      }
                    }
                  },
                  "contact": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": ["name", "phone"],
                    "properties": {
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 60
                      },
                      "phone": {
                        "type": "string",
                        "pattern": "^[0-9]{10,15}$"
                      }
                    }
                  }
                }
              },
              {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "entityType",
                  "firstName",
                  "lastName",
                  "npi",
                  "taxonomyCode",
                  "taxId",
                  "address"
                ],
                "properties": {
                  "entityType": {
                    "const": "person"
                  },
                  "firstName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 35
                  },
                  "middleName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 25
                  },
                  "lastName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  },
                  "npi": {
                    "type": "string",
                    "pattern": "^[0-9]{10}$"
                  },
                  "taxonomyCode": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9]{10}$"
                  },
                  "taxId": {
                    "type": "string",
                    "pattern": "^[0-9]{9}$"
                  },
                  "address": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": ["address1", "city", "state", "postalCode"],
                    "properties": {
                      "address1": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 55
                      },
                      "address2": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 55
                      },
                      "city": {
                        "type": "string",
                        "minLength": 2,
                        "maxLength": 30
                      },
                      "state": {
                        "type": "string",
                        "pattern": "^[A-Za-z]{2}$"
                      },
                      "postalCode": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9][A-Za-z0-9 -]{1,13}[A-Za-z0-9]$"
                      }
                    }
                  },
                  "contact": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": ["name", "phone"],
                    "properties": {
                      "name": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 60
                      },
                      "phone": {
                        "type": "string",
                        "pattern": "^[0-9]{10,15}$"
                      }
                    }
                  }
                }
              }
            ]
          },
          "payToProvider": {
            "type": "object",
            "additionalProperties": false,
            "required": ["organizationName", "address"],
            "properties": {
              "organizationName": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              },
              "npi": {
                "type": "string",
                "pattern": "^[0-9]{10}$"
              },
              "secondaryIdentifier": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$"
              },
              "address": {
                "type": "object",
                "additionalProperties": false,
                "required": ["address1", "city", "state", "postalCode"],
                "properties": {
                  "address1": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 55
                  },
                  "address2": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 55
                  },
                  "city": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 30
                  },
                  "state": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2}$"
                  },
                  "postalCode": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9][A-Za-z0-9 -]{1,13}[A-Za-z0-9]$"
                  }
                }
              }
            }
          },
          "subscriber": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "firstName",
              "lastName",
              "memberId",
              "dateOfBirth",
              "gender",
              "relationshipCode",
              "address"
            ],
            "properties": {
              "firstName": {
                "type": "string",
                "minLength": 1,
                "maxLength": 35
              },
              "middleName": {
                "type": "string",
                "minLength": 1,
                "maxLength": 25
              },
              "lastName": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              },
              "memberId": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$"
              },
              "groupNumber": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,49}$"
              },
              "dateOfBirth": {
                "type": "string",
                "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
              },
              "gender": {
                "enum": ["F", "M", "U"]
              },
              "relationshipCode": {
                "const": "18"
              },
              "address": {
                "type": "object",
                "additionalProperties": false,
                "required": ["address1", "city", "state", "postalCode"],
                "properties": {
                  "address1": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 55
                  },
                  "address2": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 55
                  },
                  "city": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 30
                  },
                  "state": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2}$"
                  },
                  "postalCode": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9][A-Za-z0-9 -]{1,13}[A-Za-z0-9]$"
                  }
                }
              }
            }
          },
          "patient": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "firstName",
              "lastName",
              "dateOfBirth",
              "gender",
              "relationshipCode",
              "address"
            ],
            "properties": {
              "firstName": {
                "type": "string",
                "minLength": 1,
                "maxLength": 35
              },
              "middleName": {
                "type": "string",
                "minLength": 1,
                "maxLength": 25
              },
              "lastName": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              },
              "dateOfBirth": {
                "type": "string",
                "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
              },
              "gender": {
                "enum": ["F", "M", "U"]
              },
              "relationshipCode": {
                "type": "string",
                "pattern": "^(?!18$)[A-Za-z0-9]{2}$"
              },
              "address": {
                "type": "object",
                "additionalProperties": false,
                "required": ["address1", "city", "state", "postalCode"],
                "properties": {
                  "address1": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 55
                  },
                  "address2": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 55
                  },
                  "city": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 30
                  },
                  "state": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2}$"
                  },
                  "postalCode": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9][A-Za-z0-9 -]{1,13}[A-Za-z0-9]$"
                  }
                }
              }
            }
          },
          "payer": {
            "type": "object",
            "additionalProperties": false,
            "required": ["organizationName", "identifier"],
            "properties": {
              "organizationName": {
                "type": "string",
                "minLength": 1,
                "maxLength": 60
              },
              "identifier": {
                "type": "string",
                "pattern": "^[A-Za-z0-9]{2,80}$"
              },
              "address": {
                "type": "object",
                "additionalProperties": false,
                "required": ["address1", "city", "state", "postalCode"],
                "properties": {
                  "address1": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 55
                  },
                  "address2": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 55
                  },
                  "city": {
                    "type": "string",
                    "minLength": 2,
                    "maxLength": 30
                  },
                  "state": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2}$"
                  },
                  "postalCode": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9][A-Za-z0-9 -]{1,13}[A-Za-z0-9]$"
                  }
                }
              }
            }
          },
          "claim": {
            "type": "object",
            "additionalProperties": false,
            "required": [
              "patientControlNumber",
              "totalChargeAmount",
              "placeOfServiceCode",
              "frequencyCode",
              "claimFilingIndicatorCode",
              "diagnoses",
              "serviceLines"
            ],
            "properties": {
              "patientControlNumber": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,37}$"
              },
              "totalChargeAmount": {
                "type": "string",
                "pattern": "^(0|[1-9][0-9]{0,9})(\\.[0-9]{1,2})?$"
              },
              "placeOfServiceCode": {
                "type": "string",
                "pattern": "^[0-9]{2}$"
              },
              "frequencyCode": {
                "enum": ["1", "7", "8"]
              },
              "claimFilingIndicatorCode": {
                "enum": [
                  "BL",
                  "CH",
                  "CI",
                  "HM",
                  "MA",
                  "MB",
                  "MC",
                  "OF",
                  "TV",
                  "VA",
                  "WC",
                  "ZZ"
                ]
              },
              "payerClaimControlNumber": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,49}$"
              },
              "diagnoses": {
                "type": "array",
                "minItems": 1,
                "maxItems": 12,
                "uniqueItems": true,
                "items": {
                  "type": "string",
                  "pattern": "^[A-Za-z][A-Za-z0-9]{2,6}$"
                }
              },
              "renderingProvider": {
                "type": "object",
                "additionalProperties": false,
                "required": ["firstName", "lastName", "npi"],
                "properties": {
                  "firstName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 35
                  },
                  "middleName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 25
                  },
                  "lastName": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 60
                  },
                  "npi": {
                    "type": "string",
                    "pattern": "^[0-9]{10}$"
                  },
                  "taxonomyCode": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9]{10}$"
                  }
                }
              },
              "serviceLines": {
                "type": "array",
                "minItems": 1,
                "maxItems": 50,
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "procedureCode",
                    "chargeAmount",
                    "unitCount",
                    "serviceDate",
                    "diagnosisPointers"
                  ],
                  "properties": {
                    "procedureCode": {
                      "type": "string",
                      "pattern": "^(?:[0-9]{5}|[0-9]{4}[A-Za-z]|[A-Za-z][0-9]{4})$"
                    },
                    "modifiers": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 4,
                      "uniqueItems": true,
                      "items": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9]{2}$"
                      }
                    },
                    "chargeAmount": {
                      "type": "string",
                      "pattern": "^(0|[1-9][0-9]{0,9})(\\.[0-9]{1,2})?$"
                    },
                    "unitCount": {
                      "type": "string",
                      "pattern": "^(0|[1-9][0-9]{0,6})(\\.[0-9]{1,3})?$"
                    },
                    "serviceDate": {
                      "type": "string",
                      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
                    },
                    "diagnosisPointers": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 4,
                      "uniqueItems": true,
                      "items": {
                        "type": "integer",
                        "minimum": 1,
                        "maximum": 12
                      }
                    },
                    "placeOfServiceCode": {
                      "type": "string",
                      "pattern": "^[0-9]{2}$"
                    },
                    "serviceDateEnd": {
                      "type": "string",
                      "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
                    },
                    "unitCode": {
                      "enum": ["MJ", "UN"]
                    },
                    "lineControlNumber": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$"
                    },
                    "emergencyIndicator": {
                      "enum": ["N", "Y"]
                    },
                    "priorAuthorizationNumber": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$"
                    },
                    "referralNumber": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$"
                    },
                    "notes": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 10,
                      "items": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 80
                      }
                    },
                    "attachments": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 10,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": ["reportTypeCode", "transmissionCode"],
                        "properties": {
                          "reportTypeCode": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9]{2}$"
                          },
                          "transmissionCode": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9]{2}$"
                          },
                          "controlNumber": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$"
                          }
                        }
                      }
                    },
                    "drug": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": ["nationalDrugCode", "quantity", "unitCode"],
                      "properties": {
                        "nationalDrugCode": {
                          "type": "string",
                          "pattern": "^[0-9]{11}$"
                        },
                        "quantity": {
                          "type": "string",
                          "pattern": "^(0|[1-9][0-9]{0,6})(\\.[0-9]{1,3})?$"
                        },
                        "unitCode": {
                          "enum": ["F2", "GR", "ME", "ML", "UN"]
                        },
                        "salesTaxAmount": {
                          "type": "string",
                          "pattern": "^(0|[1-9][0-9]{0,9})(\\.[0-9]{1,2})?$"
                        }
                      }
                    },
                    "ambulancePatientCount": {
                      "type": "integer",
                      "minimum": 1,
                      "maximum": 99
                    },
                    "ambulance": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": ["transportReasonCode", "distanceMiles"],
                      "properties": {
                        "transportReasonCode": {
                          "type": "string",
                          "pattern": "^[A-Za-z0-9]{1,2}$"
                        },
                        "distanceMiles": {
                          "type": "string",
                          "pattern": "^(0|[1-9][0-9]{0,6})(\\.[0-9]{1,3})?$"
                        },
                        "roundTripPurposeDescription": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 80
                        }
                      }
                    },
                    "dme": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "certificationTypeCode",
                        "durationUnitCode",
                        "duration"
                      ],
                      "properties": {
                        "certificationTypeCode": {
                          "enum": ["I", "R", "S"]
                        },
                        "durationUnitCode": {
                          "enum": ["DA", "MO", "WK"]
                        },
                        "duration": {
                          "type": "string",
                          "pattern": "^(0|[1-9][0-9]{0,6})(\\.[0-9]{1,3})?$"
                        },
                        "beginTherapyDate": {
                          "type": "string",
                          "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
                        },
                        "lastCertificationDate": {
                          "type": "string",
                          "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
                        },
                        "measurements": {
                          "type": "array",
                          "minItems": 1,
                          "maxItems": 20,
                          "items": {
                            "type": "object",
                            "additionalProperties": false,
                            "required": ["referenceId", "qualifier", "value"],
                            "properties": {
                              "referenceId": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9]{1,3}$"
                              },
                              "qualifier": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9]{1,3}$"
                              },
                              "value": {
                                "type": "string",
                                "pattern": "^[A-Za-z0-9.+-]{1,20}$"
                              }
                            }
                          }
                        },
                        "form": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": ["identificationCode", "answers"],
                          "properties": {
                            "identificationCode": {
                              "type": "string",
                              "pattern": "^[A-Za-z0-9.]{1,20}$"
                            },
                            "answers": {
                              "type": "array",
                              "minItems": 1,
                              "maxItems": 50,
                              "items": {
                                "type": "object",
                                "additionalProperties": false,
                                "required": ["questionNumber"],
                                "minProperties": 2,
                                "properties": {
                                  "questionNumber": {
                                    "type": "string",
                                    "pattern": "^[A-Za-z0-9]{1,20}$"
                                  },
                                  "responseCode": {
                                    "type": "string",
                                    "pattern": "^[A-Za-z0-9]{1,3}$"
                                  },
                                  "responseValue": {
                                    "type": "string",
                                    "minLength": 1,
                                    "maxLength": 30
                                  }
                                }
                              }
                            }
                          }
                        }
                      }
                    },
                    "renderingProvider": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": ["firstName", "lastName", "npi"],
                      "properties": {
                        "firstName": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 35
                        },
                        "middleName": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 25
                        },
                        "lastName": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 60
                        },
                        "npi": {
                          "type": "string",
                          "pattern": "^[0-9]{10}$"
                        },
                        "taxonomyCode": {
                          "type": "string",
                          "pattern": "^[A-Za-z0-9]{10}$"
                        },
                        "secondaryIdentifier": {
                          "type": "string",
                          "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$"
                        },
                        "address": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "address1",
                            "city",
                            "state",
                            "postalCode"
                          ],
                          "properties": {
                            "address1": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 55
                            },
                            "address2": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 55
                            },
                            "city": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 30
                            },
                            "state": {
                              "type": "string",
                              "pattern": "^[A-Za-z]{2}$"
                            },
                            "postalCode": {
                              "type": "string",
                              "pattern": "^[A-Za-z0-9][A-Za-z0-9 -]{1,13}[A-Za-z0-9]$"
                            }
                          }
                        },
                        "contact": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": ["name", "phone"],
                          "properties": {
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 60
                            },
                            "phone": {
                              "type": "string",
                              "pattern": "^[0-9]{10,15}$"
                            },
                            "email": {
                              "type": "string",
                              "minLength": 3,
                              "maxLength": 80,
                              "pattern": "^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$"
                            }
                          }
                        }
                      }
                    },
                    "orderingProvider": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": ["firstName", "lastName", "npi"],
                      "properties": {
                        "firstName": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 35
                        },
                        "middleName": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 25
                        },
                        "lastName": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 60
                        },
                        "npi": {
                          "type": "string",
                          "pattern": "^[0-9]{10}$"
                        },
                        "taxonomyCode": {
                          "type": "string",
                          "pattern": "^[A-Za-z0-9]{10}$"
                        },
                        "secondaryIdentifier": {
                          "type": "string",
                          "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$"
                        },
                        "address": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "address1",
                            "city",
                            "state",
                            "postalCode"
                          ],
                          "properties": {
                            "address1": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 55
                            },
                            "address2": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 55
                            },
                            "city": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 30
                            },
                            "state": {
                              "type": "string",
                              "pattern": "^[A-Za-z]{2}$"
                            },
                            "postalCode": {
                              "type": "string",
                              "pattern": "^[A-Za-z0-9][A-Za-z0-9 -]{1,13}[A-Za-z0-9]$"
                            }
                          }
                        },
                        "contact": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": ["name", "phone"],
                          "properties": {
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 60
                            },
                            "phone": {
                              "type": "string",
                              "pattern": "^[0-9]{10,15}$"
                            },
                            "email": {
                              "type": "string",
                              "minLength": 3,
                              "maxLength": 80,
                              "pattern": "^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$"
                            }
                          }
                        }
                      }
                    },
                    "purchasedServiceProvider": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": ["firstName", "lastName", "npi"],
                      "properties": {
                        "firstName": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 35
                        },
                        "middleName": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 25
                        },
                        "lastName": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 60
                        },
                        "npi": {
                          "type": "string",
                          "pattern": "^[0-9]{10}$"
                        },
                        "taxonomyCode": {
                          "type": "string",
                          "pattern": "^[A-Za-z0-9]{10}$"
                        },
                        "secondaryIdentifier": {
                          "type": "string",
                          "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$"
                        },
                        "address": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": [
                            "address1",
                            "city",
                            "state",
                            "postalCode"
                          ],
                          "properties": {
                            "address1": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 55
                            },
                            "address2": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 55
                            },
                            "city": {
                              "type": "string",
                              "minLength": 2,
                              "maxLength": 30
                            },
                            "state": {
                              "type": "string",
                              "pattern": "^[A-Za-z]{2}$"
                            },
                            "postalCode": {
                              "type": "string",
                              "pattern": "^[A-Za-z0-9][A-Za-z0-9 -]{1,13}[A-Za-z0-9]$"
                            }
                          }
                        },
                        "contact": {
                          "type": "object",
                          "additionalProperties": false,
                          "required": ["name", "phone"],
                          "properties": {
                            "name": {
                              "type": "string",
                              "minLength": 1,
                              "maxLength": 60
                            },
                            "phone": {
                              "type": "string",
                              "pattern": "^[0-9]{10,15}$"
                            },
                            "email": {
                              "type": "string",
                              "minLength": 3,
                              "maxLength": 80,
                              "pattern": "^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$"
                            }
                          }
                        }
                      }
                    }
                  }
                }
              },
              "providerSignatureIndicator": {
                "enum": ["N", "Y"]
              },
              "assignmentCode": {
                "enum": ["A", "B", "C"]
              },
              "benefitsAssignmentCertificationIndicator": {
                "enum": ["N", "Y"]
              },
              "releaseInformationCode": {
                "enum": ["I", "Y"]
              },
              "patientSignatureSourceCode": {
                "type": "string",
                "pattern": "^[A-Za-z0-9]$"
              },
              "clearinghouseTraceNumber": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$"
              },
              "priorAuthorizationNumber": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$"
              },
              "referralNumber": {
                "type": "string",
                "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$"
              },
              "attachments": {
                "type": "array",
                "minItems": 1,
                "maxItems": 10,
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": ["reportTypeCode", "transmissionCode"],
                  "properties": {
                    "reportTypeCode": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9]{2}$"
                    },
                    "transmissionCode": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9]{2}$"
                    },
                    "controlNumber": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$"
                    }
                  }
                }
              },
              "notes": {
                "type": "array",
                "minItems": 1,
                "maxItems": 10,
                "items": {
                  "type": "string",
                  "minLength": 1,
                  "maxLength": 80
                }
              },
              "initialTreatmentDate": {
                "type": "string",
                "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
              },
              "acuteManifestationDate": {
                "type": "string",
                "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
              },
              "lastXrayDate": {
                "type": "string",
                "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
              },
              "accident": {
                "type": "object",
                "additionalProperties": false,
                "required": ["date"],
                "properties": {
                  "date": {
                    "type": "string",
                    "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
                  },
                  "state": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2}$"
                  },
                  "countryCode": {
                    "type": "string",
                    "pattern": "^[A-Za-z]{2,3}$"
                  },
                  "relatedToEmployment": {
                    "type": "boolean"
                  },
                  "relatedToAutoAccident": {
                    "type": "boolean"
                  },
                  "relatedToOtherAccident": {
                    "type": "boolean"
                  }
                }
              },
              "anesthesiaRelatedProcedureCode": {
                "type": "string",
                "pattern": "^(?:[0-9]{5}|[0-9]{4}[A-Za-z]|[A-Za-z][0-9]{4})$"
              },
              "ambulance": {
                "type": "object",
                "additionalProperties": false,
                "required": [
                  "patientWeightPounds",
                  "transportReasonCode",
                  "pickup",
                  "dropoff"
                ],
                "properties": {
                  "patientWeightPounds": {
                    "type": "string",
                    "pattern": "^(0|[1-9][0-9]{0,6})(\\.[0-9]{1,3})?$"
                  },
                  "transportReasonCode": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9]{1,2}$"
                  },
                  "distanceMiles": {
                    "type": "string",
                    "pattern": "^(0|[1-9][0-9]{0,6})(\\.[0-9]{1,3})?$"
                  },
                  "roundTripPurposeDescription": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  },
                  "patientConditionCodes": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 5,
                    "uniqueItems": true,
                    "items": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9]{2}$"
                    }
                  },
                  "pickup": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": ["organizationName", "address"],
                    "properties": {
                      "organizationName": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 60
                      },
                      "npi": {
                        "type": "string",
                        "pattern": "^[0-9]{10}$"
                      },
                      "secondaryIdentifier": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$"
                      },
                      "address": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": ["address1", "city", "state", "postalCode"],
                        "properties": {
                          "address1": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 55
                          },
                          "address2": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 55
                          },
                          "city": {
                            "type": "string",
                            "minLength": 2,
                            "maxLength": 30
                          },
                          "state": {
                            "type": "string",
                            "pattern": "^[A-Za-z]{2}$"
                          },
                          "postalCode": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9][A-Za-z0-9 -]{1,13}[A-Za-z0-9]$"
                          }
                        }
                      }
                    }
                  },
                  "dropoff": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": ["organizationName", "address"],
                    "properties": {
                      "organizationName": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 60
                      },
                      "npi": {
                        "type": "string",
                        "pattern": "^[0-9]{10}$"
                      },
                      "secondaryIdentifier": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$"
                      },
                      "address": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": ["address1", "city", "state", "postalCode"],
                        "properties": {
                          "address1": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 55
                          },
                          "address2": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 55
                          },
                          "city": {
                            "type": "string",
                            "minLength": 2,
                            "maxLength": 30
                          },
                          "state": {
                            "type": "string",
                            "pattern": "^[A-Za-z]{2}$"
                          },
                          "postalCode": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9][A-Za-z0-9 -]{1,13}[A-Za-z0-9]$"
                          }
                        }
                      }
                    }
                  }
                }
              },
              "chiropractic": {
                "type": "object",
                "additionalProperties": false,
                "required": ["conditionCode"],
                "properties": {
                  "conditionCode": {
                    "type": "string",
                    "pattern": "^[A-Za-z0-9]{1,2}$"
                  },
                  "description": {
                    "type": "string",
                    "minLength": 1,
                    "maxLength": 80
                  }
                }
              },
              "epsdt": {
                "type": "object",
                "additionalProperties": false,
                "required": ["screeningReferralIndicator", "conditionCodes"],
                "properties": {
                  "screeningReferralIndicator": {
                    "enum": ["N", "Y"]
                  },
                  "conditionCodes": {
                    "type": "array",
                    "minItems": 1,
                    "maxItems": 5,
                    "uniqueItems": true,
                    "items": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9]{2}$"
                    }
                  }
                }
              },
              "providers": {
                "type": "object",
                "additionalProperties": false,
                "minProperties": 1,
                "properties": {
                  "referring": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": ["firstName", "lastName", "npi"],
                    "properties": {
                      "firstName": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 35
                      },
                      "middleName": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 25
                      },
                      "lastName": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 60
                      },
                      "npi": {
                        "type": "string",
                        "pattern": "^[0-9]{10}$"
                      },
                      "taxonomyCode": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9]{10}$"
                      },
                      "secondaryIdentifier": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$"
                      },
                      "address": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": ["address1", "city", "state", "postalCode"],
                        "properties": {
                          "address1": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 55
                          },
                          "address2": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 55
                          },
                          "city": {
                            "type": "string",
                            "minLength": 2,
                            "maxLength": 30
                          },
                          "state": {
                            "type": "string",
                            "pattern": "^[A-Za-z]{2}$"
                          },
                          "postalCode": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9][A-Za-z0-9 -]{1,13}[A-Za-z0-9]$"
                          }
                        }
                      },
                      "contact": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": ["name", "phone"],
                        "properties": {
                          "name": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 60
                          },
                          "phone": {
                            "type": "string",
                            "pattern": "^[0-9]{10,15}$"
                          },
                          "email": {
                            "type": "string",
                            "minLength": 3,
                            "maxLength": 80,
                            "pattern": "^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$"
                          }
                        }
                      }
                    }
                  },
                  "supervising": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": ["firstName", "lastName", "npi"],
                    "properties": {
                      "firstName": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 35
                      },
                      "middleName": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 25
                      },
                      "lastName": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 60
                      },
                      "npi": {
                        "type": "string",
                        "pattern": "^[0-9]{10}$"
                      },
                      "taxonomyCode": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9]{10}$"
                      },
                      "secondaryIdentifier": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$"
                      },
                      "address": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": ["address1", "city", "state", "postalCode"],
                        "properties": {
                          "address1": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 55
                          },
                          "address2": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 55
                          },
                          "city": {
                            "type": "string",
                            "minLength": 2,
                            "maxLength": 30
                          },
                          "state": {
                            "type": "string",
                            "pattern": "^[A-Za-z]{2}$"
                          },
                          "postalCode": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9][A-Za-z0-9 -]{1,13}[A-Za-z0-9]$"
                          }
                        }
                      },
                      "contact": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": ["name", "phone"],
                        "properties": {
                          "name": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 60
                          },
                          "phone": {
                            "type": "string",
                            "pattern": "^[0-9]{10,15}$"
                          },
                          "email": {
                            "type": "string",
                            "minLength": 3,
                            "maxLength": 80,
                            "pattern": "^[^@\\s]+@[^@\\s]+\\.[^@\\s]+$"
                          }
                        }
                      }
                    }
                  },
                  "serviceFacility": {
                    "type": "object",
                    "additionalProperties": false,
                    "required": ["organizationName", "address"],
                    "properties": {
                      "organizationName": {
                        "type": "string",
                        "minLength": 1,
                        "maxLength": 60
                      },
                      "npi": {
                        "type": "string",
                        "pattern": "^[0-9]{10}$"
                      },
                      "secondaryIdentifier": {
                        "type": "string",
                        "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$"
                      },
                      "address": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": ["address1", "city", "state", "postalCode"],
                        "properties": {
                          "address1": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 55
                          },
                          "address2": {
                            "type": "string",
                            "minLength": 1,
                            "maxLength": 55
                          },
                          "city": {
                            "type": "string",
                            "minLength": 2,
                            "maxLength": 30
                          },
                          "state": {
                            "type": "string",
                            "pattern": "^[A-Za-z]{2}$"
                          },
                          "postalCode": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9][A-Za-z0-9 -]{1,13}[A-Za-z0-9]$"
                          }
                        }
                      }
                    }
                  }
                }
              },
              "coordinationOfBenefits": {
                "type": "array",
                "minItems": 1,
                "maxItems": 2,
                "items": {
                  "type": "object",
                  "additionalProperties": false,
                  "required": [
                    "sequenceCode",
                    "claimFilingIndicatorCode",
                    "paidAmount",
                    "payerClaimControlNumber",
                    "subscriber",
                    "payer"
                  ],
                  "properties": {
                    "sequenceCode": {
                      "enum": ["S", "T"]
                    },
                    "claimFilingIndicatorCode": {
                      "enum": [
                        "BL",
                        "CH",
                        "CI",
                        "HM",
                        "MA",
                        "MB",
                        "MC",
                        "OF",
                        "TV",
                        "VA",
                        "WC",
                        "ZZ"
                      ]
                    },
                    "paidAmount": {
                      "type": "string",
                      "pattern": "^(0|[1-9][0-9]{0,9})(\\.[0-9]{1,2})?$"
                    },
                    "payerClaimControlNumber": {
                      "type": "string",
                      "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$"
                    },
                    "subscriber": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": [
                        "firstName",
                        "lastName",
                        "memberId",
                        "relationshipCode"
                      ],
                      "properties": {
                        "firstName": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 35
                        },
                        "middleName": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 25
                        },
                        "lastName": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 60
                        },
                        "memberId": {
                          "type": "string",
                          "pattern": "^[A-Za-z0-9][A-Za-z0-9._-]{0,79}$"
                        },
                        "relationshipCode": {
                          "type": "string",
                          "pattern": "^[A-Za-z0-9]{2}$"
                        }
                      }
                    },
                    "payer": {
                      "type": "object",
                      "additionalProperties": false,
                      "required": ["organizationName", "identifier"],
                      "properties": {
                        "organizationName": {
                          "type": "string",
                          "minLength": 1,
                          "maxLength": 60
                        },
                        "identifier": {
                          "type": "string",
                          "pattern": "^[A-Za-z0-9]{2,80}$"
                        }
                      }
                    },
                    "claimAdjustments": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 20,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": ["groupCode", "reasonCode", "amount"],
                        "properties": {
                          "groupCode": {
                            "enum": ["CO", "CR", "OA", "PI", "PR"]
                          },
                          "reasonCode": {
                            "type": "string",
                            "pattern": "^[A-Za-z0-9]{1,5}$"
                          },
                          "amount": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]{0,9})(\\.[0-9]{1,2})?$"
                          },
                          "quantity": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]{0,6})(\\.[0-9]{1,3})?$"
                          }
                        }
                      }
                    },
                    "serviceLineAdjudication": {
                      "type": "array",
                      "minItems": 1,
                      "maxItems": 50,
                      "items": {
                        "type": "object",
                        "additionalProperties": false,
                        "required": [
                          "lineNumber",
                          "procedureCode",
                          "paidAmount",
                          "adjudicationDate"
                        ],
                        "properties": {
                          "lineNumber": {
                            "type": "integer",
                            "minimum": 1,
                            "maximum": 50
                          },
                          "procedureCode": {
                            "type": "string",
                            "pattern": "^(?:[0-9]{5}|[0-9]{4}[A-Za-z]|[A-Za-z][0-9]{4})$"
                          },
                          "paidAmount": {
                            "type": "string",
                            "pattern": "^(0|[1-9][0-9]{0,9})(\\.[0-9]{1,2})?$"
                          },
                          "adjudicationDate": {
                            "type": "string",
                            "pattern": "^[0-9]{4}-[0-9]{2}-[0-9]{2}$"
                          },
                          "adjustments": {
                            "type": "array",
                            "minItems": 1,
                            "maxItems": 20,
                            "items": {
                              "type": "object",
                              "additionalProperties": false,
                              "required": ["groupCode", "reasonCode", "amount"],
                              "properties": {
                                "groupCode": {
                                  "enum": ["CO", "CR", "OA", "PI", "PR"]
                                },
                                "reasonCode": {
                                  "type": "string",
                                  "pattern": "^[A-Za-z0-9]{1,5}$"
                                },
                                "amount": {
                                  "type": "string",
                                  "pattern": "^(0|[1-9][0-9]{0,9})(\\.[0-9]{1,2})?$"
                                },
                                "quantity": {
                                  "type": "string",
                                  "pattern": "^(0|[1-9][0-9]{0,6})(\\.[0-9]{1,3})?$"
                                }
                              }
                            }
                          }
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        }
      }
    }
  }
}
