{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "http://smart.who.int/base/StructureDefinition-IMMZ_D1_Capture_or_update_client_history.schema.json",
  "title": "IMMZ.D1.Capture or update client history",
  "description": "Data elements for the IMMZ.D1.Capture or update client history Data Dictionary Activity.",
  "type": "object",
  "properties": {
    "resourceType": {
      "type": "string",
      "const": "IMMZD1",
      "description": "Resource type identifier for IMMZ_D1_Capture_or_update_client_history 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_D1_Capture_or_update_client_history logical model",
      "examples": [
        "LogicalModel-IMMZ_D1_Capture_or_update_client_history"
      ]
    },
    "IMMZD1": {
      "type": "array",
      "items": {
        "type": "object",
        "description": "FHIR "
      },
      "description": "Data elements for the IMMZ.D1.Capture or update client history Data Dictionary Activity."
    },
    "patient": {
      "type": "object",
      "description": "The patient."
    },
    "birthDose": {
      "type": "boolean",
      "description": "Indicates if the client received a dose within 24 hours of birth. Whether a birth dose is counted as part of the primary series will depend on the antigen"
    },
    "typeOfDose": {
      "$ref": "./ValueSet-IMMZ.D.DE258.schema.json",
      "description": "The type of dose in a series that the client received"
    },
    "completedThePrimaryVaccinationSeries": {
      "type": "boolean",
      "description": "Indicates if the client has completed the primary vaccination series of a product/antigen. If the client has not yet completed their primary series, it means they may be expected to receive more doses to complete their vaccination regimen for the respective product/antigen"
    },
    "completedTheBoosterSeries": {
      "type": "boolean",
      "description": "Indicates if the client has completed the booster series of a product/antigen"
    },
    "dateWhenPrimaryVaccinationSeriesWasCompleted": {
      "type": "string",
      "format": "date",
      "description": "The date when the client completed the primary vaccination series (per product/antigen)"
    },
    "hivStatus": {
      "$ref": "./ValueSet-IMMZ.D.DE204.schema.json",
      "description": "The current HIV status of the client"
    },
    "pretermBirth": {
      "type": "boolean",
      "description": "The infant was preterm; the mother gave birth to the infant when gestational age was less than 37 weeks"
    },
    "immunocompromised": {
      "type": "boolean",
      "description": "The client is known to be immunocompromised. This means the client has a weakened immune system and having a reduced ability to fight infections and other diseases"
    },
    "currentlyOnArt": {
      "type": "boolean",
      "description": "The client is currently receiving antiretroviral therapy (ART)"
    },
    "typeOfTbInfectionTestPerformed": {
      "$ref": "./ValueSet-IMMZ.D.DE243.schema.json",
      "description": "The type of tuberculosis (TB) infection test performed"
    },
    "tbInfectionTestResult": {
      "$ref": "./ValueSet-IMMZ.D.DE246.schema.json",
      "description": "Records the result of the TB infection test"
    },
    "immunologicallyStable": {
      "type": "boolean",
      "description": "The client is living with HIV and is immunologically stable with CD4 count or percentage above a minimum as defined in the HIV guidelines"
    },
    "clinicallyWell": {
      "type": "boolean",
      "description": "The client is living with HIV and is clinically well, as defined in HIV guidelines and WHO clinical staging"
    },
    "birthWeightInGrams": {
      "type": "number",
      "description": "Represents the client's birth weight value measures in grams"
    },
    "typeOfPoliovirusDose": {
      "$ref": "./ValueSet-IMMZ.D.DE212.schema.json",
      "description": "The type of the poliovirus vaccine dose administered to the client"
    },
    "artStartDate": {
      "type": "string",
      "format": "date",
      "description": "The date on which the client started or restarted ART"
    },
    "highRiskOfPneumococcalInfection": {
      "type": "boolean",
      "description": "The client is at high risk for pneumococcal infection because of underlying medical conditions (i.e. HIV infection or sickle-cell disease)"
    },
    "typeOfJeDose": {
      "$ref": "./ValueSet-IMMZ.D.DE216.schema.json",
      "description": "The type of Japanese encephalitis (JE) vaccine dose administered to the client"
    },
    "typeOfTbeDose": {
      "$ref": "./ValueSet-IMMZ.D.DE220.schema.json",
      "description": "The type of tick-borne encephalitis (TBE) vaccine dose administered"
    },
    "typeOfTyphoidDose": {
      "$ref": "./ValueSet-IMMZ.D.DE225.schema.json",
      "description": "The type of typhoid vaccine dose administered to the client"
    },
    "typeOfCholeraDose": {
      "$ref": "./ValueSet-IMMZ.D.DE229.schema.json",
      "description": "The type of cholera vaccine dose administered to the client"
    },
    "typeOfMeningococcalDose": {
      "$ref": "./ValueSet-IMMZ.D.DE232.schema.json",
      "description": "The type of meningococcal vaccine dose administered to the client"
    },
    "ageInMonthsWhenClientReceivedFirstMeningococcalDose": {
      "type": "number",
      "description": "The age in months when client received their first meningococcal dose"
    },
    "typeOfHepatitisADose": {
      "$ref": "./ValueSet-IMMZ.D.DE237.schema.json",
      "description": "The type of hepatitis A-containing vaccine dose administered to the client"
    },
    "typeOfHepatitisBDose": {
      "$ref": "./ValueSet-IMMZ.D.DE254.schema.json",
      "description": "The type of hepatitis B-containing vaccine dose administered to the client"
    },
    "vnaLevel": {
      "type": "number",
      "description": "Vaccine-induced neutralizing antibody (VNA) level, measured as a serum antibody concentration from the result of the concentrated, purified cell culture-derived and embryonated egg-based rabies vaccines (CCEEV)"
    },
    "riskOfOccupationalExposureToRabiesVirus": {
      "type": "boolean",
      "description": "Professional at risk of occupational exposure to rabies virus, particularly animal health workers. Also considered for medical professionals who regularly provide care to persons with rabies"
    },
    "dengueSerostatus": {
      "$ref": "./ValueSet-IMMZ.D.DE241.schema.json",
      "description": "Indicates the result of a serological test determining whether the client has antibodies against the dengue virus"
    },
    "vaccineType": {
      "type": "array",
      "items": {
        "$ref": "./ValueSet-IMMZ.Z.VS.schema.json",
        "description": "Coding-shaped {system, code} object from ValueSet IMMZ.Z.VS"
      },
      "minItems": 1,
      "description": "Vaccine type/category that was administered or was to be administered. Any vaccine code available in the IMMZ.Z Vaccine library list of codes applies in this data element"
    },
    "dateAndTimeOfVaccination": {
      "type": "string",
      "format": "date-time",
      "description": "Represents the visit/encounter date, which is the date and time when each vaccine was administered to the client"
    },
    "contactDate": {
      "type": "string",
      "format": "date-time",
      "description": "The date and time of the client's contact"
    },
    "ancContactNumber": {
      "type": "integer",
      "description": "The antenatal care (ANC) contact or visit number"
    },
    "doseNumber": {
      "type": "integer",
      "description": "Vaccine dose number including dose number within series"
    }
  },
  "required": [
    "resourceType",
    "patient",
    "typeOfDose",
    "vaccineType",
    "dateAndTimeOfVaccination",
    "doseNumber"
  ],
  "allOf": [
    {
      "$ref": "./StructureDefinition-FHIRSchemaBase.schema.json"
    },
    {
      "type": "object",
      "properties": {
        "resourceDefinition": {
          "type": "string",
          "format": "uri",
          "const": "http://smart.who.int/immunizations/StructureDefinition/IMMZD1"
        },
        "fhir:parent": {
          "type": "string",
          "const": "http://hl7.org/fhir/StructureDefinition/Base"
        },
        "jsonld:valuesets": {
          "type": "array",
          "items": {
            "type": "string"
          },
          "const": [
            "IMMZ.D.DE204",
            "IMMZ.D.DE212",
            "IMMZ.D.DE216",
            "IMMZ.D.DE220",
            "IMMZ.D.DE225",
            "IMMZ.D.DE229",
            "IMMZ.D.DE232",
            "IMMZ.D.DE237",
            "IMMZ.D.DE241",
            "IMMZ.D.DE243",
            "IMMZ.D.DE246",
            "IMMZ.D.DE254",
            "IMMZ.D.DE258",
            "IMMZ.Z.VS"
          ]
        },
        "jsonld:contextTemplate": {
          "type": "object",
          "const": {
            "@version": 1.1,
            "fhir": "http://hl7.org/fhir/",
            "IMMZ.D.DE243": "http://smart.who.int/base/ValueSet-IMMZ.D.DE243.jsonld",
            "IMMZ.D.DE237": "http://smart.who.int/base/ValueSet-IMMZ.D.DE237.jsonld",
            "IMMZ.D.DE212": "http://smart.who.int/base/ValueSet-IMMZ.D.DE212.jsonld",
            "IMMZ.D.DE216": "http://smart.who.int/base/ValueSet-IMMZ.D.DE216.jsonld",
            "IMMZ.D.DE246": "http://smart.who.int/base/ValueSet-IMMZ.D.DE246.jsonld",
            "IMMZ.D.DE254": "http://smart.who.int/base/ValueSet-IMMZ.D.DE254.jsonld",
            "IMMZ.D.DE241": "http://smart.who.int/base/ValueSet-IMMZ.D.DE241.jsonld",
            "IMMZ.D.DE229": "http://smart.who.int/base/ValueSet-IMMZ.D.DE229.jsonld",
            "IMMZ.D.DE204": "http://smart.who.int/base/ValueSet-IMMZ.D.DE204.jsonld",
            "IMMZ.D.DE232": "http://smart.who.int/base/ValueSet-IMMZ.D.DE232.jsonld",
            "IMMZ.Z.VS": "http://smart.who.int/base/ValueSet-IMMZ.Z.VS.jsonld",
            "IMMZ.D.DE258": "http://smart.who.int/base/ValueSet-IMMZ.D.DE258.jsonld",
            "IMMZ.D.DE220": "http://smart.who.int/base/ValueSet-IMMZ.D.DE220.jsonld",
            "IMMZ.D.DE225": "http://smart.who.int/base/ValueSet-IMMZ.D.DE225.jsonld"
          }
        }
      }
    }
  ]
}