{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "http://smart.who.int/base/StructureDefinition-IMMZ_D17_Report_AEFI.schema.json",
  "title": "IMMZ.D17.Report AEFI",
  "description": "Data elements for the IMMZ.D17.Report AEFI Data Dictionary Activity.",
  "type": "object",
  "properties": {
    "resourceType": {
      "type": "string",
      "const": "IMMZD17",
      "description": "Resource type identifier for IMMZ_D17_Report_AEFI logical model"
    },
    "@context": {
      "description": "JSON-LD context for this logical model with ValueSet vocabularies",
      "anyOf": [
        {
          "type": "string",
          "format": "uri",
          "description": "URI reference to external JSON-LD context"
        },
        {
          "type": "object",
          "description": "Inline JSON-LD context",
          "properties": {
            "@version": {
              "type": "number",
              "const": 1.1
            },
            "fhir": {
              "type": "string",
              "const": "http://hl7.org/fhir/"
            }
          },
          "additionalProperties": {
            "type": "string",
            "format": "uri"
          }
        },
        {
          "type": "array",
          "description": "Array of JSON-LD context objects/URIs",
          "items": {
            "anyOf": [
              {
                "type": "string",
                "format": "uri"
              },
              {
                "type": "object"
              }
            ]
          }
        }
      ]
    },
    "@type": {
      "type": "string",
      "description": "JSON-LD type identifier for IMMZ_D17_Report_AEFI logical model",
      "examples": [
        "LogicalModel-IMMZ_D17_Report_AEFI"
      ]
    },
    "IMMZD17": {
      "type": "array",
      "items": {
        "type": "object",
        "description": "FHIR "
      },
      "description": "Data elements for the IMMZ.D17.Report AEFI Data Dictionary Activity."
    },
    "patient": {
      "type": "object",
      "description": "The patient."
    },
    "reactionReported": {
      "type": "boolean",
      "description": "Indicates observation of an adverse event/reaction"
    },
    "reactionDate": {
      "type": "string",
      "format": "date",
      "description": "When adverse event/reaction started"
    },
    "reactionManifestation": {
      "oneOf": [
        {
          "type": "object",
          "description": "FHIR Coding from ValueSet IMMZ.D.DE95",
          "properties": {
            "system": {
              "type": "string",
              "description": "Code system URI"
            },
            "code": {
              "type": "string",
              "description": "Code value"
            },
            "display": {
              "type": "string",
              "description": "Human readable display text"
            }
          },
          "required": [
            "system",
            "code"
          ]
        },
        {
          "type": "object",
          "description": "Coding from ValueSet IMMZ.D.DE95 (JSON-LD structure)",
          "properties": {
            "@type": {
              "type": "string",
              "const": "http://smart.who.int/base/ValueSet-IMMZ.D.DE95.jsonld",
              "description": "JSON-LD type reference to ValueSet IMMZ.D.DE95"
            },
            "@id": {
              "type": "string",
              "format": "uri",
              "description": "Full IRI of the code from ValueSet IMMZ.D.DE95"
            }
          },
          "required": [
            "@type",
            "@id"
          ],
          "additionalProperties": false
        }
      ],
      "description": "The manifestation of the reaction (e.g. infected abscess, swelling, rash, hives, diarrhoea, etc.) observed after administering the vaccine"
    },
    "typeOfReaction": {
      "oneOf": [
        {
          "type": "object",
          "description": "FHIR Coding from ValueSet IMMZ.D.DE107",
          "properties": {
            "system": {
              "type": "string",
              "description": "Code system URI"
            },
            "code": {
              "type": "string",
              "description": "Code value"
            },
            "display": {
              "type": "string",
              "description": "Human readable display text"
            }
          },
          "required": [
            "system",
            "code"
          ]
        },
        {
          "type": "object",
          "description": "Coding from ValueSet IMMZ.D.DE107 (JSON-LD structure)",
          "properties": {
            "@type": {
              "type": "string",
              "const": "http://smart.who.int/base/ValueSet-IMMZ.D.DE107.jsonld",
              "description": "JSON-LD type reference to ValueSet IMMZ.D.DE107"
            },
            "@id": {
              "type": "string",
              "format": "uri",
              "description": "Full IRI of the code from ValueSet IMMZ.D.DE107"
            }
          },
          "required": [
            "@type",
            "@id"
          ],
          "additionalProperties": false
        }
      ],
      "description": "If the event resulted in a reaction, what is the type of reaction"
    },
    "otherImportantMedicalEvent": {
      "type": "string",
      "description": "There was another important reaction or medical event"
    },
    "reactionOutcome": {
      "oneOf": [
        {
          "type": "object",
          "description": "FHIR Coding from ValueSet IMMZ.D.DE115",
          "properties": {
            "system": {
              "type": "string",
              "description": "Code system URI"
            },
            "code": {
              "type": "string",
              "description": "Code value"
            },
            "display": {
              "type": "string",
              "description": "Human readable display text"
            }
          },
          "required": [
            "system",
            "code"
          ]
        },
        {
          "type": "object",
          "description": "Coding from ValueSet IMMZ.D.DE115 (JSON-LD structure)",
          "properties": {
            "@type": {
              "type": "string",
              "const": "http://smart.who.int/base/ValueSet-IMMZ.D.DE115.jsonld",
              "description": "JSON-LD type reference to ValueSet IMMZ.D.DE115"
            },
            "@id": {
              "type": "string",
              "format": "uri",
              "description": "Full IRI of the code from ValueSet IMMZ.D.DE115"
            }
          },
          "required": [
            "@type",
            "@id"
          ],
          "additionalProperties": false
        }
      ],
      "description": "The outcome of the reaction (e.g. death, recovered, recovering)"
    }
  },
  "required": [
    "resourceType",
    "patient"
  ],
  "resourceDefinition": "http://smart.who.int/immunizations/StructureDefinition/IMMZD17",
  "fhir:parent": "http://hl7.org/fhir/StructureDefinition/Base",
  "jsonld:valuesets": [
    "IMMZ.D.DE95",
    "IMMZ.D.DE107",
    "IMMZ.D.DE115"
  ],
  "jsonld:contextTemplate": {
    "@version": 1.1,
    "fhir": "http://hl7.org/fhir/",
    "IMMZ.D.DE95": "http://smart.who.int/base/ValueSet-IMMZ.D.DE95.jsonld",
    "IMMZ.D.DE107": "http://smart.who.int/base/ValueSet-IMMZ.D.DE107.jsonld",
    "IMMZ.D.DE115": "http://smart.who.int/base/ValueSet-IMMZ.D.DE115.jsonld"
  }
}