NesEnrolment
type: StructureDefinition
node role: treeRoot
id:
  v: NesEnrolment
text:
  status:
    v: extensions
  div: Generated Narrative: StructureDefinition NesEnrolment Name Flags Card. Type Description & Constraints<img src="[binary]" alt="doco" style="background-color: inherit"/> EpisodeOfCare C 0..* EpisodeOfCare An association of a Patient with an Organization and Healthcare Provider(s) for a period of time that the Organization assumes some level of responsibility URL-LENGTH: URLs must be less than 1024 characters URL-ALLOWED-CHARS: character restrictions for URLs SYSTEM-LENGTH: System URLs must be less than 1024 characters SYSTEM-ALLOWED-CHARS: character restrictions for system url CODEABLE-CONCEPT-TEXT-LENGTH: valueCodeableConcept.text must be less than 1024 characters CODEABLE-CONCEPT-TEXT-ALLOWED-CHARS: character restrictions for valueCodeableConcept.text meta versionId 0..0 source 0..0 security 0..0 tag 0..0 language 0..0 Slices for contained 0..* Resource Contained, inline Resources Slice: Unordered, Closed by type:$this contained:careManager 0..1 NesPractitionerRole Contained resource for the last qualified Encounter relating to this Enrolment contained:qualifiedEncounter 0..1 Encounter Contained, inline Resources contained:patient 0..1 NesPatient Information about an individual or animal receiving health care services Slices for extension 0..* Extension Extension Slice: Unordered, Open by value:url extension:expiryDate 0..1 date The date on which the Enrolment will expire URL: http://hl7.org.nz/fhir/StructureDefinition/enrolment-expiry-date extension:re-enrolmentDate 0..1 date Extension URL: http://hl7.org.nz/fhir/StructureDefinition/reenrolment-date extension:owningOrganisation 0..1 Reference(HPI Organization) Organisation that creates the enrolment URL: http://hl7.org.nz/fhir/StructureDefinition/enrolment-owner-org extension:terminationReason 0..1 (Complex) describe the reason the enrolment has ended URL: http://hl7.org.nz/fhir/StructureDefinition/nes-enrolment-termination-reason value[x] 0..1 CodeableConcept Value of extension Binding: NES Enrolment Termination R…
url:
  v: http://hl7.org.nz/fhir/StructureDefinition/NesEnrolment
version:
  v: 1.4.10
name:
  v: NesEnrolment
title:
  v: NES Enrolment
status:
  v: active
date:
  v: 2025-04-08T02:13:26+00:00
publisher:
  v: Te Whatu Ora
contact:
  name:
    v: Te Whatu Ora
  telecom:
    system:
      v: email
description:
  v: Adds additional, NES specific extensions for enrolments
fhir version:
  v: 4.0.1
mapping:
  identity:
    v: workflow
  uri:
    v: http://hl7.org/fhir/workflow
  name:
    v: Workflow Pattern
mapping:
  identity:
    v: rim
  uri:
    v: http://hl7.org/v3
  name:
    v: RIM Mapping
mapping:
  identity:
    v: w5
  uri:
    v: http://hl7.org/fhir/fivews
  name:
    v: FiveWs Pattern Mapping
kind:
  v: resource
abstract:
  v: false
type:
  v: EpisodeOfCare
base definition:
  v: http://hl7.org/fhir/StructureDefinition/EpisodeOfCare
  link: http://hl7.org/fhir/StructureDefinition/EpisodeOfCare
derivation:
  v: constraint
snapshot:
  extension:
    url:
      v: http://hl7.org/fhir/tools/StructureDefinition/snapshot-base-version
    value: string
      v: 4.0.1
  element:
    id:
      v: EpisodeOfCare
    path:
      v: EpisodeOfCare
    short:
      v: An association of a Patient with an Organization and Healthcare Provider(s) for a period of time that the Organization assumes some level of responsibility
    definition:
      v: An association between a patient and an organization / healthcare provider(s) during which time encounters may occur. The managing organization assumes a level of responsibility for the patient during this time.
    alias:
      v: Case Program Problem
    min:
      v: 0
    max:
      v: *
    base:
      path:
        v: EpisodeOfCare
      min:
        v: 0
      max:
        v: *
    constraint:
      key:
        v: dom-2
      severity:
        v: error
      human:
        v: If the resource is contained in another resource, it SHALL NOT contain nested Resources
      expression:
        v: contained.contained.empty()
      xpath:
        v: not(parent::f:contained and f:contained)
      source:
        v: http://hl7.org/fhir/StructureDefinition/DomainResource
        link: http://hl7.org/fhir/StructureDefinition/DomainResource
    constraint:
      key:
        v: dom-3
      severity:
        v: error
      human:
        v: If the resource is contained in another resource, it SHALL be referred to from elsewhere in the resource or SHALL refer to the containing resource
      expression:
        v: contained.where((('#'+id in (%resource.descendants().reference | %resource.descendants().as(canonical) | %resource.descendants().as(uri) | %resource.descendants().as(url))) or descendants().where(reference = '#').exists() or descendants().where(as(canonical) = '#').exists() or descendants().where(as(canonical) = '#').exists()).not()).trace('unmatched', id).empty()
      xpath:
        v: not(exists(for $id in f:contained/*/f:id/@value return $contained[not(parent::*/descendant::f:reference/@value=concat('#', $contained/*/id/@value) or descendant::f:reference[@value='#'])]))
      source:
        v: http://hl7.org/fhir/StructureDefinition/DomainResource
        link: http://hl7.org/fhir/StructureDefinition/DomainResource
    constraint:
      key:
        v: dom-4
      severity:
        v: error
      human:
        v: If a resource is contained in another resource, it SHALL NOT have a meta.versionId or a meta.lastUpdated
      expression:
        v: contained.meta.versionId.empty() and contained.meta.lastUpdated.empty()
      xpath:
        v: not(exists(f:contained/*/f:meta/f:versionId)) and not(exists(f:contained/*/f:meta/f:lastUpdated))
      source:
        v: http://hl7.org/fhir/StructureDefinition/DomainResource
        link: http://hl7.org/fhir/StructureDefinition/DomainResource
    constraint:
      key:
        v: dom-5
      severity:
        v: error
      human:
        v: If a resource is contained in another resource, it SHALL NOT have a security label
      expression:
        v: contained.meta.security.empty()
      xpath:
        v: not(exists(f:contained/*/f:meta/f:security))
      source:
        v: http://hl7.org/fhir/StructureDefinition/DomainResource
        link: http://hl7.org/fhir/StructureDefinition/DomainResource
    constraint:
      extension:
        value: boolean
      extension:
        value: markdown
      key:
        v: dom-6
      severity:
        v: warning
      human:
        v: A resource should have narrative for robust management
      expression:
        v: text.`div`.exists()
      xpath:
        v: exists(f:text/h:div)
      source:
        v: http://hl7.org/fhir/StructureDefinition/DomainResource
        link: http://hl7.org/fhir/StructureDefinition/DomainResource
    constraint:
      key:
        v: URL-LENGTH
      severity:
        v: error
      human:
        v: URLs must be less than 1024 characters
      expression:
        v: EpisodeOfCare.descendants().url.all(length()<1024)
      source:
        v: http://hl7.org.nz/fhir/StructureDefinition/NesEnrolment
        link: http://hl7.org.nz/fhir/StructureDefinition/NesEnrolment
    constraint:
      key:
        v: URL-ALLOWED-CHARS
      severity:
        v: error
      human:
        v: character restrictions for URLs
      expression:
        v: EpisodeOfCare.descendants().url.all(matches('^[-a-zA-Z0-9@:%._~#=?&\/]*$'))
      source:
        v: http://hl7.org.nz/fhir/StructureDefinition/NesEnrolment
        link: http://hl7.org.nz/fhir/StructureDefinition/NesEnrolment
    constraint:
      key:
        v: SYSTEM-LENGTH
      severity:
        v: error
      human:
        v: System URLs must be less than 1024 characters
      expression:
        v: EpisodeOfCare.descendants().system.all(length()<1024)
      source:
        v: http://hl7.org.nz/fhir/StructureDefinition/NesEnrolment
        link: http://hl7.org.nz/fhir/StructureDefinition/NesEnrolment

boolean
v: true

markdown
v: When a resource has no narrative, only systems that fully understand the data can display the resource to a human safely. Including a human readable representation in the resource makes for a much more robust eco-system and cheaper handling of resources by intermediary systems. Some ecosystems restrict distribution of resources to only those systems that do fully understand the resources, and as a consequence implementers may believe that the narrative is superfluous. However experience shows that such eco-systems often open up to new participants over time.

key:
  v: SYSTEM-ALLOWED-CHARS
severity:
  v: error
human:
  v: character restrictions for system url
expression:
  v: EpisodeOfCare.descendants().system.all(matches('^[-a-zA-Z0-9@:%._~#=?&\/]*$'))
source:
  v: http://hl7.org.nz/fhir/StructureDefinition/NesEnrolment
  link: http://hl7.org.nz/fhir/StructureDefinition/NesEnrolment

key:
  v: CODEABLE-CONCEPT-TEXT-LENGTH
severity:
  v: error
human:
  v: valueCodeableConcept.text must be less than 1024 characters
expression:
  v: EpisodeOfCare.descendants().valueCodeableConcept.text.all(length()<1024)
source:
  v: http://hl7.org.nz/fhir/StructureDefinition/NesEnrolment
  link: http://hl7.org.nz/fhir/StructureDefinition/NesEnrolment

key:
  v: CODEABLE-CONCEPT-TEXT-ALLOWED-CHARS
severity:
  v: error
human:
  v: character restrictions for valueCodeableConcept.text
expression:
  v: EpisodeOfCare.descendants().valueCodeableConcept.text.all(matches('^([-a-zA-Z0-9\' \t\r\n.\/,])*$'))
source:
  v: http://hl7.org.nz/fhir/StructureDefinition/NesEnrolment
  link: http://hl7.org.nz/fhir/StructureDefinition/NesEnrolment

v: false

v: false

identity:
  v: rim
map:
  v: Entity. Role, or Act

identity:
  v: workflow
map:
  v: Event

identity:
  v: rim
map:
  v: n/a

id:
  v: EpisodeOfCare.id
path:
  v: EpisodeOfCare.id
short:
  v: Logical id of this artifact
definition:
  v: The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.
comment:
  v: The only time that a resource does not have an id is when it is being submitted to the server using a create operation.
min:
  v: 0
max:
  v: 1
base:
  path:
    v: Resource.id
  min:
    v: 0
  max:
    v: 1
type:
  extension:
    url:
      v: http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type
    value: url
      v: id
  code:
    v: http://hl7.org/fhirpath/System.String
is modifier:
  v: false
is summary:
  v: true

id:
  v: EpisodeOfCare.meta
path:
  v: EpisodeOfCare.meta
short:
  v: Metadata about the resource
definition:
  v: The metadata about the resource. This is content that is maintained by the infrastructure. Changes to the content might not always be associated with version changes to the resource.
min:
  v: 0
max:
  v: 1
base:
  path:
    v: Resource.meta
  min:
    v: 0
  max:
    v: 1
type:
  code:
    v: Meta
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
is modifier:
  v: false
is summary:
  v: true

id:
  v: EpisodeOfCare.meta.id
path:
  v: EpisodeOfCare.meta.id
representation:
  v: xmlAttr
short:
  v: Unique id for inter-element referencing
definition:
  v: Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.
min:
  v: 0
max:
  v: 1
base:
  path:
    v: Element.id
  min:
    v: 0
  max:
    v: 1
type:
  extension:
    url:
      v: http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type
    value: url
      v: string
  code:
    v: http://hl7.org/fhirpath/System.String
is modifier:
  v: false
is summary:
  v: false
mapping:
  identity:
    v: rim
  map:
    v: n/a

id:
  v: EpisodeOfCare.meta.extension
path:
  v: EpisodeOfCare.meta.extension
slicing:
  discriminator:
    type:
      v: value
    path:
      v: url
  description:
    v: Extensions are always sliced by (at least) url
  rules:
    v: open
short:
  v: Additional content defined by implementations
definition:
  v: May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.
comment:
  v: There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions. The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone.
alias:
  v: extensions
alias:
  v: user content
min:
  v: 0
max:
  v: *
base:
  path:
    v: Element.extension
  min:
    v: 0
  max:
    v: *
type:
  code:
    v: Extension
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
constraint:
  key:
    v: ext-1
  severity:
    v: error
  human:
    v: Must have either extensions or value[x], not both
  expression:
    v: extension.exists() != value.exists()
  xpath:
    v: exists(f:extension)!=exists(f:*[starts-with(local-name(.), "value")])
  source:
    v: http://hl7.org/fhir/StructureDefinition/Extension
    link: http://hl7.org/fhir/StructureDefinition/Extension
is modifier:
  v: false
is summary:
  v: false
mapping:
  identity:
    v: rim
  map:
    v: n/a

id:
  v: EpisodeOfCare.meta.versionId
path:
  v: EpisodeOfCare.meta.versionId
short:
  v: Version specific identifier
definition:
  v: The version specific identifier, as it appears in the version portion of the URL. This value changes when the resource is created, updated, or deleted.
comment:
  v: The server assigns this value, and ignores what the client specifies, except in the case that the server is imposing version integrity on updates/deletes.
min:
  v: 0
max:
  v: 0
base:
  path:
    v: Meta.versionId
  min:
    v: 0
  max:
    v: 1
type:
  code:
    v: id
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
is modifier:
  v: false
is summary:
  v: true

id:
  v: EpisodeOfCare.meta.lastUpdated
path:
  v: EpisodeOfCare.meta.lastUpdated
short:
  v: When the resource version last changed
definition:
  v: When the resource last changed - e.g. when the version changed.
comment:
  v: This value is always populated except when the resource is first being created. The server / resource manager sets this value; what a client provides is irrelevant. This is equivalent to the HTTP Last-Modified and SHOULD have the same value on a [read](http://hl7.org/fhir/R4/http.html#read) interaction.
min:
  v: 0
max:
  v: 1
base:
  path:
    v: Meta.lastUpdated
  min:
    v: 0
  max:
    v: 1
type:
  code:
    v: instant
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
is modifier:
  v: false
is summary:
  v: true

id:
  v: EpisodeOfCare.meta.source
path:
  v: EpisodeOfCare.meta.source
short:
  v: Identifies where the resource comes from
definition:
  v: A uri that identifies the source system of the resource. This provides a minimal amount of [Provenance](http://hl7.org/fhir/R4/provenance.html#) information that can be used to track or differentiate the source of information in the resource. The source may identify another FHIR server, document, message, database, etc.
comment:
  v: In the provenance resource, this corresponds to Provenance.entity.what[x]. The exact use of the source (and the implied Provenance.entity.role) is left to implementer discretion. Only one nominated source is allowed; for additional provenance details, a full Provenance resource should be used. This element can be used to indicate where the current master source of a resource that has a canonical URL if the resource is no longer hosted at the canonical URL.
min:
  v: 0
max:
  v: 0
base:
  path:
    v: Meta.source
  min:
    v: 0
  max:
    v: 1
type:
  code:
    v: uri
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
is modifier:
  v: false
is summary:
  v: true

id:
  v: EpisodeOfCare.meta.profile
path:
  v: EpisodeOfCare.meta.profile
short:
  v: Profiles this resource claims to conform to
definition:
  v: A list of profiles (references to [StructureDefinition](http://hl7.org/fhir/R4/structuredefinition.html#) resources) that this resource claims to conform to. The URL is a reference to [StructureDefinition.url](http://hl7.org/fhir/R4/structuredefinition-definitions.html#StructureDefinition.url).
comment:
  v: It is up to the server and/or other infrastructure of policy to determine whether/how these claims are verified and/or updated over time. The list of profile URLs is a set.
min:
  v: 0
max:
  v: *
base:
  path:
    v: Meta.profile
  min:
    v: 0
  max:
    v: *
type:
  code:
    v: canonical
  target profile:
    v: http://hl7.org/fhir/StructureDefinition/StructureDefinition
    link: http://hl7.org/fhir/StructureDefinition/StructureDefinition
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
is modifier:
  v: false
is summary:
  v: true

id:
  v: EpisodeOfCare.meta.security
path:
  v: EpisodeOfCare.meta.security
short:
  v: Security Labels applied to this resource
definition:
  v: Security labels applied to this resource. These tags connect specific resources to the overall security policy and infrastructure.
comment:
  v: The security labels can be updated without changing the stated version of the resource. The list of security labels is a set. Uniqueness is based the system/code, and version and display are ignored.
min:
  v: 0
max:
  v: 0
base:
  path:
    v: Meta.security
  min:
    v: 0
  max:
    v: *
type:
  code:
    v: Coding
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
is modifier:
  v: false
is summary:
  v: true
binding:
  extension:
    url:
      v: http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName
    value: string
      v: SecurityLabels
  strength:
    v: extensible
  description:
    v: Security Labels from the Healthcare Privacy and Security Classification System.
  value set:
    v: http://hl7.org/fhir/ValueSet/security-labels
    link: http://hl7.org/fhir/ValueSet/security-labels

id:
  v: EpisodeOfCare.meta.tag
path:
  v: EpisodeOfCare.meta.tag
short:
  v: Tags applied to this resource
definition:
  v: Tags applied to this resource. Tags are intended to be used to identify and relate resources to process and workflow, and applications are not required to consider the tags when interpreting the meaning of a resource.
comment:
  v: The tags can be updated without changing the stated version of the resource. The list of tags is a set. Uniqueness is based the system/code, and version and display are ignored.
min:
  v: 0
max:
  v: 0
base:
  path:
    v: Meta.tag
  min:
    v: 0
  max:
    v: *
type:
  code:
    v: Coding
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
is modifier:
  v: false
is summary:
  v: true
binding:
  extension:
    url:
      v: http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName
    value: string
      v: Tags
  strength:
    v: example
  description:
    v: Codes that represent various types of tags, commonly workflow-related; e.g. "Needs review by Dr. Jones".
  value set:
    v: http://hl7.org/fhir/ValueSet/common-tags
    link: http://hl7.org/fhir/ValueSet/common-tags

id:
  v: EpisodeOfCare.implicitRules
path:
  v: EpisodeOfCare.implicitRules
short:
  v: A set of rules under which this content was created
definition:
  v: A reference to a set of rules that were followed when the resource was constructed, and which must be understood when processing the content. Often, this is a reference to an implementation guide that defines the special rules along with other profiles etc.
comment:
  v: Asserting this rule set restricts the content to be only understood by a limited set of trading partners. This inherently limits the usefulness of the data in the long term. However, the existing health eco-system is highly fractured, and not yet ready to define, collect, and exchange data in a generally computable sense. Wherever possible, implementers and/or specification writers should avoid using this element. Often, when used, the URL is a reference to an implementation guide that defines these special rules as part of it's narrative along with other profiles, value sets, etc.
min:
  v: 0
max:
  v: 1
base:
  path:
    v: Resource.implicitRules
  min:
    v: 0
  max:
    v: 1
type:
  code:
    v: uri
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
is modifier:
  v: true
is modifier reason:
  v: This element is labeled as a modifier because the implicit rules may provide additional knowledge about the resource that modifies it's meaning or interpretation
is summary:
  v: true

id:
  v: EpisodeOfCare.language
path:
  v: EpisodeOfCare.language
short:
  v: Language of the resource content
definition:
  v: The base language in which the resource is written.
comment:
  v: Language is provided to support indexing and accessibility (typically, services such as text to speech use the language tag). The html language tag in the narrative applies to the narrative. The language tag on the resource may be used to specify the language of other presentations generated from the data in the resource. Not all the content has to be in the base language. The Resource.language should not be assumed to apply to the narrative automatically. If a language is specified, it should it also be specified on the div element in the html (see rules in HTML5 for information about the relationship between xml:lang and the html lang attribute).
min:
  v: 0
max:
  v: 0
base:
  path:
    v: Resource.language
  min:
    v: 0
  max:
    v: 1
type:
  code:
    v: code
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
is modifier:
  v: false
is summary:
  v: false
binding:
  extension:
    url:
      v: http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet
    value: canonical
      v: http://hl7.org/fhir/ValueSet/all-languages
      link: http://hl7.org/fhir/ValueSet/all-languages
  extension:
    url:
      v: http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName
    value: string
      v: Language
  strength:
    v: preferred
  description:
    v: A human language.
  value set:
    v: http://hl7.org/fhir/ValueSet/languages
    link: http://hl7.org/fhir/ValueSet/languages

id:
  v: EpisodeOfCare.text
path:
  v: EpisodeOfCare.text
short:
  v: Text summary of the resource, for human interpretation
definition:
  v: A human-readable narrative that contains a summary of the resource and can be used to represent the content of the resource to a human. The narrative need not encode all the structured data, but is required to contain sufficient detail to make it "clinically safe" for a human to just read the narrative. Resource definitions may define what content should be represented in the narrative to ensure clinical safety.
comment:
  v: Contained resources do not have narrative. Resources that are not contained SHOULD have a narrative. In some cases, a resource may only have text with little or no additional discrete data (as long as all minOccurs=1 elements are satisfied). This may be necessary for data from legacy systems where information is captured as a "text blob" or where text is additionally entered raw or narrated and encoded information is added later.
alias:
  v: narrative
alias:
  v: html
alias:
  v: xhtml
alias:
  v: display
min:
  v: 0
max:
  v: 1
base:
  path:
    v: DomainResource.text
  min:
    v: 0
  max:
    v: 1
type:
  code:
    v: Narrative
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
is modifier:
  v: false
is summary:
  v: false
mapping:
  identity:
    v: rim
  map:
    v: Act.text?

id:
  v: EpisodeOfCare.contained
path:
  v: EpisodeOfCare.contained
slicing:
  discriminator:
    type:
      v: type
    path:
      v: $this
  description:
    v: Slicing to specify a PractitionerRole resource may be returned as a contained resource for the Care Manager
  rules:
    v: closed
short:
  v: Contained, inline Resources
definition:
  v: These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.
comment:
  v: This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. Contained resources may have profiles and tags In their meta elements, but SHALL NOT have security labels.
alias:
  v: inline resources
alias:
  v: anonymous resources
alias:
  v: contained resources
min:
  v: 0
max:
  v: *
base:
  path:
    v: DomainResource.contained
  min:
    v: 0
  max:
    v: *
type:
  code:
    v: Resource
is modifier:
  v: false
is summary:
  v: false
mapping:
  identity:
    v: rim
  map:
    v: N/A

id:
  v: EpisodeOfCare.contained:careManager
path:
  v: EpisodeOfCare.contained
slice name:
  v: careManager
short:
  v: Contained resource for the last qualified Encounter relating to this Enrolment
definition:
  v: A specific set of Roles/Locations/specialties/services that a practitioner may perform at an organization for a period of time.
comment:
  v: This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. Contained resources may have profiles and tags In their meta elements, but SHALL NOT have security labels.
min:
  v: 0
max:
  v: 1
base:
  path:
    v: DomainResource.contained
  min:
    v: 0
  max:
    v: *
type:
  code:
    v: PractitionerRole
  profile:
    v: http://hl7.org.nz/fhir/StructureDefinition/NesPractitionerRole
    link: http://hl7.org.nz/fhir/StructureDefinition/NesPractitionerRole
is modifier:
  v: false
is summary:
  v: false
mapping:
  identity:
    v: rim
  map:
    v: Entity. Role, or Act
mapping:
  identity:
    v: v2
  map:
    v: PRD (as one example)
mapping:
  identity:
    v: rim
  map:
    v: Role
mapping:
  identity:
    v: servd
  map:
    v: ServiceSiteProvider

id:
  v: EpisodeOfCare.contained:qualifiedEncounter
path:
  v: EpisodeOfCare.contained
slice name:
  v: qualifiedEncounter
short:
  v: Contained, inline Resources
definition:
  v: These resources do not have an independent existence apart from the resource that contains them - they cannot be identified independently, and nor can they have their own independent transaction scope.
comment:
  v: This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. Contained resources may have profiles and tags In their meta elements, but SHALL NOT have security labels.
alias:
  v: inline resources
alias:
  v: anonymous resources
alias:
  v: contained resources
min:
  v: 0
max:
  v: 1
base:
  path:
    v: DomainResource.contained
  min:
    v: 0
  max:
    v: *
type:
  code:
    v: Encounter
is modifier:
  v: false
is summary:
  v: false
mapping:
  identity:
    v: rim
  map:
    v: N/A

id:
  v: EpisodeOfCare.contained:patient
path:
  v: EpisodeOfCare.contained
slice name:
  v: patient
short:
  v: Information about an individual or animal receiving health care services
definition:
  v: Demographics and other administrative information about an individual or animal receiving care or other health-related services.
comment:
  v: This should never be done when the content can be identified properly, as once identification is lost, it is extremely difficult (and context dependent) to restore it again. Contained resources may have profiles and tags In their meta elements, but SHALL NOT have security labels.
alias:
  v: SubjectOfCare Client Resident
min:
  v: 0
max:
  v: 1
base:
  path:
    v: DomainResource.contained
  min:
    v: 0
  max:
    v: *
type:
  code:
    v: Patient
  profile:
    v: http://hl7.org.nz/fhir/StructureDefinition/NesPatient
    link: http://hl7.org.nz/fhir/StructureDefinition/NesPatient
is modifier:
  v: false
is summary:
  v: false
mapping:
  identity:
    v: rim
  map:
    v: Entity. Role, or Act
mapping:
  identity:
    v: rim
  map:
    v: Patient[classCode=PAT]
mapping:
  identity:
    v: cda
  map:
    v: ClinicalDocument.recordTarget.patientRole

id:
  v: EpisodeOfCare.extension
path:
  v: EpisodeOfCare.extension
slicing:
  discriminator:
    type:
      v: value
    path:
      v: url
  ordered:
    v: false
  rules:
    v: open
short:
  v: Extension
definition:
  v: An Extension
min:
  v: 0
max:
  v: *
base:
  path:
    v: DomainResource.extension
  min:
    v: 0
  max:
    v: *
type:
  code:
    v: Extension
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
constraint:
  key:
    v: ext-1
  severity:
    v: error
  human:
    v: Must have either extensions or value[x], not both
  expression:
    v: extension.exists() != value.exists()
  xpath:
    v: exists(f:extension)!=exists(f:*[starts-with(local-name(.), "value")])
  source:
    v: http://hl7.org/fhir/StructureDefinition/Extension
    link: http://hl7.org/fhir/StructureDefinition/Extension
is modifier:
  v: false
is summary:
  v: false

id:
  v: EpisodeOfCare.extension:expiryDate
path:
  v: EpisodeOfCare.extension
slice name:
  v: expiryDate
short:
  v: The date on which the Enrolment will expire
definition:
  v: The enrolment expiry date
min:
  v: 0
max:
  v: 1
base:
  path:
    v: DomainResource.extension
  min:
    v: 0
  max:
    v: *
type:
  code:
    v: Extension
  profile:
    v: http://hl7.org.nz/fhir/StructureDefinition/enrolment-expiry-date
    link: http://hl7.org.nz/fhir/StructureDefinition/enrolment-expiry-date
condition:
  v: ele-1
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
constraint:
  key:
    v: ext-1
  severity:
    v: error
  human:
    v: Must have either extensions or value[x], not both
  expression:
    v: extension.exists() != value.exists()
  xpath:
    v: exists(f:extension)!=exists(f:*[starts-with(local-name(.), 'value')])
  source:
    v: http://hl7.org/fhir/StructureDefinition/Extension
    link: http://hl7.org/fhir/StructureDefinition/Extension
is modifier:
  v: false

id:
  v: EpisodeOfCare.extension:re-enrolmentDate
path:
  v: EpisodeOfCare.extension
slice name:
  v: re-enrolmentDate
short:
  v: Extension
definition:
  v: The re-enrolment date
min:
  v: 0
max:
  v: 1
base:
  path:
    v: DomainResource.extension
  min:
    v: 0
  max:
    v: *
type:
  code:
    v: Extension
  profile:
    v: http://hl7.org.nz/fhir/StructureDefinition/reenrolment-date
    link: http://hl7.org.nz/fhir/StructureDefinition/reenrolment-date
condition:
  v: ele-1
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
constraint:
  key:
    v: ext-1
  severity:
    v: error
  human:
    v: Must have either extensions or value[x], not both
  expression:
    v: extension.exists() != value.exists()
  xpath:
    v: exists(f:extension)!=exists(f:*[starts-with(local-name(.), 'value')])
  source:
    v: http://hl7.org/fhir/StructureDefinition/Extension
    link: http://hl7.org/fhir/StructureDefinition/Extension
is modifier:
  v: false

id:
  v: EpisodeOfCare.extension:owningOrganisation
path:
  v: EpisodeOfCare.extension
slice name:
  v: owningOrganisation
short:
  v: Organisation that creates the enrolment
definition:
  v: Org that creates the enrolment
min:
  v: 0
max:
  v: 1
base:
  path:
    v: DomainResource.extension
  min:
    v: 0
  max:
    v: *
type:
  code:
    v: Extension
  profile:
    v: http://hl7.org.nz/fhir/StructureDefinition/enrolment-owner-org
    link: http://hl7.org.nz/fhir/StructureDefinition/enrolment-owner-org
condition:
  v: ele-1
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
constraint:
  key:
    v: ext-1
  severity:
    v: error
  human:
    v: Must have either extensions or value[x], not both
  expression:
    v: extension.exists() != value.exists()
  xpath:
    v: exists(f:extension)!=exists(f:*[starts-with(local-name(.), 'value')])
  source:
    v: http://hl7.org/fhir/StructureDefinition/Extension
    link: http://hl7.org/fhir/StructureDefinition/Extension
is modifier:
  v: false

id:
  v: EpisodeOfCare.extension:terminationReason
path:
  v: EpisodeOfCare.extension
slice name:
  v: terminationReason
short:
  v: describe the reason the enrolment has ended
definition:
  v: NES Enrolment Termination Reason Code
min:
  v: 0
max:
  v: 1
base:
  path:
    v: DomainResource.extension
  min:
    v: 0
  max:
    v: *
type:
  code:
    v: Extension
  profile:
    v: http://hl7.org.nz/fhir/StructureDefinition/nes-enrolment-termination-reason
    link: http://hl7.org.nz/fhir/StructureDefinition/nes-enrolment-termination-reason
condition:
  v: ele-1
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
constraint:
  key:
    v: ext-1
  severity:
    v: error
  human:
    v: Must have either extensions or value[x], not both
  expression:
    v: extension.exists() != value.exists()
  xpath:
    v: exists(f:extension)!=exists(f:*[starts-with(local-name(.), 'value')])
  source:
    v: http://hl7.org/fhir/StructureDefinition/Extension
    link: http://hl7.org/fhir/StructureDefinition/Extension
is modifier:
  v: false

id:
  v: EpisodeOfCare.extension:terminationReason.id
path:
  v: EpisodeOfCare.extension.id
representation:
  v: xmlAttr
short:
  v: Unique id for inter-element referencing
definition:
  v: Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.
min:
  v: 0
max:
  v: 1
base:
  path:
    v: Element.id
  min:
    v: 0
  max:
    v: 1
type:
  extension:
    url:
      v: http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type
    value: url
      v: string
  code:
    v: http://hl7.org/fhirpath/System.String
is modifier:
  v: false
is summary:
  v: false
mapping:
  identity:
    v: rim
  map:
    v: n/a

id:
  v: EpisodeOfCare.extension:terminationReason.extension
path:
  v: EpisodeOfCare.extension.extension
slicing:
  discriminator:
    type:
      v: value
    path:
      v: url
  description:
    v: Extensions are always sliced by (at least) url
  rules:
    v: open
short:
  v: Extension
definition:
  v: An Extension
min:
  v: 0
max:
  v: 0
base:
  path:
    v: Element.extension
  min:
    v: 0
  max:
    v: *
type:
  code:
    v: Extension
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
constraint:
  key:
    v: ext-1
  severity:
    v: error
  human:
    v: Must have either extensions or value[x], not both
  expression:
    v: extension.exists() != value.exists()
  xpath:
    v: exists(f:extension)!=exists(f:*[starts-with(local-name(.), "value")])
  source:
    v: http://hl7.org/fhir/StructureDefinition/Extension
    link: http://hl7.org/fhir/StructureDefinition/Extension
is modifier:
  v: false
is summary:
  v: false

id:
  v: EpisodeOfCare.extension:terminationReason.url
path:
  v: EpisodeOfCare.extension.url
representation:
  v: xmlAttr
short:
  v: identifies the meaning of the extension
definition:
  v: Source of the definition for the extension code - a logical name or a URL.
comment:
  v: The definition may point directly to a computable or human-readable definition of the extensibility codes, or it may be a logical URI as declared in some other specification. The definition SHALL be a URI for the Structure Definition defining the extension.
min:
  v: 1
max:
  v: 1
base:
  path:
    v: Extension.url
  min:
    v: 1
  max:
    v: 1
type:
  extension:
    url:
      v: http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type
    value: url
      v: uri
  code:
    v: http://hl7.org/fhirpath/System.String
fixed: uri
  v: http://hl7.org.nz/fhir/StructureDefinition/nes-enrolment-termination-reason
is modifier:
  v: false
is summary:
  v: false
mapping:
  identity:
    v: rim
  map:
    v: N/A

id:
  v: EpisodeOfCare.extension:terminationReason.value[x]
path:
  v: EpisodeOfCare.extension.value[x]
short:
  v: Value of extension
definition:
  v: Value of extension - must be one of a constrained set of the data types (see [Extensibility](http://hl7.org/fhir/R4/extensibility.html) for a list).
min:
  v: 0
max:
  v: 1
base:
  path:
    v: Extension.value[x]
  min:
    v: 0
  max:
    v: 1
type:
  code:
    v: CodeableConcept
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
is modifier:
  v: false
is summary:
  v: false
binding:
  strength:
    v: required
  value set:
    v: https://nzhts.digital.health.nz/fhir/ValueSet/nes-enrolment-termination-reason
    link: https://nzhts.digital.health.nz/fhir/ValueSet/nes-enrolment-termination-reason
mapping:
  identity:
    v: rim
  map:
    v: N/A

id:
  v: EpisodeOfCare.extension:qualifiedEncounter
path:
  v: EpisodeOfCare.extension
slice name:
  v: qualifiedEncounter
short:
  v: the last qualified Encounter relating to this Enrolment
definition:
  v: The last qualified encounter foe this enrolment
min:
  v: 0
max:
  v: 1
base:
  path:
    v: DomainResource.extension
  min:
    v: 0
  max:
    v: *
type:
  code:
    v: Extension
  profile:
    v: http://hl7.org.nz/fhir/StructureDefinition/enrolment-encounter
    link: http://hl7.org.nz/fhir/StructureDefinition/enrolment-encounter
condition:
  v: ele-1
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
constraint:
  key:
    v: ext-1
  severity:
    v: error
  human:
    v: Must have either extensions or value[x], not both
  expression:
    v: extension.exists() != value.exists()
  xpath:
    v: exists(f:extension)!=exists(f:*[starts-with(local-name(.), 'value')])
  source:
    v: http://hl7.org/fhir/StructureDefinition/Extension
    link: http://hl7.org/fhir/StructureDefinition/Extension
is modifier:
  v: false

id:
  v: EpisodeOfCare.modifierExtension
path:
  v: EpisodeOfCare.modifierExtension
short:
  v: Extensions that cannot be ignored
definition:
  v: May be used to represent additional information that is not part of the basic definition of the resource and that modifies the understanding of the element that contains it and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer is allowed to define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions. Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).
comment:
  v: There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions. The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone.
requirements:
  v: Modifier extensions allow for extensions that *cannot* be safely ignored to be clearly distinguished from the vast majority of extensions which can be safely ignored. This promotes interoperability by eliminating the need for implementers to prohibit the presence of extensions. For further information, see the [definition of modifier extensions](http://hl7.org/fhir/R4/extensibility.html#modifierExtension).
alias:
  v: extensions
alias:
  v: user content
min:
  v: 0
max:
  v: *
base:
  path:
    v: DomainResource.modifierExtension
  min:
    v: 0
  max:
    v: *
type:
  code:
    v: Extension
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
constraint:
  key:
    v: ext-1
  severity:
    v: error
  human:
    v: Must have either extensions or value[x], not both
  expression:
    v: extension.exists() != value.exists()
  xpath:
    v: exists(f:extension)!=exists(f:*[starts-with(local-name(.), "value")])
  source:
    v: http://hl7.org/fhir/StructureDefinition/Extension
    link: http://hl7.org/fhir/StructureDefinition/Extension
is modifier:
  v: true
is modifier reason:
  v: Modifier extensions are expected to modify the meaning or interpretation of the resource that contains them
is summary:
  v: false
mapping:
  identity:
    v: rim
  map:
    v: N/A

id:
  v: EpisodeOfCare.identifier
path:
  v: EpisodeOfCare.identifier
short:
  v: Business Identifier(s) relevant for this EpisodeOfCare
definition:
  v: The EpisodeOfCare may be known by different identifiers for different contexts of use, such as when an external agency is tracking the Episode for funding purposes.
min:
  v: 0
max:
  v: *
base:
  path:
    v: EpisodeOfCare.identifier
  min:
    v: 0
  max:
    v: *
type:
  code:
    v: Identifier
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
is modifier:
  v: false
is summary:
  v: false
mapping:
  identity:
    v: workflow
  map:
    v: Event.identifier
mapping:
  identity:
    v: w5
  map:
    v: FiveWs.identifier

id:
  v: EpisodeOfCare.status
path:
  v: EpisodeOfCare.status
short:
  v: planned | waitlist | active | onhold | finished | cancelled | entered-in-error
definition:
  v: planned | waitlist | active | onhold | finished | cancelled.
comment:
  v: This element is labeled as a modifier because the status contains codes that mark the episode as not currently valid.
min:
  v: 1
max:
  v: 1
base:
  path:
    v: EpisodeOfCare.status
  min:
    v: 1
  max:
    v: 1
type:
  code:
    v: code
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
is modifier:
  v: true
is modifier reason:
  v: This element is labelled as a modifier because it is a status element that contains status entered-in-error which means that the resource should not be treated as valid
is summary:
  v: true
binding:
  strength:
    v: required
  value set:
    v: https://nzhts.digital.health.nz/fhir/ValueSet/nes-episode-of-care-status
    link: https://nzhts.digital.health.nz/fhir/ValueSet/nes-episode-of-care-status
mapping:
  identity:
    v: workflow
  map:
    v: Event.status
mapping:
  identity:
    v: w5
  map:
    v: FiveWs.status

id:
  v: EpisodeOfCare.statusHistory
path:
  v: EpisodeOfCare.statusHistory
short:
  v: Past list of status codes (the current status may be included to cover the start date of the status)
definition:
  v: The history of statuses that the EpisodeOfCare has been through (without requiring processing the history of the resource).
min:
  v: 0
max:
  v: 0
base:
  path:
    v: EpisodeOfCare.statusHistory
  min:
    v: 0
  max:
    v: *
type:
  code:
    v: BackboneElement
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
is modifier:
  v: false
is summary:
  v: false

id:
  v: EpisodeOfCare.statusHistory.id
path:
  v: EpisodeOfCare.statusHistory.id
representation:
  v: xmlAttr
short:
  v: Unique id for inter-element referencing
definition:
  v: Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.
min:
  v: 0
max:
  v: 1
base:
  path:
    v: Element.id
  min:
    v: 0
  max:
    v: 1
type:
  extension:
    url:
      v: http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type
    value: url
      v: string
  code:
    v: http://hl7.org/fhirpath/System.String
is modifier:
  v: false
is summary:
  v: false
mapping:
  identity:
    v: rim
  map:
    v: n/a

id:
  v: EpisodeOfCare.statusHistory.extension
path:
  v: EpisodeOfCare.statusHistory.extension
short:
  v: Additional content defined by implementations
definition:
  v: May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.
comment:
  v: There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions. The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone.
alias:
  v: extensions
alias:
  v: user content
min:
  v: 0
max:
  v: *
base:
  path:
    v: Element.extension
  min:
    v: 0
  max:
    v: *
type:
  code:
    v: Extension
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
constraint:
  key:
    v: ext-1
  severity:
    v: error
  human:
    v: Must have either extensions or value[x], not both
  expression:
    v: extension.exists() != value.exists()
  xpath:
    v: exists(f:extension)!=exists(f:*[starts-with(local-name(.), "value")])
  source:
    v: http://hl7.org/fhir/StructureDefinition/Extension
    link: http://hl7.org/fhir/StructureDefinition/Extension
is modifier:
  v: false
is summary:
  v: false
mapping:
  identity:
    v: rim
  map:
    v: n/a

id:
  v: EpisodeOfCare.statusHistory.modifierExtension
path:
  v: EpisodeOfCare.statusHistory.modifierExtension
short:
  v: Extensions that cannot be ignored even if unrecognized
definition:
  v: May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions. Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).
comment:
  v: There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions. The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone.
requirements:
  v: Modifier extensions allow for extensions that *cannot* be safely ignored to be clearly distinguished from the vast majority of extensions which can be safely ignored. This promotes interoperability by eliminating the need for implementers to prohibit the presence of extensions. For further information, see the [definition of modifier extensions](http://hl7.org/fhir/R4/extensibility.html#modifierExtension).
alias:
  v: extensions
alias:
  v: user content
alias:
  v: modifiers
min:
  v: 0
max:
  v: *
base:
  path:
    v: BackboneElement.modifierExtension
  min:
    v: 0
  max:
    v: *
type:
  code:
    v: Extension
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
constraint:
  key:
    v: ext-1
  severity:
    v: error
  human:
    v: Must have either extensions or value[x], not both
  expression:
    v: extension.exists() != value.exists()
  xpath:
    v: exists(f:extension)!=exists(f:*[starts-with(local-name(.), "value")])
  source:
    v: http://hl7.org/fhir/StructureDefinition/Extension
    link: http://hl7.org/fhir/StructureDefinition/Extension
is modifier:
  v: true
is modifier reason:
  v: Modifier extensions are expected to modify the meaning or interpretation of the element that contains them
is summary:
  v: true
mapping:
  identity:
    v: rim
  map:
    v: N/A

id:
  v: EpisodeOfCare.statusHistory.status
path:
  v: EpisodeOfCare.statusHistory.status
short:
  v: planned | waitlist | active | onhold | finished | cancelled | entered-in-error
definition:
  v: planned | waitlist | active | onhold | finished | cancelled.
min:
  v: 1
max:
  v: 1
base:
  path:
    v: EpisodeOfCare.statusHistory.status
  min:
    v: 1
  max:
    v: 1
type:
  code:
    v: code
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
is modifier:
  v: false
is summary:
  v: false
binding:
  extension:
    url:
      v: http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName
    value: string
      v: EpisodeOfCareStatus
  strength:
    v: required
  description:
    v: The status of the episode of care.
  value set:
    v: http://hl7.org/fhir/ValueSet/episode-of-care-status|4.0.1
    link: 4.0
    link: .1

id:
  v: EpisodeOfCare.statusHistory.period
path:
  v: EpisodeOfCare.statusHistory.period
short:
  v: Duration the EpisodeOfCare was in the specified status
definition:
  v: The period during this EpisodeOfCare that the specific status applied.
min:
  v: 1
max:
  v: 1
base:
  path:
    v: EpisodeOfCare.statusHistory.period
  min:
    v: 1
  max:
    v: 1
type:
  code:
    v: Period
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
is modifier:
  v: false
is summary:
  v: false

id:
  v: EpisodeOfCare.type
path:
  v: EpisodeOfCare.type
short:
  v: Type/class - e.g. specialist referral, disease management
definition:
  v: A classification of the type of episode of care; e.g. specialist referral, disease management, type of funded care.
comment:
  v: The type can be very important in processing as this could be used in determining if the EpisodeOfCare is relevant to specific government reporting, or other types of classifications.
min:
  v: 0
max:
  v: *
base:
  path:
    v: EpisodeOfCare.type
  min:
    v: 0
  max:
    v: *
type:
  code:
    v: CodeableConcept
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
is modifier:
  v: false
is summary:
  v: true
binding:
  strength:
    v: required
  value set:
    v: https://nzhts.digital.health.nz/fhir/ValueSet/nes-enrolment-type
    link: https://nzhts.digital.health.nz/fhir/ValueSet/nes-enrolment-type
mapping:
  identity:
    v: workflow
  map:
    v: Event.code
mapping:
  identity:
    v: w5
  map:
    v: FiveWs.class

id:
  v: EpisodeOfCare.diagnosis
path:
  v: EpisodeOfCare.diagnosis
short:
  v: The list of diagnosis relevant to this episode of care
definition:
  v: The list of diagnosis relevant to this episode of care.
min:
  v: 0
max:
  v: 0
base:
  path:
    v: EpisodeOfCare.diagnosis
  min:
    v: 0
  max:
    v: *
type:
  code:
    v: BackboneElement
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
is modifier:
  v: false
is summary:
  v: true

id:
  v: EpisodeOfCare.diagnosis.id
path:
  v: EpisodeOfCare.diagnosis.id
representation:
  v: xmlAttr
short:
  v: Unique id for inter-element referencing
definition:
  v: Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.
min:
  v: 0
max:
  v: 1
base:
  path:
    v: Element.id
  min:
    v: 0
  max:
    v: 1
type:
  extension:
    url:
      v: http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type
    value: url
      v: string
  code:
    v: http://hl7.org/fhirpath/System.String
is modifier:
  v: false
is summary:
  v: false
mapping:
  identity:
    v: rim
  map:
    v: n/a

id:
  v: EpisodeOfCare.diagnosis.extension
path:
  v: EpisodeOfCare.diagnosis.extension
short:
  v: Additional content defined by implementations
definition:
  v: May be used to represent additional information that is not part of the basic definition of the element. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension.
comment:
  v: There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions. The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone.
alias:
  v: extensions
alias:
  v: user content
min:
  v: 0
max:
  v: *
base:
  path:
    v: Element.extension
  min:
    v: 0
  max:
    v: *
type:
  code:
    v: Extension
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
constraint:
  key:
    v: ext-1
  severity:
    v: error
  human:
    v: Must have either extensions or value[x], not both
  expression:
    v: extension.exists() != value.exists()
  xpath:
    v: exists(f:extension)!=exists(f:*[starts-with(local-name(.), "value")])
  source:
    v: http://hl7.org/fhir/StructureDefinition/Extension
    link: http://hl7.org/fhir/StructureDefinition/Extension
is modifier:
  v: false
is summary:
  v: false
mapping:
  identity:
    v: rim
  map:
    v: n/a

id:
  v: EpisodeOfCare.diagnosis.modifierExtension
path:
  v: EpisodeOfCare.diagnosis.modifierExtension
short:
  v: Extensions that cannot be ignored even if unrecognized
definition:
  v: May be used to represent additional information that is not part of the basic definition of the element and that modifies the understanding of the element in which it is contained and/or the understanding of the containing element's descendants. Usually modifier elements provide negation or qualification. To make the use of extensions safe and manageable, there is a strict set of governance applied to the definition and use of extensions. Though any implementer can define an extension, there is a set of requirements that SHALL be met as part of the definition of the extension. Applications processing a resource are required to check for modifier extensions. Modifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).
comment:
  v: There can be no stigma associated with the use of extensions by any application, project, or standard - regardless of the institution or jurisdiction that uses or defines the extensions. The use of extensions is what allows the FHIR specification to retain a core level of simplicity for everyone.
requirements:
  v: Modifier extensions allow for extensions that *cannot* be safely ignored to be clearly distinguished from the vast majority of extensions which can be safely ignored. This promotes interoperability by eliminating the need for implementers to prohibit the presence of extensions. For further information, see the [definition of modifier extensions](http://hl7.org/fhir/R4/extensibility.html#modifierExtension).
alias:
  v: extensions
alias:
  v: user content
alias:
  v: modifiers
min:
  v: 0
max:
  v: *
base:
  path:
    v: BackboneElement.modifierExtension
  min:
    v: 0
  max:
    v: *
type:
  code:
    v: Extension
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
constraint:
  key:
    v: ext-1
  severity:
    v: error
  human:
    v: Must have either extensions or value[x], not both
  expression:
    v: extension.exists() != value.exists()
  xpath:
    v: exists(f:extension)!=exists(f:*[starts-with(local-name(.), "value")])
  source:
    v: http://hl7.org/fhir/StructureDefinition/Extension
    link: http://hl7.org/fhir/StructureDefinition/Extension
is modifier:
  v: true
is modifier reason:
  v: Modifier extensions are expected to modify the meaning or interpretation of the element that contains them
is summary:
  v: true
mapping:
  identity:
    v: rim
  map:
    v: N/A

id:
  v: EpisodeOfCare.diagnosis.condition
path:
  v: EpisodeOfCare.diagnosis.condition
short:
  v: Conditions/problems/diagnoses this episode of care is for
definition:
  v: A list of conditions/problems/diagnoses that this episode of care is intended to be providing care for.
min:
  v: 1
max:
  v: 1
base:
  path:
    v: EpisodeOfCare.diagnosis.condition
  min:
    v: 1
  max:
    v: 1
type:
  code:
    v: Reference
  target profile:
    v: http://hl7.org/fhir/StructureDefinition/Condition
    link: http://hl7.org/fhir/StructureDefinition/Condition
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
is modifier:
  v: false
is summary:
  v: true
mapping:
  identity:
    v: workflow
  map:
    v: Event.reasonReference
mapping:
  identity:
    v: w5
  map:
    v: FiveWs.what[x]

id:
  v: EpisodeOfCare.diagnosis.role
path:
  v: EpisodeOfCare.diagnosis.role
short:
  v: Role that this diagnosis has within the episode of care (e.g. admission, billing, discharge …)
definition:
  v: Role that this diagnosis has within the episode of care (e.g. admission, billing, discharge …).
min:
  v: 0
max:
  v: 1
base:
  path:
    v: EpisodeOfCare.diagnosis.role
  min:
    v: 0
  max:
    v: 1
type:
  code:
    v: CodeableConcept
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
is modifier:
  v: false
is summary:
  v: true
binding:
  extension:
    url:
      v: http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName
    value: string
      v: DiagnosisRole
  strength:
    v: preferred
  description:
    v: The type of diagnosis this condition represents.
  value set:
    v: http://hl7.org/fhir/ValueSet/diagnosis-role
    link: http://hl7.org/fhir/ValueSet/diagnosis-role

id:
  v: EpisodeOfCare.diagnosis.rank
path:
  v: EpisodeOfCare.diagnosis.rank
short:
  v: Ranking of the diagnosis (for each role type)
definition:
  v: Ranking of the diagnosis (for each role type).
min:
  v: 0
max:
  v: 1
base:
  path:
    v: EpisodeOfCare.diagnosis.rank
  min:
    v: 0
  max:
    v: 1
type:
  code:
    v: positiveInt
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
is modifier:
  v: false
is summary:
  v: true

id:
  v: EpisodeOfCare.patient
path:
  v: EpisodeOfCare.patient
short:
  v: The patient who is the focus of this episode of care
definition:
  v: The patient who is the focus of this episode of care.
min:
  v: 1
max:
  v: 1
base:
  path:
    v: EpisodeOfCare.patient
  min:
    v: 1
  max:
    v: 1
type:
  code:
    v: Reference
  target profile:
    v: http://hl7.org.nz/fhir/StructureDefinition/NesPatient
    link: http://hl7.org.nz/fhir/StructureDefinition/NesPatient
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
is modifier:
  v: false
is summary:
  v: true
mapping:
  identity:
    v: workflow
  map:
    v: Event.subject
mapping:
  identity:
    v: w5
  map:
    v: FiveWs.subject[x]
mapping:
  identity:
    v: w5
  map:
    v: FiveWs.subject

id:
  v: EpisodeOfCare.managingOrganization
path:
  v: EpisodeOfCare.managingOrganization
short:
  v: Organization that assumes care
definition:
  v: The organization that has assumed the specific responsibilities for the specified duration.
min:
  v: 0
max:
  v: 1
base:
  path:
    v: EpisodeOfCare.managingOrganization
  min:
    v: 0
  max:
    v: 1
type:
  code:
    v: Reference
  target profile:
    v: http://hl7.org/fhir/StructureDefinition/Organization
    link: http://hl7.org/fhir/StructureDefinition/Organization
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
is modifier:
  v: false
is summary:
  v: true
mapping:
  identity:
    v: workflow
  map:
    v: Event.performer.actor

id:
  v: EpisodeOfCare.period
path:
  v: EpisodeOfCare.period
short:
  v: Interval during responsibility is assumed
definition:
  v: The interval during which the managing organization assumes the defined responsibility.
min:
  v: 0
max:
  v: 1
base:
  path:
    v: EpisodeOfCare.period
  min:
    v: 0
  max:
    v: 1
type:
  code:
    v: Period
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
is modifier:
  v: false
is summary:
  v: true
mapping:
  identity:
    v: workflow
  map:
    v: Event.occurrence[x]
mapping:
  identity:
    v: w5
  map:
    v: FiveWs.init

id:
  v: EpisodeOfCare.referralRequest
path:
  v: EpisodeOfCare.referralRequest
short:
  v: Originating Referral Request(s)
definition:
  v: Referral Request(s) that are fulfilled by this EpisodeOfCare, incoming referrals.
min:
  v: 0
max:
  v: 0
base:
  path:
    v: EpisodeOfCare.referralRequest
  min:
    v: 0
  max:
    v: *
type:
  code:
    v: Reference
  target profile:
    v: http://hl7.org/fhir/StructureDefinition/ServiceRequest
    link: http://hl7.org/fhir/StructureDefinition/ServiceRequest
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
is modifier:
  v: false
is summary:
  v: false
mapping:
  identity:
    v: workflow
  map:
    v: Event.basedOn

id:
  v: EpisodeOfCare.careManager
path:
  v: EpisodeOfCare.careManager
short:
  v: Care manager/care coordinator for the patient
definition:
  v: The practitioner that is the care manager/care coordinator for this patient.
min:
  v: 0
max:
  v: 1
base:
  path:
    v: EpisodeOfCare.careManager
  min:
    v: 0
  max:
    v: 1
type:
  code:
    v: Reference
  target profile:
    v: http://hl7.org/fhir/StructureDefinition/Practitioner
    link: http://hl7.org/fhir/StructureDefinition/Practitioner
  target profile:
    v: http://hl7.org/fhir/StructureDefinition/PractitionerRole
    link: http://hl7.org/fhir/StructureDefinition/PractitionerRole
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
is modifier:
  v: false
is summary:
  v: false
mapping:
  identity:
    v: workflow
  map:
    v: Event.performer.actor

id:
  v: EpisodeOfCare.team
path:
  v: EpisodeOfCare.team
short:
  v: Other practitioners facilitating this episode of care
definition:
  v: The list of practitioners that may be facilitating this episode of care for specific purposes.
alias:
  v: CareTeam
min:
  v: 0
max:
  v: 0
base:
  path:
    v: EpisodeOfCare.team
  min:
    v: 0
  max:
    v: *
type:
  code:
    v: Reference
  target profile:
    v: http://hl7.org/fhir/StructureDefinition/CareTeam
    link: http://hl7.org/fhir/StructureDefinition/CareTeam
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
is modifier:
  v: false
is summary:
  v: false
mapping:
  identity:
    v: workflow
  map:
    v: Event.performer.actor

id:
  v: EpisodeOfCare.account
path:
  v: EpisodeOfCare.account
short:
  v: The set of accounts that may be used for billing for this EpisodeOfCare
definition:
  v: The set of accounts that may be used for billing for this EpisodeOfCare.
comment:
  v: The billing system may choose to allocate billable items associated with the EpisodeOfCare to different referenced Accounts based on internal business rules.
min:
  v: 0
max:
  v: 0
base:
  path:
    v: EpisodeOfCare.account
  min:
    v: 0
  max:
    v: *
type:
  code:
    v: Reference
  target profile:
    v: http://hl7.org/fhir/StructureDefinition/Account
    link: http://hl7.org/fhir/StructureDefinition/Account
constraint:
  key:
    v: ele-1
  severity:
    v: error
  human:
    v: All FHIR elements must have a @value or children
  expression:
    v: hasValue() or (children().count() > id.count())
  xpath:
    v: @value|f:*|h:div
  source:
    v: http://hl7.org/fhir/StructureDefinition/Element
    link: http://hl7.org/fhir/StructureDefinition/Element
is modifier:
  v: false
is summary:
  v: false

element:
  id:
    v: EpisodeOfCare
  path:
    v: EpisodeOfCare
  constraint:
    key:
      v: URL-LENGTH
    severity:
      v: error
    human:
      v: URLs must be less than 1024 characters
    expression:
      v: EpisodeOfCare.descendants().url.all(length()<1024)
    source:
      v: http://hl7.org.nz/fhir/StructureDefinition/NesEnrolment
      link: http://hl7.org.nz/fhir/StructureDefinition/NesEnrolment
  constraint:
    key:
      v: URL-ALLOWED-CHARS
    severity:
      v: error
    human:
      v: character restrictions for URLs
    expression:
      v: EpisodeOfCare.descendants().url.all(matches('^[-a-zA-Z0-9@:%._~#=?&\/]*$'))
    source:
      v: http://hl7.org.nz/fhir/StructureDefinition/NesEnrolment
      link: http://hl7.org.nz/fhir/StructureDefinition/NesEnrolment
  constraint:
    key:
      v: SYSTEM-LENGTH
    severity:
      v: error
    human:
      v: System URLs must be less than 1024 characters
    expression:
      v: EpisodeOfCare.descendants().system.all(length()<1024)
    source:
      v: http://hl7.org.nz/fhir/StructureDefinition/NesEnrolment
      link: http://hl7.org.nz/fhir/StructureDefinition/NesEnrolment
  constraint:
    key:
      v: SYSTEM-ALLOWED-CHARS
    severity:
      v: error
    human:
      v: character restrictions for system url
    expression:
      v: EpisodeOfCare.descendants().system.all(matches('^[-a-zA-Z0-9@:%._~#=?&\/]*$'))
    source:
      v: http://hl7.org.nz/fhir/StructureDefinition/NesEnrolment
      link: http://hl7.org.nz/fhir/StructureDefinition/NesEnrolment
  constraint:
    key:
      v: CODEABLE-CONCEPT-TEXT-LENGTH
    severity:
      v: error
    human:
      v: valueCodeableConcept.text must be less than 1024 characters
    expression:
      v: EpisodeOfCare.descendants().valueCodeableConcept.text.all(length()<1024)
    source:
      v: http://hl7.org.nz/fhir/StructureDefinition/NesEnrolment
      link: http://hl7.org.nz/fhir/StructureDefinition/NesEnrolment
  constraint:
    key:
      v: CODEABLE-CONCEPT-TEXT-ALLOWED-CHARS
    severity:
      v: error
    human:
      v: character restrictions for valueCodeableConcept.text
    expression:
      v: EpisodeOfCare.descendants().valueCodeableConcept.text.all(matches('^([-a-zA-Z0-9\' \t\r\n.\/,])*$'))
    source:
      v: http://hl7.org.nz/fhir/StructureDefinition/NesEnrolment
      link: http://hl7.org.nz/fhir/StructureDefinition/NesEnrolment
element:
  id:
    v: EpisodeOfCare.meta.versionId
  path:
    v: EpisodeOfCare.meta.versionId
  max:
    v: 0
element:
  id:
    v: EpisodeOfCare.meta.source
  path:
    v: EpisodeOfCare.meta.source
  max:
    v: 0
element:
  id:
    v: EpisodeOfCare.meta.security
  path:
    v: EpisodeOfCare.meta.security
  max:
    v: 0
element:
  id:
    v: EpisodeOfCare.meta.tag
  path:
    v: EpisodeOfCare.meta.tag
  max:
    v: 0
element:
  id:
    v: EpisodeOfCare.language
  path:
    v: EpisodeOfCare.language
  max:
    v: 0
element:
  id:
    v: EpisodeOfCare.contained
  path:
    v: EpisodeOfCare.contained
  slicing:
    discriminator:
      type:
        v: type
      path:
        v: $this
    description:
      v: Slicing to specify a PractitionerRole resource may be returned as a contained resource for the Care Manager
    rules:
      v: closed
element:
  id:
    v: EpisodeOfCare.contained:careManager
  path:
    v: EpisodeOfCare.contained
  slice name:
    v: careManager
  short:
    v: Contained resource for the last qualified Encounter relating to this Enrolment
  min:
    v: 0
  max:
    v: 1
  type:
    code:
      v: PractitionerRole
    profile:
      v: http://hl7.org.nz/fhir/StructureDefinition/NesPractitionerRole
      link: http://hl7.org.nz/fhir/StructureDefinition/NesPractitionerRole
element:
  id:
    v: EpisodeOfCare.contained:qualifiedEncounter
  path:
    v: EpisodeOfCare.contained
  slice name:
    v: qualifiedEncounter
  min:
    v: 0
  max:
    v: 1
  type:
    code:
      v: Encounter
element:
  id:
    v: EpisodeOfCare.contained:patient
  path:
    v: EpisodeOfCare.contained
  slice name:
    v: patient
  min:
    v: 0
  max:
    v: 1
  type:
    code:
      v: Patient
    profile:
      v: http://hl7.org.nz/fhir/StructureDefinition/NesPatient
      link: http://hl7.org.nz/fhir/StructureDefinition/NesPatient
element:
  id:
    v: EpisodeOfCare.extension
  path:
    v: EpisodeOfCare.extension
  slicing:
    discriminator:
      type:
        v: value
      path:
        v: url
    ordered:
      v: false
    rules:
      v: open
element:
  id:
    v: EpisodeOfCare.extension:expiryDate
  path:
    v: EpisodeOfCare.extension
  slice name:
    v: expiryDate
  short:
    v: The date on which the Enrolment will expire

v: 0

v: 1

code:
  v: Extension
profile:
  v: http://hl7.org.nz/fhir/StructureDefinition/enrolment-expiry-date
  link: http://hl7.org.nz/fhir/StructureDefinition/enrolment-expiry-date

id:
  v: EpisodeOfCare.extension:re-enrolmentDate
path:
  v: EpisodeOfCare.extension
slice name:
  v: re-enrolmentDate
min:
  v: 0
max:
  v: 1
type:
  code:
    v: Extension
  profile:
    v: http://hl7.org.nz/fhir/StructureDefinition/reenrolment-date
    link: http://hl7.org.nz/fhir/StructureDefinition/reenrolment-date

id:
  v: EpisodeOfCare.extension:owningOrganisation
path:
  v: EpisodeOfCare.extension
slice name:
  v: owningOrganisation
short:
  v: Organisation that creates the enrolment
min:
  v: 0
max:
  v: 1
type:
  code:
    v: Extension
  profile:
    v: http://hl7.org.nz/fhir/StructureDefinition/enrolment-owner-org
    link: http://hl7.org.nz/fhir/StructureDefinition/enrolment-owner-org

id:
  v: EpisodeOfCare.extension:terminationReason
path:
  v: EpisodeOfCare.extension
slice name:
  v: terminationReason
short:
  v: describe the reason the enrolment has ended
min:
  v: 0
max:
  v: 1
type:
  code:
    v: Extension
  profile:
    v: http://hl7.org.nz/fhir/StructureDefinition/nes-enrolment-termination-reason
    link: http://hl7.org.nz/fhir/StructureDefinition/nes-enrolment-termination-reason

id:
  v: EpisodeOfCare.extension:terminationReason.value[x]
path:
  v: EpisodeOfCare.extension.value[x]
binding:
  strength:
    v: required
  value set:
    v: https://nzhts.digital.health.nz/fhir/ValueSet/nes-enrolment-termination-reason
    link: https://nzhts.digital.health.nz/fhir/ValueSet/nes-enrolment-termination-reason

id:
  v: EpisodeOfCare.extension:qualifiedEncounter
path:
  v: EpisodeOfCare.extension
slice name:
  v: qualifiedEncounter
short:
  v: the last qualified Encounter relating to this Enrolment
min:
  v: 0
max:
  v: 1
type:
  code:
    v: Extension
  profile:
    v: http://hl7.org.nz/fhir/StructureDefinition/enrolment-encounter
    link: http://hl7.org.nz/fhir/StructureDefinition/enrolment-encounter

id:
  v: EpisodeOfCare.status
path:
  v: EpisodeOfCare.status
binding:
  strength:
    v: required
  value set:
    v: https://nzhts.digital.health.nz/fhir/ValueSet/nes-episode-of-care-status
    link: https://nzhts.digital.health.nz/fhir/ValueSet/nes-episode-of-care-status

id:
  v: EpisodeOfCare.statusHistory
path:
  v: EpisodeOfCare.statusHistory
max:
  v: 0

id:
  v: EpisodeOfCare.type
path:
  v: EpisodeOfCare.type
binding:
  strength:
    v: required
  value set:
    v: https://nzhts.digital.health.nz/fhir/ValueSet/nes-enrolment-type
    link: https://nzhts.digital.health.nz/fhir/ValueSet/nes-enrolment-type

id:
  v: EpisodeOfCare.diagnosis
path:
  v: EpisodeOfCare.diagnosis
max:
  v: 0

id:
  v: EpisodeOfCare.patient
path:
  v: EpisodeOfCare.patient
type:
  code:
    v: Reference
  target profile:
    v: http://hl7.org.nz/fhir/StructureDefinition/NesPatient
    link: http://hl7.org.nz/fhir/StructureDefinition/NesPatient

id:
  v: EpisodeOfCare.referralRequest
path:
  v: EpisodeOfCare.referralRequest
max:
  v: 0

id:
  v: EpisodeOfCare.team
path:
  v: EpisodeOfCare.team
max:
  v: 0

id:
  v: EpisodeOfCare.account
path:
  v: EpisodeOfCare.account
max:
  v: 0