{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://raw.githubusercontent.com/api-evangelist/nextgen-healthcare/main/json-schema/nextgen-healthcare-encounter-schema.json",
  "title": "Encounter",
  "x-generated": "2026-10-12",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/nextgen-healthcare-encounter-api-openapi.yml#/components/schemas/Encounter",
  "type": "object",
  "properties": {
    "resourceType": {
      "type": "string",
      "minLength": 1
    },
    "id": {
      "type": "string",
      "description": "The id of the resource."
    },
    "meta": {
      "type": "object",
      "description": "Metadata about the resource",
      "properties": {
        "profile": {
          "type": "array",
          "description": "Profiles this resource claims to conform to",
          "items": {
            "type": "string"
          }
        }
      },
      "required": [
        "profile"
      ]
    },
    "identifier": {
      "type": "array",
      "description": "Identifier(s) by which this encounter is known",
      "items": {
        "type": "object",
        "properties": {
          "use": {
            "type": "string",
            "description": "usual | official | temp | secondary | old"
          },
          "system": {
            "type": "string",
            "description": "the namespace for the identifier value"
          },
          "value": {
            "type": "string",
            "description": "The value that is unique"
          }
        },
        "required": [
          "use"
        ]
      }
    },
    "status": {
      "type": "string",
      "description": "describe the encounter status."
    },
    "class": {
      "type": "object",
      "description": "Classification of patient encounte",
      "properties": {
        "system": {
          "type": "string",
          "description": "Identity of the terminology system"
        },
        "code": {
          "type": "string",
          "description": "Symbol in syntax defined by the system"
        },
        "display": {
          "type": "string",
          "description": "Representation defined by the system"
        }
      }
    },
    "type": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "coding": {
            "type": "array",
            "description": "Specific type of encounter",
            "items": {
              "type": "object",
              "properties": {
                "system": {
                  "type": "string"
                },
                "code": {
                  "type": "string"
                },
                "display": {
                  "type": "string"
                }
              }
            }
          },
          "text": {
            "type": "string"
          }
        }
      }
    },
    "subject": {
      "type": "object",
      "properties": {
        "reference": {
          "type": "string"
        }
      }
    },
    "participant": {
      "type": "array",
      "description": "List of participants involved in the encounter",
      "items": {
        "type": "object",
        "properties": {
          "type": {
            "type": "array",
            "items": {
              "type": "object",
              "properties": {
                "coding": {
                  "type": "array",
                  "items": {
                    "type": "object",
                    "properties": {
                      "system": {
                        "type": "string"
                      },
                      "code": {
                        "type": "string"
                      },
                      "display": {
                        "type": "string"
                      }
                    }
                  }
                },
                "text": {
                  "type": "string"
                }
              }
            }
          },
          "period": {
            "type": "object",
            "properties": {
              "start": {
                "type": "string"
              },
              "end": {
                "type": "string"
              }
            }
          },
          "individual": {
            "type": "object",
            "properties": {
              "reference": {
                "type": "string"
              }
            }
          }
        }
      }
    },
    "period": {
      "type": "object",
      "properties": {
        "start": {
          "type": "string"
        },
        "end": {
          "type": "string"
        }
      }
    },
    "reasoncode": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "text": {
            "type": "string"
          }
        }
      }
    },
    "hospitalization": {
      "type": "object",
      "properties": {
        "dischargeDisposition": {
          "type": "object",
          "properties": {
            "coding": {
              "type": "array",
              "items": {
                "type": "object",
                "properties": {
                  "system": {
                    "type": "string"
                  },
                  "code": {
                    "type": "string"
                  },
                  "display": {
                    "type": "string"
                  }
                }
              }
            },
            "text": {
              "type": "string"
            }
          }
        }
      }
    },
    "location": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "location": {
            "type": "object",
            "properties": {
              "reference": {
                "type": "string"
              }
            }
          }
        }
      }
    }
  },
  "required": [
    "status",
    "class",
    "location",
    "subject",
    "resourceType",
    "id",
    "meta"
  ]
}