WHO Immunization Implementation Guide
1.0.0 - release

WHO Immunization Implementation Guide, published by WHO. This guide is not an authorized publication; it is the continuous build for version 1.0.0 built by the FHIR (HL7® FHIR® Standard) CI Build. This version is based on the current content of https://github.com/WorldHealthOrganization/smart-immunizations/tree/132/merge and changes regularly. See the Directory of published versions

Measure: IMMZIND08

Official URL: http://smart.who.int/immunizations/Measure/IMMZIND08 Version: 1.0.0
Draft as of 2025-06-11 Computable Name: IMMZIND08

IMMZ.IND.08 Immunization coverage for oral polio vaccine (OPV), 3rd dose

Knowledge Artifact Metadata
Name (machine-readable) IMMZIND08
Title (human-readable) IMMZIND08
Status Draft
Experimental false
Description

IMMZ.IND.08 Immunization coverage for oral polio vaccine (OPV), 3rd dose

Measure Steward WHO
Steward Contact Details WHO: http://who.int
Measure Metadata
Version Number 1.0.0
Measure Scoring Proportion
Measure Population Criteria
Initial Population ID: IMMZ.IND.08.IP
Description:

Initial Population

Logic Definition: Initial Population
Denominator ID: IMMZ.IND.08.D
Description:

Denominator

Logic Definition: Denominator
Numerator ID: IMMZ.IND.08.N
Description:

Numerator

Logic Definition: Numerator
Stratifier ID: IMMZ.IND.08.S1
Code: By-Administrative Area
Stratifier ID: IMMZ.IND.08.S2
Code: By-Sex
Stratifier ID: IMMZ.IND.08.S3
Code: By-Age group
Stratifier ID: IMMZ.IND.08.S4
Code: By-Age group
Population Basis boolean
Measure Logic
Primary Library IMMZIND08Logic
Dependency Description: FHIR model information
Resource: http://fhir.org/guides/cqf/common/Library/FHIR-ModelInfo|4.0.1
Canonical URL: http://fhir.org/guides/cqf/common/Library/FHIR-ModelInfo|4.0.1
Dependency Description: Library WC
Resource: WHOCommon
Canonical URL: http://smart.who.int/immunizations/Library/WHOCommon
Dependency Description: Library FHIRHelpers
Resource: http://fhir.org/guides/cqf/common/Library/FHIRHelpers|4.0.1
Canonical URL: http://fhir.org/guides/cqf/common/Library/FHIRHelpers|4.0.1
Dependency Description: Library Common
Resource: IMMZCommon
Canonical URL: http://smart.who.int/immunizations/Library/IMMZCommon
Dependency Description: Library Polio
Resource: IMMZD2DTPolioElements
Canonical URL: http://smart.who.int/immunizations/Library/IMMZD2DTPolioElements
Dependency Description: Library Elements
Resource: IMMZElements
Canonical URL: http://smart.who.int/immunizations/Library/IMMZElements
Dependency Description: Library Concepts
Resource: IMMZConcepts
Canonical URL: http://smart.who.int/immunizations/Library/IMMZConcepts
Dependency Description: Library Elements
Resource: http://smart.who.int/immunizations/Library/IMMZIndicatorElements
Canonical URL: http://smart.who.int/immunizations/Library/IMMZIndicatorElements
Dependency Description: Library Age
Resource: IMMZAgeConcepts
Canonical URL: http://smart.who.int/immunizations/Library/IMMZAgeConcepts
Dependency Description: Code system IMMZD
Resource: IMMZ.D CodeSystem for Data Elements
Canonical URL: http://smart.who.int/immunizations/CodeSystem/IMMZ.D
Dependency Description: Code system ISO-8601-Derived Periods
Resource: http://ohie.org/CodeSystem/iso-8601-derived-periods
Canonical URL: http://ohie.org/CodeSystem/iso-8601-derived-periods
Dependency Description: Code system Administrative Gender Codes
Resource: AdministrativeGender
Canonical URL: http://hl7.org/fhir/administrative-gender
Dependency Description: Value set Poliovirus-containing vaccines
Resource: IMMZ.Z.DE14 ValueSet for Poliovirus-containing vaccines
Canonical URL: http://smart.who.int/immunizations/ValueSet/IMMZ.Z.DE14
Direct Reference Code Display: bOPV
Code: DE214
System: http://smart.who.int/immunizations/CodeSystem/IMMZ.D
Direct Reference Code Display: < 1 year
Code: P0Y--P1Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: >= 1 year
Code: P1Y--P9999Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 1 year
Code: P1Y--P2Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 2 years
Code: P2Y--P3Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 3 years
Code: P3Y--P4Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 4 years
Code: P4Y--P5Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 5 years
Code: P5Y--P6Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 6 years
Code: P6Y--P7Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 7 years
Code: P7Y--P8Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 8 years
Code: P8Y--P9Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 9 years
Code: P9Y--P10Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 10 years
Code: P10Y--P11Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 11 years
Code: P11Y--P12Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 12 years
Code: P12Y--P13Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 13 years
Code: P13Y--P14Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 14 years
Code: P14Y--P15Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 15 years
Code: P15Y--P16Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 16 years
Code: P16Y--P17Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 17 years
Code: P17Y--P18Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 18 years
Code: P18Y--P19Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 19 years
Code: P19Y--P20Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 20 years
Code: P20Y--P21Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 21 years
Code: P21Y--P22Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 22 years
Code: P22Y--P23Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 23 years
Code: P23Y--P24Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 24 years
Code: P24Y--P25Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 25 years
Code: P25Y--P26Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 26 years
Code: P26Y--P27Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 27 years
Code: P27Y--P28Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 28 years
Code: P28Y--P29Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 29 years
Code: P29Y--P30Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 30 years
Code: P30Y--P31Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 31 years
Code: P31Y--P32Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 32 years
Code: P32Y--P33Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 33 years
Code: P33Y--P34Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 34 years
Code: P34Y--P35Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 35 years
Code: P35Y--P36Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 36 years
Code: P36Y--P37Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 37 years
Code: P37Y--P38Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 38 years
Code: P38Y--P39Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 39 years
Code: P39Y--P40Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 40 years
Code: P40Y--P41Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 41 years
Code: P41Y--P42Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 42 years
Code: P42Y--P43Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 43 years
Code: P43Y--P44Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 44 years
Code: P44Y--P45Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 45 years
Code: P45Y--P46Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 46 years
Code: P46Y--P47Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 47 years
Code: P47Y--P48Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 48 years
Code: P48Y--P49Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 49 years
Code: P49Y--P50Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 50 years
Code: P50Y--P51Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 51 years
Code: P51Y--P52Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 52 years
Code: P52Y--P53Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 53 years
Code: P53Y--P54Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 54 years
Code: P54Y--P55Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 55 years
Code: P55Y--P56Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 56 years
Code: P56Y--P57Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 57 years
Code: P57Y--P58Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 58 years
Code: P58Y--P59Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 59 years
Code: P59Y--P60Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 60 years
Code: P60Y--P61Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 61 years
Code: P61Y--P62Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 62 years
Code: P62Y--P63Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 63 years
Code: P63Y--P64Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 64 years
Code: P64Y--P65Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 65 years
Code: P65Y--P66Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 66 years
Code: P66Y--P67Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 67 years
Code: P67Y--P68Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 68 years
Code: P68Y--P69Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 69 years
Code: P69Y--P70Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 70 years
Code: P70Y--P71Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 71 years
Code: P71Y--P72Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 72 years
Code: P72Y--P73Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 73 years
Code: P73Y--P74Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 74 years
Code: P74Y--P75Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 75 years
Code: P75Y--P76Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 76 years
Code: P76Y--P77Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 77 years
Code: P77Y--P78Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 78 years
Code: P78Y--P79Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 79 years
Code: P79Y--P80Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 80 years
Code: P80Y--P81Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 81 years
Code: P81Y--P82Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 82 years
Code: P82Y--P83Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 83 years
Code: P83Y--P84Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 84 years
Code: P84Y--P85Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 85 years
Code: P85Y--P86Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 86 years
Code: P86Y--P87Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 87 years
Code: P87Y--P88Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 88 years
Code: P88Y--P89Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 89 years
Code: P89Y--P90Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 90 years
Code: P90Y--P91Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 91 years
Code: P91Y--P92Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 92 years
Code: P92Y--P93Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 93 years
Code: P93Y--P94Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 94 years
Code: P94Y--P95Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 95 years
Code: P95Y--P96Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 96 years
Code: P96Y--P97Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 97 years
Code: P97Y--P98Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 98 years
Code: P98Y--P99Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: 99 years
Code: P99Y--P100Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: >= 100 years
Code: P100Y--P9999Y
System: http://ohie.org/CodeSystem/iso-8601-derived-periods
Direct Reference Code Display: Males
Code: male
System: http://hl7.org/fhir/administrative-gender
Direct Reference Code Display: Females
Code: female
System: http://hl7.org/fhir/administrative-gender
Direct Reference Code Display: Other/NA
Code: other
System: http://hl7.org/fhir/administrative-gender
Parameter Name: Measurement Period
Use: In
Min Cardinality: 0
Max Cardinality: 1
Type: Period
Parameter Name: Numerator
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Stratification 4
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: Coding
Parameter Name: Stratification 3
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: Coding
Parameter Name: Stratification 2
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: Coding
Parameter Name: Stratification 1
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: string
Parameter Name: Denominator
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Parameter Name: Initial Population
Use: Out
Min Cardinality: 0
Max Cardinality: 1
Type: boolean
Measure Logic Data Requirements
Data Requirement Type: Patient
Profile(s): Patient
Must Support Elements: birthDate, gender
Data Requirement Type: Patient
Profile(s): Patient
Must Support Elements: use
Code Filter(s):
Path: use
Code:
Data Requirement Type: Immunization
Profile(s): Immunization
Must Support Elements: status, isSubpotent, protocolApplied, url
Code Filter(s):
Path: status
Code:
Data Requirement Type: Immunization
Profile(s): Immunization
Must Support Elements: occurrence, protocolApplied, url
Data Requirement Type: Immunization
Profile(s): Immunization
Must Support Elements: status, isSubpotent, vaccineCode, protocolApplied, url
Code Filter(s):
Path: status
Code:
Path: vaccineCode
ValueSet: IMMZ.Z.DE14 ValueSet for Poliovirus-containing vaccines
Measure Logic Definitions
Logic Definition Library Name: IMMZElements
/**
 * @dataElement All Doses Administered to Patient
 */
define "Doses Administered to Patient":
  [Immunization] I
    where I.status = 'completed'
    and I.isSubpotent is not true
Logic Definition Library Name: IMMZD2DTPolioElements
/*
@internal: Polio containing Doses Administered to Patient
*/
define "Polio Doses Administered to Patient":
  Elements."Doses Administered to Patient" I
  where
    I.vaccineCode in Concepts."Poliovirus-containing vaccines"
Logic Definition Library Name: IMMZD2DTPolioElements
/*
@internal: Polio containing Doses Administered to Patient that are in the Primary series
*/
define "Polio Primary Series Doses Administered to Patient":
  "Polio Doses Administered to Patient".seriesPrimary()
Logic Definition Library Name: IMMZD2DTPolioElements
/*
@internal: Polio bOPV Primary Series Doses Administered to Patient
*/
define "Polio bOPV Primary Series Doses Administered to Patient":
  "Polio Primary Series Doses Administered to Patient" I
  where I.typeOfDose() ~ Concepts."bOPV"
Logic Definition Library Name: IMMZIND08Logic
/*
@numerator: Number of OPV doses (3rd dose) administered through routine services during the reporting period
@pseudocode: COUNT of immunization events WHERE "Vaccine type" = "Oral polio vaccines" for the 3rd dose in the primary series AND "Date and time of vaccination" is during the reporting period
*/
define "Numerator":
  Coalesce( Polio."Polio bOPV Primary Series Doses Administered to Patient".sortedIndex(2).occurrence.toInterval() starts during "Measurement Period",
    false )
Logic Definition Library Name: IMMZIndicatorElements
/*
@stratifier: Infant disaggregations by age
*/
define "Infant By Age Stratifier":
    case 
        when AgeInYearsAt(end of "Measurement Period") < 1 then Age."P0Y--P1Y"
        when AgeInYearsAt(end of "Measurement Period") >= 1 then Age."P1Y--P9999Y"
        else null
    end
Logic Definition Library Name: IMMZIND08Logic
define "Stratification 4":
	Elements."Infant By Age Stratifier"
Logic Definition Library Name: IMMZIndicatorElements
/*
@stratifier: Age in Years
*/
define "Age Stratifier":
  case
    when AgeInYearsAt(end of "Measurement Period") < 1 then Age."P0Y--P1Y"
    when AgeInYearsAt(end of "Measurement Period") < 2 then Age."P1Y--P2Y"
    when AgeInYearsAt(end of "Measurement Period") < 3 then Age."P2Y--P3Y"
    when AgeInYearsAt(end of "Measurement Period") < 4 then Age."P3Y--P4Y"
    when AgeInYearsAt(end of "Measurement Period") < 5 then Age."P4Y--P5Y"
    when AgeInYearsAt(end of "Measurement Period") < 6 then Age."P5Y--P6Y"
    when AgeInYearsAt(end of "Measurement Period") < 7 then Age."P6Y--P7Y"
    when AgeInYearsAt(end of "Measurement Period") < 8 then Age."P7Y--P8Y"
    when AgeInYearsAt(end of "Measurement Period") < 9 then Age."P8Y--P9Y"
    when AgeInYearsAt(end of "Measurement Period") < 10 then Age."P9Y--P10Y"
    when AgeInYearsAt(end of "Measurement Period") < 11 then Age."P10Y--P11Y"
    when AgeInYearsAt(end of "Measurement Period") < 12 then Age."P11Y--P12Y"
    when AgeInYearsAt(end of "Measurement Period") < 13 then Age."P12Y--P13Y"
    when AgeInYearsAt(end of "Measurement Period") < 14 then Age."P13Y--P14Y"
    when AgeInYearsAt(end of "Measurement Period") < 15 then Age."P14Y--P15Y"
    when AgeInYearsAt(end of "Measurement Period") < 16 then Age."P15Y--P16Y"
    when AgeInYearsAt(end of "Measurement Period") < 17 then Age."P16Y--P17Y"
    when AgeInYearsAt(end of "Measurement Period") < 18 then Age."P17Y--P18Y"
    when AgeInYearsAt(end of "Measurement Period") < 19 then Age."P18Y--P19Y"
    when AgeInYearsAt(end of "Measurement Period") < 20 then Age."P19Y--P20Y"
    when AgeInYearsAt(end of "Measurement Period") < 21 then Age."P20Y--P21Y"
    when AgeInYearsAt(end of "Measurement Period") < 22 then Age."P21Y--P22Y"
    when AgeInYearsAt(end of "Measurement Period") < 23 then Age."P22Y--P23Y"
    when AgeInYearsAt(end of "Measurement Period") < 24 then Age."P23Y--P24Y"
    when AgeInYearsAt(end of "Measurement Period") < 25 then Age."P24Y--P25Y"
    when AgeInYearsAt(end of "Measurement Period") < 26 then Age."P25Y--P26Y"
    when AgeInYearsAt(end of "Measurement Period") < 27 then Age."P26Y--P27Y"
    when AgeInYearsAt(end of "Measurement Period") < 28 then Age."P27Y--P28Y"
    when AgeInYearsAt(end of "Measurement Period") < 29 then Age."P28Y--P29Y"
    when AgeInYearsAt(end of "Measurement Period") < 30 then Age."P29Y--P30Y"
    when AgeInYearsAt(end of "Measurement Period") < 31 then Age."P30Y--P31Y"
    when AgeInYearsAt(end of "Measurement Period") < 32 then Age."P31Y--P32Y"
    when AgeInYearsAt(end of "Measurement Period") < 33 then Age."P32Y--P33Y"
    when AgeInYearsAt(end of "Measurement Period") < 34 then Age."P33Y--P34Y"
    when AgeInYearsAt(end of "Measurement Period") < 35 then Age."P34Y--P35Y"
    when AgeInYearsAt(end of "Measurement Period") < 36 then Age."P35Y--P36Y"
    when AgeInYearsAt(end of "Measurement Period") < 37 then Age."P36Y--P37Y"
    when AgeInYearsAt(end of "Measurement Period") < 38 then Age."P37Y--P38Y"
    when AgeInYearsAt(end of "Measurement Period") < 39 then Age."P38Y--P39Y"
    when AgeInYearsAt(end of "Measurement Period") < 40 then Age."P39Y--P40Y"
    when AgeInYearsAt(end of "Measurement Period") < 41 then Age."P40Y--P41Y"
    when AgeInYearsAt(end of "Measurement Period") < 42 then Age."P41Y--P42Y"
    when AgeInYearsAt(end of "Measurement Period") < 43 then Age."P42Y--P43Y"
    when AgeInYearsAt(end of "Measurement Period") < 44 then Age."P43Y--P44Y"
    when AgeInYearsAt(end of "Measurement Period") < 45 then Age."P44Y--P45Y"
    when AgeInYearsAt(end of "Measurement Period") < 46 then Age."P45Y--P46Y"
    when AgeInYearsAt(end of "Measurement Period") < 47 then Age."P46Y--P47Y"
    when AgeInYearsAt(end of "Measurement Period") < 48 then Age."P47Y--P48Y"
    when AgeInYearsAt(end of "Measurement Period") < 49 then Age."P48Y--P49Y"
    when AgeInYearsAt(end of "Measurement Period") < 50 then Age."P49Y--P50Y"
    when AgeInYearsAt(end of "Measurement Period") < 51 then Age."P50Y--P51Y"
    when AgeInYearsAt(end of "Measurement Period") < 52 then Age."P51Y--P52Y"
    when AgeInYearsAt(end of "Measurement Period") < 53 then Age."P52Y--P53Y"
    when AgeInYearsAt(end of "Measurement Period") < 54 then Age."P53Y--P54Y"
    when AgeInYearsAt(end of "Measurement Period") < 55 then Age."P54Y--P55Y"
    when AgeInYearsAt(end of "Measurement Period") < 56 then Age."P55Y--P56Y"
    when AgeInYearsAt(end of "Measurement Period") < 57 then Age."P56Y--P57Y"
    when AgeInYearsAt(end of "Measurement Period") < 58 then Age."P57Y--P58Y"
    when AgeInYearsAt(end of "Measurement Period") < 59 then Age."P58Y--P59Y"
    when AgeInYearsAt(end of "Measurement Period") < 60 then Age."P59Y--P60Y"
    when AgeInYearsAt(end of "Measurement Period") < 61 then Age."P60Y--P61Y"
    when AgeInYearsAt(end of "Measurement Period") < 62 then Age."P61Y--P62Y"
    when AgeInYearsAt(end of "Measurement Period") < 63 then Age."P62Y--P63Y"
    when AgeInYearsAt(end of "Measurement Period") < 64 then Age."P63Y--P64Y"
    when AgeInYearsAt(end of "Measurement Period") < 65 then Age."P64Y--P65Y"
    when AgeInYearsAt(end of "Measurement Period") < 66 then Age."P65Y--P66Y"
    when AgeInYearsAt(end of "Measurement Period") < 67 then Age."P66Y--P67Y"
    when AgeInYearsAt(end of "Measurement Period") < 68 then Age."P67Y--P68Y"
    when AgeInYearsAt(end of "Measurement Period") < 69 then Age."P68Y--P69Y"
    when AgeInYearsAt(end of "Measurement Period") < 70 then Age."P69Y--P70Y"
    when AgeInYearsAt(end of "Measurement Period") < 71 then Age."P70Y--P71Y"
    when AgeInYearsAt(end of "Measurement Period") < 72 then Age."P71Y--P72Y"
    when AgeInYearsAt(end of "Measurement Period") < 73 then Age."P72Y--P73Y"
    when AgeInYearsAt(end of "Measurement Period") < 74 then Age."P73Y--P74Y"
    when AgeInYearsAt(end of "Measurement Period") < 75 then Age."P74Y--P75Y"
    when AgeInYearsAt(end of "Measurement Period") < 76 then Age."P75Y--P76Y"
    when AgeInYearsAt(end of "Measurement Period") < 77 then Age."P76Y--P77Y"
    when AgeInYearsAt(end of "Measurement Period") < 78 then Age."P77Y--P78Y"
    when AgeInYearsAt(end of "Measurement Period") < 79 then Age."P78Y--P79Y"
    when AgeInYearsAt(end of "Measurement Period") < 80 then Age."P79Y--P80Y"
    when AgeInYearsAt(end of "Measurement Period") < 81 then Age."P80Y--P81Y"
    when AgeInYearsAt(end of "Measurement Period") < 82 then Age."P81Y--P82Y"
    when AgeInYearsAt(end of "Measurement Period") < 83 then Age."P82Y--P83Y"
    when AgeInYearsAt(end of "Measurement Period") < 84 then Age."P83Y--P84Y"
    when AgeInYearsAt(end of "Measurement Period") < 85 then Age."P84Y--P85Y"
    when AgeInYearsAt(end of "Measurement Period") < 86 then Age."P85Y--P86Y"
    when AgeInYearsAt(end of "Measurement Period") < 87 then Age."P86Y--P87Y"
    when AgeInYearsAt(end of "Measurement Period") < 88 then Age."P87Y--P88Y"
    when AgeInYearsAt(end of "Measurement Period") < 89 then Age."P88Y--P89Y"
    when AgeInYearsAt(end of "Measurement Period") < 90 then Age."P89Y--P90Y"
    when AgeInYearsAt(end of "Measurement Period") < 91 then Age."P90Y--P91Y"
    when AgeInYearsAt(end of "Measurement Period") < 92 then Age."P91Y--P92Y"
    when AgeInYearsAt(end of "Measurement Period") < 93 then Age."P92Y--P93Y"
    when AgeInYearsAt(end of "Measurement Period") < 94 then Age."P93Y--P94Y"
    when AgeInYearsAt(end of "Measurement Period") < 95 then Age."P94Y--P95Y"
    when AgeInYearsAt(end of "Measurement Period") < 96 then Age."P95Y--P96Y"
    when AgeInYearsAt(end of "Measurement Period") < 97 then Age."P96Y--P97Y"
    when AgeInYearsAt(end of "Measurement Period") < 98 then Age."P97Y--P98Y"
    when AgeInYearsAt(end of "Measurement Period") < 99 then Age."P98Y--P99Y"
    when AgeInYearsAt(end of "Measurement Period") < 100 then Age."P99Y--P100Y"
    when AgeInYearsAt(end of "Measurement Period") >= 100 then Age."P100Y--P9999Y"
    else null
  end
Logic Definition Library Name: IMMZIND08Logic
define "Stratification 3":
	Elements."Age Stratifier"
Logic Definition Library Name: IMMZIndicatorElements
/*
@stratifier: By Administrative Gender of Patient Stratifier
*/
define "By Administrative Gender Stratifier":
    case 
        when Patient.gender = 'male' then "Males"
        when Patient.gender = 'female' then "Females"
        else "Other"
    end
Logic Definition Library Name: IMMZIND08Logic
define "Stratification 2":
	Elements."By Administrative Gender Stratifier"
Logic Definition Library Name: IMMZIndicatorElements
/*
@stratifier: By Geographic Region of Patient Stratifier
*/
define "By Geographic Region Stratifier":
    First(Patient.address A where A.use in { 'home' }).state
Logic Definition Library Name: IMMZIND08Logic
/*
@disaggregation: Administrative area
                 Sex
                 Age in years
                 Age group (depending on schedule)
*/
define "Stratification 1":
	Elements."By Geographic Region Stratifier"
Logic Definition Library Name: IMMZIND08Logic
/*
@denominator: Number in target group
@pseudocode: As defined by the Member States
*/
define "Denominator":
  true
Logic Definition Library Name: IMMZIND08Logic
/*
 * As defined by Member State
 */
define "Initial Population":
  true
Logic Definition Library Name: WHOCommon
/*
From FHIRCommon 4.1.0:
*/

/*
@description: Normalizes a value that is a choice of timing-valued types to an equivalent interval
@comment: Normalizes a choice type of FHIR.dateTime, FHIR.Period, FHIR.Timing, FHIR.instance, FHIR.string, FHIR.Age, or FHIR.Range types
to an equivalent interval. This selection of choice types is a superset of the majority of choice types that are used as possible
representations for timing-valued elements in FHIR, allowing this function to be used across any resource.

The input can be provided as a dateTime, Period, Timing, instant, string, Age, or Range.
The intent of this function is to provide a clear and concise mechanism to treat single
elements that have multiple possible representations as intervals so that logic doesn't have to account
for the variability. More complex calculations (such as medication request period or dispense period
calculation) need specific guidance and consideration. That guidance may make use of this function, but
the focus of this function is on single element calculations where the semantics are unambiguous.
If the input is a dateTime, the result a DateTime Interval beginning and ending on that dateTime.
If the input is a Period, the result is a DateTime Interval.
If the input is a Timing, an error is raised indicating a single interval cannot be computed from a Timing.
If the input is an instant, the result is a DateTime Interval beginning and ending on that instant.
If the input is a string, an error is raised indicating a single interval cannot be computed from a string.
If the input is an Age, the result is a DateTime Interval beginning when the patient was the given Age,
and ending immediately prior to when the patient was the given Age plus one year.
If the input is a Range, the result is a DateTime Interval beginning when the patient was the Age given
by the low end of the Range, and ending immediately prior to when the patient was the Age given by the
high end of the Range plus one year.

NOTE: Due to the
complexity of determining a single interval from a Timing or String type, this function will throw a run-time exception if it is used
with a Timing or String.
*/
define fluent function toInterval(choice Choice<FHIR.dateTime, FHIR.Period, FHIR.Timing, FHIR.instant, FHIR.string, FHIR.Age, FHIR.Range>):
  case
    when choice is FHIR.dateTime then
      Interval[FHIRHelpers.ToDateTime(choice as FHIR.dateTime), FHIRHelpers.ToDateTime(choice as FHIR.dateTime)]
    when choice is FHIR.Period then
      FHIRHelpers.ToInterval(choice as FHIR.Period)
    when choice is FHIR.instant then
      Interval[FHIRHelpers.ToDateTime(choice as FHIR.instant), FHIRHelpers.ToDateTime(choice as FHIR.instant)]
    when choice is FHIR.Age then
      Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(choice as FHIR.Age),
        FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity(choice as FHIR.Age) + 1 year)
    when choice is FHIR.Range then
      Interval[FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((choice as FHIR.Range).low),
        FHIRHelpers.ToDate(Patient.birthDate) + FHIRHelpers.ToQuantity((choice as FHIR.Range).high) + 1 year)
    when choice is FHIR.Timing then
      Message(null as Interval<DateTime>, true, 'NOT_IMPLEMENTED', 'Error', 'Calculation of an interval from a Timing value is not supported')
    when choice is FHIR.string then
      Message(null as Interval<DateTime>, true, 'NOT_IMPLEMENTED', 'Error', 'Calculation of an interval from a String value is not supported')
    else
      null as Interval<DateTime>
  end
Logic Definition Library Name: FHIRHelpers
define function ToDateTime(value dateTime): value.value
Logic Definition Library Name: FHIRHelpers
define function ToInterval(period FHIR.Period):
    if period is null then
        null
    else
        if period."start" is null then
            Interval(period."start".value, period."end".value]
        else
            Interval[period."start".value, period."end".value]
Logic Definition Library Name: FHIRHelpers
define function ToDateTime(value instant): value.value
Logic Definition Library Name: FHIRHelpers
define function ToDate(value date): value.value
Logic Definition Library Name: FHIRHelpers
define function ToQuantity(quantity FHIR.Quantity):
    case
        when quantity is null then null
        when quantity.value is null then null
        when quantity.comparator is not null then
            Message(null, true, 'FHIRHelpers.ToQuantity.ComparatorQuantityNotSupported', 'Error', 'FHIR Quantity value has a comparator and cannot be converted to a System.Quantity value.')
        when quantity.system is null or quantity.system.value = 'http://unitsofmeasure.org'
              or quantity.system.value = 'http://hl7.org/fhirpath/CodeSystem/calendar-units' then
            System.Quantity { value: quantity.value.value, unit: ToCalendarUnit(Coalesce(quantity.code.value, quantity.unit.value, '1')) }
        else
            Message(null, true, 'FHIRHelpers.ToQuantity.InvalidFHIRQuantity', 'Error', 'Invalid FHIR Quantity code: ' & quantity.unit.value & ' (' & quantity.system.value & '|' & quantity.code.value & ')')
    end
Logic Definition Library Name: FHIRHelpers
define function ToCalendarUnit(unit System.String):
    case unit
        when 'ms' then 'millisecond'
        when 's' then 'second'
        when 'min' then 'minute'
        when 'h' then 'hour'
        when 'd' then 'day'
        when 'wk' then 'week'
        when 'mo' then 'month'
        when 'a' then 'year'
        else unit
    end
Logic Definition Library Name: IMMZCommon
/**
 * @description: Sorts a list and returns the requested index
 */
define fluent function sortedIndex(immunizations List<Immunization>, idx Integer):
  if exists( immunizations ) then
    (immunizations I sort by start of occurrence.toInterval())[idx]
  else null
Logic Definition Library Name: IMMZCommon
/**
 * @description: Gets the doses from the primary series
 */
define fluent function seriesPrimary(immunizations List<Immunization>):
  immunizations I where
    exists( I.protocolApplied pa where pa.series = 'Primary series' )
Logic Definition Library Name: FHIRHelpers
define function ToString(value string): value.value
Logic Definition Library Name: FHIRHelpers
define function ToString(value ImmunizationStatus): value.value
Logic Definition Library Name: FHIRHelpers
define function ToBoolean(value boolean): value.value
Logic Definition Library Name: FHIRHelpers
define function ToConcept(concept FHIR.CodeableConcept):
    if concept is null then
        null
    else
        System.Concept {
            codes: concept.coding C return ToCode(C),
            display: concept.text.value
        }
Logic Definition Library Name: FHIRHelpers
define function ToCode(coding FHIR.Coding):
    if coding is null then
        null
    else
        System.Code {
          code: coding.code.value,
          system: coding.system.value,
          version: coding.version.value,
          display: coding.display.value
        }
Logic Definition Library Name: IMMZCommon
/**
 * @description: Gets the type of antigen dose extension value from an Immunization
 */
define fluent function typeOfDose(immz Immunization):
  (First(
    immz.extension E where E.url = 'http://smart.who.int/immunizations/StructureDefinition/IMMZTypeOfDose'
  )).value as FHIR.CodeableConcept
Logic Definition Library Name: FHIRHelpers
define function ToString(value uri): value.value
Logic Definition Library Name: FHIRHelpers
define function ToString(value AdministrativeGender): value.value
Logic Definition Library Name: FHIRHelpers
define function ToString(value AddressUse): value.value
Generated using version 0.4.6 of the sample-content-ig Liquid templates