diff --git a/.rubocop.yml b/.rubocop.yml index 19be17725..0ef5e6332 100644 --- a/.rubocop.yml +++ b/.rubocop.yml @@ -26,6 +26,14 @@ Lint/EmptyBlock: Exclude: - 'dev_suites/ui_onc_program/**/*' +inherit_mode: + merge: + - AllowedNames + +Naming/MethodParameterName: + AllowedNames: + - ig + Style/BlockComments: Exclude: - 'spec/spec_helper.rb' diff --git a/lib/inferno/apps/cli/evaluate.rb b/lib/inferno/apps/cli/evaluate.rb index dd6aa1bb2..b8094384e 100644 --- a/lib/inferno/apps/cli/evaluate.rb +++ b/lib/inferno/apps/cli/evaluate.rb @@ -12,21 +12,20 @@ class Evaluate < Thor::Group def evaluate(ig_path, data_path, _log_level) validate_args(ig_path, data_path) - _ig = get_ig(ig_path) + ig = get_ig(ig_path) - # Rule execution, and result output below will be integrated soon. - - # if data_path - # DatasetLoader.from_path(File.join(__dir__, data_path)) - # else - # ig.examples - # end + data = + if data_path + DatasetLoader.from_path(File.join(__dir__, data_path)) + else + ig.examples + end - # config = Config.new - # evaluator = Inferno::DSL::FHIREvaluation::Evaluator.new(data, config) + evaluator = Inferno::DSL::FHIREvaluation::Evaluator.new(ig) - # results = evaluate() - # output_results(results, options[:output]) + config = Inferno::DSL::FHIREvaluation::Config.new + results = evaluator.evaluate(data, config) + output_results(results, options[:output]) end def validate_args(ig_path, data_path) diff --git a/lib/inferno/dsl/fhir_evaluation/default.yml b/lib/inferno/dsl/fhir_evaluation/default.yml index 5f5ebd0e8..adbca9472 100644 --- a/lib/inferno/dsl/fhir_evaluation/default.yml +++ b/lib/inferno/dsl/fhir_evaluation/default.yml @@ -7,3 +7,26 @@ Environment: Url: 'https://cts.nlm.nih.gov' Rule: + AllMustSupportsPresent: + Description: 'An instance of all MustSupport elements, extensions, and slices is present in the given resources' + Enabled: true + # RequirementExtensionUrl accepts an extension URL which tags element definitions as required for the purposes of this test, even if not Must Support. + # For instance, US Core elements with the "http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement" extension + # may be considered required even if not necessarily tagged Must Support. + # An instance of the extension must have valueBoolean=true to be recognized. + RequirementExtensionUrl: null + ConformanceOptions: + # ConformanceOptions allows selecting from a few approaches to determine which subset of resources + # should be used to search for the MustSupport elements from each profile. + # Resources that are not the same type as the target of the profile are never searched, regardless of option. + + # - If considerMetaProfile, the search will include resources that declare the current profile in meta.profile + considerMetaProfile: true + + # - If considerValidationResults, resources will be validated against each profile to determine which they should be checked against. + # The search will include resources that validate against the current profile + # (in other words, resources for which a validation request produces no errors). + considerValidationResults: false + + # - If considerOnlyResourceType, the search will include resources of the same type as the profile target type (StructureDefintion.type) + considerOnlyResourceType: false diff --git a/lib/inferno/dsl/fhir_evaluation/evaluation_context.rb b/lib/inferno/dsl/fhir_evaluation/evaluation_context.rb index ee62dab9f..640ec17d7 100644 --- a/lib/inferno/dsl/fhir_evaluation/evaluation_context.rb +++ b/lib/inferno/dsl/fhir_evaluation/evaluation_context.rb @@ -6,14 +6,16 @@ module FHIREvaluation # - The data being evaluated # - A summary/characterization of the data # - Evaluation results + # - A Validator instance, configured to point to the given IG class EvaluationContext - attr_reader :ig, :data, :results, :config + attr_reader :ig, :data, :results, :config, :validator - def initialize(ig, data, config) # rubocop:disable Naming/MethodParameterName + def initialize(ig, data, config, validator) @ig = ig @data = data @results = [] @config = config + @validator = validator end def add_result(result) diff --git a/lib/inferno/dsl/fhir_evaluation/evaluator.rb b/lib/inferno/dsl/fhir_evaluation/evaluator.rb index 88d005573..cc0a9eb45 100644 --- a/lib/inferno/dsl/fhir_evaluation/evaluator.rb +++ b/lib/inferno/dsl/fhir_evaluation/evaluator.rb @@ -5,19 +5,21 @@ require_relative 'evaluation_context' require_relative 'evaluation_result' require_relative 'dataset_loader' +require_relative 'rules/all_must_supports_present' module Inferno module DSL module FHIREvaluation class Evaluator - attr_accessor :ig + attr_accessor :ig, :validator - def initialize(ig) # rubocop:disable Naming/MethodParameterName + def initialize(ig, validator = nil) @ig = ig + @validator = validator end def evaluate(data, config = Config.new) - context = EvaluationContext.new(@ig, data, config) + context = EvaluationContext.new(@ig, data, config, validator) active_rules = [] config.data['Rule'].each do |rulename, rule_details| diff --git a/lib/inferno/dsl/fhir_evaluation/profile_conformance_helper.rb b/lib/inferno/dsl/fhir_evaluation/profile_conformance_helper.rb new file mode 100644 index 000000000..1ef4c31f1 --- /dev/null +++ b/lib/inferno/dsl/fhir_evaluation/profile_conformance_helper.rb @@ -0,0 +1,48 @@ +module Inferno + module DSL + module FHIREvaluation + # This module is used to decide whether a resource instantiates a given profile. + # Aligning resources to profiles is necessary when evaluating the comprehensiveness + # of the resources with respect to those profiles, unfortunately it's impossible to + # programmatically determine intent. (i.e, is this resource supposed to instantiate this profile?) + # This module offers some approaches to make that determination. + module ProfileConformanceHelper + DEFAULT_OPTIONS = { + considerMetaProfile: true, + considerValidationResults: false, + considerOnlyResourceType: false + }.freeze + + def conforms_to_profile?(resource, profile, options = DEFAULT_OPTIONS, validator = nil) + return false if resource.resourceType != profile.type + + options[:considerOnlyResourceType] || + consider_meta_profile(resource, profile, options) || + consider_validation_results(resource, profile, options, validator) || + (block_given? && yield(resource)) + end + + def consider_meta_profile(resource, profile, options) + options[:considerMetaProfile] && declares_meta_profile?(resource, profile) + end + + def declares_meta_profile?(resource, profile) + declared_profiles = resource&.meta&.profile || [] + profile_url = profile.url + versioned_url = "#{profile_url}|#{profile.version}" + + declared_profiles.include?(profile_url) || declared_profiles.include?(versioned_url) + end + + def consider_validation_results(resource, profile, options, validator) + options[:considerValidationResults] && validates_profile?(resource, profile, validator) + end + + def validates_profile?(_resource, _profile, _validator) + raise 'Profile validation is not yet implemented. ' \ + 'Set considerValidationResults=false.' + end + end + end + end +end diff --git a/lib/inferno/dsl/fhir_evaluation/rules/all_must_supports_present.rb b/lib/inferno/dsl/fhir_evaluation/rules/all_must_supports_present.rb new file mode 100644 index 000000000..24c7e55b6 --- /dev/null +++ b/lib/inferno/dsl/fhir_evaluation/rules/all_must_supports_present.rb @@ -0,0 +1,343 @@ +require_relative '../../fhir_resource_navigation' +require_relative '../../must_support_metadata_extractor' +require_relative '../profile_conformance_helper' + +module Inferno + module DSL + module FHIREvaluation + module Rules + class AllMustSupportsPresent < Rule + include FHIRResourceNavigation + include ProfileConformanceHelper + attr_accessor :metadata + + # check is invoked from CLI, assume no ability to customize the metadata (for now) + def check(context) + missing_items_by_profile = {} + context.ig.profiles.each do |profile| + resources = pick_resources_for_profile(profile, context) + if resources.blank? + missing_items_by_profile[profile.url] = ['No matching resources were found to check'] + next + end + requirement_extension = context.config.data['Rule']['AllMustSupportsPresent']['RequirementExtensionUrl'] + profile_metadata = extract_metadata(profile, context.ig, requirement_extension) + missing_items = perform_must_support_test_with_metadata(resources, profile_metadata) + + missing_items_by_profile[profile.url] = missing_items if missing_items.any? + end + + if missing_items_by_profile.count.zero? + result = EvaluationResult.new('All MustSupports are present', severity: 'success', rule: self) + else + message = 'Found Profiles with not all MustSupports represented:' + missing_items_by_profile.each do |profile_url, missing_items| + message += "\n\t\t#{profile_url}: #{missing_items.join(', ')}" + end + result = EvaluationResult.new(message, rule: self) + end + context.add_result result + end + + def pick_resources_for_profile(profile, context) + conformance_options = context.config.data['Rule']['AllMustSupportsPresent']['ConformanceOptions'].to_options + + # Unless specifically looking for Bundles, break them out into the resources they include + all_resources = + if profile.type == 'Bundle' + context.data + else + flatten_bundles(context.data) + end + + all_resources.filter do |r| + conforms_to_profile?(r, profile, conformance_options, context.validator) + end + end + + # perform_must_support_test is invoked from DSL assertions, allows customizing the metdata with a block. + # Customizing the metadata may add, modify, or remove items. + # For instance, US Core 3.1.1 Patient "Previous Name" is defined as MS only in narrative. + # Choices are also defined only in narrative. + def perform_must_support_test(profile, resources, ig, requirement_extension = nil) + profile_metadata = extract_metadata(profile, ig, requirement_extension) + yield profile_metadata if block_given? + + perform_must_support_test_with_metadata(resources, profile_metadata) + end + + # perform_must_support_test_with_metadata is invoked from either option above, + # with the metadata to be used as the basis for the check + # (or can be invoked directly from a test if you want to completely overwrite the metadata) + def perform_must_support_test_with_metadata(resources, profile_metadata) + return if resources.blank? + + @metadata = profile_metadata + + missing_elements(resources) + missing_slices(resources) + missing_extensions(resources) + + handle_must_support_choices if metadata.must_supports[:choices].present? + + missing_must_support_strings + end + + def extract_metadata(profile, ig, requirement_extension = nil) + MustSupportMetadataExtractor.new(profile.snapshot.element, profile, profile.type, ig, requirement_extension) + end + + def handle_must_support_choices + handle_must_support_element_choices + handle_must_support_extension_choices + handle_must_support_slice_choices + end + + def handle_must_support_element_choices + missing_elements.delete_if do |element| + choices = metadata.must_supports[:choices].find do |choice| + choice[:paths]&.include?(element[:path]) || + choice[:elements]&.any? { |ms_element| ms_element[:path] == element[:path] } + end + any_choice_supported?(choices) + end + end + + def handle_must_support_extension_choices + missing_extensions.delete_if do |extension| + choices = metadata.must_supports[:choices].find do |choice| + choice[:extension_ids]&.include?(extension[:id]) + end + any_choice_supported?(choices) + end + end + + def handle_must_support_slice_choices + missing_slices.delete_if do |slice| + choices = metadata.must_supports[:choices].find { |choice| choice[:slice_names]&.include?(slice[:name]) } + any_choice_supported?(choices) + end + end + + def any_choice_supported?(choices) + return false unless choices.present? + + any_path_choice_supported?(choices) || + any_extension_ids_choice_supported?(choices) || + any_slice_names_choice_supported?(choices) || + any_elements_choice_supported?(choices) + end + + def any_path_choice_supported?(choices) + return false unless choices[:paths].present? + + choices[:paths].any? { |path| missing_elements.none? { |element| element[:path] == path } } + end + + def any_extension_ids_choice_supported?(choices) + return false unless choices[:extension_ids].present? + + choices[:extension_ids].any? do |extension_id| + missing_extensions.none? { |extension| extension[:id] == extension_id } + end + end + + def any_slice_names_choice_supported?(choices) + return false unless choices[:slice_names].present? + + choices[:slice_names].any? { |slice_name| missing_slices.none? { |slice| slice[:name] == slice_name } } + end + + def any_elements_choice_supported?(choices) + return false unless choices[:elements].present? + + choices[:elements].any? do |choice| + missing_elements.none? do |element| + element[:path] == choice[:path] && element[:fixed_value] == choice[:fixed_value] + end + end + end + + def missing_must_support_strings + missing_elements.map { |element_definition| missing_element_string(element_definition) } + + missing_slices.map { |slice_definition| slice_definition[:slice_id] } + + missing_extensions.map { |extension_definition| extension_definition[:id] } + end + + def missing_element_string(element_definition) + if element_definition[:fixed_value].present? + "#{element_definition[:path]}:#{element_definition[:fixed_value]}" + else + element_definition[:path] + end + end + + def must_support_extensions + metadata.must_supports[:extensions] + end + + def missing_extensions(resources = []) + @missing_extensions ||= + must_support_extensions.select do |extension_definition| + resources.none? do |resource| + path = extension_definition[:path] + + if path == 'extension' + resource.extension.any? { |extension| extension.url == extension_definition[:url] } + else + extension = find_a_value_at(resource, path) do |el| + el.url == extension_definition[:url] + end + + extension.present? + end + end + end + end + + def must_support_elements + metadata.must_supports[:elements] + end + + def missing_elements(resources = []) + @missing_elements ||= find_missing_elements(resources, must_support_elements) + end + + def find_missing_elements(resources, must_support_elements) + must_support_elements.select do |element_definition| + resources.none? { |resource| resource_populates_element?(resource, element_definition) } + end + end + + def resource_populates_element?(resource, element_definition) + path = element_definition[:path] + ms_extension_urls = must_support_extensions.select { |ex| ex[:path] == "#{path}.extension" } + .map { |ex| ex[:url] } + + value_found = find_a_value_at(resource, path) do |potential_value| + matching_without_extensions?(potential_value, ms_extension_urls, element_definition[:fixed_value]) + end + + # Note that false.present? => false, which is why we need to add this extra check + value_found.present? || value_found == false + end + + def matching_without_extensions?(value, ms_extension_urls, fixed_value) + if value.instance_of?(Inferno::DSL::PrimitiveType) + urls = value.extension&.map(&:url) + has_ms_extension = (urls & ms_extension_urls).present? + value = value.value + end + + return false unless has_ms_extension || value_without_extensions?(value) + + matches_fixed_value?(value, fixed_value) + end + + def matches_fixed_value?(value, fixed_value) + fixed_value.blank? || value == fixed_value + end + + def value_without_extensions?(value) + value_without_extensions = value.respond_to?(:to_hash) ? value.to_hash.except('extension') : value + value_without_extensions.present? || value_without_extensions == false + end + + def must_support_slices + metadata.must_supports[:slices] + end + + def missing_slices(resources = []) + @missing_slices ||= + must_support_slices.select do |slice| + resources.none? do |resource| + path = slice[:path] + find_slice(resource, path, slice[:discriminator]).present? + end + end + end + + def find_slice(resource, path, discriminator) + # TODO: there is a lot of similarity + # between this and FHIRResourceNavigation.matching_slice? + # Can these be combined? + find_a_value_at(resource, path) do |element| + case discriminator[:type] + when 'patternCodeableConcept' + find_pattern_codeable_concept_slice(element, discriminator) + when 'patternCoding' + find_pattern_coding_slice(element, discriminator) + when 'patternIdentifier' + find_pattern_identifier_slice(element, discriminator) + when 'value' + find_value_slice(element, discriminator) + when 'type' + find_type_slice(element, discriminator) + when 'requiredBinding' + find_required_binding_slice(element, discriminator) + end + end + end + + def find_pattern_codeable_concept_slice(element, discriminator) + coding_path = discriminator[:path].present? ? "#{discriminator[:path]}.coding" : 'coding' + find_a_value_at(element, coding_path) do |coding| + coding.code == discriminator[:code] && coding.system == discriminator[:system] + end + end + + def find_pattern_coding_slice(element, discriminator) + coding_path = discriminator[:path].present? ? discriminator[:path] : '' + find_a_value_at(element, coding_path) do |coding| + coding.code == discriminator[:code] && coding.system == discriminator[:system] + end + end + + def find_pattern_identifier_slice(element, discriminator) + find_a_value_at(element, discriminator[:path]) do |identifier| + identifier.system == discriminator[:system] + end + end + + def find_value_slice(element, discriminator) + values = discriminator[:values].map { |value| value.merge(path: value[:path].split('.')) } + find_slice_by_values(element, values) + end + + def find_type_slice(element, discriminator) + case discriminator[:code] + when 'Date' + begin + Date.parse(element) + rescue ArgumentError + false + end + when 'DateTime' + begin + DateTime.parse(element) + rescue ArgumentError + false + end + when 'String' + element.is_a? String + else + element.is_a? FHIR.const_get(discriminator[:code]) + end + end + + def find_required_binding_slice(element, discriminator) + coding_path = discriminator[:path].present? ? "#{discriminator[:path]}.coding" : 'coding' + + find_a_value_at(element, coding_path) do |coding| + discriminator[:values].any? { |value| value[:system] == coding.system && value[:code] == coding.code } + end + end + + def find_slice_by_values(element, value_definitions) + Array.wrap(element).find { |el| verify_slice_by_values(el, value_definitions) } + end + end + end + end + end +end diff --git a/lib/inferno/dsl/fhir_resource_navigation.rb b/lib/inferno/dsl/fhir_resource_navigation.rb new file mode 100644 index 000000000..defec074e --- /dev/null +++ b/lib/inferno/dsl/fhir_resource_navigation.rb @@ -0,0 +1,199 @@ +require_relative 'primitive_type' + +module Inferno + module DSL + module FHIRResourceNavigation + DAR_EXTENSION_URL = 'http://hl7.org/fhir/StructureDefinition/data-absent-reason'.freeze + PRIMITIVE_DATA_TYPES = FHIR::PRIMITIVES.keys + + def resolve_path(elements, path) + elements = Array.wrap(elements) + return elements if path.blank? + + paths = path.split(/(?\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n
NameFlagsCard.TypeDescription & Constraints\"doco\"
\".\"\".\" DocumentReference 0..*DocumentReferenceA reference to a document
\".\"\".\"\".\" identifier S0..*Identifier(USCDI) Other identifiers for the document
\".\"\".\"\".\" status S1..1code(USCDI) current | superseded | entered-in-error
Binding: DocumentReferenceStatus (required)
\".\"\".\"\".\" type S1..1CodeableConcept(USCDI) Kind of document (LOINC if possible)
Binding: US Core DocumentReference Type (required): All LOINC values whose SCALE is DOC in the LOINC database and the HL7 v3 Code System NullFlavor concept 'unknown'

Additional BindingsPurpose
US Core Clinical Note TypeMin Binding
\".\"\".\"\".\" Slices for category S1..*CodeableConcept(USCDI) Categorization of document
Slice: Unordered, Open by pattern:$this
\".\"\".\"\".\"\".\" category:uscore 0..*CodeableConcept(USCDI) Categorization of document
Binding: US Core DocumentReference Category (required): The US Core DocumentReferences Type Value Set is a "starter set" of categories supported for fetching and storing clinical notes. Note that other codes are permitted, see Required Bindings When Slicing by Value Sets

\".\"\".\"\".\" subject S1..1Reference(US Core Patient Profile)(USCDI) Who/what is the subject of the document
\".\"\".\"\".\" date S0..1instant(USCDI) When this document reference was created
\".\"\".\"\".\" author S0..*Reference(US Core Practitioner Profile S | US Core Organization Profile | US Core Patient Profile | US Core PractitionerRole Profile | US Core RelatedPerson Profile | Device)(USCDI) Who and/or what authored the document
\".\"\".\"\".\" content S1..*BackboneElement(USCDI) Document referenced
\".\"\".\"\".\"\".\" attachment SC1..1Attachment(USCDI) Where to access the document
us-core-6: DocumentReference.content.attachment.url or DocumentReference.content.attachment.data or both SHALL be present.
\".\"\".\"\".\"\".\"\".\" contentType S0..1code(USCDI) Mime type of the content, with charset etc.
\".\"\".\"\".\"\".\"\".\" data SC0..1base64Binary(USCDI) Data inline, base64ed
\".\"\".\"\".\"\".\"\".\" url SC0..1url(USCDI) Uri where the data can be found
\".\"\".\"\".\"\".\" format S0..1Coding(USCDI) Format/content rules for the document
Binding: DocumentReferenceFormatCodeSet (extensible)
\".\"\".\"\".\" context S0..1BackboneElement(USCDI) Clinical context of document
\".\"\".\"\".\"\".\" encounter S0..1Reference(US Core Encounter Profile)(USCDI) Context of the document content
\".\"\".\"\".\"\".\" period S0..1Period(USCDI) Time of service that is being documented

\"doco\" Documentation for this format
" + }, + "url" : "http://hl7.org/fhir/us/core/StructureDefinition/us-core-documentreference", + "version" : "6.1.0", + "name" : "USCoreDocumentReferenceProfile", + "title" : "US Core DocumentReference Profile", + "status" : "active", + "experimental" : false, + "date" : "2022-04-20", + "publisher" : "HL7 International - Cross-Group Projects", + "contact" : [{ + "name" : "HL7 International - Cross-Group Projects", + "telecom" : [{ + "system" : "url", + "value" : "http://www.hl7.org/Special/committees/cgp" + }, + { + "system" : "email", + "value" : "cgp@lists.HL7.org" + }] + }], + "description" : "To promote interoperability and adoption through common implementation, this profile sets minimum expectations for searching and fetching patient documents including Clinical Notes using the DocumentReference resource. It identifies which core elements, extensions, vocabularies, and value sets **SHALL** be present and constrains the way the elements are used when using the profile. It provides the floor for standards development for specific use cases. Prior to reviewing this profile, implementers are encouraged to read the Clinical Notes Guidance to understand the overlap of US Core DocumentReference Profile and US Core DiagnosticReport Profile for Report and Note exchange.", + "jurisdiction" : [{ + "coding" : [{ + "system" : "urn:iso:std:iso:3166", + "code" : "US" + }] + }], + "copyright" : "Used by permission of HL7 International, all rights reserved Creative Commons License", + "fhirVersion" : "4.0.1", + "mapping" : [{ + "identity" : "workflow", + "uri" : "http://hl7.org/fhir/workflow", + "name" : "Workflow Pattern" + }, + { + "identity" : "fhircomposition", + "uri" : "http://hl7.org/fhir/composition", + "name" : "FHIR Composition" + }, + { + "identity" : "rim", + "uri" : "http://hl7.org/v3", + "name" : "RIM Mapping" + }, + { + "identity" : "cda", + "uri" : "http://hl7.org/v3/cda", + "name" : "CDA (R2)" + }, + { + "identity" : "w5", + "uri" : "http://hl7.org/fhir/fivews", + "name" : "FiveWs Pattern Mapping" + }, + { + "identity" : "v2", + "uri" : "http://hl7.org/v2", + "name" : "HL7 v2 Mapping" + }, + { + "identity" : "xds", + "uri" : "http://ihe.net/xds", + "name" : "XDS metadata equivalent" + }], + "kind" : "resource", + "abstract" : false, + "type" : "DocumentReference", + "baseDefinition" : "http://hl7.org/fhir/StructureDefinition/DocumentReference", + "derivation" : "constraint", + "snapshot" : { + "element" : [{ + "id" : "DocumentReference", + "path" : "DocumentReference", + "short" : "A reference to a document", + "definition" : "\\-", + "comment" : "\\-", + "min" : 0, + "max" : "*", + "base" : { + "path" : "DocumentReference", + "min" : 0, + "max" : "*" + }, + "constraint" : [{ + "key" : "dom-2", + "severity" : "error", + "human" : "If the resource is contained in another resource, it SHALL NOT contain nested Resources", + "expression" : "contained.contained.empty()", + "xpath" : "not(parent::f:contained and f:contained)", + "source" : "http://hl7.org/fhir/StructureDefinition/DomainResource" + }, + { + "key" : "dom-3", + "severity" : "error", + "human" : "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" : "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" : "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" : "http://hl7.org/fhir/StructureDefinition/DomainResource" + }, + { + "key" : "dom-4", + "severity" : "error", + "human" : "If a resource is contained in another resource, it SHALL NOT have a meta.versionId or a meta.lastUpdated", + "expression" : "contained.meta.versionId.empty() and contained.meta.lastUpdated.empty()", + "xpath" : "not(exists(f:contained/*/f:meta/f:versionId)) and not(exists(f:contained/*/f:meta/f:lastUpdated))", + "source" : "http://hl7.org/fhir/StructureDefinition/DomainResource" + }, + { + "key" : "dom-5", + "severity" : "error", + "human" : "If a resource is contained in another resource, it SHALL NOT have a security label", + "expression" : "contained.meta.security.empty()", + "xpath" : "not(exists(f:contained/*/f:meta/f:security))", + "source" : "http://hl7.org/fhir/StructureDefinition/DomainResource" + }, + { + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-bestpractice", + "valueBoolean" : true + }, + { + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-bestpractice-explanation", + "valueMarkdown" : "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" : "dom-6", + "severity" : "warning", + "human" : "A resource should have narrative for robust management", + "expression" : "text.`div`.exists()", + "xpath" : "exists(f:text/h:div)", + "source" : "http://hl7.org/fhir/StructureDefinition/DomainResource" + }], + "mustSupport" : false, + "isModifier" : false, + "isSummary" : false, + "mapping" : [{ + "identity" : "rim", + "map" : "Entity. Role, or Act" + }, + { + "identity" : "workflow", + "map" : "Event" + }, + { + "identity" : "fhircomposition", + "map" : "when describing a Composition" + }, + { + "identity" : "rim", + "map" : "Document[classCode=\"DOC\" and moodCode=\"EVN\"]" + }, + { + "identity" : "cda", + "map" : "when describing a CDA" + }] + }, + { + "id" : "DocumentReference.id", + "path" : "DocumentReference.id", + "short" : "Logical id of this artifact", + "definition" : "The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.", + "comment" : "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" : 0, + "max" : "1", + "base" : { + "path" : "Resource.id", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type", + "valueUrl" : "id" + }], + "code" : "http://hl7.org/fhirpath/System.String" + }], + "isModifier" : false, + "isSummary" : true + }, + { + "id" : "DocumentReference.meta", + "path" : "DocumentReference.meta", + "short" : "Metadata about the resource", + "definition" : "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" : 0, + "max" : "1", + "base" : { + "path" : "Resource.meta", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "Meta" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : true + }, + { + "id" : "DocumentReference.implicitRules", + "path" : "DocumentReference.implicitRules", + "short" : "A set of rules under which this content was created", + "definition" : "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" : "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" : 0, + "max" : "1", + "base" : { + "path" : "Resource.implicitRules", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "uri" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : true, + "isModifierReason" : "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", + "isSummary" : true + }, + { + "id" : "DocumentReference.language", + "path" : "DocumentReference.language", + "short" : "Language of the resource content", + "definition" : "The base language in which the resource is written.", + "comment" : "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" : 0, + "max" : "1", + "base" : { + "path" : "Resource.language", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "code" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : false, + "binding" : { + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet", + "valueCanonical" : "http://hl7.org/fhir/ValueSet/all-languages" + }, + { + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString" : "Language" + }, + { + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-isCommonBinding", + "valueBoolean" : true + }], + "strength" : "preferred", + "description" : "A human language.", + "valueSet" : "http://hl7.org/fhir/ValueSet/languages" + } + }, + { + "id" : "DocumentReference.text", + "path" : "DocumentReference.text", + "short" : "Text summary of the resource, for human interpretation", + "definition" : "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" : "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" : ["narrative", + "html", + "xhtml", + "display"], + "min" : 0, + "max" : "1", + "base" : { + "path" : "DomainResource.text", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "Narrative" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : false, + "mapping" : [{ + "identity" : "rim", + "map" : "Act.text?" + }] + }, + { + "id" : "DocumentReference.contained", + "path" : "DocumentReference.contained", + "short" : "Contained, inline Resources", + "definition" : "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" : "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" : ["inline resources", + "anonymous resources", + "contained resources"], + "min" : 0, + "max" : "*", + "base" : { + "path" : "DomainResource.contained", + "min" : 0, + "max" : "*" + }, + "type" : [{ + "code" : "Resource" + }], + "isModifier" : false, + "isSummary" : false, + "mapping" : [{ + "identity" : "rim", + "map" : "N/A" + }] + }, + { + "id" : "DocumentReference.extension", + "path" : "DocumentReference.extension", + "short" : "Additional content defined by implementations", + "definition" : "May be used to represent additional information that is not part of the basic definition of the resource. 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" : "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" : ["extensions", + "user content"], + "min" : 0, + "max" : "*", + "base" : { + "path" : "DomainResource.extension", + "min" : 0, + "max" : "*" + }, + "type" : [{ + "code" : "Extension" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key" : "ext-1", + "severity" : "error", + "human" : "Must have either extensions or value[x], not both", + "expression" : "extension.exists() != value.exists()", + "xpath" : "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])", + "source" : "http://hl7.org/fhir/StructureDefinition/Extension" + }], + "isModifier" : false, + "isSummary" : false, + "mapping" : [{ + "identity" : "rim", + "map" : "N/A" + }] + }, + { + "id" : "DocumentReference.modifierExtension", + "path" : "DocumentReference.modifierExtension", + "short" : "Extensions that cannot be ignored", + "definition" : "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.\n\nModifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).", + "comment" : "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" : "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" : ["extensions", + "user content"], + "min" : 0, + "max" : "*", + "base" : { + "path" : "DomainResource.modifierExtension", + "min" : 0, + "max" : "*" + }, + "type" : [{ + "code" : "Extension" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key" : "ext-1", + "severity" : "error", + "human" : "Must have either extensions or value[x], not both", + "expression" : "extension.exists() != value.exists()", + "xpath" : "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])", + "source" : "http://hl7.org/fhir/StructureDefinition/Extension" + }], + "isModifier" : true, + "isModifierReason" : "Modifier extensions are expected to modify the meaning or interpretation of the resource that contains them", + "isSummary" : false, + "mapping" : [{ + "identity" : "rim", + "map" : "N/A" + }] + }, + { + "id" : "DocumentReference.masterIdentifier", + "path" : "DocumentReference.masterIdentifier", + "short" : "Master Version Specific Identifier", + "definition" : "Document identifier as assigned by the source of the document. This identifier is specific to this version of the document. This unique identifier may be used elsewhere to identify this version of the document.", + "comment" : "CDA Document Id extension and root.", + "requirements" : "The structure and format of this Id shall be consistent with the specification corresponding to the formatCode attribute. (e.g. for a DICOM standard document a 64-character numeric UID, for an HL7 CDA format a serialization of the CDA Document Id extension and root in the form \"oid^extension\", where OID is a 64 digits max, and the Id is a 16 UTF-8 char max. If the OID is coded without the extension then the '^' character shall not be included.).", + "min" : 0, + "max" : "1", + "base" : { + "path" : "DocumentReference.masterIdentifier", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "Identifier" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : true, + "mapping" : [{ + "identity" : "workflow", + "map" : "Event.identifier" + }, + { + "identity" : "w5", + "map" : "FiveWs.identifier" + }, + { + "identity" : "fhircomposition", + "map" : "Composition.identifier" + }, + { + "identity" : "v2", + "map" : "TXA-12" + }, + { + "identity" : "rim", + "map" : ".id" + }, + { + "identity" : "xds", + "map" : "DocumentEntry.uniqueId" + }, + { + "identity" : "cda", + "map" : "ClinicalDocument/id" + }] + }, + { + "id" : "DocumentReference.identifier", + "extension" : [{ + "url" : "http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement", + "valueBoolean" : true + }], + "path" : "DocumentReference.identifier", + "short" : "(USCDI) Other identifiers for the document", + "definition" : "Other identifiers associated with the document, including version independent identifiers.", + "min" : 0, + "max" : "*", + "base" : { + "path" : "DocumentReference.identifier", + "min" : 0, + "max" : "*" + }, + "type" : [{ + "code" : "Identifier" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "mustSupport" : true, + "isModifier" : false, + "isSummary" : true, + "mapping" : [{ + "identity" : "workflow", + "map" : "Event.identifier" + }, + { + "identity" : "w5", + "map" : "FiveWs.identifier" + }, + { + "identity" : "v2", + "map" : "TXA-16?" + }, + { + "identity" : "rim", + "map" : ".id / .setId" + }, + { + "identity" : "xds", + "map" : "DocumentEntry.entryUUID" + }] + }, + { + "id" : "DocumentReference.status", + "extension" : [{ + "url" : "http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement", + "valueBoolean" : true + }], + "path" : "DocumentReference.status", + "short" : "(USCDI) current | superseded | entered-in-error", + "definition" : "The status of this document reference.", + "comment" : "This is the status of the DocumentReference object, which might be independent from the docStatus element.\n\nThis element is labeled as a modifier because the status contains the codes that mark the document or reference as not currently valid.", + "min" : 1, + "max" : "1", + "base" : { + "path" : "DocumentReference.status", + "min" : 1, + "max" : "1" + }, + "type" : [{ + "code" : "code" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "mustSupport" : true, + "isModifier" : true, + "isModifierReason" : "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", + "isSummary" : true, + "binding" : { + "strength" : "required", + "valueSet" : "http://hl7.org/fhir/ValueSet/document-reference-status" + }, + "mapping" : [{ + "identity" : "workflow", + "map" : "Event.status" + }, + { + "identity" : "w5", + "map" : "FiveWs.status" + }, + { + "identity" : "v2", + "map" : "TXA-19" + }, + { + "identity" : "rim", + "map" : "interim: .completionCode=\"IN\" & ./statusCode[isNormalDatatype()]=\"active\"; final: .completionCode=\"AU\" && ./statusCode[isNormalDatatype()]=\"complete\" and not(./inboundRelationship[typeCode=\"SUBJ\" and isNormalActRelationship()]/source[subsumesCode(\"ActClass#CACT\") and moodCode=\"EVN\" and domainMember(\"ReviseDocument\", code) and isNormalAct()]); amended: .completionCode=\"AU\" && ./statusCode[isNormalDatatype()]=\"complete\" and ./inboundRelationship[typeCode=\"SUBJ\" and isNormalActRelationship()]/source[subsumesCode(\"ActClass#CACT\") and moodCode=\"EVN\" and domainMember(\"ReviseDocument\", code) and isNormalAct() and statusCode=\"completed\"]; withdrawn : .completionCode=NI && ./statusCode[isNormalDatatype()]=\"obsolete\"" + }, + { + "identity" : "xds", + "map" : "DocumentEntry.availabilityStatus" + }] + }, + { + "id" : "DocumentReference.docStatus", + "path" : "DocumentReference.docStatus", + "short" : "preliminary | final | amended | entered-in-error", + "definition" : "The status of the underlying document.", + "comment" : "The document that is pointed to might be in various lifecycle states.", + "min" : 0, + "max" : "1", + "base" : { + "path" : "DocumentReference.docStatus", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "code" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : true, + "binding" : { + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString" : "ReferredDocumentStatus" + }], + "strength" : "required", + "description" : "Status of the underlying document.", + "valueSet" : "http://hl7.org/fhir/ValueSet/composition-status|4.0.1" + }, + "mapping" : [{ + "identity" : "w5", + "map" : "FiveWs.status" + }, + { + "identity" : "fhircomposition", + "map" : "Composition.status" + }, + { + "identity" : "v2", + "map" : "TXA-17" + }, + { + "identity" : "rim", + "map" : ".statusCode" + }] + }, + { + "id" : "DocumentReference.type", + "extension" : [{ + "url" : "http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement", + "valueBoolean" : true + }], + "path" : "DocumentReference.type", + "short" : "(USCDI) Kind of document (LOINC if possible)", + "definition" : "Specifies the particular kind of document referenced (e.g. History and Physical, Discharge Summary, Progress Note). This usually equates to the purpose of making the document referenced.", + "comment" : "Key metadata element describing the document that describes he exact type of document. Helps humans to assess whether the document is of interest when viewing a list of documents.", + "min" : 1, + "max" : "1", + "base" : { + "path" : "DocumentReference.type", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "CodeableConcept" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "mustSupport" : true, + "isModifier" : false, + "isSummary" : true, + "binding" : { + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-minValueSet", + "valueCanonical" : "http://hl7.org/fhir/us/core/ValueSet/us-core-clinical-note-type" + }], + "strength" : "required", + "description" : "All LOINC values whose SCALE is DOC in the LOINC database and the HL7 v3 Code System NullFlavor concept 'unknown'", + "valueSet" : "http://hl7.org/fhir/us/core/ValueSet/us-core-documentreference-type" + }, + "mapping" : [{ + "identity" : "workflow", + "map" : "Event.code" + }, + { + "identity" : "w5", + "map" : "FiveWs.class" + }, + { + "identity" : "fhircomposition", + "map" : "Composition.type" + }, + { + "identity" : "v2", + "map" : "TXA-2" + }, + { + "identity" : "rim", + "map" : "./code" + }, + { + "identity" : "xds", + "map" : "DocumentEntry.type" + }, + { + "identity" : "cda", + "map" : "ClinicalDocument/code/@code \n\nThe typeCode should be mapped from the ClinicalDocument/code element to a set of document type codes configured in the affinity domain. One suggested coding system to use for typeCode is LOINC, in which case the mapping step can be omitted." + }] + }, + { + "id" : "DocumentReference.category", + "extension" : [{ + "url" : "http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement", + "valueBoolean" : true + }], + "path" : "DocumentReference.category", + "slicing" : { + "discriminator" : [{ + "type" : "pattern", + "path" : "$this" + }], + "rules" : "open" + }, + "short" : "(USCDI) Categorization of document", + "definition" : "A categorization for the type of document referenced - helps for indexing and searching. This may be implied by or derived from the code specified in the DocumentReference.type.", + "comment" : "Key metadata element describing the the category or classification of the document. This is a broader perspective that groups similar documents based on how they would be used. This is a primary key used in searching.", + "alias" : ["claxs"], + "min" : 1, + "max" : "*", + "base" : { + "path" : "DocumentReference.category", + "min" : 0, + "max" : "*" + }, + "type" : [{ + "code" : "CodeableConcept" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "mustSupport" : true, + "isModifier" : false, + "isSummary" : true, + "binding" : { + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString" : "DocumentC80Class" + }], + "strength" : "example", + "description" : "High-level kind of a clinical document at a macro level.", + "valueSet" : "http://hl7.org/fhir/ValueSet/document-classcodes" + }, + "mapping" : [{ + "identity" : "w5", + "map" : "FiveWs.class" + }, + { + "identity" : "fhircomposition", + "map" : "Composition.class" + }, + { + "identity" : "rim", + "map" : ".outboundRelationship[typeCode=\"COMP].target[classCode=\"LIST\", moodCode=\"EVN\"].code" + }, + { + "identity" : "xds", + "map" : "DocumentEntry.class" + }, + { + "identity" : "cda", + "map" : "Derived from a mapping of /ClinicalDocument/code/@code to an Affinity Domain specified coded value to use and coding system. Affinity Domains are encouraged to use the appropriate value for Type of Service, based on the LOINC Type of Service (see Page 53 of the LOINC User's Manual). Must be consistent with /ClinicalDocument/code/@code" + }] + }, + { + "id" : "DocumentReference.category:uscore", + "extension" : [{ + "url" : "http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement", + "valueBoolean" : true + }], + "path" : "DocumentReference.category", + "sliceName" : "uscore", + "short" : "(USCDI) Categorization of document", + "definition" : "A categorization for the type of document referenced - helps for indexing and searching. This may be implied by or derived from the code specified in the DocumentReference.type.", + "comment" : "Key metadata element describing the the category or classification of the document. This is a broader perspective that groups similar documents based on how they would be used. This is a primary key used in searching.", + "alias" : ["claxs"], + "min" : 0, + "max" : "*", + "base" : { + "path" : "DocumentReference.category", + "min" : 0, + "max" : "*" + }, + "type" : [{ + "code" : "CodeableConcept" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : true, + "binding" : { + "strength" : "required", + "description" : "The US Core DocumentReferences Type Value Set is a \"starter set\" of categories supported for fetching and storing clinical notes. Note that other codes are permitted, see [Required Bindings When Slicing by Value Sets](http://hl7.org/fhir/us/core/general-requirements.html#required-bindings-when-slicing-by-valuesets)", + "valueSet" : "http://hl7.org/fhir/us/core/ValueSet/us-core-documentreference-category" + }, + "mapping" : [{ + "identity" : "w5", + "map" : "FiveWs.class" + }, + { + "identity" : "fhircomposition", + "map" : "Composition.class" + }, + { + "identity" : "rim", + "map" : ".outboundRelationship[typeCode=\"COMP].target[classCode=\"LIST\", moodCode=\"EVN\"].code" + }, + { + "identity" : "xds", + "map" : "DocumentEntry.class" + }, + { + "identity" : "cda", + "map" : "Derived from a mapping of /ClinicalDocument/code/@code to an Affinity Domain specified coded value to use and coding system. Affinity Domains are encouraged to use the appropriate value for Type of Service, based on the LOINC Type of Service (see Page 53 of the LOINC User's Manual). Must be consistent with /ClinicalDocument/code/@code" + }] + }, + { + "id" : "DocumentReference.subject", + "extension" : [{ + "url" : "http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement", + "valueBoolean" : true + }], + "path" : "DocumentReference.subject", + "short" : "(USCDI) Who/what is the subject of the document", + "definition" : "Who or what the document is about. The document can be about a person, (patient or healthcare practitioner), a device (e.g. a machine) or even a group of subjects (such as a document about a herd of farm animals, or a set of patients that share a common exposure).", + "min" : 1, + "max" : "1", + "base" : { + "path" : "DocumentReference.subject", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "Reference", + "targetProfile" : ["http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient"] + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "mustSupport" : true, + "isModifier" : false, + "isSummary" : true, + "mapping" : [{ + "identity" : "workflow", + "map" : "Event.subject" + }, + { + "identity" : "w5", + "map" : "FiveWs.subject[x]" + }, + { + "identity" : "fhircomposition", + "map" : "Composition.subject" + }, + { + "identity" : "v2", + "map" : "PID-3 (No standard way to define a Practitioner or Group subject in HL7 v2 MDM message)" + }, + { + "identity" : "rim", + "map" : ".participation[typeCode=\"SBJ\"].role[typeCode=\"PAT\"]" + }, + { + "identity" : "xds", + "map" : "DocumentEntry.patientId" + }, + { + "identity" : "cda", + "map" : "ClinicalDocument/recordTarget/" + }, + { + "identity" : "w5", + "map" : "FiveWs.subject" + }] + }, + { + "id" : "DocumentReference.date", + "extension" : [{ + "url" : "http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement", + "valueBoolean" : true + }], + "path" : "DocumentReference.date", + "short" : "(USCDI) When this document reference was created", + "definition" : "When the document reference was created.", + "comment" : "Referencing/indexing time is used for tracking, organizing versions and searching.", + "alias" : ["indexed"], + "min" : 0, + "max" : "1", + "base" : { + "path" : "DocumentReference.date", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "instant" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "mustSupport" : true, + "isModifier" : false, + "isSummary" : true, + "mapping" : [{ + "identity" : "workflow", + "map" : "Event.occurrence[x]" + }, + { + "identity" : "w5", + "map" : "FiveWs.recorded" + }, + { + "identity" : "fhircomposition", + "map" : "Composition.date" + }, + { + "identity" : "rim", + "map" : ".availabilityTime[type=\"TS\"]" + }] + }, + { + "id" : "DocumentReference.author", + "extension" : [{ + "url" : "http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement", + "valueBoolean" : true + }], + "path" : "DocumentReference.author", + "short" : "(USCDI) Who and/or what authored the document", + "definition" : "Identifies who is responsible for adding the information to the document.", + "comment" : "Not necessarily who did the actual data entry (i.e. typist) or who was the source (informant).", + "min" : 0, + "max" : "*", + "base" : { + "path" : "DocumentReference.author", + "min" : 0, + "max" : "*" + }, + "type" : [{ + "code" : "Reference", + "targetProfile" : ["http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitioner", + "http://hl7.org/fhir/us/core/StructureDefinition/us-core-organization", + "http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient", + "http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitionerrole", + "http://hl7.org/fhir/us/core/StructureDefinition/us-core-relatedperson", + "http://hl7.org/fhir/StructureDefinition/Device"], + "_targetProfile" : [{ + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-type-must-support", + "valueBoolean" : true + }] + }, + { + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-type-must-support", + "valueBoolean" : false + }] + }, + { + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-type-must-support", + "valueBoolean" : false + }] + }, + { + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-type-must-support", + "valueBoolean" : false + }] + }, + { + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-type-must-support", + "valueBoolean" : false + }] + }, + { + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-type-must-support", + "valueBoolean" : false + }] + }] + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "mustSupport" : true, + "isModifier" : false, + "isSummary" : true, + "mapping" : [{ + "identity" : "workflow", + "map" : "Event.performer.actor" + }, + { + "identity" : "fhircomposition", + "map" : "Composition.author" + }, + { + "identity" : "v2", + "map" : "TXA-9 (No standard way to indicate a Device in HL7 v2 MDM message)" + }, + { + "identity" : "rim", + "map" : ".participation[typeCode=\"AUT\"].role[classCode=\"ASSIGNED\"]" + }, + { + "identity" : "xds", + "map" : "DocumentEntry.author" + }, + { + "identity" : "cda", + "map" : "ClinicalDocument/author" + }] + }, + { + "id" : "DocumentReference.authenticator", + "path" : "DocumentReference.authenticator", + "short" : "Who/what authenticated the document", + "definition" : "Which person or organization authenticates that this document is valid.", + "comment" : "Represents a participant within the author institution who has legally authenticated or attested the document. Legal authentication implies that a document has been signed manually or electronically by the legal Authenticator.", + "min" : 0, + "max" : "1", + "base" : { + "path" : "DocumentReference.authenticator", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "Reference", + "targetProfile" : ["http://hl7.org/fhir/StructureDefinition/Practitioner", + "http://hl7.org/fhir/StructureDefinition/PractitionerRole", + "http://hl7.org/fhir/StructureDefinition/Organization"] + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : false, + "mapping" : [{ + "identity" : "workflow", + "map" : "Event.performer.actor" + }, + { + "identity" : "w5", + "map" : "FiveWs.witness" + }, + { + "identity" : "fhircomposition", + "map" : "Composition.attester" + }, + { + "identity" : "v2", + "map" : "TXA-10" + }, + { + "identity" : "rim", + "map" : ".participation[typeCode=\"AUTHEN\"].role[classCode=\"ASSIGNED\"]" + }, + { + "identity" : "xds", + "map" : "DocumentEntry.legalAuthenticator" + }, + { + "identity" : "cda", + "map" : "ClinicalDocument/legalAuthenticator" + }] + }, + { + "id" : "DocumentReference.custodian", + "path" : "DocumentReference.custodian", + "short" : "Organization which maintains the document", + "definition" : "Identifies the organization or group who is responsible for ongoing maintenance of and access to the document.", + "comment" : "Identifies the logical organization (software system, vendor, or department) to go to find the current version, where to report issues, etc. This is different from the physical location (URL, disk drive, or server) of the document, which is the technical location of the document, which host may be delegated to the management of some other organization.", + "min" : 0, + "max" : "1", + "base" : { + "path" : "DocumentReference.custodian", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "Reference", + "targetProfile" : ["http://hl7.org/fhir/StructureDefinition/Organization"] + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : false, + "mapping" : [{ + "identity" : "workflow", + "map" : "Event.performer.actor" + }, + { + "identity" : "fhircomposition", + "map" : "Composition.custodian" + }, + { + "identity" : "rim", + "map" : ".participation[typeCode=\"RCV\"].role[classCode=\"CUST\"].scoper[classCode=\"ORG\" and determinerCode=\"INST\"]" + }] + }, + { + "id" : "DocumentReference.relatesTo", + "path" : "DocumentReference.relatesTo", + "short" : "Relationships to other documents", + "definition" : "Relationships that this document has with other document references that already exist.", + "comment" : "This element is labeled as a modifier because documents that append to other documents are incomplete on their own.", + "min" : 0, + "max" : "*", + "base" : { + "path" : "DocumentReference.relatesTo", + "min" : 0, + "max" : "*" + }, + "type" : [{ + "code" : "BackboneElement" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : true, + "mapping" : [{ + "identity" : "fhircomposition", + "map" : "Composition.relatesTo" + }, + { + "identity" : "rim", + "map" : ".outboundRelationship" + }, + { + "identity" : "xds", + "map" : "DocumentEntry Associations" + }] + }, + { + "id" : "DocumentReference.relatesTo.id", + "path" : "DocumentReference.relatesTo.id", + "representation" : ["xmlAttr"], + "short" : "Unique id for inter-element referencing", + "definition" : "Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", + "min" : 0, + "max" : "1", + "base" : { + "path" : "Element.id", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type", + "valueUrl" : "string" + }], + "code" : "http://hl7.org/fhirpath/System.String" + }], + "isModifier" : false, + "isSummary" : false, + "mapping" : [{ + "identity" : "rim", + "map" : "n/a" + }] + }, + { + "id" : "DocumentReference.relatesTo.extension", + "path" : "DocumentReference.relatesTo.extension", + "short" : "Additional content defined by implementations", + "definition" : "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" : "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" : ["extensions", + "user content"], + "min" : 0, + "max" : "*", + "base" : { + "path" : "Element.extension", + "min" : 0, + "max" : "*" + }, + "type" : [{ + "code" : "Extension" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key" : "ext-1", + "severity" : "error", + "human" : "Must have either extensions or value[x], not both", + "expression" : "extension.exists() != value.exists()", + "xpath" : "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])", + "source" : "http://hl7.org/fhir/StructureDefinition/Extension" + }], + "isModifier" : false, + "isSummary" : false, + "mapping" : [{ + "identity" : "rim", + "map" : "n/a" + }] + }, + { + "id" : "DocumentReference.relatesTo.modifierExtension", + "path" : "DocumentReference.relatesTo.modifierExtension", + "short" : "Extensions that cannot be ignored even if unrecognized", + "definition" : "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.\n\nModifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).", + "comment" : "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" : "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" : ["extensions", + "user content", + "modifiers"], + "min" : 0, + "max" : "*", + "base" : { + "path" : "BackboneElement.modifierExtension", + "min" : 0, + "max" : "*" + }, + "type" : [{ + "code" : "Extension" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key" : "ext-1", + "severity" : "error", + "human" : "Must have either extensions or value[x], not both", + "expression" : "extension.exists() != value.exists()", + "xpath" : "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])", + "source" : "http://hl7.org/fhir/StructureDefinition/Extension" + }], + "isModifier" : true, + "isModifierReason" : "Modifier extensions are expected to modify the meaning or interpretation of the element that contains them", + "isSummary" : true, + "mapping" : [{ + "identity" : "rim", + "map" : "N/A" + }] + }, + { + "id" : "DocumentReference.relatesTo.code", + "path" : "DocumentReference.relatesTo.code", + "short" : "replaces | transforms | signs | appends", + "definition" : "The type of relationship that this document has with anther document.", + "comment" : "If this document appends another document, then the document cannot be fully understood without also accessing the referenced document.", + "min" : 1, + "max" : "1", + "base" : { + "path" : "DocumentReference.relatesTo.code", + "min" : 1, + "max" : "1" + }, + "type" : [{ + "code" : "code" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : true, + "binding" : { + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString" : "DocumentRelationshipType" + }], + "strength" : "required", + "description" : "The type of relationship between documents.", + "valueSet" : "http://hl7.org/fhir/ValueSet/document-relationship-type|4.0.1" + }, + "mapping" : [{ + "identity" : "fhircomposition", + "map" : "Composition.relatesTo.code" + }, + { + "identity" : "rim", + "map" : ".outboundRelationship.typeCode" + }, + { + "identity" : "xds", + "map" : "DocumentEntry Associations type" + }] + }, + { + "id" : "DocumentReference.relatesTo.target", + "path" : "DocumentReference.relatesTo.target", + "short" : "Target of the relationship", + "definition" : "The target document of this relationship.", + "min" : 1, + "max" : "1", + "base" : { + "path" : "DocumentReference.relatesTo.target", + "min" : 1, + "max" : "1" + }, + "type" : [{ + "code" : "Reference", + "targetProfile" : ["http://hl7.org/fhir/StructureDefinition/DocumentReference"] + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : true, + "mapping" : [{ + "identity" : "fhircomposition", + "map" : "Composition.relatesTo.target" + }, + { + "identity" : "rim", + "map" : ".target[classCode=\"DOC\", moodCode=\"EVN\"].id" + }, + { + "identity" : "xds", + "map" : "DocumentEntry Associations reference" + }] + }, + { + "id" : "DocumentReference.description", + "path" : "DocumentReference.description", + "short" : "Human-readable description", + "definition" : "Human-readable description of the source document.", + "comment" : "What the document is about, a terse summary of the document.", + "requirements" : "Helps humans to assess whether the document is of interest.", + "min" : 0, + "max" : "1", + "base" : { + "path" : "DocumentReference.description", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "string" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : true, + "mapping" : [{ + "identity" : "v2", + "map" : "TXA-25" + }, + { + "identity" : "rim", + "map" : ".outboundRelationship[typeCode=\"SUBJ\"].target.text" + }, + { + "identity" : "xds", + "map" : "DocumentEntry.comments" + }] + }, + { + "id" : "DocumentReference.securityLabel", + "path" : "DocumentReference.securityLabel", + "short" : "Document security-tags", + "definition" : "A set of Security-Tag codes specifying the level of privacy/security of the Document. Note that DocumentReference.meta.security contains the security labels of the \"reference\" to the document, while DocumentReference.securityLabel contains a snapshot of the security labels on the document the reference refers to.", + "comment" : "The confidentiality codes can carry multiple vocabulary items. HL7 has developed an understanding of security and privacy tags that might be desirable in a Document Sharing environment, called HL7 Healthcare Privacy and Security Classification System (HCS). The following specification is recommended but not mandated, as the vocabulary bindings are an administrative domain responsibility. The use of this method is up to the policy domain such as the XDS Affinity Domain or other Trust Domain where all parties including sender and recipients are trusted to appropriately tag and enforce. \n\nIn the HL7 Healthcare Privacy and Security Classification (HCS) there are code systems specific to Confidentiality, Sensitivity, Integrity, and Handling Caveats. Some values would come from a local vocabulary as they are related to workflow roles and special projects.", + "requirements" : "Use of the Health Care Privacy/Security Classification (HCS) system of security-tag use is recommended.", + "min" : 0, + "max" : "*", + "base" : { + "path" : "DocumentReference.securityLabel", + "min" : 0, + "max" : "*" + }, + "type" : [{ + "code" : "CodeableConcept" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : true, + "binding" : { + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString" : "SecurityLabels" + }, + { + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-isCommonBinding", + "valueBoolean" : true + }], + "strength" : "extensible", + "description" : "Security Labels from the Healthcare Privacy and Security Classification System.", + "valueSet" : "http://hl7.org/fhir/ValueSet/security-labels" + }, + "mapping" : [{ + "identity" : "fhircomposition", + "map" : "Composition.confidentiality, Composition.meta.security" + }, + { + "identity" : "v2", + "map" : "TXA-18" + }, + { + "identity" : "rim", + "map" : ".confidentialityCode" + }, + { + "identity" : "xds", + "map" : "DocumentEntry.confidentialityCode" + }, + { + "identity" : "cda", + "map" : "ClinicalDocument/confidentialityCode/@code" + }] + }, + { + "id" : "DocumentReference.content", + "extension" : [{ + "url" : "http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement", + "valueBoolean" : true + }], + "path" : "DocumentReference.content", + "short" : "(USCDI) Document referenced", + "definition" : "The document and format referenced. There may be multiple content element repetitions, each with a different format.", + "min" : 1, + "max" : "*", + "base" : { + "path" : "DocumentReference.content", + "min" : 1, + "max" : "*" + }, + "type" : [{ + "code" : "BackboneElement" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "mustSupport" : true, + "isModifier" : false, + "isSummary" : true, + "mapping" : [{ + "identity" : "fhircomposition", + "map" : "Bundle(Composition+*)" + }, + { + "identity" : "rim", + "map" : "document.text" + }] + }, + { + "id" : "DocumentReference.content.id", + "path" : "DocumentReference.content.id", + "representation" : ["xmlAttr"], + "short" : "Unique id for inter-element referencing", + "definition" : "Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", + "min" : 0, + "max" : "1", + "base" : { + "path" : "Element.id", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type", + "valueUrl" : "string" + }], + "code" : "http://hl7.org/fhirpath/System.String" + }], + "isModifier" : false, + "isSummary" : false, + "mapping" : [{ + "identity" : "rim", + "map" : "n/a" + }] + }, + { + "id" : "DocumentReference.content.extension", + "path" : "DocumentReference.content.extension", + "short" : "Additional content defined by implementations", + "definition" : "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" : "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" : ["extensions", + "user content"], + "min" : 0, + "max" : "*", + "base" : { + "path" : "Element.extension", + "min" : 0, + "max" : "*" + }, + "type" : [{ + "code" : "Extension" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key" : "ext-1", + "severity" : "error", + "human" : "Must have either extensions or value[x], not both", + "expression" : "extension.exists() != value.exists()", + "xpath" : "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])", + "source" : "http://hl7.org/fhir/StructureDefinition/Extension" + }], + "isModifier" : false, + "isSummary" : false, + "mapping" : [{ + "identity" : "rim", + "map" : "n/a" + }] + }, + { + "id" : "DocumentReference.content.modifierExtension", + "path" : "DocumentReference.content.modifierExtension", + "short" : "Extensions that cannot be ignored even if unrecognized", + "definition" : "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.\n\nModifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).", + "comment" : "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" : "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" : ["extensions", + "user content", + "modifiers"], + "min" : 0, + "max" : "*", + "base" : { + "path" : "BackboneElement.modifierExtension", + "min" : 0, + "max" : "*" + }, + "type" : [{ + "code" : "Extension" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key" : "ext-1", + "severity" : "error", + "human" : "Must have either extensions or value[x], not both", + "expression" : "extension.exists() != value.exists()", + "xpath" : "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])", + "source" : "http://hl7.org/fhir/StructureDefinition/Extension" + }], + "isModifier" : true, + "isModifierReason" : "Modifier extensions are expected to modify the meaning or interpretation of the element that contains them", + "isSummary" : true, + "mapping" : [{ + "identity" : "rim", + "map" : "N/A" + }] + }, + { + "id" : "DocumentReference.content.attachment", + "extension" : [{ + "url" : "http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement", + "valueBoolean" : true + }], + "path" : "DocumentReference.content.attachment", + "short" : "(USCDI) Where to access the document", + "definition" : "The document or URL of the document along with critical metadata to prove content has integrity.", + "min" : 1, + "max" : "1", + "base" : { + "path" : "DocumentReference.content.attachment", + "min" : 1, + "max" : "1" + }, + "type" : [{ + "code" : "Attachment" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key" : "us-core-6", + "severity" : "error", + "human" : "DocumentReference.content.attachment.url or DocumentReference.content.attachment.data or both SHALL be present.", + "expression" : "url.exists() or data.exists()", + "xpath" : "f:url or f:content" + }], + "mustSupport" : true, + "isModifier" : false, + "isSummary" : true, + "mapping" : [{ + "identity" : "fhircomposition", + "map" : "Composition.language, \nComposition.title, \nComposition.date" + }, + { + "identity" : "v2", + "map" : "TXA-3 for mime type" + }, + { + "identity" : "rim", + "map" : "document.text" + }, + { + "identity" : "xds", + "map" : "DocumentEntry.mimeType, DocumentEntry.languageCode, DocumentEntry.URI, DocumentEntry.size, DocumentEntry.hash, DocumentEntry.title, DocumentEntry.creationTime" + }, + { + "identity" : "cda", + "map" : "ClinicalDocument/languageCode, ClinicalDocument/title, ClinicalDocument/date" + }] + }, + { + "id" : "DocumentReference.content.attachment.id", + "path" : "DocumentReference.content.attachment.id", + "representation" : ["xmlAttr"], + "short" : "Unique id for inter-element referencing", + "definition" : "Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", + "min" : 0, + "max" : "1", + "base" : { + "path" : "Element.id", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type", + "valueUrl" : "string" + }], + "code" : "http://hl7.org/fhirpath/System.String" + }], + "isModifier" : false, + "isSummary" : false, + "mapping" : [{ + "identity" : "rim", + "map" : "n/a" + }] + }, + { + "id" : "DocumentReference.content.attachment.extension", + "path" : "DocumentReference.content.attachment.extension", + "slicing" : { + "discriminator" : [{ + "type" : "value", + "path" : "url" + }], + "description" : "Extensions are always sliced by (at least) url", + "rules" : "open" + }, + "short" : "Additional content defined by implementations", + "definition" : "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" : "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" : ["extensions", + "user content"], + "min" : 0, + "max" : "*", + "base" : { + "path" : "Element.extension", + "min" : 0, + "max" : "*" + }, + "type" : [{ + "code" : "Extension" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key" : "ext-1", + "severity" : "error", + "human" : "Must have either extensions or value[x], not both", + "expression" : "extension.exists() != value.exists()", + "xpath" : "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])", + "source" : "http://hl7.org/fhir/StructureDefinition/Extension" + }], + "isModifier" : false, + "isSummary" : false, + "mapping" : [{ + "identity" : "rim", + "map" : "n/a" + }] + }, + { + "id" : "DocumentReference.content.attachment.contentType", + "extension" : [{ + "url" : "http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement", + "valueBoolean" : true + }], + "path" : "DocumentReference.content.attachment.contentType", + "short" : "(USCDI) Mime type of the content, with charset etc.", + "definition" : "Identifies the type of the data in the attachment and allows a method to be chosen to interpret or render the data. Includes mime type parameters such as charset where appropriate.", + "requirements" : "Processors of the data need to be able to know how to interpret the data.", + "min" : 0, + "max" : "1", + "base" : { + "path" : "Attachment.contentType", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "code" + }], + "example" : [{ + "label" : "General", + "valueCode" : "text/plain; charset=UTF-8, image/png" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "mustSupport" : true, + "isModifier" : false, + "isSummary" : true, + "binding" : { + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString" : "MimeType" + }, + { + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-isCommonBinding", + "valueBoolean" : true + }], + "strength" : "required", + "description" : "The mime type of an attachment. Any valid mime type is allowed.", + "valueSet" : "http://hl7.org/fhir/ValueSet/mimetypes|4.0.1" + }, + "mapping" : [{ + "identity" : "v2", + "map" : "ED.2+ED.3/RP.2+RP.3. Note conversion may be needed if old style values are being used" + }, + { + "identity" : "rim", + "map" : "./mediaType, ./charset" + }] + }, + { + "id" : "DocumentReference.content.attachment.language", + "path" : "DocumentReference.content.attachment.language", + "short" : "Human language of the content (BCP-47)", + "definition" : "The human language of the content. The value can be any valid value according to BCP 47.", + "requirements" : "Users need to be able to choose between the languages in a set of attachments.", + "min" : 0, + "max" : "1", + "base" : { + "path" : "Attachment.language", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "code" + }], + "example" : [{ + "label" : "General", + "valueCode" : "en-AU" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : true, + "binding" : { + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet", + "valueCanonical" : "http://hl7.org/fhir/ValueSet/all-languages" + }, + { + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString" : "Language" + }, + { + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-isCommonBinding", + "valueBoolean" : true + }], + "strength" : "preferred", + "description" : "A human language.", + "valueSet" : "http://hl7.org/fhir/ValueSet/languages" + }, + "mapping" : [{ + "identity" : "rim", + "map" : "./language" + }] + }, + { + "id" : "DocumentReference.content.attachment.data", + "extension" : [{ + "url" : "http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement", + "valueBoolean" : true + }], + "path" : "DocumentReference.content.attachment.data", + "short" : "(USCDI) Data inline, base64ed", + "definition" : "The actual data of the attachment - a sequence of bytes, base64 encoded.", + "comment" : "The base64-encoded data SHALL be expressed in the same character set as the base resource XML or JSON.", + "requirements" : "The data needs to able to be transmitted inline.", + "min" : 0, + "max" : "1", + "base" : { + "path" : "Attachment.data", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "base64Binary" + }], + "condition" : ["us-core-6"], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "mustSupport" : true, + "isModifier" : false, + "isSummary" : false, + "mapping" : [{ + "identity" : "v2", + "map" : "ED.5" + }, + { + "identity" : "rim", + "map" : "./data" + }] + }, + { + "id" : "DocumentReference.content.attachment.url", + "extension" : [{ + "url" : "http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement", + "valueBoolean" : true + }], + "path" : "DocumentReference.content.attachment.url", + "short" : "(USCDI) Uri where the data can be found", + "definition" : "A location where the data can be accessed.", + "comment" : "If both data and url are provided, the url SHALL point to the same content as the data contains. Urls may be relative references or may reference transient locations such as a wrapping envelope using cid: though this has ramifications for using signatures. Relative URLs are interpreted relative to the service url, like a resource reference, rather than relative to the resource itself. If a URL is provided, it SHALL resolve to actual data.", + "requirements" : "The data needs to be transmitted by reference.", + "min" : 0, + "max" : "1", + "base" : { + "path" : "Attachment.url", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "url" + }], + "example" : [{ + "label" : "General", + "valueUrl" : "http://www.acme.com/logo-small.png" + }], + "condition" : ["us-core-6"], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "mustSupport" : true, + "isModifier" : false, + "isSummary" : true, + "mapping" : [{ + "identity" : "v2", + "map" : "RP.1+RP.2 - if they refer to a URL (see v2.6)" + }, + { + "identity" : "rim", + "map" : "./reference/literal" + }] + }, + { + "id" : "DocumentReference.content.attachment.size", + "path" : "DocumentReference.content.attachment.size", + "short" : "Number of bytes of content (if url provided)", + "definition" : "The number of bytes of data that make up this attachment (before base64 encoding, if that is done).", + "comment" : "The number of bytes is redundant if the data is provided as a base64binary, but is useful if the data is provided as a url reference.", + "requirements" : "Representing the size allows applications to determine whether they should fetch the content automatically in advance, or refuse to fetch it at all.", + "min" : 0, + "max" : "1", + "base" : { + "path" : "Attachment.size", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "unsignedInt" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : true, + "mapping" : [{ + "identity" : "rim", + "map" : "N/A (needs data type R3 proposal)" + }] + }, + { + "id" : "DocumentReference.content.attachment.hash", + "path" : "DocumentReference.content.attachment.hash", + "short" : "Hash of the data (sha-1, base64ed)", + "definition" : "The calculated hash of the data using SHA-1. Represented using base64.", + "comment" : "The hash is calculated on the data prior to base64 encoding, if the data is based64 encoded. The hash is not intended to support digital signatures. Where protection against malicious threats a digital signature should be considered, see [Provenance.signature](http://hl7.org/fhir/R4/provenance-definitions.html#Provenance.signature) for mechanism to protect a resource with a digital signature.", + "requirements" : "Included so that applications can verify that the contents of a location have not changed due to technical failures (e.g., storage rot, transport glitch, incorrect version).", + "min" : 0, + "max" : "1", + "base" : { + "path" : "Attachment.hash", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "base64Binary" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : true, + "mapping" : [{ + "identity" : "rim", + "map" : ".integrityCheck[parent::ED/integrityCheckAlgorithm=\"SHA-1\"]" + }] + }, + { + "id" : "DocumentReference.content.attachment.title", + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-translatable", + "valueBoolean" : true + }], + "path" : "DocumentReference.content.attachment.title", + "short" : "Label to display in place of the data", + "definition" : "A label or set of text to display in place of the data.", + "requirements" : "Applications need a label to display to a human user in place of the actual data if the data cannot be rendered or perceived by the viewer.", + "min" : 0, + "max" : "1", + "base" : { + "path" : "Attachment.title", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "string" + }], + "example" : [{ + "label" : "General", + "valueString" : "Official Corporate Logo" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : true, + "mapping" : [{ + "identity" : "rim", + "map" : "./title/data" + }] + }, + { + "id" : "DocumentReference.content.attachment.creation", + "path" : "DocumentReference.content.attachment.creation", + "short" : "Date attachment was first created", + "definition" : "The date that the attachment was first created.", + "requirements" : "This is often tracked as an integrity issue for use of the attachment.", + "min" : 0, + "max" : "1", + "base" : { + "path" : "Attachment.creation", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "dateTime" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : true, + "mapping" : [{ + "identity" : "rim", + "map" : "N/A (needs data type R3 proposal)" + }] + }, + { + "id" : "DocumentReference.content.format", + "extension" : [{ + "url" : "http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement", + "valueBoolean" : true + }], + "path" : "DocumentReference.content.format", + "short" : "(USCDI) Format/content rules for the document", + "definition" : "An identifier of the document encoding, structure, and template that the document conforms to beyond the base format indicated in the mimeType.", + "comment" : "Note that while IHE mostly issues URNs for format types, not all documents can be identified by a URI.", + "min" : 0, + "max" : "1", + "base" : { + "path" : "DocumentReference.content.format", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "Coding" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "mustSupport" : true, + "isModifier" : false, + "isSummary" : true, + "binding" : { + "strength" : "extensible", + "valueSet" : "http://hl7.org/fhir/ValueSet/formatcodes" + }, + "mapping" : [{ + "identity" : "fhircomposition", + "map" : "Composition.meta.profile" + }, + { + "identity" : "rim", + "map" : "document.text" + }, + { + "identity" : "xds", + "map" : "DocumentEntry.formatCode" + }, + { + "identity" : "cda", + "map" : "derived from the IHE Profile or Implementation Guide templateID" + }] + }, + { + "id" : "DocumentReference.context", + "extension" : [{ + "url" : "http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement", + "valueBoolean" : true + }], + "path" : "DocumentReference.context", + "short" : "(USCDI) Clinical context of document", + "definition" : "The clinical context in which the document was prepared.", + "comment" : "These values are primarily added to help with searching for interesting/relevant documents.", + "min" : 0, + "max" : "1", + "base" : { + "path" : "DocumentReference.context", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "BackboneElement" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "mustSupport" : true, + "isModifier" : false, + "isSummary" : true, + "mapping" : [{ + "identity" : "rim", + "map" : "outboundRelationship[typeCode=\"SUBJ\"].target[classCode<'ACT']" + }] + }, + { + "id" : "DocumentReference.context.id", + "path" : "DocumentReference.context.id", + "representation" : ["xmlAttr"], + "short" : "Unique id for inter-element referencing", + "definition" : "Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", + "min" : 0, + "max" : "1", + "base" : { + "path" : "Element.id", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type", + "valueUrl" : "string" + }], + "code" : "http://hl7.org/fhirpath/System.String" + }], + "isModifier" : false, + "isSummary" : false, + "mapping" : [{ + "identity" : "rim", + "map" : "n/a" + }] + }, + { + "id" : "DocumentReference.context.extension", + "path" : "DocumentReference.context.extension", + "short" : "Additional content defined by implementations", + "definition" : "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" : "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" : ["extensions", + "user content"], + "min" : 0, + "max" : "*", + "base" : { + "path" : "Element.extension", + "min" : 0, + "max" : "*" + }, + "type" : [{ + "code" : "Extension" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key" : "ext-1", + "severity" : "error", + "human" : "Must have either extensions or value[x], not both", + "expression" : "extension.exists() != value.exists()", + "xpath" : "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])", + "source" : "http://hl7.org/fhir/StructureDefinition/Extension" + }], + "isModifier" : false, + "isSummary" : false, + "mapping" : [{ + "identity" : "rim", + "map" : "n/a" + }] + }, + { + "id" : "DocumentReference.context.modifierExtension", + "path" : "DocumentReference.context.modifierExtension", + "short" : "Extensions that cannot be ignored even if unrecognized", + "definition" : "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.\n\nModifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).", + "comment" : "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" : "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" : ["extensions", + "user content", + "modifiers"], + "min" : 0, + "max" : "*", + "base" : { + "path" : "BackboneElement.modifierExtension", + "min" : 0, + "max" : "*" + }, + "type" : [{ + "code" : "Extension" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key" : "ext-1", + "severity" : "error", + "human" : "Must have either extensions or value[x], not both", + "expression" : "extension.exists() != value.exists()", + "xpath" : "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])", + "source" : "http://hl7.org/fhir/StructureDefinition/Extension" + }], + "isModifier" : true, + "isModifierReason" : "Modifier extensions are expected to modify the meaning or interpretation of the element that contains them", + "isSummary" : true, + "mapping" : [{ + "identity" : "rim", + "map" : "N/A" + }] + }, + { + "id" : "DocumentReference.context.encounter", + "extension" : [{ + "url" : "http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement", + "valueBoolean" : true + }], + "path" : "DocumentReference.context.encounter", + "short" : "(USCDI) Context of the document content", + "definition" : "Describes the clinical encounter or type of care that the document content is associated with.", + "min" : 0, + "max" : "1", + "base" : { + "path" : "DocumentReference.context.encounter", + "min" : 0, + "max" : "*" + }, + "type" : [{ + "code" : "Reference", + "targetProfile" : ["http://hl7.org/fhir/us/core/StructureDefinition/us-core-encounter"] + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "mustSupport" : true, + "isModifier" : false, + "isSummary" : false, + "mapping" : [{ + "identity" : "workflow", + "map" : "Event.context" + }, + { + "identity" : "w5", + "map" : "FiveWs.context" + }, + { + "identity" : "fhircomposition", + "map" : "Composition.encounter" + }, + { + "identity" : "rim", + "map" : "unique(highest(./outboundRelationship[typeCode=\"SUBJ\" and isNormalActRelationship()], priorityNumber)/target[moodCode=\"EVN\" and classCode=(\"ENC\", \"PCPR\") and isNormalAct])" + }] + }, + { + "id" : "DocumentReference.context.event", + "path" : "DocumentReference.context.event", + "short" : "Main clinical acts documented", + "definition" : "This list of codes represents the main clinical acts, such as a colonoscopy or an appendectomy, being documented. In some cases, the event is inherent in the type Code, such as a \"History and Physical Report\" in which the procedure being documented is necessarily a \"History and Physical\" act.", + "comment" : "An event can further specialize the act inherent in the type, such as where it is simply \"Procedure Report\" and the procedure was a \"colonoscopy\". If one or more event codes are included, they shall not conflict with the values inherent in the class or type elements as such a conflict would create an ambiguous situation.", + "min" : 0, + "max" : "*", + "base" : { + "path" : "DocumentReference.context.event", + "min" : 0, + "max" : "*" + }, + "type" : [{ + "code" : "CodeableConcept" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : false, + "binding" : { + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString" : "DocumentEventType" + }], + "strength" : "example", + "description" : "This list of codes represents the main clinical acts being documented.", + "valueSet" : "http://terminology.hl7.org/ValueSet/v3-ActCode" + }, + "mapping" : [{ + "identity" : "fhircomposition", + "map" : "Composition.event.code" + }, + { + "identity" : "rim", + "map" : ".code" + }, + { + "identity" : "xds", + "map" : "DocumentEntry.eventCodeList" + }] + }, + { + "id" : "DocumentReference.context.period", + "extension" : [{ + "url" : "http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement", + "valueBoolean" : true + }], + "path" : "DocumentReference.context.period", + "short" : "(USCDI) Time of service that is being documented", + "definition" : "The time period over which the service that is described by the document was provided.", + "min" : 0, + "max" : "1", + "base" : { + "path" : "DocumentReference.context.period", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "Period" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "mustSupport" : true, + "isModifier" : false, + "isSummary" : true, + "mapping" : [{ + "identity" : "fhircomposition", + "map" : "Composition.event.period" + }, + { + "identity" : "rim", + "map" : ".effectiveTime" + }, + { + "identity" : "xds", + "map" : "DocumentEntry.serviceStartTime, DocumentEntry.serviceStopTime" + }, + { + "identity" : "cda", + "map" : "ClinicalDocument/documentationOf/\nserviceEvent/effectiveTime/low/\n@value --> ClinicalDocument/documentationOf/\nserviceEvent/effectiveTime/high/\n@value" + }] + }, + { + "id" : "DocumentReference.context.facilityType", + "path" : "DocumentReference.context.facilityType", + "short" : "Kind of facility where patient was seen", + "definition" : "The kind of facility where the patient was seen.", + "min" : 0, + "max" : "1", + "base" : { + "path" : "DocumentReference.context.facilityType", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "CodeableConcept" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : false, + "binding" : { + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString" : "DocumentC80FacilityType" + }], + "strength" : "example", + "description" : "XDS Facility Type.", + "valueSet" : "http://hl7.org/fhir/ValueSet/c80-facilitycodes" + }, + "mapping" : [{ + "identity" : "fhircomposition", + "map" : "usually from a mapping to a local ValueSet" + }, + { + "identity" : "rim", + "map" : ".participation[typeCode=\"LOC\"].role[classCode=\"DSDLOC\"].code" + }, + { + "identity" : "xds", + "map" : "DocumentEntry.healthcareFacilityTypeCode" + }, + { + "identity" : "cda", + "map" : "usually a mapping to a local ValueSet. Must be consistent with /clinicalDocument/code" + }] + }, + { + "id" : "DocumentReference.context.practiceSetting", + "path" : "DocumentReference.context.practiceSetting", + "short" : "Additional details about where the content was created (e.g. clinical specialty)", + "definition" : "This property may convey specifics about the practice setting where the content was created, often reflecting the clinical specialty.", + "comment" : "This element should be based on a coarse classification system for the class of specialty practice. Recommend the use of the classification system for Practice Setting, such as that described by the Subject Matter Domain in LOINC.", + "requirements" : "This is an important piece of metadata that providers often rely upon to quickly sort and/or filter out to find specific content.", + "min" : 0, + "max" : "1", + "base" : { + "path" : "DocumentReference.context.practiceSetting", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "CodeableConcept" + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : false, + "binding" : { + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString" : "DocumentC80PracticeSetting" + }], + "strength" : "example", + "description" : "Additional details about where the content was created (e.g. clinical specialty).", + "valueSet" : "http://hl7.org/fhir/ValueSet/c80-practice-codes" + }, + "mapping" : [{ + "identity" : "fhircomposition", + "map" : "usually from a mapping to a local ValueSet" + }, + { + "identity" : "rim", + "map" : ".participation[typeCode=\"LOC\"].role[classCode=\"DSDLOC\"].code" + }, + { + "identity" : "xds", + "map" : "DocumentEntry.practiceSettingCode" + }, + { + "identity" : "cda", + "map" : "usually from a mapping to a local ValueSet" + }] + }, + { + "id" : "DocumentReference.context.sourcePatientInfo", + "path" : "DocumentReference.context.sourcePatientInfo", + "short" : "Patient demographics from source", + "definition" : "The Patient Information as known when the document was published. May be a reference to a version specific, or contained.", + "min" : 0, + "max" : "1", + "base" : { + "path" : "DocumentReference.context.sourcePatientInfo", + "min" : 0, + "max" : "1" + }, + "type" : [{ + "code" : "Reference", + "targetProfile" : ["http://hl7.org/fhir/StructureDefinition/Patient"] + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : false, + "mapping" : [{ + "identity" : "fhircomposition", + "map" : "Composition.subject" + }, + { + "identity" : "rim", + "map" : ".participation[typeCode=\"SBJ\"].role[typeCode=\"PAT\"]" + }, + { + "identity" : "xds", + "map" : "DocumentEntry.sourcePatientInfo, DocumentEntry.sourcePatientId" + }, + { + "identity" : "cda", + "map" : "ClinicalDocument/recordTarget/" + }] + }, + { + "id" : "DocumentReference.context.related", + "path" : "DocumentReference.context.related", + "short" : "Related identifiers or resources", + "definition" : "Related identifiers or resources associated with the DocumentReference.", + "comment" : "May be identifiers or resources that caused the DocumentReference or referenced Document to be created.", + "min" : 0, + "max" : "*", + "base" : { + "path" : "DocumentReference.context.related", + "min" : 0, + "max" : "*" + }, + "type" : [{ + "code" : "Reference", + "targetProfile" : ["http://hl7.org/fhir/StructureDefinition/Resource"] + }], + "constraint" : [{ + "key" : "ele-1", + "severity" : "error", + "human" : "All FHIR elements must have a @value or children", + "expression" : "hasValue() or (children().count() > id.count())", + "xpath" : "@value|f:*|h:div", + "source" : "http://hl7.org/fhir/StructureDefinition/Element" + }], + "isModifier" : false, + "isSummary" : false, + "mapping" : [{ + "identity" : "fhircomposition", + "map" : "Composition.event.detail" + }, + { + "identity" : "rim", + "map" : "./outboundRelationship[typeCode=\"PERT\" and isNormalActRelationship()] / target[isNormalAct]" + }, + { + "identity" : "xds", + "map" : "DocumentEntry.referenceIdList" + }, + { + "identity" : "cda", + "map" : "ClinicalDocument/relatedDocument" + }] + }] + }, + "differential" : { + "element" : [{ + "id" : "DocumentReference", + "path" : "DocumentReference", + "definition" : "\\-", + "comment" : "\\-", + "mustSupport" : false + }, + { + "id" : "DocumentReference.identifier", + "extension" : [{ + "url" : "http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement", + "valueBoolean" : true + }], + "path" : "DocumentReference.identifier", + "short" : "(USCDI) Other identifiers for the document", + "mustSupport" : true + }, + { + "id" : "DocumentReference.status", + "extension" : [{ + "url" : "http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement", + "valueBoolean" : true + }], + "path" : "DocumentReference.status", + "short" : "(USCDI) current | superseded | entered-in-error", + "mustSupport" : true, + "binding" : { + "strength" : "required", + "valueSet" : "http://hl7.org/fhir/ValueSet/document-reference-status" + } + }, + { + "id" : "DocumentReference.type", + "extension" : [{ + "url" : "http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement", + "valueBoolean" : true + }], + "path" : "DocumentReference.type", + "short" : "(USCDI) Kind of document (LOINC if possible)", + "min" : 1, + "mustSupport" : true, + "binding" : { + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-minValueSet", + "valueCanonical" : "http://hl7.org/fhir/us/core/ValueSet/us-core-clinical-note-type" + }], + "strength" : "required", + "description" : "All LOINC values whose SCALE is DOC in the LOINC database and the HL7 v3 Code System NullFlavor concept 'unknown'", + "valueSet" : "http://hl7.org/fhir/us/core/ValueSet/us-core-documentreference-type" + } + }, + { + "id" : "DocumentReference.category", + "extension" : [{ + "url" : "http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement", + "valueBoolean" : true + }], + "path" : "DocumentReference.category", + "slicing" : { + "discriminator" : [{ + "type" : "pattern", + "path" : "$this" + }], + "rules" : "open" + }, + "short" : "(USCDI) Categorization of document", + "min" : 1, + "mustSupport" : true + }, + { + "id" : "DocumentReference.category:uscore", + "extension" : [{ + "url" : "http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement", + "valueBoolean" : true + }], + "path" : "DocumentReference.category", + "sliceName" : "uscore", + "short" : "(USCDI) Categorization of document", + "binding" : { + "strength" : "required", + "description" : "The US Core DocumentReferences Type Value Set is a \"starter set\" of categories supported for fetching and storing clinical notes. Note that other codes are permitted, see [Required Bindings When Slicing by Value Sets](http://hl7.org/fhir/us/core/general-requirements.html#required-bindings-when-slicing-by-valuesets)", + "valueSet" : "http://hl7.org/fhir/us/core/ValueSet/us-core-documentreference-category" + } + }, + { + "id" : "DocumentReference.subject", + "extension" : [{ + "url" : "http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement", + "valueBoolean" : true + }], + "path" : "DocumentReference.subject", + "short" : "(USCDI) Who/what is the subject of the document", + "min" : 1, + "type" : [{ + "code" : "Reference", + "targetProfile" : ["http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient"] + }], + "mustSupport" : true + }, + { + "id" : "DocumentReference.date", + "extension" : [{ + "url" : "http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement", + "valueBoolean" : true + }], + "path" : "DocumentReference.date", + "short" : "(USCDI) When this document reference was created", + "mustSupport" : true + }, + { + "id" : "DocumentReference.author", + "extension" : [{ + "url" : "http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement", + "valueBoolean" : true + }], + "path" : "DocumentReference.author", + "short" : "(USCDI) Who and/or what authored the document", + "type" : [{ + "code" : "Reference", + "targetProfile" : ["http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitioner", + "http://hl7.org/fhir/us/core/StructureDefinition/us-core-organization", + "http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient", + "http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitionerrole", + "http://hl7.org/fhir/us/core/StructureDefinition/us-core-relatedperson", + "http://hl7.org/fhir/StructureDefinition/Device"], + "_targetProfile" : [{ + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-type-must-support", + "valueBoolean" : true + }] + }, + { + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-type-must-support", + "valueBoolean" : false + }] + }, + { + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-type-must-support", + "valueBoolean" : false + }] + }, + { + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-type-must-support", + "valueBoolean" : false + }] + }, + { + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-type-must-support", + "valueBoolean" : false + }] + }, + { + "extension" : [{ + "url" : "http://hl7.org/fhir/StructureDefinition/elementdefinition-type-must-support", + "valueBoolean" : false + }] + }] + }], + "mustSupport" : true + }, + { + "id" : "DocumentReference.content", + "extension" : [{ + "url" : "http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement", + "valueBoolean" : true + }], + "path" : "DocumentReference.content", + "short" : "(USCDI) Document referenced", + "mustSupport" : true + }, + { + "id" : "DocumentReference.content.attachment", + "extension" : [{ + "url" : "http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement", + "valueBoolean" : true + }], + "path" : "DocumentReference.content.attachment", + "short" : "(USCDI) Where to access the document", + "constraint" : [{ + "key" : "us-core-6", + "severity" : "error", + "human" : "DocumentReference.content.attachment.url or DocumentReference.content.attachment.data or both SHALL be present.", + "expression" : "url.exists() or data.exists()", + "xpath" : "f:url or f:content" + }], + "mustSupport" : true + }, + { + "id" : "DocumentReference.content.attachment.contentType", + "extension" : [{ + "url" : "http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement", + "valueBoolean" : true + }], + "path" : "DocumentReference.content.attachment.contentType", + "short" : "(USCDI) Mime type of the content, with charset etc.", + "mustSupport" : true + }, + { + "id" : "DocumentReference.content.attachment.data", + "extension" : [{ + "url" : "http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement", + "valueBoolean" : true + }], + "path" : "DocumentReference.content.attachment.data", + "short" : "(USCDI) Data inline, base64ed", + "min" : 0, + "condition" : ["us-core-6"], + "mustSupport" : true + }, + { + "id" : "DocumentReference.content.attachment.url", + "extension" : [{ + "url" : "http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement", + "valueBoolean" : true + }], + "path" : "DocumentReference.content.attachment.url", + "short" : "(USCDI) Uri where the data can be found", + "min" : 0, + "condition" : ["us-core-6"], + "mustSupport" : true + }, + { + "id" : "DocumentReference.content.format", + "extension" : [{ + "url" : "http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement", + "valueBoolean" : true + }], + "path" : "DocumentReference.content.format", + "short" : "(USCDI) Format/content rules for the document", + "mustSupport" : true, + "binding" : { + "strength" : "extensible", + "valueSet" : "http://hl7.org/fhir/ValueSet/formatcodes" + } + }, + { + "id" : "DocumentReference.context", + "extension" : [{ + "url" : "http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement", + "valueBoolean" : true + }], + "path" : "DocumentReference.context", + "short" : "(USCDI) Clinical context of document", + "mustSupport" : true + }, + { + "id" : "DocumentReference.context.encounter", + "extension" : [{ + "url" : "http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement", + "valueBoolean" : true + }], + "path" : "DocumentReference.context.encounter", + "short" : "(USCDI) Context of the document content", + "max" : "1", + "type" : [{ + "code" : "Reference", + "targetProfile" : ["http://hl7.org/fhir/us/core/StructureDefinition/us-core-encounter"] + }], + "mustSupport" : true + }, + { + "id" : "DocumentReference.context.period", + "extension" : [{ + "url" : "http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement", + "valueBoolean" : true + }], + "path" : "DocumentReference.context.period", + "short" : "(USCDI) Time of service that is being documented", + "mustSupport" : true + }] + } +} \ No newline at end of file diff --git a/spec/fixtures/StructureDefinition-us-core-pulse-oximetry_v400.json b/spec/fixtures/StructureDefinition-us-core-pulse-oximetry_v400.json new file mode 100644 index 000000000..5c2bf3233 --- /dev/null +++ b/spec/fixtures/StructureDefinition-us-core-pulse-oximetry_v400.json @@ -0,0 +1,5503 @@ +{ + "resourceType": "StructureDefinition", + "id": "us-core-pulse-oximetry", + "text": { + "status": "extensions", + "div": "
\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n\r\n
NameFlagsCard.TypeDescription & Constraints\"doco\"
\".\"\".\" Observation 0..*USCoreVitalSignsProfileUS Core Pulse Oximetry Profile
\".\"\".\"\".\" code S1..1CodeableConceptOxygen Saturation by Pulse Oximetry
\".\"\".\"\".\"\".\" Slices for coding S0..*CodingCode defined by a terminology system
Slice: Unordered, Open by pattern:$this
\".\"\".\"\".\"\".\"\".\" coding:PulseOx S1..1CodingCode defined by a terminology system
Required Pattern: At least the following
\".\"\".\"\".\"\".\"\".\"\".\" system1..1uriIdentity of the terminology system
Fixed Value: http://loinc.org
\".\"\".\"\".\"\".\"\".\"\".\" code1..1codeSymbol in syntax defined by the system
Fixed Value: 59408-5
\".\"\".\"\".\"\".\"\".\" coding:O2Sat S1..1CodingCode defined by a terminology system
Required Pattern: At least the following
\".\"\".\"\".\"\".\"\".\"\".\" system1..1uriIdentity of the terminology system
Fixed Value: http://loinc.org
\".\"\".\"\".\"\".\"\".\"\".\" code1..1codeSymbol in syntax defined by the system
Fixed Value: 2708-6
\".\"\".\"\".\" Slices for component S0..*BackboneElementUsed when reporting flow rates or oxygen concentration.
Slice: Unordered, Open by pattern:code
\".\"\".\"\".\"\".\" component:FlowRate S0..1BackboneElementInhaled oxygen flow rate
\".\"\".\"\".\"\".\"\".\" code S1..1CodeableConceptType of component observation (code / type)
Required Pattern: At least the following
\".\"\".\"\".\"\".\"\".\"\".\" coding1..*CodingCode defined by a terminology system
Fixed Value: (complex)
\".\"\".\"\".\"\".\"\".\"\".\"\".\" system1..1uriIdentity of the terminology system
Fixed Value: http://loinc.org
\".\"\".\"\".\"\".\"\".\"\".\"\".\" code1..1codeSymbol in syntax defined by the system
Fixed Value: 3151-8
\".\"\".\"\".\"\".\"\".\" valueQuantity S0..1Quantity SVital Sign Component Value
\".\"\".\"\".\"\".\"\".\"\".\" value S1..1decimalNumerical value (with implicit precision)
\".\"\".\"\".\"\".\"\".\"\".\" unit S1..1stringUnit representation
\".\"\".\"\".\"\".\"\".\"\".\" system S1..1uriSystem that defines coded unit form
Fixed Value: http://unitsofmeasure.org
\".\"\".\"\".\"\".\"\".\"\".\" code S1..1codeCoded form of the unit
Fixed Value: L/min
\".\"\".\"\".\"\".\" component:Concentration S0..1BackboneElementInhaled oxygen concentration
\".\"\".\"\".\"\".\"\".\" code S1..1CodeableConceptType of component observation (code / type)
Required Pattern: At least the following
\".\"\".\"\".\"\".\"\".\"\".\" coding1..*CodingCode defined by a terminology system
Fixed Value: (complex)
\".\"\".\"\".\"\".\"\".\"\".\"\".\" system1..1uriIdentity of the terminology system
Fixed Value: http://loinc.org
\".\"\".\"\".\"\".\"\".\"\".\"\".\" code1..1codeSymbol in syntax defined by the system
Fixed Value: 3150-0
\".\"\".\"\".\"\".\"\".\" valueQuantity S0..1Quantity SVital Sign Component Value
\".\"\".\"\".\"\".\"\".\"\".\" value S1..1decimalNumerical value (with implicit precision)
\".\"\".\"\".\"\".\"\".\"\".\" unit S1..1stringUnit representation
\".\"\".\"\".\"\".\"\".\"\".\" system S1..1uriSystem that defines coded unit form
Fixed Value: http://unitsofmeasure.org
\".\"\".\"\".\"\".\"\".\"\".\" code S1..1codeCoded form of the unit
Fixed Value: %

\"doco\" Documentation for this format
" + }, + "url": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-pulse-oximetry", + "version": "4.0.0", + "name": "USCorePulseOximetryProfile", + "title": "US Core Pulse Oximetry Profile", + "status": "active", + "experimental": false, + "date": "2020-11-18", + "publisher": "HL7 International - US Realm Steering Committee", + "contact": [ + { + "name": "HL7 International - US Realm Steering Committee", + "telecom": [ + { + "system": "url", + "value": "http://www.hl7.org/Special/committees/usrealm/index.cfm" + } + ] + } + ], + "description": "Defines constraints on the Observation resource to represent inspired O2 by pulse oximetry and inspired oxygen concentration observations with a standard LOINC codes and UCUM units of measure. This profile is derived from the US Core Vital Signs Profile.", + "jurisdiction": [ + { + "coding": [ + { + "system": "urn:iso:std:iso:3166", + "code": "US" + } + ] + } + ], + "copyright": "Used by permission of HL7 International, all rights reserved Creative Commons License", + "fhirVersion": "4.0.1", + "mapping": [ + { + "identity": "workflow", + "uri": "http://hl7.org/fhir/workflow", + "name": "Workflow Pattern" + }, + { + "identity": "sct-concept", + "uri": "http://snomed.info/conceptdomain", + "name": "SNOMED CT Concept Domain Binding" + }, + { + "identity": "v2", + "uri": "http://hl7.org/v2", + "name": "HL7 v2 Mapping" + }, + { + "identity": "rim", + "uri": "http://hl7.org/v3", + "name": "RIM Mapping" + }, + { + "identity": "w5", + "uri": "http://hl7.org/fhir/fivews", + "name": "FiveWs Pattern Mapping" + }, + { + "identity": "sct-attr", + "uri": "http://snomed.org/attributebinding", + "name": "SNOMED CT Attribute Binding" + } + ], + "kind": "resource", + "abstract": false, + "type": "Observation", + "baseDefinition": "http://hl7.org/fhir/us/core/StructureDefinition/us-core-vital-signs", + "derivation": "constraint", + "snapshot": { + "element": [ + { + "id": "Observation", + "path": "Observation", + "short": "US Core Pulse Oximetry Profile", + "definition": "Defines constraints on the Observation resource to represent inspired O2 by pulse oximetry and inspired oxygen concentration observations with a standard LOINC codes and UCUM units of measure. This profile is derived from the US Core Vital Signs Profile.", + "comment": "Used for simple observations such as device measurements, laboratory atomic results, vital signs, height, weight, smoking status, comments, etc. Other resources are used to provide context for observations such as laboratory reports, etc.", + "alias": [ + "Vital Signs", + "Measurement", + "Results", + "Tests" + ], + "min": 0, + "max": "*", + "base": { + "path": "Observation", + "min": 0, + "max": "*" + }, + "constraint": [ + { + "key": "dom-2", + "severity": "error", + "human": "If the resource is contained in another resource, it SHALL NOT contain nested Resources", + "expression": "contained.contained.empty()", + "xpath": "not(parent::f:contained and f:contained)", + "source": "http://hl7.org/fhir/StructureDefinition/DomainResource" + }, + { + "key": "dom-3", + "severity": "error", + "human": "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": "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": "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": "http://hl7.org/fhir/StructureDefinition/DomainResource" + }, + { + "key": "dom-4", + "severity": "error", + "human": "If a resource is contained in another resource, it SHALL NOT have a meta.versionId or a meta.lastUpdated", + "expression": "contained.meta.versionId.empty() and contained.meta.lastUpdated.empty()", + "xpath": "not(exists(f:contained/*/f:meta/f:versionId)) and not(exists(f:contained/*/f:meta/f:lastUpdated))", + "source": "http://hl7.org/fhir/StructureDefinition/DomainResource" + }, + { + "key": "dom-5", + "severity": "error", + "human": "If a resource is contained in another resource, it SHALL NOT have a security label", + "expression": "contained.meta.security.empty()", + "xpath": "not(exists(f:contained/*/f:meta/f:security))", + "source": "http://hl7.org/fhir/StructureDefinition/DomainResource" + }, + { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bestpractice", + "valueBoolean": true + }, + { + "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bestpractice-explanation", + "valueMarkdown": "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": "dom-6", + "severity": "warning", + "human": "A resource should have narrative for robust management", + "expression": "text.`div`.exists()", + "xpath": "exists(f:text/h:div)", + "source": "http://hl7.org/fhir/StructureDefinition/DomainResource" + }, + { + "key": "obs-6", + "severity": "error", + "human": "dataAbsentReason SHALL only be present if Observation.value[x] is not present", + "expression": "dataAbsentReason.empty() or value.empty()", + "xpath": "not(exists(f:dataAbsentReason)) or (not(exists(*[starts-with(local-name(.), 'value')])))", + "source": "http://hl7.org/fhir/StructureDefinition/Observation" + }, + { + "key": "obs-7", + "severity": "error", + "human": "If Observation.code is the same as an Observation.component.code then the value element associated with the code SHALL NOT be present", + "expression": "value.empty() or component.code.where(coding.intersect(%resource.code.coding).exists()).empty()", + "xpath": "not(f:*[starts-with(local-name(.), 'value')] and (for $coding in f:code/f:coding return f:component/f:code/f:coding[f:code/@value=$coding/f:code/@value] [f:system/@value=$coding/f:system/@value]))", + "source": "http://hl7.org/fhir/StructureDefinition/Observation" + }, + { + "key": "vs-2", + "severity": "error", + "human": "If there is no component or hasMember element then either a value[x] or a data absent reason must be present.", + "expression": "(component.empty() and hasMember.empty()) implies (dataAbsentReason.exists() or value.exists())", + "xpath": "f:component or f:memberOF or f:*[starts-with(local-name(.), 'value')] or f:dataAbsentReason", + "source": "http://hl7.org/fhir/StructureDefinition/vitalsigns" + } + ], + "mustSupport": false, + "isModifier": false, + "isSummary": false, + "mapping": [ + { + "identity": "rim", + "map": "Entity. Role, or Act" + }, + { + "identity": "workflow", + "map": "Event" + }, + { + "identity": "sct-concept", + "map": "< 363787002 |Observable entity|" + }, + { + "identity": "v2", + "map": "OBX" + }, + { + "identity": "rim", + "map": "Observation[classCode=OBS, moodCode=EVN]" + } + ] + }, + { + "id": "Observation.id", + "path": "Observation.id", + "short": "Logical id of this artifact", + "definition": "The logical id of the resource, as used in the URL for the resource. Once assigned, this value never changes.", + "comment": "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": 0, + "max": "1", + "base": { + "path": "Resource.id", + "min": 0, + "max": "1" + }, + "type": [ + { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type", + "valueUrl": "string" + } + ], + "code": "http://hl7.org/fhirpath/System.String" + } + ], + "isModifier": false, + "isSummary": true + }, + { + "id": "Observation.meta", + "path": "Observation.meta", + "short": "Metadata about the resource", + "definition": "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": 0, + "max": "1", + "base": { + "path": "Resource.meta", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "Meta" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": false, + "isSummary": true + }, + { + "id": "Observation.implicitRules", + "path": "Observation.implicitRules", + "short": "A set of rules under which this content was created", + "definition": "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": "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": 0, + "max": "1", + "base": { + "path": "Resource.implicitRules", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "uri" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": true, + "isModifierReason": "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", + "isSummary": true + }, + { + "id": "Observation.language", + "path": "Observation.language", + "short": "Language of the resource content", + "definition": "The base language in which the resource is written.", + "comment": "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": 0, + "max": "1", + "base": { + "path": "Resource.language", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "code" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": false, + "isSummary": false, + "binding": { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-maxValueSet", + "valueCanonical": "http://hl7.org/fhir/ValueSet/all-languages" + }, + { + "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString": "Language" + }, + { + "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-isCommonBinding", + "valueBoolean": true + } + ], + "strength": "preferred", + "description": "A human language.", + "valueSet": "http://hl7.org/fhir/ValueSet/languages" + } + }, + { + "id": "Observation.text", + "path": "Observation.text", + "short": "Text summary of the resource, for human interpretation", + "definition": "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": "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": [ + "narrative", + "html", + "xhtml", + "display" + ], + "min": 0, + "max": "1", + "base": { + "path": "DomainResource.text", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "Narrative" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": false, + "isSummary": false, + "mapping": [ + { + "identity": "rim", + "map": "Act.text?" + } + ] + }, + { + "id": "Observation.contained", + "path": "Observation.contained", + "short": "Contained, inline Resources", + "definition": "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": "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": [ + "inline resources", + "anonymous resources", + "contained resources" + ], + "min": 0, + "max": "*", + "base": { + "path": "DomainResource.contained", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "Resource" + } + ], + "isModifier": false, + "isSummary": false, + "mapping": [ + { + "identity": "rim", + "map": "N/A" + } + ] + }, + { + "id": "Observation.extension", + "path": "Observation.extension", + "short": "Additional content defined by implementations", + "definition": "May be used to represent additional information that is not part of the basic definition of the resource. 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": "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": [ + "extensions", + "user content" + ], + "min": 0, + "max": "*", + "base": { + "path": "DomainResource.extension", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "Extension" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key": "ext-1", + "severity": "error", + "human": "Must have either extensions or value[x], not both", + "expression": "extension.exists() != value.exists()", + "xpath": "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])", + "source": "http://hl7.org/fhir/StructureDefinition/Extension" + } + ], + "isModifier": false, + "isSummary": false, + "mapping": [ + { + "identity": "rim", + "map": "N/A" + } + ] + }, + { + "id": "Observation.modifierExtension", + "path": "Observation.modifierExtension", + "short": "Extensions that cannot be ignored", + "definition": "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.\n\nModifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).", + "comment": "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": "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/extensibility.html#modifierExtension).", + "alias": [ + "extensions", + "user content" + ], + "min": 0, + "max": "*", + "base": { + "path": "DomainResource.modifierExtension", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "Extension" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key": "ext-1", + "severity": "error", + "human": "Must have either extensions or value[x], not both", + "expression": "extension.exists() != value.exists()", + "xpath": "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])", + "source": "http://hl7.org/fhir/StructureDefinition/Extension" + } + ], + "isModifier": true, + "isModifierReason": "Modifier extensions are expected to modify the meaning or interpretation of the resource that contains them", + "isSummary": false, + "mapping": [ + { + "identity": "rim", + "map": "N/A" + } + ] + }, + { + "id": "Observation.identifier", + "path": "Observation.identifier", + "short": "Business Identifier for observation", + "definition": "A unique identifier assigned to this observation.", + "requirements": "Allows observations to be distinguished and referenced.", + "min": 0, + "max": "*", + "base": { + "path": "Observation.identifier", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "Identifier" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": false, + "isSummary": true, + "mapping": [ + { + "identity": "workflow", + "map": "Event.identifier" + }, + { + "identity": "w5", + "map": "FiveWs.identifier" + }, + { + "identity": "v2", + "map": "OBX.21 For OBX segments from systems without OBX-21 support a combination of ORC/OBR and OBX must be negotiated between trading partners to uniquely identify the OBX segment. Depending on how V2 has been implemented each of these may be an option: 1) OBR-3 + OBX-3 + OBX-4 or 2) OBR-3 + OBR-4 + OBX-3 + OBX-4 or 2) some other way to uniquely ID the OBR/ORC + OBX-3 + OBX-4." + }, + { + "identity": "rim", + "map": "id" + } + ] + }, + { + "id": "Observation.basedOn", + "path": "Observation.basedOn", + "short": "Fulfills plan, proposal or order", + "definition": "A plan, proposal or order that is fulfilled in whole or in part by this event. For example, a MedicationRequest may require a patient to have laboratory test performed before it is dispensed.", + "requirements": "Allows tracing of authorization for the event and tracking whether proposals/recommendations were acted upon.", + "alias": [ + "Fulfills" + ], + "min": 0, + "max": "*", + "base": { + "path": "Observation.basedOn", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "Reference", + "targetProfile": [ + "http://hl7.org/fhir/StructureDefinition/CarePlan", + "http://hl7.org/fhir/StructureDefinition/DeviceRequest", + "http://hl7.org/fhir/StructureDefinition/ImmunizationRecommendation", + "http://hl7.org/fhir/StructureDefinition/MedicationRequest", + "http://hl7.org/fhir/StructureDefinition/NutritionOrder", + "http://hl7.org/fhir/StructureDefinition/ServiceRequest" + ] + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": false, + "isSummary": true, + "mapping": [ + { + "identity": "workflow", + "map": "Event.basedOn" + }, + { + "identity": "v2", + "map": "ORC" + }, + { + "identity": "rim", + "map": ".inboundRelationship[typeCode=COMP].source[moodCode=EVN]" + } + ] + }, + { + "id": "Observation.partOf", + "path": "Observation.partOf", + "short": "Part of referenced event", + "definition": "A larger event of which this particular Observation is a component or step. For example, an observation as part of a procedure.", + "comment": "To link an Observation to an Encounter use `encounter`. See the [Notes](http://hl7.org/fhir/observation.html#obsgrouping) below for guidance on referencing another Observation.", + "alias": [ + "Container" + ], + "min": 0, + "max": "*", + "base": { + "path": "Observation.partOf", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "Reference", + "targetProfile": [ + "http://hl7.org/fhir/StructureDefinition/MedicationAdministration", + "http://hl7.org/fhir/StructureDefinition/MedicationDispense", + "http://hl7.org/fhir/StructureDefinition/MedicationStatement", + "http://hl7.org/fhir/StructureDefinition/Procedure", + "http://hl7.org/fhir/StructureDefinition/Immunization", + "http://hl7.org/fhir/StructureDefinition/ImagingStudy" + ] + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": false, + "isSummary": true, + "mapping": [ + { + "identity": "workflow", + "map": "Event.partOf" + }, + { + "identity": "v2", + "map": "Varies by domain" + }, + { + "identity": "rim", + "map": ".outboundRelationship[typeCode=FLFS].target" + } + ] + }, + { + "id": "Observation.status", + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-display-hint", + "valueString": "default: final" + } + ], + "path": "Observation.status", + "short": "registered | preliminary | final | amended +", + "definition": "The status of the result value.", + "comment": "This element is labeled as a modifier because the status contains codes that mark the resource as not currently valid.", + "requirements": "Need to track the status of individual results. Some results are finalized before the whole report is finalized.", + "min": 1, + "max": "1", + "base": { + "path": "Observation.status", + "min": 1, + "max": "1" + }, + "type": [ + { + "code": "code" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "mustSupport": true, + "isModifier": true, + "isModifierReason": "This element is labeled 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", + "isSummary": true, + "binding": { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString": "Status" + } + ], + "strength": "required", + "valueSet": "http://hl7.org/fhir/ValueSet/observation-status|4.0.1" + }, + "mapping": [ + { + "identity": "workflow", + "map": "Event.status" + }, + { + "identity": "w5", + "map": "FiveWs.status" + }, + { + "identity": "sct-concept", + "map": "< 445584004 |Report by finality status|" + }, + { + "identity": "v2", + "map": "OBX-11" + }, + { + "identity": "rim", + "map": "status Amended & Final are differentiated by whether it is the subject of a ControlAct event with a type of \"revise\"" + } + ] + }, + { + "id": "Observation.category", + "path": "Observation.category", + "slicing": { + "discriminator": [ + { + "type": "value", + "path": "coding.code" + }, + { + "type": "value", + "path": "coding.system" + } + ], + "ordered": false, + "rules": "open" + }, + "short": "Classification of type of observation", + "definition": "A code that classifies the general type of observation being made.", + "comment": "In addition to the required category valueset, this element allows various categorization schemes based on the owner’s definition of the category and effectively multiple categories can be used at once. The level of granularity is defined by the category concepts in the value set.", + "requirements": "Used for filtering what observations are retrieved and displayed.", + "min": 1, + "max": "*", + "base": { + "path": "Observation.category", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "CodeableConcept" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "mustSupport": true, + "isModifier": false, + "isSummary": false, + "binding": { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString": "ObservationCategory" + } + ], + "strength": "preferred", + "description": "Codes for high level observation categories.", + "valueSet": "http://hl7.org/fhir/ValueSet/observation-category" + }, + "mapping": [ + { + "identity": "w5", + "map": "FiveWs.class" + }, + { + "identity": "rim", + "map": ".outboundRelationship[typeCode=\"COMP].target[classCode=\"LIST\", moodCode=\"EVN\"].code" + } + ] + }, + { + "id": "Observation.category:VSCat", + "path": "Observation.category", + "sliceName": "VSCat", + "short": "Classification of type of observation", + "definition": "A code that classifies the general type of observation being made.", + "comment": "In addition to the required category valueset, this element allows various categorization schemes based on the owner’s definition of the category and effectively multiple categories can be used at once. The level of granularity is defined by the category concepts in the value set.", + "requirements": "Used for filtering what observations are retrieved and displayed.", + "min": 1, + "max": "1", + "base": { + "path": "Observation.category", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "CodeableConcept" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "mustSupport": true, + "isModifier": false, + "isSummary": false, + "binding": { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString": "ObservationCategory" + } + ], + "strength": "preferred", + "description": "Codes for high level observation categories.", + "valueSet": "http://hl7.org/fhir/ValueSet/observation-category" + }, + "mapping": [ + { + "identity": "w5", + "map": "FiveWs.class" + }, + { + "identity": "rim", + "map": ".outboundRelationship[typeCode=\"COMP].target[classCode=\"LIST\", moodCode=\"EVN\"].code" + } + ] + }, + { + "id": "Observation.category:VSCat.id", + "path": "Observation.category.id", + "representation": [ + "xmlAttr" + ], + "short": "Unique id for inter-element referencing", + "definition": "Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", + "min": 0, + "max": "1", + "base": { + "path": "Element.id", + "min": 0, + "max": "1" + }, + "type": [ + { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type", + "valueUrl": "string" + } + ], + "code": "http://hl7.org/fhirpath/System.String" + } + ], + "isModifier": false, + "isSummary": false, + "mapping": [ + { + "identity": "rim", + "map": "n/a" + } + ] + }, + { + "id": "Observation.category:VSCat.extension", + "path": "Observation.category.extension", + "slicing": { + "discriminator": [ + { + "type": "value", + "path": "url" + } + ], + "description": "Extensions are always sliced by (at least) url", + "rules": "open" + }, + "short": "Additional content defined by implementations", + "definition": "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": "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": [ + "extensions", + "user content" + ], + "min": 0, + "max": "*", + "base": { + "path": "Element.extension", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "Extension" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key": "ext-1", + "severity": "error", + "human": "Must have either extensions or value[x], not both", + "expression": "extension.exists() != value.exists()", + "xpath": "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])", + "source": "http://hl7.org/fhir/StructureDefinition/Extension" + } + ], + "isModifier": false, + "isSummary": false, + "mapping": [ + { + "identity": "rim", + "map": "n/a" + } + ] + }, + { + "id": "Observation.category:VSCat.coding", + "path": "Observation.category.coding", + "short": "Code defined by a terminology system", + "definition": "A reference to a code defined by a terminology system.", + "comment": "Codes may be defined very casually in enumerations, or code lists, up to very formal definitions such as SNOMED CT - see the HL7 v3 Core Principles for more information. Ordering of codings is undefined and SHALL NOT be used to infer meaning. Generally, at most only one of the coding values will be labeled as UserSelected = true.", + "requirements": "Allows for alternative encodings within a code system, and translations to other code systems.", + "min": 1, + "max": "*", + "base": { + "path": "CodeableConcept.coding", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "Coding" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "mustSupport": true, + "isModifier": false, + "isSummary": true, + "mapping": [ + { + "identity": "v2", + "map": "C*E.1-8, C*E.10-22" + }, + { + "identity": "rim", + "map": "union(., ./translation)" + }, + { + "identity": "orim", + "map": "fhir:CodeableConcept.coding rdfs:subPropertyOf dt:CD.coding" + } + ] + }, + { + "id": "Observation.category:VSCat.coding.id", + "path": "Observation.category.coding.id", + "representation": [ + "xmlAttr" + ], + "short": "Unique id for inter-element referencing", + "definition": "Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", + "min": 0, + "max": "1", + "base": { + "path": "Element.id", + "min": 0, + "max": "1" + }, + "type": [ + { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type", + "valueUrl": "string" + } + ], + "code": "http://hl7.org/fhirpath/System.String" + } + ], + "isModifier": false, + "isSummary": false, + "mapping": [ + { + "identity": "rim", + "map": "n/a" + } + ] + }, + { + "id": "Observation.category:VSCat.coding.extension", + "path": "Observation.category.coding.extension", + "slicing": { + "discriminator": [ + { + "type": "value", + "path": "url" + } + ], + "description": "Extensions are always sliced by (at least) url", + "rules": "open" + }, + "short": "Additional content defined by implementations", + "definition": "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": "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": [ + "extensions", + "user content" + ], + "min": 0, + "max": "*", + "base": { + "path": "Element.extension", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "Extension" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key": "ext-1", + "severity": "error", + "human": "Must have either extensions or value[x], not both", + "expression": "extension.exists() != value.exists()", + "xpath": "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])", + "source": "http://hl7.org/fhir/StructureDefinition/Extension" + } + ], + "isModifier": false, + "isSummary": false, + "mapping": [ + { + "identity": "rim", + "map": "n/a" + } + ] + }, + { + "id": "Observation.category:VSCat.coding.system", + "path": "Observation.category.coding.system", + "short": "Identity of the terminology system", + "definition": "The identification of the code system that defines the meaning of the symbol in the code.", + "comment": "The URI may be an OID (urn:oid:...) or a UUID (urn:uuid:...). OIDs and UUIDs SHALL be references to the HL7 OID registry. Otherwise, the URI should come from HL7's list of FHIR defined special URIs or it should reference to some definition that establishes the system clearly and unambiguously.", + "requirements": "Need to be unambiguous about the source of the definition of the symbol.", + "min": 1, + "max": "1", + "base": { + "path": "Coding.system", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "uri" + } + ], + "fixedUri": "http://terminology.hl7.org/CodeSystem/observation-category", + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "mustSupport": true, + "isModifier": false, + "isSummary": true, + "mapping": [ + { + "identity": "v2", + "map": "C*E.3" + }, + { + "identity": "rim", + "map": "./codeSystem" + }, + { + "identity": "orim", + "map": "fhir:Coding.system rdfs:subPropertyOf dt:CDCoding.codeSystem" + } + ] + }, + { + "id": "Observation.category:VSCat.coding.version", + "path": "Observation.category.coding.version", + "short": "Version of the system - if relevant", + "definition": "The version of the code system which was used when choosing this code. Note that a well-maintained code system does not need the version reported, because the meaning of codes is consistent across versions. However this cannot consistently be assured, and when the meaning is not guaranteed to be consistent, the version SHOULD be exchanged.", + "comment": "Where the terminology does not clearly define what string should be used to identify code system versions, the recommendation is to use the date (expressed in FHIR date format) on which that version was officially published as the version date.", + "min": 0, + "max": "1", + "base": { + "path": "Coding.version", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "string" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": false, + "isSummary": true, + "mapping": [ + { + "identity": "v2", + "map": "C*E.7" + }, + { + "identity": "rim", + "map": "./codeSystemVersion" + }, + { + "identity": "orim", + "map": "fhir:Coding.version rdfs:subPropertyOf dt:CDCoding.codeSystemVersion" + } + ] + }, + { + "id": "Observation.category:VSCat.coding.code", + "path": "Observation.category.coding.code", + "short": "Symbol in syntax defined by the system", + "definition": "A symbol in syntax defined by the system. The symbol may be a predefined code or an expression in a syntax defined by the coding system (e.g. post-coordination).", + "requirements": "Need to refer to a particular code in the system.", + "min": 1, + "max": "1", + "base": { + "path": "Coding.code", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "code" + } + ], + "fixedCode": "vital-signs", + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "mustSupport": true, + "isModifier": false, + "isSummary": true, + "mapping": [ + { + "identity": "v2", + "map": "C*E.1" + }, + { + "identity": "rim", + "map": "./code" + }, + { + "identity": "orim", + "map": "fhir:Coding.code rdfs:subPropertyOf dt:CDCoding.code" + } + ] + }, + { + "id": "Observation.category:VSCat.coding.display", + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-translatable", + "valueBoolean": true + } + ], + "path": "Observation.category.coding.display", + "short": "Representation defined by the system", + "definition": "A representation of the meaning of the code in the system, following the rules of the system.", + "requirements": "Need to be able to carry a human-readable meaning of the code for readers that do not know the system.", + "min": 0, + "max": "1", + "base": { + "path": "Coding.display", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "string" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": false, + "isSummary": true, + "mapping": [ + { + "identity": "v2", + "map": "C*E.2 - but note this is not well followed" + }, + { + "identity": "rim", + "map": "CV.displayName" + }, + { + "identity": "orim", + "map": "fhir:Coding.display rdfs:subPropertyOf dt:CDCoding.displayName" + } + ] + }, + { + "id": "Observation.category:VSCat.coding.userSelected", + "path": "Observation.category.coding.userSelected", + "short": "If this coding was chosen directly by the user", + "definition": "Indicates that this coding was chosen by a user directly - e.g. off a pick list of available items (codes or displays).", + "comment": "Amongst a set of alternatives, a directly chosen code is the most appropriate starting point for new translations. There is some ambiguity about what exactly 'directly chosen' implies, and trading partner agreement may be needed to clarify the use of this element and its consequences more completely.", + "requirements": "This has been identified as a clinical safety criterium - that this exact system/code pair was chosen explicitly, rather than inferred by the system based on some rules or language processing.", + "min": 0, + "max": "1", + "base": { + "path": "Coding.userSelected", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "boolean" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": false, + "isSummary": true, + "mapping": [ + { + "identity": "v2", + "map": "Sometimes implied by being first" + }, + { + "identity": "rim", + "map": "CD.codingRationale" + }, + { + "identity": "orim", + "map": "fhir:Coding.userSelected fhir:mapsTo dt:CDCoding.codingRationale. fhir:Coding.userSelected fhir:hasMap fhir:Coding.userSelected.map. fhir:Coding.userSelected.map a fhir:Map; fhir:target dt:CDCoding.codingRationale. fhir:Coding.userSelected\\#true a [ fhir:source \"true\"; fhir:target dt:CDCoding.codingRationale\\#O ]" + } + ] + }, + { + "id": "Observation.category:VSCat.text", + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-translatable", + "valueBoolean": true + } + ], + "path": "Observation.category.text", + "short": "Plain text representation of the concept", + "definition": "A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user.", + "comment": "Very often the text is the same as a displayName of one of the codings.", + "requirements": "The codes from the terminologies do not always capture the correct meaning with all the nuances of the human using them, or sometimes there is no appropriate code at all. In these cases, the text is used to capture the full meaning of the source.", + "min": 0, + "max": "1", + "base": { + "path": "CodeableConcept.text", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "string" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": false, + "isSummary": true, + "mapping": [ + { + "identity": "v2", + "map": "C*E.9. But note many systems use C*E.2 for this" + }, + { + "identity": "rim", + "map": "./originalText[mediaType/code=\"text/plain\"]/data" + }, + { + "identity": "orim", + "map": "fhir:CodeableConcept.text rdfs:subPropertyOf dt:CD.originalText" + } + ] + }, + { + "id": "Observation.code", + "path": "Observation.code", + "short": "Oxygen Saturation by Pulse Oximetry", + "definition": "Coded Responses from C-CDA Vital Sign Results.", + "comment": "The code (59408-5 Oxygen saturation in Arterial blood by Pulse oximetry) is included as an additional observation code to FHIR Core vital Oxygen Saturation code (2708-6 Oxygen saturation in Arterial blood).", + "requirements": "5. SHALL contain exactly one [1..1] code, where the @code SHOULD be selected from ValueSet HITSP Vital Sign Result Type 2.16.840.1.113883.3.88.12.80.62 DYNAMIC (CONF:7301).", + "alias": [ + "Name" + ], + "min": 1, + "max": "1", + "base": { + "path": "Observation.code", + "min": 1, + "max": "1" + }, + "type": [ + { + "code": "CodeableConcept" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "mustSupport": true, + "isModifier": false, + "isSummary": true, + "binding": { + "strength": "extensible", + "description": "The vital sign codes from the base FHIR and US Core Vital Signs.", + "valueSet": "http://hl7.org/fhir/us/core/ValueSet/us-core-vital-signs" + }, + "mapping": [ + { + "identity": "workflow", + "map": "Event.code" + }, + { + "identity": "w5", + "map": "FiveWs.what[x]" + }, + { + "identity": "sct-concept", + "map": "< 363787002 |Observable entity| OR < 386053000 |Evaluation procedure|" + }, + { + "identity": "v2", + "map": "OBX-3" + }, + { + "identity": "rim", + "map": "code" + }, + { + "identity": "sct-attr", + "map": "116680003 |Is a|" + } + ] + }, + { + "id": "Observation.code.id", + "path": "Observation.code.id", + "representation": [ + "xmlAttr" + ], + "short": "Unique id for inter-element referencing", + "definition": "Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", + "min": 0, + "max": "1", + "base": { + "path": "Element.id", + "min": 0, + "max": "1" + }, + "type": [ + { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type", + "valueUrl": "string" + } + ], + "code": "http://hl7.org/fhirpath/System.String" + } + ], + "isModifier": false, + "isSummary": false, + "mapping": [ + { + "identity": "rim", + "map": "n/a" + } + ] + }, + { + "id": "Observation.code.extension", + "path": "Observation.code.extension", + "slicing": { + "discriminator": [ + { + "type": "value", + "path": "url" + } + ], + "description": "Extensions are always sliced by (at least) url", + "rules": "open" + }, + "short": "Additional content defined by implementations", + "definition": "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": "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": [ + "extensions", + "user content" + ], + "min": 0, + "max": "*", + "base": { + "path": "Element.extension", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "Extension" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key": "ext-1", + "severity": "error", + "human": "Must have either extensions or value[x], not both", + "expression": "extension.exists() != value.exists()", + "xpath": "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])", + "source": "http://hl7.org/fhir/StructureDefinition/Extension" + } + ], + "isModifier": false, + "isSummary": false, + "mapping": [ + { + "identity": "rim", + "map": "n/a" + } + ] + }, + { + "id": "Observation.code.coding", + "path": "Observation.code.coding", + "slicing": { + "discriminator": [ + { + "type": "pattern", + "path": "$this" + } + ], + "rules": "open" + }, + "short": "Code defined by a terminology system", + "definition": "A reference to a code defined by a terminology system.", + "comment": "Codes may be defined very casually in enumerations, or code lists, up to very formal definitions such as SNOMED CT - see the HL7 v3 Core Principles for more information. Ordering of codings is undefined and SHALL NOT be used to infer meaning. Generally, at most only one of the coding values will be labeled as UserSelected = true.", + "requirements": "Allows for alternative encodings within a code system, and translations to other code systems.", + "min": 0, + "max": "*", + "base": { + "path": "CodeableConcept.coding", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "Coding" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "mustSupport": true, + "isModifier": false, + "isSummary": true, + "mapping": [ + { + "identity": "v2", + "map": "C*E.1-8, C*E.10-22" + }, + { + "identity": "rim", + "map": "union(., ./translation)" + }, + { + "identity": "orim", + "map": "fhir:CodeableConcept.coding rdfs:subPropertyOf dt:CD.coding" + } + ] + }, + { + "id": "Observation.code.coding:PulseOx", + "path": "Observation.code.coding", + "sliceName": "PulseOx", + "short": "Code defined by a terminology system", + "definition": "A reference to a code defined by a terminology system.", + "comment": "Codes may be defined very casually in enumerations, or code lists, up to very formal definitions such as SNOMED CT - see the HL7 v3 Core Principles for more information. Ordering of codings is undefined and SHALL NOT be used to infer meaning. Generally, at most only one of the coding values will be labeled as UserSelected = true.", + "requirements": "Allows for alternative encodings within a code system, and translations to other code systems.", + "min": 1, + "max": "1", + "base": { + "path": "CodeableConcept.coding", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "Coding" + } + ], + "patternCoding": { + "system": "http://loinc.org", + "code": "59408-5" + }, + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "mustSupport": true, + "isModifier": false, + "isSummary": true, + "mapping": [ + { + "identity": "v2", + "map": "C*E.1-8, C*E.10-22" + }, + { + "identity": "rim", + "map": "union(., ./translation)" + }, + { + "identity": "orim", + "map": "fhir:CodeableConcept.coding rdfs:subPropertyOf dt:CD.coding" + } + ] + }, + { + "id": "Observation.code.coding:O2Sat", + "path": "Observation.code.coding", + "sliceName": "O2Sat", + "short": "Code defined by a terminology system", + "definition": "A reference to a code defined by a terminology system.", + "comment": "Codes may be defined very casually in enumerations, or code lists, up to very formal definitions such as SNOMED CT - see the HL7 v3 Core Principles for more information. Ordering of codings is undefined and SHALL NOT be used to infer meaning. Generally, at most only one of the coding values will be labeled as UserSelected = true.", + "requirements": "Allows for alternative encodings within a code system, and translations to other code systems.", + "min": 1, + "max": "1", + "base": { + "path": "CodeableConcept.coding", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "Coding" + } + ], + "patternCoding": { + "system": "http://loinc.org", + "code": "2708-6" + }, + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "mustSupport": true, + "isModifier": false, + "isSummary": true, + "mapping": [ + { + "identity": "v2", + "map": "C*E.1-8, C*E.10-22" + }, + { + "identity": "rim", + "map": "union(., ./translation)" + }, + { + "identity": "orim", + "map": "fhir:CodeableConcept.coding rdfs:subPropertyOf dt:CD.coding" + } + ] + }, + { + "id": "Observation.code.text", + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-translatable", + "valueBoolean": true + } + ], + "path": "Observation.code.text", + "short": "Plain text representation of the concept", + "definition": "A human language representation of the concept as seen/selected/uttered by the user who entered the data and/or which represents the intended meaning of the user.", + "comment": "Very often the text is the same as a displayName of one of the codings.", + "requirements": "The codes from the terminologies do not always capture the correct meaning with all the nuances of the human using them, or sometimes there is no appropriate code at all. In these cases, the text is used to capture the full meaning of the source.", + "min": 0, + "max": "1", + "base": { + "path": "CodeableConcept.text", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "string" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": false, + "isSummary": true, + "mapping": [ + { + "identity": "v2", + "map": "C*E.9. But note many systems use C*E.2 for this" + }, + { + "identity": "rim", + "map": "./originalText[mediaType/code=\"text/plain\"]/data" + }, + { + "identity": "orim", + "map": "fhir:CodeableConcept.text rdfs:subPropertyOf dt:CD.originalText" + } + ] + }, + { + "id": "Observation.subject", + "path": "Observation.subject", + "short": "Who and/or what the observation is about", + "definition": "The patient, or group of patients, location, or device this observation is about and into whose record the observation is placed. If the actual focus of the observation is different from the subject (or a sample of, part, or region of the subject), the `focus` element or the `code` itself specifies the actual focus of the observation.", + "comment": "One would expect this element to be a cardinality of 1..1. The only circumstance in which the subject can be missing is when the observation is made by a device that does not know the patient. In this case, the observation SHALL be matched to a patient through some context/channel matching technique, and at this point, the observation should be updated.", + "requirements": "Observations have no value if you don't know who or what they're about.", + "min": 1, + "max": "1", + "base": { + "path": "Observation.subject", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "Reference", + "targetProfile": [ + "http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient" + ] + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "mustSupport": true, + "isModifier": false, + "isSummary": true, + "mapping": [ + { + "identity": "workflow", + "map": "Event.subject" + }, + { + "identity": "w5", + "map": "FiveWs.subject[x]" + }, + { + "identity": "v2", + "map": "PID-3" + }, + { + "identity": "rim", + "map": "participation[typeCode=RTGT]" + }, + { + "identity": "w5", + "map": "FiveWs.subject" + } + ] + }, + { + "id": "Observation.focus", + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-standards-status", + "valueCode": "trial-use" + } + ], + "path": "Observation.focus", + "short": "What the observation is about, when it is not about the subject of record", + "definition": "The actual focus of an observation when it is not the patient of record representing something or someone associated with the patient such as a spouse, parent, fetus, or donor. For example, fetus observations in a mother's record. The focus of an observation could also be an existing condition, an intervention, the subject's diet, another observation of the subject, or a body structure such as tumor or implanted device. An example use case would be using the Observation resource to capture whether the mother is trained to change her child's tracheostomy tube. In this example, the child is the patient of record and the mother is the focus.", + "comment": "Typically, an observation is made about the subject - a patient, or group of patients, location, or device - and the distinction between the subject and what is directly measured for an observation is specified in the observation code itself ( e.g., \"Blood Glucose\") and does not need to be represented separately using this element. Use `specimen` if a reference to a specimen is required. If a code is required instead of a resource use either `bodysite` for bodysites or the standard extension [focusCode](http://hl7.org/fhir/extension-observation-focuscode.html).", + "min": 0, + "max": "*", + "base": { + "path": "Observation.focus", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "Reference", + "targetProfile": [ + "http://hl7.org/fhir/StructureDefinition/Resource" + ] + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": false, + "isSummary": true, + "mapping": [ + { + "identity": "w5", + "map": "FiveWs.subject[x]" + }, + { + "identity": "v2", + "map": "OBX-3" + }, + { + "identity": "rim", + "map": "participation[typeCode=SBJ]" + }, + { + "identity": "w5", + "map": "FiveWs.subject" + } + ] + }, + { + "id": "Observation.encounter", + "path": "Observation.encounter", + "short": "Healthcare event during which this observation is made", + "definition": "The healthcare event (e.g. a patient and healthcare provider interaction) during which this observation is made.", + "comment": "This will typically be the encounter the event occurred within, but some events may be initiated prior to or after the official completion of an encounter but still be tied to the context of the encounter (e.g. pre-admission laboratory tests).", + "requirements": "For some observations it may be important to know the link between an observation and a particular encounter.", + "alias": [ + "Context" + ], + "min": 0, + "max": "1", + "base": { + "path": "Observation.encounter", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "Reference", + "targetProfile": [ + "http://hl7.org/fhir/StructureDefinition/Encounter" + ] + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": false, + "isSummary": true, + "mapping": [ + { + "identity": "workflow", + "map": "Event.context" + }, + { + "identity": "w5", + "map": "FiveWs.context" + }, + { + "identity": "v2", + "map": "PV1" + }, + { + "identity": "rim", + "map": "inboundRelationship[typeCode=COMP].source[classCode=ENC, moodCode=EVN]" + } + ] + }, + { + "id": "Observation.effective[x]", + "path": "Observation.effective[x]", + "short": "Often just a dateTime for Vital Signs", + "definition": "Often just a dateTime for Vital Signs.", + "comment": "At least a date should be present unless this observation is a historical report. For recording imprecise or \"fuzzy\" times (For example, a blood glucose measurement taken \"after breakfast\") use the [Timing](http://hl7.org/fhir/datatypes.html#timing) datatype which allow the measurement to be tied to regular life events.", + "requirements": "Knowing when an observation was deemed true is important to its relevance as well as determining trends.", + "alias": [ + "Occurrence" + ], + "min": 1, + "max": "1", + "base": { + "path": "Observation.effective[x]", + "min": 0, + "max": "1" + }, + "type": [ + { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-type-must-support", + "valueBoolean": true + } + ], + "code": "dateTime" + }, + { + "code": "Period" + } + ], + "condition": [ + "vs-1" + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key": "vs-1", + "severity": "error", + "human": "if Observation.effective[x] is dateTime and has a value then that value shall be precise to the day", + "expression": "($this as dateTime).toString().length() >= 8", + "xpath": "f:effectiveDateTime[matches(@value, '^\\d{4}-\\d{2}-\\d{2}')]", + "source": "http://hl7.org/fhir/StructureDefinition/vitalsigns" + } + ], + "mustSupport": true, + "isModifier": false, + "isSummary": true, + "mapping": [ + { + "identity": "workflow", + "map": "Event.occurrence[x]" + }, + { + "identity": "w5", + "map": "FiveWs.done[x]" + }, + { + "identity": "v2", + "map": "OBX-14, and/or OBX-19 after v2.4 (depends on who observation made)" + }, + { + "identity": "rim", + "map": "effectiveTime" + } + ] + }, + { + "id": "Observation.issued", + "path": "Observation.issued", + "short": "Date/Time this version was made available", + "definition": "The date and time this version of the observation was made available to providers, typically after the results have been reviewed and verified.", + "comment": "For Observations that don’t require review and verification, it may be the same as the [`lastUpdated` ](http://hl7.org/fhir/resource-definitions.html#Meta.lastUpdated) time of the resource itself. For Observations that do require review and verification for certain updates, it might not be the same as the `lastUpdated` time of the resource itself due to a non-clinically significant update that doesn’t require the new version to be reviewed and verified again.", + "min": 0, + "max": "1", + "base": { + "path": "Observation.issued", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "instant" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": false, + "isSummary": true, + "mapping": [ + { + "identity": "w5", + "map": "FiveWs.recorded" + }, + { + "identity": "v2", + "map": "OBR.22 (or MSH.7), or perhaps OBX-19 (depends on who observation made)" + }, + { + "identity": "rim", + "map": "participation[typeCode=AUT].time" + } + ] + }, + { + "id": "Observation.performer", + "path": "Observation.performer", + "short": "Who is responsible for the observation", + "definition": "Who was responsible for asserting the observed value as \"true\".", + "requirements": "May give a degree of confidence in the observation and also indicates where follow-up questions should be directed.", + "min": 0, + "max": "*", + "base": { + "path": "Observation.performer", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "Reference", + "targetProfile": [ + "http://hl7.org/fhir/StructureDefinition/Practitioner", + "http://hl7.org/fhir/StructureDefinition/PractitionerRole", + "http://hl7.org/fhir/StructureDefinition/Organization", + "http://hl7.org/fhir/StructureDefinition/CareTeam", + "http://hl7.org/fhir/StructureDefinition/Patient", + "http://hl7.org/fhir/StructureDefinition/RelatedPerson" + ] + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": false, + "isSummary": true, + "mapping": [ + { + "identity": "workflow", + "map": "Event.performer.actor" + }, + { + "identity": "w5", + "map": "FiveWs.actor" + }, + { + "identity": "v2", + "map": "OBX.15 / (Practitioner) OBX-16, PRT-5:PRT-4='RO' / (Device) OBX-18 , PRT-10:PRT-4='EQUIP' / (Organization) OBX-23, PRT-8:PRT-4='PO'" + }, + { + "identity": "rim", + "map": "participation[typeCode=PRF]" + } + ] + }, + { + "id": "Observation.value[x]", + "path": "Observation.value[x]", + "short": "Vital Signs Value", + "definition": "Vital Signs value are typically recorded using the Quantity data type.", + "comment": "An observation may have; 1) a single value here, 2) both a value and a set of related or component values, or 3) only a set of related or component values. If a value is present, the datatype for this element should be determined by Observation.code. A CodeableConcept with just a text would be used instead of a string if the field was usually coded, or if the type associated with the Observation.code defines a coded value. For additional guidance, see the [Notes section](http://hl7.org/fhir/observation.html#notes) below.", + "requirements": "9. SHALL contain exactly one [1..1] value with @xsi:type=\"PQ\" (CONF:7305).", + "min": 0, + "max": "1", + "base": { + "path": "Observation.value[x]", + "min": 0, + "max": "1" + }, + "type": [ + { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-type-must-support", + "valueBoolean": true + } + ], + "code": "Quantity" + }, + { + "code": "CodeableConcept" + }, + { + "code": "string" + }, + { + "code": "boolean" + }, + { + "code": "integer" + }, + { + "code": "Range" + }, + { + "code": "Ratio" + }, + { + "code": "SampledData" + }, + { + "code": "time" + }, + { + "code": "dateTime" + }, + { + "code": "Period" + } + ], + "condition": [ + "obs-7", + "vs-2" + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "mustSupport": true, + "isModifier": false, + "isSummary": true, + "binding": { + "strength": "extensible", + "description": "Common UCUM units for recording Vital Signs.", + "valueSet": "http://hl7.org/fhir/ValueSet/ucum-vitals-common|4.0.1" + }, + "mapping": [ + { + "identity": "sct-concept", + "map": "< 441742003 |Evaluation finding|" + }, + { + "identity": "v2", + "map": "OBX.2, OBX.5, OBX.6" + }, + { + "identity": "rim", + "map": "value" + }, + { + "identity": "sct-attr", + "map": "363714003 |Interprets|" + } + ] + }, + { + "id": "Observation.dataAbsentReason", + "path": "Observation.dataAbsentReason", + "short": "Why the result is missing", + "definition": "Provides a reason why the expected value in the element Observation.value[x] is missing.", + "comment": "Null or exceptional values can be represented two ways in FHIR Observations. One way is to simply include them in the value set and represent the exceptions in the value. For example, measurement values for a serology test could be \"detected\", \"not detected\", \"inconclusive\", or \"specimen unsatisfactory\". \n\nThe alternate way is to use the value element for actual observations and use the explicit dataAbsentReason element to record exceptional values. For example, the dataAbsentReason code \"error\" could be used when the measurement was not completed. Note that an observation may only be reported if there are values to report. For example differential cell counts values may be reported only when > 0. Because of these options, use-case agreements are required to interpret general observations for null or exceptional values.", + "requirements": "For many results it is necessary to handle exceptional values in measurements.", + "min": 0, + "max": "1", + "base": { + "path": "Observation.dataAbsentReason", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "CodeableConcept" + } + ], + "condition": [ + "obs-6", + "vs-2" + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "mustSupport": true, + "isModifier": false, + "isSummary": false, + "binding": { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString": "ObservationValueAbsentReason" + } + ], + "strength": "extensible", + "description": "Codes specifying why the result (`Observation.value[x]`) is missing.", + "valueSet": "http://hl7.org/fhir/ValueSet/data-absent-reason" + }, + "mapping": [ + { + "identity": "v2", + "map": "N/A" + }, + { + "identity": "rim", + "map": "value.nullFlavor" + } + ] + }, + { + "id": "Observation.interpretation", + "path": "Observation.interpretation", + "short": "High, low, normal, etc.", + "definition": "A categorical assessment of an observation value. For example, high, low, normal.", + "comment": "Historically used for laboratory results (known as 'abnormal flag' ), its use extends to other use cases where coded interpretations are relevant. Often reported as one or more simple compact codes this element is often placed adjacent to the result value in reports and flow sheets to signal the meaning/normalcy status of the result.", + "requirements": "For some results, particularly numeric results, an interpretation is necessary to fully understand the significance of a result.", + "alias": [ + "Abnormal Flag" + ], + "min": 0, + "max": "*", + "base": { + "path": "Observation.interpretation", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "CodeableConcept" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": false, + "isSummary": false, + "binding": { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString": "ObservationInterpretation" + } + ], + "strength": "extensible", + "description": "Codes identifying interpretations of observations.", + "valueSet": "http://hl7.org/fhir/ValueSet/observation-interpretation" + }, + "mapping": [ + { + "identity": "sct-concept", + "map": "< 260245000 |Findings values|" + }, + { + "identity": "v2", + "map": "OBX-8" + }, + { + "identity": "rim", + "map": "interpretationCode" + }, + { + "identity": "sct-attr", + "map": "363713009 |Has interpretation|" + } + ] + }, + { + "id": "Observation.note", + "path": "Observation.note", + "short": "Comments about the observation", + "definition": "Comments about the observation or the results.", + "comment": "May include general statements about the observation, or statements about significant, unexpected or unreliable results values, or information about its source when relevant to its interpretation.", + "requirements": "Need to be able to provide free text additional information.", + "min": 0, + "max": "*", + "base": { + "path": "Observation.note", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "Annotation" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": false, + "isSummary": false, + "mapping": [ + { + "identity": "v2", + "map": "NTE.3 (partner NTE to OBX, or sometimes another (child?) OBX)" + }, + { + "identity": "rim", + "map": "subjectOf.observationEvent[code=\"annotation\"].value" + } + ] + }, + { + "id": "Observation.bodySite", + "path": "Observation.bodySite", + "short": "Observed body part", + "definition": "Indicates the site on the subject's body where the observation was made (i.e. the target site).", + "comment": "Only used if not implicit in code found in Observation.code. In many systems, this may be represented as a related observation instead of an inline component. \n\nIf the use case requires BodySite to be handled as a separate resource (e.g. to identify and track separately) then use the standard extension[ bodySite](http://hl7.org/fhir/extension-bodysite.html).", + "min": 0, + "max": "1", + "base": { + "path": "Observation.bodySite", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "CodeableConcept" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": false, + "isSummary": false, + "binding": { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString": "BodySite" + } + ], + "strength": "example", + "description": "Codes describing anatomical locations. May include laterality.", + "valueSet": "http://hl7.org/fhir/ValueSet/body-site" + }, + "mapping": [ + { + "identity": "sct-concept", + "map": "< 123037004 |Body structure|" + }, + { + "identity": "v2", + "map": "OBX-20" + }, + { + "identity": "rim", + "map": "targetSiteCode" + }, + { + "identity": "sct-attr", + "map": "718497002 |Inherent location|" + } + ] + }, + { + "id": "Observation.method", + "path": "Observation.method", + "short": "How it was done", + "definition": "Indicates the mechanism used to perform the observation.", + "comment": "Only used if not implicit in code for Observation.code.", + "requirements": "In some cases, method can impact results and is thus used for determining whether results can be compared or determining significance of results.", + "min": 0, + "max": "1", + "base": { + "path": "Observation.method", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "CodeableConcept" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": false, + "isSummary": false, + "binding": { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString": "ObservationMethod" + } + ], + "strength": "example", + "description": "Methods for simple observations.", + "valueSet": "http://hl7.org/fhir/ValueSet/observation-methods" + }, + "mapping": [ + { + "identity": "v2", + "map": "OBX-17" + }, + { + "identity": "rim", + "map": "methodCode" + } + ] + }, + { + "id": "Observation.specimen", + "path": "Observation.specimen", + "short": "Specimen used for this observation", + "definition": "The specimen that was used when this observation was made.", + "comment": "Should only be used if not implicit in code found in `Observation.code`. Observations are not made on specimens themselves; they are made on a subject, but in many cases by the means of a specimen. Note that although specimens are often involved, they are not always tracked and reported explicitly. Also note that observation resources may be used in contexts that track the specimen explicitly (e.g. Diagnostic Report).", + "min": 0, + "max": "1", + "base": { + "path": "Observation.specimen", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "Reference", + "targetProfile": [ + "http://hl7.org/fhir/StructureDefinition/Specimen" + ] + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": false, + "isSummary": false, + "mapping": [ + { + "identity": "sct-concept", + "map": "< 123038009 |Specimen|" + }, + { + "identity": "v2", + "map": "SPM segment" + }, + { + "identity": "rim", + "map": "participation[typeCode=SPC].specimen" + }, + { + "identity": "sct-attr", + "map": "704319004 |Inherent in|" + } + ] + }, + { + "id": "Observation.device", + "path": "Observation.device", + "short": "(Measurement) Device", + "definition": "The device used to generate the observation data.", + "comment": "Note that this is not meant to represent a device involved in the transmission of the result, e.g., a gateway. Such devices may be documented using the Provenance resource where relevant.", + "min": 0, + "max": "1", + "base": { + "path": "Observation.device", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "Reference", + "targetProfile": [ + "http://hl7.org/fhir/StructureDefinition/Device", + "http://hl7.org/fhir/StructureDefinition/DeviceMetric" + ] + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": false, + "isSummary": false, + "mapping": [ + { + "identity": "sct-concept", + "map": "< 49062001 |Device|" + }, + { + "identity": "v2", + "map": "OBX-17 / PRT -10" + }, + { + "identity": "rim", + "map": "participation[typeCode=DEV]" + }, + { + "identity": "sct-attr", + "map": "424226004 |Using device|" + } + ] + }, + { + "id": "Observation.referenceRange", + "path": "Observation.referenceRange", + "short": "Provides guide for interpretation", + "definition": "Guidance on how to interpret the value by comparison to a normal or recommended range. Multiple reference ranges are interpreted as an \"OR\". In other words, to represent two distinct target populations, two `referenceRange` elements would be used.", + "comment": "Most observations only have one generic reference range. Systems MAY choose to restrict to only supplying the relevant reference range based on knowledge about the patient (e.g., specific to the patient's age, gender, weight and other factors), but this might not be possible or appropriate. Whenever more than one reference range is supplied, the differences between them SHOULD be provided in the reference range and/or age properties.", + "requirements": "Knowing what values are considered \"normal\" can help evaluate the significance of a particular result. Need to be able to provide multiple reference ranges for different contexts.", + "min": 0, + "max": "*", + "base": { + "path": "Observation.referenceRange", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "BackboneElement" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key": "obs-3", + "severity": "error", + "human": "Must have at least a low or a high or text", + "expression": "low.exists() or high.exists() or text.exists()", + "xpath": "(exists(f:low) or exists(f:high)or exists(f:text))" + } + ], + "isModifier": false, + "isSummary": false, + "mapping": [ + { + "identity": "v2", + "map": "OBX.7" + }, + { + "identity": "rim", + "map": "outboundRelationship[typeCode=REFV]/target[classCode=OBS, moodCode=EVN]" + } + ] + }, + { + "id": "Observation.referenceRange.id", + "path": "Observation.referenceRange.id", + "representation": [ + "xmlAttr" + ], + "short": "Unique id for inter-element referencing", + "definition": "Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", + "min": 0, + "max": "1", + "base": { + "path": "Element.id", + "min": 0, + "max": "1" + }, + "type": [ + { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type", + "valueUrl": "string" + } + ], + "code": "http://hl7.org/fhirpath/System.String" + } + ], + "isModifier": false, + "isSummary": false, + "mapping": [ + { + "identity": "rim", + "map": "n/a" + } + ] + }, + { + "id": "Observation.referenceRange.extension", + "path": "Observation.referenceRange.extension", + "short": "Additional content defined by implementations", + "definition": "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": "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": [ + "extensions", + "user content" + ], + "min": 0, + "max": "*", + "base": { + "path": "Element.extension", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "Extension" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key": "ext-1", + "severity": "error", + "human": "Must have either extensions or value[x], not both", + "expression": "extension.exists() != value.exists()", + "xpath": "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])", + "source": "http://hl7.org/fhir/StructureDefinition/Extension" + } + ], + "isModifier": false, + "isSummary": false, + "mapping": [ + { + "identity": "rim", + "map": "n/a" + } + ] + }, + { + "id": "Observation.referenceRange.modifierExtension", + "path": "Observation.referenceRange.modifierExtension", + "short": "Extensions that cannot be ignored even if unrecognized", + "definition": "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.\n\nModifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).", + "comment": "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": "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/extensibility.html#modifierExtension).", + "alias": [ + "extensions", + "user content", + "modifiers" + ], + "min": 0, + "max": "*", + "base": { + "path": "BackboneElement.modifierExtension", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "Extension" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key": "ext-1", + "severity": "error", + "human": "Must have either extensions or value[x], not both", + "expression": "extension.exists() != value.exists()", + "xpath": "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])", + "source": "http://hl7.org/fhir/StructureDefinition/Extension" + } + ], + "isModifier": true, + "isModifierReason": "Modifier extensions are expected to modify the meaning or interpretation of the element that contains them", + "isSummary": true, + "mapping": [ + { + "identity": "rim", + "map": "N/A" + } + ] + }, + { + "id": "Observation.referenceRange.low", + "path": "Observation.referenceRange.low", + "short": "Low Range, if relevant", + "definition": "The value of the low bound of the reference range. The low bound of the reference range endpoint is inclusive of the value (e.g. reference range is >=5 - <=9). If the low bound is omitted, it is assumed to be meaningless (e.g. reference range is <=2.3).", + "min": 0, + "max": "1", + "base": { + "path": "Observation.referenceRange.low", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "Quantity", + "profile": [ + "http://hl7.org/fhir/StructureDefinition/SimpleQuantity" + ] + } + ], + "condition": [ + "obs-3" + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": false, + "isSummary": false, + "mapping": [ + { + "identity": "v2", + "map": "OBX-7" + }, + { + "identity": "rim", + "map": "value:IVL_PQ.low" + } + ] + }, + { + "id": "Observation.referenceRange.high", + "path": "Observation.referenceRange.high", + "short": "High Range, if relevant", + "definition": "The value of the high bound of the reference range. The high bound of the reference range endpoint is inclusive of the value (e.g. reference range is >=5 - <=9). If the high bound is omitted, it is assumed to be meaningless (e.g. reference range is >= 2.3).", + "min": 0, + "max": "1", + "base": { + "path": "Observation.referenceRange.high", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "Quantity", + "profile": [ + "http://hl7.org/fhir/StructureDefinition/SimpleQuantity" + ] + } + ], + "condition": [ + "obs-3" + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": false, + "isSummary": false, + "mapping": [ + { + "identity": "v2", + "map": "OBX-7" + }, + { + "identity": "rim", + "map": "value:IVL_PQ.high" + } + ] + }, + { + "id": "Observation.referenceRange.type", + "path": "Observation.referenceRange.type", + "short": "Reference range qualifier", + "definition": "Codes to indicate the what part of the targeted reference population it applies to. For example, the normal or therapeutic range.", + "comment": "This SHOULD be populated if there is more than one range. If this element is not present then the normal range is assumed.", + "requirements": "Need to be able to say what kind of reference range this is - normal, recommended, therapeutic, etc., - for proper interpretation.", + "min": 0, + "max": "1", + "base": { + "path": "Observation.referenceRange.type", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "CodeableConcept" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": false, + "isSummary": false, + "binding": { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString": "ObservationRangeMeaning" + } + ], + "strength": "preferred", + "description": "Code for the meaning of a reference range.", + "valueSet": "http://hl7.org/fhir/ValueSet/referencerange-meaning" + }, + "mapping": [ + { + "identity": "sct-concept", + "map": "< 260245000 |Findings values| OR \r< 365860008 |General clinical state finding| \rOR \r< 250171008 |Clinical history or observation findings| OR \r< 415229000 |Racial group| OR \r< 365400002 |Finding of puberty stage| OR\r< 443938003 |Procedure carried out on subject|" + }, + { + "identity": "v2", + "map": "OBX-10" + }, + { + "identity": "rim", + "map": "interpretationCode" + } + ] + }, + { + "id": "Observation.referenceRange.appliesTo", + "path": "Observation.referenceRange.appliesTo", + "short": "Reference range population", + "definition": "Codes to indicate the target population this reference range applies to. For example, a reference range may be based on the normal population or a particular sex or race. Multiple `appliesTo` are interpreted as an \"AND\" of the target populations. For example, to represent a target population of African American females, both a code of female and a code for African American would be used.", + "comment": "This SHOULD be populated if there is more than one range. If this element is not present then the normal population is assumed.", + "requirements": "Need to be able to identify the target population for proper interpretation.", + "min": 0, + "max": "*", + "base": { + "path": "Observation.referenceRange.appliesTo", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "CodeableConcept" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": false, + "isSummary": false, + "binding": { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString": "ObservationRangeType" + } + ], + "strength": "example", + "description": "Codes identifying the population the reference range applies to.", + "valueSet": "http://hl7.org/fhir/ValueSet/referencerange-appliesto" + }, + "mapping": [ + { + "identity": "sct-concept", + "map": "< 260245000 |Findings values| OR \r< 365860008 |General clinical state finding| \rOR \r< 250171008 |Clinical history or observation findings| OR \r< 415229000 |Racial group| OR \r< 365400002 |Finding of puberty stage| OR\r< 443938003 |Procedure carried out on subject|" + }, + { + "identity": "v2", + "map": "OBX-10" + }, + { + "identity": "rim", + "map": "interpretationCode" + } + ] + }, + { + "id": "Observation.referenceRange.age", + "path": "Observation.referenceRange.age", + "short": "Applicable age range, if relevant", + "definition": "The age at which this reference range is applicable. This is a neonatal age (e.g. number of weeks at term) if the meaning says so.", + "requirements": "Some analytes vary greatly over age.", + "min": 0, + "max": "1", + "base": { + "path": "Observation.referenceRange.age", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "Range" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": false, + "isSummary": false, + "mapping": [ + { + "identity": "rim", + "map": "outboundRelationship[typeCode=PRCN].targetObservationCriterion[code=\"age\"].value" + } + ] + }, + { + "id": "Observation.referenceRange.text", + "path": "Observation.referenceRange.text", + "short": "Text based reference range in an observation", + "definition": "Text based reference range in an observation which may be used when a quantitative range is not appropriate for an observation. An example would be a reference value of \"Negative\" or a list or table of \"normals\".", + "min": 0, + "max": "1", + "base": { + "path": "Observation.referenceRange.text", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "string" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": false, + "isSummary": false, + "mapping": [ + { + "identity": "v2", + "map": "OBX-7" + }, + { + "identity": "rim", + "map": "value:ST" + } + ] + }, + { + "id": "Observation.hasMember", + "path": "Observation.hasMember", + "short": "Used when reporting vital signs panel components", + "definition": "Used when reporting vital signs panel components.", + "comment": "When using this element, an observation will typically have either a value or a set of related resources, although both may be present in some cases. For a discussion on the ways Observations can assembled in groups together, see [Notes](http://hl7.org/fhir/observation.html#obsgrouping) below. Note that a system may calculate results from [QuestionnaireResponse](http://hl7.org/fhir/questionnaireresponse.html) into a final score and represent the score as an Observation.", + "min": 0, + "max": "*", + "base": { + "path": "Observation.hasMember", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "Reference", + "targetProfile": [ + "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse", + "http://hl7.org/fhir/StructureDefinition/MolecularSequence", + "http://hl7.org/fhir/StructureDefinition/vitalsigns" + ] + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": false, + "isSummary": true, + "mapping": [ + { + "identity": "v2", + "map": "Relationships established by OBX-4 usage" + }, + { + "identity": "rim", + "map": "outBoundRelationship" + } + ] + }, + { + "id": "Observation.derivedFrom", + "path": "Observation.derivedFrom", + "short": "Related measurements the observation is made from", + "definition": "The target resource that represents a measurement from which this observation value is derived. For example, a calculated anion gap or a fetal measurement based on an ultrasound image.", + "comment": "All the reference choices that are listed in this element can represent clinical observations and other measurements that may be the source for a derived value. The most common reference will be another Observation. For a discussion on the ways Observations can assembled in groups together, see [Notes](http://hl7.org/fhir/observation.html#obsgrouping) below.", + "min": 0, + "max": "*", + "base": { + "path": "Observation.derivedFrom", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "Reference", + "targetProfile": [ + "http://hl7.org/fhir/StructureDefinition/DocumentReference", + "http://hl7.org/fhir/StructureDefinition/ImagingStudy", + "http://hl7.org/fhir/StructureDefinition/Media", + "http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse", + "http://hl7.org/fhir/StructureDefinition/MolecularSequence", + "http://hl7.org/fhir/StructureDefinition/vitalsigns" + ] + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": false, + "isSummary": true, + "mapping": [ + { + "identity": "v2", + "map": "Relationships established by OBX-4 usage" + }, + { + "identity": "rim", + "map": ".targetObservation" + } + ] + }, + { + "id": "Observation.component", + "path": "Observation.component", + "slicing": { + "discriminator": [ + { + "type": "pattern", + "path": "code" + } + ], + "rules": "open" + }, + "short": "Used when reporting flow rates or oxygen concentration.", + "definition": "Used when reporting flow rates or oxygen concentration.", + "comment": "For a discussion on the ways Observations can be assembled in groups together see [Notes](http://hl7.org/fhir/observation.html#notes) below.", + "requirements": "Component observations share the same attributes in the Observation resource as the primary observation and are always treated a part of a single observation (they are not separable). However, the reference range for the primary observation value is not inherited by the component values and is required when appropriate for each component observation.", + "min": 0, + "max": "*", + "base": { + "path": "Observation.component", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "BackboneElement" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key": "vs-3", + "severity": "error", + "human": "If there is no a value a data absent reason must be present", + "expression": "value.exists() or dataAbsentReason.exists()", + "xpath": "f:*[starts-with(local-name(.), 'value')] or f:dataAbsentReason", + "source": "http://hl7.org/fhir/StructureDefinition/vitalsigns" + } + ], + "mustSupport": true, + "isModifier": false, + "isSummary": true, + "mapping": [ + { + "identity": "v2", + "map": "containment by OBX-4?" + }, + { + "identity": "rim", + "map": "outBoundRelationship[typeCode=COMP]" + } + ] + }, + { + "id": "Observation.component.id", + "path": "Observation.component.id", + "representation": [ + "xmlAttr" + ], + "short": "Unique id for inter-element referencing", + "definition": "Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", + "min": 0, + "max": "1", + "base": { + "path": "Element.id", + "min": 0, + "max": "1" + }, + "type": [ + { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type", + "valueUrl": "string" + } + ], + "code": "http://hl7.org/fhirpath/System.String" + } + ], + "isModifier": false, + "isSummary": false, + "mapping": [ + { + "identity": "rim", + "map": "n/a" + } + ] + }, + { + "id": "Observation.component.extension", + "path": "Observation.component.extension", + "short": "Additional content defined by implementations", + "definition": "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": "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": [ + "extensions", + "user content" + ], + "min": 0, + "max": "*", + "base": { + "path": "Element.extension", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "Extension" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key": "ext-1", + "severity": "error", + "human": "Must have either extensions or value[x], not both", + "expression": "extension.exists() != value.exists()", + "xpath": "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])", + "source": "http://hl7.org/fhir/StructureDefinition/Extension" + } + ], + "isModifier": false, + "isSummary": false, + "mapping": [ + { + "identity": "rim", + "map": "n/a" + } + ] + }, + { + "id": "Observation.component.modifierExtension", + "path": "Observation.component.modifierExtension", + "short": "Extensions that cannot be ignored even if unrecognized", + "definition": "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.\n\nModifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).", + "comment": "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": "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/extensibility.html#modifierExtension).", + "alias": [ + "extensions", + "user content", + "modifiers" + ], + "min": 0, + "max": "*", + "base": { + "path": "BackboneElement.modifierExtension", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "Extension" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key": "ext-1", + "severity": "error", + "human": "Must have either extensions or value[x], not both", + "expression": "extension.exists() != value.exists()", + "xpath": "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])", + "source": "http://hl7.org/fhir/StructureDefinition/Extension" + } + ], + "isModifier": true, + "isModifierReason": "Modifier extensions are expected to modify the meaning or interpretation of the element that contains them", + "isSummary": true, + "mapping": [ + { + "identity": "rim", + "map": "N/A" + } + ] + }, + { + "id": "Observation.component.code", + "path": "Observation.component.code", + "short": "Type of component observation (code / type)", + "definition": "Describes what was observed. Sometimes this is called the observation \"code\".", + "comment": "*All* code-value and component.code-component.value pairs need to be taken into account to correctly understand the meaning of the observation.", + "requirements": "Knowing what kind of observation is being made is essential to understanding the observation.", + "min": 1, + "max": "1", + "base": { + "path": "Observation.component.code", + "min": 1, + "max": "1" + }, + "type": [ + { + "code": "CodeableConcept" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "mustSupport": true, + "isModifier": false, + "isSummary": true, + "binding": { + "strength": "extensible", + "description": "The vital sign codes from the base FHIR and US Core Vital Signs.", + "valueSet": "http://hl7.org/fhir/us/core/ValueSet/us-core-vital-signs" + }, + "mapping": [ + { + "identity": "w5", + "map": "FiveWs.what[x]" + }, + { + "identity": "sct-concept", + "map": "< 363787002 |Observable entity| OR \r< 386053000 |Evaluation procedure|" + }, + { + "identity": "v2", + "map": "OBX-3" + }, + { + "identity": "rim", + "map": "code" + } + ] + }, + { + "id": "Observation.component.value[x]", + "path": "Observation.component.value[x]", + "short": "Vital Sign Component Value", + "definition": "Vital Signs value are typically recorded using the Quantity data type. For supporting observations such as cuff size could use other datatypes such as CodeableConcept.", + "comment": "Used when observation has a set of component observations. An observation may have both a value (e.g. an Apgar score) and component observations (the observations from which the Apgar score was derived). If a value is present, the datatype for this element should be determined by Observation.code. A CodeableConcept with just a text would be used instead of a string if the field was usually coded, or if the type associated with the Observation.code defines a coded value. For additional guidance, see the [Notes section](http://hl7.org/fhir/observation.html#notes) below.", + "requirements": "9. SHALL contain exactly one [1..1] value with @xsi:type=\"PQ\" (CONF:7305).", + "min": 0, + "max": "1", + "base": { + "path": "Observation.component.value[x]", + "min": 0, + "max": "1" + }, + "type": [ + { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-type-must-support", + "valueBoolean": true + } + ], + "code": "Quantity" + }, + { + "code": "CodeableConcept" + }, + { + "code": "string" + }, + { + "code": "boolean" + }, + { + "code": "integer" + }, + { + "code": "Range" + }, + { + "code": "Ratio" + }, + { + "code": "SampledData" + }, + { + "code": "time" + }, + { + "code": "dateTime" + }, + { + "code": "Period" + } + ], + "condition": [ + "vs-3" + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "mustSupport": true, + "isModifier": false, + "isSummary": true, + "binding": { + "strength": "extensible", + "description": "Common UCUM units for recording Vital Signs.", + "valueSet": "http://hl7.org/fhir/ValueSet/ucum-vitals-common|4.0.1" + }, + "mapping": [ + { + "identity": "sct-concept", + "map": "363714003 |Interprets| < 441742003 |Evaluation finding|" + }, + { + "identity": "v2", + "map": "OBX.2, OBX.5, OBX.6" + }, + { + "identity": "rim", + "map": "value" + }, + { + "identity": "sct-attr", + "map": "363714003 |Interprets|" + } + ] + }, + { + "id": "Observation.component.dataAbsentReason", + "path": "Observation.component.dataAbsentReason", + "short": "Why the component result is missing", + "definition": "Provides a reason why the expected value in the element Observation.component.value[x] is missing.", + "comment": "\"Null\" or exceptional values can be represented two ways in FHIR Observations. One way is to simply include them in the value set and represent the exceptions in the value. For example, measurement values for a serology test could be \"detected\", \"not detected\", \"inconclusive\", or \"test not done\". \n\nThe alternate way is to use the value element for actual observations and use the explicit dataAbsentReason element to record exceptional values. For example, the dataAbsentReason code \"error\" could be used when the measurement was not completed. Because of these options, use-case agreements are required to interpret general observations for exceptional values.", + "requirements": "For many results it is necessary to handle exceptional values in measurements.", + "min": 0, + "max": "1", + "base": { + "path": "Observation.component.dataAbsentReason", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "CodeableConcept" + } + ], + "condition": [ + "obs-6", + "vs-3" + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "mustSupport": true, + "isModifier": false, + "isSummary": false, + "binding": { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString": "ObservationValueAbsentReason" + } + ], + "strength": "extensible", + "description": "Codes specifying why the result (`Observation.value[x]`) is missing.", + "valueSet": "http://hl7.org/fhir/ValueSet/data-absent-reason" + }, + "mapping": [ + { + "identity": "v2", + "map": "N/A" + }, + { + "identity": "rim", + "map": "value.nullFlavor" + } + ] + }, + { + "id": "Observation.component.interpretation", + "path": "Observation.component.interpretation", + "short": "High, low, normal, etc.", + "definition": "A categorical assessment of an observation value. For example, high, low, normal.", + "comment": "Historically used for laboratory results (known as 'abnormal flag' ), its use extends to other use cases where coded interpretations are relevant. Often reported as one or more simple compact codes this element is often placed adjacent to the result value in reports and flow sheets to signal the meaning/normalcy status of the result.", + "requirements": "For some results, particularly numeric results, an interpretation is necessary to fully understand the significance of a result.", + "alias": [ + "Abnormal Flag" + ], + "min": 0, + "max": "*", + "base": { + "path": "Observation.component.interpretation", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "CodeableConcept" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": false, + "isSummary": false, + "binding": { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString": "ObservationInterpretation" + } + ], + "strength": "extensible", + "description": "Codes identifying interpretations of observations.", + "valueSet": "http://hl7.org/fhir/ValueSet/observation-interpretation" + }, + "mapping": [ + { + "identity": "sct-concept", + "map": "< 260245000 |Findings values|" + }, + { + "identity": "v2", + "map": "OBX-8" + }, + { + "identity": "rim", + "map": "interpretationCode" + }, + { + "identity": "sct-attr", + "map": "363713009 |Has interpretation|" + } + ] + }, + { + "id": "Observation.component.referenceRange", + "path": "Observation.component.referenceRange", + "short": "Provides guide for interpretation of component result", + "definition": "Guidance on how to interpret the value by comparison to a normal or recommended range.", + "comment": "Most observations only have one generic reference range. Systems MAY choose to restrict to only supplying the relevant reference range based on knowledge about the patient (e.g., specific to the patient's age, gender, weight and other factors), but this might not be possible or appropriate. Whenever more than one reference range is supplied, the differences between them SHOULD be provided in the reference range and/or age properties.", + "requirements": "Knowing what values are considered \"normal\" can help evaluate the significance of a particular result. Need to be able to provide multiple reference ranges for different contexts.", + "min": 0, + "max": "*", + "base": { + "path": "Observation.component.referenceRange", + "min": 0, + "max": "*" + }, + "contentReference": "http://hl7.org/fhir/StructureDefinition/Observation#Observation.referenceRange", + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": false, + "isSummary": false, + "mapping": [ + { + "identity": "v2", + "map": "OBX.7" + }, + { + "identity": "rim", + "map": "outboundRelationship[typeCode=REFV]/target[classCode=OBS, moodCode=EVN]" + } + ] + }, + { + "id": "Observation.component:FlowRate", + "path": "Observation.component", + "sliceName": "FlowRate", + "short": "Inhaled oxygen flow rate", + "definition": "Used when reporting component observation such as systolic and diastolic blood pressure.", + "comment": "For a discussion on the ways Observations can be assembled in groups together see [Notes](http://hl7.org/fhir/observation.html#notes) below.", + "requirements": "Component observations share the same attributes in the Observation resource as the primary observation and are always treated a part of a single observation (they are not separable). However, the reference range for the primary observation value is not inherited by the component values and is required when appropriate for each component observation.", + "min": 0, + "max": "1", + "base": { + "path": "Observation.component", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "BackboneElement" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key": "vs-3", + "severity": "error", + "human": "If there is no a value a data absent reason must be present", + "expression": "value.exists() or dataAbsentReason.exists()", + "xpath": "f:*[starts-with(local-name(.), 'value')] or f:dataAbsentReason", + "source": "http://hl7.org/fhir/StructureDefinition/vitalsigns" + } + ], + "mustSupport": true, + "isModifier": false, + "isSummary": true, + "mapping": [ + { + "identity": "v2", + "map": "containment by OBX-4?" + }, + { + "identity": "rim", + "map": "outBoundRelationship[typeCode=COMP]" + } + ] + }, + { + "id": "Observation.component:FlowRate.id", + "path": "Observation.component.id", + "representation": [ + "xmlAttr" + ], + "short": "Unique id for inter-element referencing", + "definition": "Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", + "min": 0, + "max": "1", + "base": { + "path": "Element.id", + "min": 0, + "max": "1" + }, + "type": [ + { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type", + "valueUrl": "string" + } + ], + "code": "http://hl7.org/fhirpath/System.String" + } + ], + "isModifier": false, + "isSummary": false, + "mapping": [ + { + "identity": "rim", + "map": "n/a" + } + ] + }, + { + "id": "Observation.component:FlowRate.extension", + "path": "Observation.component.extension", + "short": "Additional content defined by implementations", + "definition": "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": "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": [ + "extensions", + "user content" + ], + "min": 0, + "max": "*", + "base": { + "path": "Element.extension", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "Extension" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key": "ext-1", + "severity": "error", + "human": "Must have either extensions or value[x], not both", + "expression": "extension.exists() != value.exists()", + "xpath": "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])", + "source": "http://hl7.org/fhir/StructureDefinition/Extension" + } + ], + "isModifier": false, + "isSummary": false, + "mapping": [ + { + "identity": "rim", + "map": "n/a" + } + ] + }, + { + "id": "Observation.component:FlowRate.modifierExtension", + "path": "Observation.component.modifierExtension", + "short": "Extensions that cannot be ignored even if unrecognized", + "definition": "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.\n\nModifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).", + "comment": "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": "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/extensibility.html#modifierExtension).", + "alias": [ + "extensions", + "user content", + "modifiers" + ], + "min": 0, + "max": "*", + "base": { + "path": "BackboneElement.modifierExtension", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "Extension" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key": "ext-1", + "severity": "error", + "human": "Must have either extensions or value[x], not both", + "expression": "extension.exists() != value.exists()", + "xpath": "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])", + "source": "http://hl7.org/fhir/StructureDefinition/Extension" + } + ], + "isModifier": true, + "isModifierReason": "Modifier extensions are expected to modify the meaning or interpretation of the element that contains them", + "isSummary": true, + "mapping": [ + { + "identity": "rim", + "map": "N/A" + } + ] + }, + { + "id": "Observation.component:FlowRate.code", + "path": "Observation.component.code", + "short": "Type of component observation (code / type)", + "definition": "Describes what was observed. Sometimes this is called the observation \"code\".", + "comment": "*All* code-value and component.code-component.value pairs need to be taken into account to correctly understand the meaning of the observation.", + "requirements": "Knowing what kind of observation is being made is essential to understanding the observation.", + "min": 1, + "max": "1", + "base": { + "path": "Observation.component.code", + "min": 1, + "max": "1" + }, + "type": [ + { + "code": "CodeableConcept" + } + ], + "patternCodeableConcept": { + "coding": [ + { + "system": "http://loinc.org", + "code": "3151-8" + } + ] + }, + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "mustSupport": true, + "isModifier": false, + "isSummary": true, + "binding": { + "strength": "extensible", + "description": "The vital sign codes from the base FHIR and US Core Vital Signs.", + "valueSet": "http://hl7.org/fhir/us/core/ValueSet/us-core-vital-signs" + }, + "mapping": [ + { + "identity": "w5", + "map": "FiveWs.what[x]" + }, + { + "identity": "sct-concept", + "map": "< 363787002 |Observable entity| OR \r< 386053000 |Evaluation procedure|" + }, + { + "identity": "v2", + "map": "OBX-3" + }, + { + "identity": "rim", + "map": "code" + } + ] + }, + { + "id": "Observation.component:FlowRate.value[x]", + "path": "Observation.component.value[x]", + "short": "Vital Sign Component Value", + "definition": "Vital Signs value are typically recorded using the Quantity data type. For supporting observations such as cuff size could use other datatypes such as CodeableConcept.", + "comment": "Used when observation has a set of component observations. An observation may have both a value (e.g. an Apgar score) and component observations (the observations from which the Apgar score was derived). If a value is present, the datatype for this element should be determined by Observation.code. A CodeableConcept with just a text would be used instead of a string if the field was usually coded, or if the type associated with the Observation.code defines a coded value. For additional guidance, see the [Notes section](http://hl7.org/fhir/observation.html#notes) below.", + "requirements": "9. SHALL contain exactly one [1..1] value with @xsi:type=\"PQ\" (CONF:7305).", + "min": 0, + "max": "1", + "base": { + "path": "Observation.component.value[x]", + "min": 0, + "max": "1" + }, + "type": [ + { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-type-must-support", + "valueBoolean": true + } + ], + "code": "Quantity" + } + ], + "condition": [ + "vs-3" + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "mustSupport": true, + "isModifier": false, + "isSummary": true, + "binding": { + "strength": "extensible", + "description": "Common UCUM units for recording Vital Signs.", + "valueSet": "http://hl7.org/fhir/ValueSet/ucum-vitals-common|4.0.1" + }, + "mapping": [ + { + "identity": "sct-concept", + "map": "363714003 |Interprets| < 441742003 |Evaluation finding|" + }, + { + "identity": "v2", + "map": "OBX.2, OBX.5, OBX.6" + }, + { + "identity": "rim", + "map": "value" + }, + { + "identity": "sct-attr", + "map": "363714003 |Interprets|" + } + ] + }, + { + "id": "Observation.component:FlowRate.value[x].id", + "path": "Observation.component.value[x].id", + "representation": [ + "xmlAttr" + ], + "short": "Unique id for inter-element referencing", + "definition": "Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", + "min": 0, + "max": "1", + "base": { + "path": "Element.id", + "min": 0, + "max": "1" + }, + "type": [ + { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type", + "valueUrl": "string" + } + ], + "code": "http://hl7.org/fhirpath/System.String" + } + ], + "isModifier": false, + "isSummary": false, + "mapping": [ + { + "identity": "rim", + "map": "n/a" + } + ] + }, + { + "id": "Observation.component:FlowRate.value[x].extension", + "path": "Observation.component.value[x].extension", + "slicing": { + "discriminator": [ + { + "type": "value", + "path": "url" + } + ], + "description": "Extensions are always sliced by (at least) url", + "rules": "open" + }, + "short": "Additional content defined by implementations", + "definition": "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": "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": [ + "extensions", + "user content" + ], + "min": 0, + "max": "*", + "base": { + "path": "Element.extension", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "Extension" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key": "ext-1", + "severity": "error", + "human": "Must have either extensions or value[x], not both", + "expression": "extension.exists() != value.exists()", + "xpath": "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])", + "source": "http://hl7.org/fhir/StructureDefinition/Extension" + } + ], + "isModifier": false, + "isSummary": false, + "mapping": [ + { + "identity": "rim", + "map": "n/a" + } + ] + }, + { + "id": "Observation.component:FlowRate.value[x].value", + "path": "Observation.component.value[x].value", + "short": "Numerical value (with implicit precision)", + "definition": "The value of the measured amount. The value includes an implicit precision in the presentation of the value.", + "comment": "The implicit precision in the value should always be honored. Monetary values have their own rules for handling precision (refer to standard accounting text books).", + "requirements": "Precision is handled implicitly in almost all cases of measurement.", + "min": 1, + "max": "1", + "base": { + "path": "Quantity.value", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "decimal" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "mustSupport": true, + "isModifier": false, + "isSummary": true, + "mapping": [ + { + "identity": "v2", + "map": "SN.2 / CQ - N/A" + }, + { + "identity": "rim", + "map": "PQ.value, CO.value, MO.value, IVL.high or IVL.low depending on the value" + } + ] + }, + { + "id": "Observation.component:FlowRate.value[x].comparator", + "path": "Observation.component.value[x].comparator", + "short": "< | <= | >= | > - how to understand the value", + "definition": "How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is \"<\" , then the real value is < stated value.", + "requirements": "Need a framework for handling measures where the value is <5ug/L or >400mg/L due to the limitations of measuring methodology.", + "min": 0, + "max": "1", + "base": { + "path": "Quantity.comparator", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "code" + } + ], + "meaningWhenMissing": "If there is no comparator, then there is no modification of the value", + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": true, + "isModifierReason": "This is labeled as \"Is Modifier\" because the comparator modifies the interpretation of the value significantly. If there is no comparator, then there is no modification of the value", + "isSummary": true, + "binding": { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString": "QuantityComparator" + } + ], + "strength": "required", + "description": "How the Quantity should be understood and represented.", + "valueSet": "http://hl7.org/fhir/ValueSet/quantity-comparator|4.0.1" + }, + "mapping": [ + { + "identity": "v2", + "map": "SN.1 / CQ.1" + }, + { + "identity": "rim", + "map": "IVL properties" + } + ] + }, + { + "id": "Observation.component:FlowRate.value[x].unit", + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-translatable", + "valueBoolean": true + } + ], + "path": "Observation.component.value[x].unit", + "short": "Unit representation", + "definition": "A human-readable form of the unit.", + "requirements": "There are many representations for units of measure and in many contexts, particular representations are fixed and required. I.e. mcg for micrograms.", + "min": 1, + "max": "1", + "base": { + "path": "Quantity.unit", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "string" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "mustSupport": true, + "isModifier": false, + "isSummary": true, + "mapping": [ + { + "identity": "v2", + "map": "(see OBX.6 etc.) / CQ.2" + }, + { + "identity": "rim", + "map": "PQ.unit" + } + ] + }, + { + "id": "Observation.component:FlowRate.value[x].system", + "path": "Observation.component.value[x].system", + "short": "System that defines coded unit form", + "definition": "The identification of the system that provides the coded form of the unit.", + "requirements": "Need to know the system that defines the coded form of the unit.", + "min": 1, + "max": "1", + "base": { + "path": "Quantity.system", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "uri" + } + ], + "fixedUri": "http://unitsofmeasure.org", + "condition": [ + "qty-3" + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "mustSupport": true, + "isModifier": false, + "isSummary": true, + "mapping": [ + { + "identity": "v2", + "map": "(see OBX.6 etc.) / CQ.2" + }, + { + "identity": "rim", + "map": "CO.codeSystem, PQ.translation.codeSystem" + } + ] + }, + { + "id": "Observation.component:FlowRate.value[x].code", + "path": "Observation.component.value[x].code", + "short": "Coded form of the unit", + "definition": "A computer processable form of the unit in some unit representation system.", + "comment": "The preferred system is UCUM, but SNOMED CT can also be used (for customary units) or ISO 4217 for currency. The context of use may additionally require a code from a particular system.", + "requirements": "Need a computable form of the unit that is fixed across all forms. UCUM provides this for quantities, but SNOMED CT provides many units of interest.", + "min": 1, + "max": "1", + "base": { + "path": "Quantity.code", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "code" + } + ], + "fixedCode": "L/min", + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "mustSupport": true, + "isModifier": false, + "isSummary": true, + "mapping": [ + { + "identity": "v2", + "map": "(see OBX.6 etc.) / CQ.2" + }, + { + "identity": "rim", + "map": "PQ.code, MO.currency, PQ.translation.code" + } + ] + }, + { + "id": "Observation.component:FlowRate.dataAbsentReason", + "path": "Observation.component.dataAbsentReason", + "short": "Why the component result is missing", + "definition": "Provides a reason why the expected value in the element Observation.component.value[x] is missing.", + "comment": "\"Null\" or exceptional values can be represented two ways in FHIR Observations. One way is to simply include them in the value set and represent the exceptions in the value. For example, measurement values for a serology test could be \"detected\", \"not detected\", \"inconclusive\", or \"test not done\". \n\nThe alternate way is to use the value element for actual observations and use the explicit dataAbsentReason element to record exceptional values. For example, the dataAbsentReason code \"error\" could be used when the measurement was not completed. Because of these options, use-case agreements are required to interpret general observations for exceptional values.", + "requirements": "For many results it is necessary to handle exceptional values in measurements.", + "min": 0, + "max": "1", + "base": { + "path": "Observation.component.dataAbsentReason", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "CodeableConcept" + } + ], + "condition": [ + "obs-6", + "vs-3" + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "mustSupport": true, + "isModifier": false, + "isSummary": false, + "binding": { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString": "ObservationValueAbsentReason" + } + ], + "strength": "extensible", + "description": "Codes specifying why the result (`Observation.value[x]`) is missing.", + "valueSet": "http://hl7.org/fhir/ValueSet/data-absent-reason" + }, + "mapping": [ + { + "identity": "v2", + "map": "N/A" + }, + { + "identity": "rim", + "map": "value.nullFlavor" + } + ] + }, + { + "id": "Observation.component:FlowRate.interpretation", + "path": "Observation.component.interpretation", + "short": "High, low, normal, etc.", + "definition": "A categorical assessment of an observation value. For example, high, low, normal.", + "comment": "Historically used for laboratory results (known as 'abnormal flag' ), its use extends to other use cases where coded interpretations are relevant. Often reported as one or more simple compact codes this element is often placed adjacent to the result value in reports and flow sheets to signal the meaning/normalcy status of the result.", + "requirements": "For some results, particularly numeric results, an interpretation is necessary to fully understand the significance of a result.", + "alias": [ + "Abnormal Flag" + ], + "min": 0, + "max": "*", + "base": { + "path": "Observation.component.interpretation", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "CodeableConcept" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": false, + "isSummary": false, + "binding": { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString": "ObservationInterpretation" + } + ], + "strength": "extensible", + "description": "Codes identifying interpretations of observations.", + "valueSet": "http://hl7.org/fhir/ValueSet/observation-interpretation" + }, + "mapping": [ + { + "identity": "sct-concept", + "map": "< 260245000 |Findings values|" + }, + { + "identity": "v2", + "map": "OBX-8" + }, + { + "identity": "rim", + "map": "interpretationCode" + }, + { + "identity": "sct-attr", + "map": "363713009 |Has interpretation|" + } + ] + }, + { + "id": "Observation.component:FlowRate.referenceRange", + "path": "Observation.component.referenceRange", + "short": "Provides guide for interpretation of component result", + "definition": "Guidance on how to interpret the value by comparison to a normal or recommended range.", + "comment": "Most observations only have one generic reference range. Systems MAY choose to restrict to only supplying the relevant reference range based on knowledge about the patient (e.g., specific to the patient's age, gender, weight and other factors), but this might not be possible or appropriate. Whenever more than one reference range is supplied, the differences between them SHOULD be provided in the reference range and/or age properties.", + "requirements": "Knowing what values are considered \"normal\" can help evaluate the significance of a particular result. Need to be able to provide multiple reference ranges for different contexts.", + "min": 0, + "max": "*", + "base": { + "path": "Observation.component.referenceRange", + "min": 0, + "max": "*" + }, + "contentReference": "http://hl7.org/fhir/StructureDefinition/Observation#Observation.referenceRange", + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": false, + "isSummary": false, + "mapping": [ + { + "identity": "v2", + "map": "OBX.7" + }, + { + "identity": "rim", + "map": "outboundRelationship[typeCode=REFV]/target[classCode=OBS, moodCode=EVN]" + } + ] + }, + { + "id": "Observation.component:Concentration", + "path": "Observation.component", + "sliceName": "Concentration", + "short": "Inhaled oxygen concentration", + "definition": "Used when reporting component observation such as systolic and diastolic blood pressure.", + "comment": "For a discussion on the ways Observations can be assembled in groups together see [Notes](http://hl7.org/fhir/observation.html#notes) below.", + "requirements": "Component observations share the same attributes in the Observation resource as the primary observation and are always treated a part of a single observation (they are not separable). However, the reference range for the primary observation value is not inherited by the component values and is required when appropriate for each component observation.", + "min": 0, + "max": "1", + "base": { + "path": "Observation.component", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "BackboneElement" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key": "vs-3", + "severity": "error", + "human": "If there is no a value a data absent reason must be present", + "expression": "value.exists() or dataAbsentReason.exists()", + "xpath": "f:*[starts-with(local-name(.), 'value')] or f:dataAbsentReason", + "source": "http://hl7.org/fhir/StructureDefinition/vitalsigns" + } + ], + "mustSupport": true, + "isModifier": false, + "isSummary": true, + "mapping": [ + { + "identity": "v2", + "map": "containment by OBX-4?" + }, + { + "identity": "rim", + "map": "outBoundRelationship[typeCode=COMP]" + } + ] + }, + { + "id": "Observation.component:Concentration.id", + "path": "Observation.component.id", + "representation": [ + "xmlAttr" + ], + "short": "Unique id for inter-element referencing", + "definition": "Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", + "min": 0, + "max": "1", + "base": { + "path": "Element.id", + "min": 0, + "max": "1" + }, + "type": [ + { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type", + "valueUrl": "string" + } + ], + "code": "http://hl7.org/fhirpath/System.String" + } + ], + "isModifier": false, + "isSummary": false, + "mapping": [ + { + "identity": "rim", + "map": "n/a" + } + ] + }, + { + "id": "Observation.component:Concentration.extension", + "path": "Observation.component.extension", + "short": "Additional content defined by implementations", + "definition": "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": "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": [ + "extensions", + "user content" + ], + "min": 0, + "max": "*", + "base": { + "path": "Element.extension", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "Extension" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key": "ext-1", + "severity": "error", + "human": "Must have either extensions or value[x], not both", + "expression": "extension.exists() != value.exists()", + "xpath": "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])", + "source": "http://hl7.org/fhir/StructureDefinition/Extension" + } + ], + "isModifier": false, + "isSummary": false, + "mapping": [ + { + "identity": "rim", + "map": "n/a" + } + ] + }, + { + "id": "Observation.component:Concentration.modifierExtension", + "path": "Observation.component.modifierExtension", + "short": "Extensions that cannot be ignored even if unrecognized", + "definition": "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.\n\nModifier extensions SHALL NOT change the meaning of any elements on Resource or DomainResource (including cannot change the meaning of modifierExtension itself).", + "comment": "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": "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/extensibility.html#modifierExtension).", + "alias": [ + "extensions", + "user content", + "modifiers" + ], + "min": 0, + "max": "*", + "base": { + "path": "BackboneElement.modifierExtension", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "Extension" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key": "ext-1", + "severity": "error", + "human": "Must have either extensions or value[x], not both", + "expression": "extension.exists() != value.exists()", + "xpath": "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])", + "source": "http://hl7.org/fhir/StructureDefinition/Extension" + } + ], + "isModifier": true, + "isModifierReason": "Modifier extensions are expected to modify the meaning or interpretation of the element that contains them", + "isSummary": true, + "mapping": [ + { + "identity": "rim", + "map": "N/A" + } + ] + }, + { + "id": "Observation.component:Concentration.code", + "path": "Observation.component.code", + "short": "Type of component observation (code / type)", + "definition": "Describes what was observed. Sometimes this is called the observation \"code\".", + "comment": "*All* code-value and component.code-component.value pairs need to be taken into account to correctly understand the meaning of the observation.", + "requirements": "Knowing what kind of observation is being made is essential to understanding the observation.", + "min": 1, + "max": "1", + "base": { + "path": "Observation.component.code", + "min": 1, + "max": "1" + }, + "type": [ + { + "code": "CodeableConcept" + } + ], + "patternCodeableConcept": { + "coding": [ + { + "system": "http://loinc.org", + "code": "3150-0" + } + ] + }, + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "mustSupport": true, + "isModifier": false, + "isSummary": true, + "binding": { + "strength": "extensible", + "description": "The vital sign codes from the base FHIR and US Core Vital Signs.", + "valueSet": "http://hl7.org/fhir/us/core/ValueSet/us-core-vital-signs" + }, + "mapping": [ + { + "identity": "w5", + "map": "FiveWs.what[x]" + }, + { + "identity": "sct-concept", + "map": "< 363787002 |Observable entity| OR \r< 386053000 |Evaluation procedure|" + }, + { + "identity": "v2", + "map": "OBX-3" + }, + { + "identity": "rim", + "map": "code" + } + ] + }, + { + "id": "Observation.component:Concentration.value[x]", + "path": "Observation.component.value[x]", + "short": "Vital Sign Component Value", + "definition": "Vital Signs value are typically recorded using the Quantity data type. For supporting observations such as cuff size could use other datatypes such as CodeableConcept.", + "comment": "Used when observation has a set of component observations. An observation may have both a value (e.g. an Apgar score) and component observations (the observations from which the Apgar score was derived). If a value is present, the datatype for this element should be determined by Observation.code. A CodeableConcept with just a text would be used instead of a string if the field was usually coded, or if the type associated with the Observation.code defines a coded value. For additional guidance, see the [Notes section](http://hl7.org/fhir/observation.html#notes) below.", + "requirements": "9. SHALL contain exactly one [1..1] value with @xsi:type=\"PQ\" (CONF:7305).", + "min": 0, + "max": "1", + "base": { + "path": "Observation.component.value[x]", + "min": 0, + "max": "1" + }, + "type": [ + { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-type-must-support", + "valueBoolean": true + } + ], + "code": "Quantity" + } + ], + "condition": [ + "vs-3" + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "mustSupport": true, + "isModifier": false, + "isSummary": true, + "binding": { + "strength": "extensible", + "description": "Common UCUM units for recording Vital Signs.", + "valueSet": "http://hl7.org/fhir/ValueSet/ucum-vitals-common|4.0.1" + }, + "mapping": [ + { + "identity": "sct-concept", + "map": "363714003 |Interprets| < 441742003 |Evaluation finding|" + }, + { + "identity": "v2", + "map": "OBX.2, OBX.5, OBX.6" + }, + { + "identity": "rim", + "map": "value" + }, + { + "identity": "sct-attr", + "map": "363714003 |Interprets|" + } + ] + }, + { + "id": "Observation.component:Concentration.value[x].id", + "path": "Observation.component.value[x].id", + "representation": [ + "xmlAttr" + ], + "short": "Unique id for inter-element referencing", + "definition": "Unique id for the element within a resource (for internal references). This may be any string value that does not contain spaces.", + "min": 0, + "max": "1", + "base": { + "path": "Element.id", + "min": 0, + "max": "1" + }, + "type": [ + { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/structuredefinition-fhir-type", + "valueUrl": "string" + } + ], + "code": "http://hl7.org/fhirpath/System.String" + } + ], + "isModifier": false, + "isSummary": false, + "mapping": [ + { + "identity": "rim", + "map": "n/a" + } + ] + }, + { + "id": "Observation.component:Concentration.value[x].extension", + "path": "Observation.component.value[x].extension", + "slicing": { + "discriminator": [ + { + "type": "value", + "path": "url" + } + ], + "description": "Extensions are always sliced by (at least) url", + "rules": "open" + }, + "short": "Additional content defined by implementations", + "definition": "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": "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": [ + "extensions", + "user content" + ], + "min": 0, + "max": "*", + "base": { + "path": "Element.extension", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "Extension" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + }, + { + "key": "ext-1", + "severity": "error", + "human": "Must have either extensions or value[x], not both", + "expression": "extension.exists() != value.exists()", + "xpath": "exists(f:extension)!=exists(f:*[starts-with(local-name(.), \"value\")])", + "source": "http://hl7.org/fhir/StructureDefinition/Extension" + } + ], + "isModifier": false, + "isSummary": false, + "mapping": [ + { + "identity": "rim", + "map": "n/a" + } + ] + }, + { + "id": "Observation.component:Concentration.value[x].value", + "path": "Observation.component.value[x].value", + "short": "Numerical value (with implicit precision)", + "definition": "The value of the measured amount. The value includes an implicit precision in the presentation of the value.", + "comment": "The implicit precision in the value should always be honored. Monetary values have their own rules for handling precision (refer to standard accounting text books).", + "requirements": "Precision is handled implicitly in almost all cases of measurement.", + "min": 1, + "max": "1", + "base": { + "path": "Quantity.value", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "decimal" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "mustSupport": true, + "isModifier": false, + "isSummary": true, + "mapping": [ + { + "identity": "v2", + "map": "SN.2 / CQ - N/A" + }, + { + "identity": "rim", + "map": "PQ.value, CO.value, MO.value, IVL.high or IVL.low depending on the value" + } + ] + }, + { + "id": "Observation.component:Concentration.value[x].comparator", + "path": "Observation.component.value[x].comparator", + "short": "< | <= | >= | > - how to understand the value", + "definition": "How the value should be understood and represented - whether the actual value is greater or less than the stated value due to measurement issues; e.g. if the comparator is \"<\" , then the real value is < stated value.", + "requirements": "Need a framework for handling measures where the value is <5ug/L or >400mg/L due to the limitations of measuring methodology.", + "min": 0, + "max": "1", + "base": { + "path": "Quantity.comparator", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "code" + } + ], + "meaningWhenMissing": "If there is no comparator, then there is no modification of the value", + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": true, + "isModifierReason": "This is labeled as \"Is Modifier\" because the comparator modifies the interpretation of the value significantly. If there is no comparator, then there is no modification of the value", + "isSummary": true, + "binding": { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString": "QuantityComparator" + } + ], + "strength": "required", + "description": "How the Quantity should be understood and represented.", + "valueSet": "http://hl7.org/fhir/ValueSet/quantity-comparator|4.0.1" + }, + "mapping": [ + { + "identity": "v2", + "map": "SN.1 / CQ.1" + }, + { + "identity": "rim", + "map": "IVL properties" + } + ] + }, + { + "id": "Observation.component:Concentration.value[x].unit", + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-translatable", + "valueBoolean": true + } + ], + "path": "Observation.component.value[x].unit", + "short": "Unit representation", + "definition": "A human-readable form of the unit.", + "requirements": "There are many representations for units of measure and in many contexts, particular representations are fixed and required. I.e. mcg for micrograms.", + "min": 1, + "max": "1", + "base": { + "path": "Quantity.unit", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "string" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "mustSupport": true, + "isModifier": false, + "isSummary": true, + "mapping": [ + { + "identity": "v2", + "map": "(see OBX.6 etc.) / CQ.2" + }, + { + "identity": "rim", + "map": "PQ.unit" + } + ] + }, + { + "id": "Observation.component:Concentration.value[x].system", + "path": "Observation.component.value[x].system", + "short": "System that defines coded unit form", + "definition": "The identification of the system that provides the coded form of the unit.", + "requirements": "Need to know the system that defines the coded form of the unit.", + "min": 1, + "max": "1", + "base": { + "path": "Quantity.system", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "uri" + } + ], + "fixedUri": "http://unitsofmeasure.org", + "condition": [ + "qty-3" + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "mustSupport": true, + "isModifier": false, + "isSummary": true, + "mapping": [ + { + "identity": "v2", + "map": "(see OBX.6 etc.) / CQ.2" + }, + { + "identity": "rim", + "map": "CO.codeSystem, PQ.translation.codeSystem" + } + ] + }, + { + "id": "Observation.component:Concentration.value[x].code", + "path": "Observation.component.value[x].code", + "short": "Coded form of the unit", + "definition": "A computer processable form of the unit in some unit representation system.", + "comment": "The preferred system is UCUM, but SNOMED CT can also be used (for customary units) or ISO 4217 for currency. The context of use may additionally require a code from a particular system.", + "requirements": "Need a computable form of the unit that is fixed across all forms. UCUM provides this for quantities, but SNOMED CT provides many units of interest.", + "min": 1, + "max": "1", + "base": { + "path": "Quantity.code", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "code" + } + ], + "fixedCode": "%", + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "mustSupport": true, + "isModifier": false, + "isSummary": true, + "mapping": [ + { + "identity": "v2", + "map": "(see OBX.6 etc.) / CQ.2" + }, + { + "identity": "rim", + "map": "PQ.code, MO.currency, PQ.translation.code" + } + ] + }, + { + "id": "Observation.component:Concentration.dataAbsentReason", + "path": "Observation.component.dataAbsentReason", + "short": "Why the component result is missing", + "definition": "Provides a reason why the expected value in the element Observation.component.value[x] is missing.", + "comment": "\"Null\" or exceptional values can be represented two ways in FHIR Observations. One way is to simply include them in the value set and represent the exceptions in the value. For example, measurement values for a serology test could be \"detected\", \"not detected\", \"inconclusive\", or \"test not done\". \n\nThe alternate way is to use the value element for actual observations and use the explicit dataAbsentReason element to record exceptional values. For example, the dataAbsentReason code \"error\" could be used when the measurement was not completed. Because of these options, use-case agreements are required to interpret general observations for exceptional values.", + "requirements": "For many results it is necessary to handle exceptional values in measurements.", + "min": 0, + "max": "1", + "base": { + "path": "Observation.component.dataAbsentReason", + "min": 0, + "max": "1" + }, + "type": [ + { + "code": "CodeableConcept" + } + ], + "condition": [ + "obs-6", + "vs-3" + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "mustSupport": true, + "isModifier": false, + "isSummary": false, + "binding": { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString": "ObservationValueAbsentReason" + } + ], + "strength": "extensible", + "description": "Codes specifying why the result (`Observation.value[x]`) is missing.", + "valueSet": "http://hl7.org/fhir/ValueSet/data-absent-reason" + }, + "mapping": [ + { + "identity": "v2", + "map": "N/A" + }, + { + "identity": "rim", + "map": "value.nullFlavor" + } + ] + }, + { + "id": "Observation.component:Concentration.interpretation", + "path": "Observation.component.interpretation", + "short": "High, low, normal, etc.", + "definition": "A categorical assessment of an observation value. For example, high, low, normal.", + "comment": "Historically used for laboratory results (known as 'abnormal flag' ), its use extends to other use cases where coded interpretations are relevant. Often reported as one or more simple compact codes this element is often placed adjacent to the result value in reports and flow sheets to signal the meaning/normalcy status of the result.", + "requirements": "For some results, particularly numeric results, an interpretation is necessary to fully understand the significance of a result.", + "alias": [ + "Abnormal Flag" + ], + "min": 0, + "max": "*", + "base": { + "path": "Observation.component.interpretation", + "min": 0, + "max": "*" + }, + "type": [ + { + "code": "CodeableConcept" + } + ], + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": false, + "isSummary": false, + "binding": { + "extension": [ + { + "url": "http://hl7.org/fhir/StructureDefinition/elementdefinition-bindingName", + "valueString": "ObservationInterpretation" + } + ], + "strength": "extensible", + "description": "Codes identifying interpretations of observations.", + "valueSet": "http://hl7.org/fhir/ValueSet/observation-interpretation" + }, + "mapping": [ + { + "identity": "sct-concept", + "map": "< 260245000 |Findings values|" + }, + { + "identity": "v2", + "map": "OBX-8" + }, + { + "identity": "rim", + "map": "interpretationCode" + }, + { + "identity": "sct-attr", + "map": "363713009 |Has interpretation|" + } + ] + }, + { + "id": "Observation.component:Concentration.referenceRange", + "path": "Observation.component.referenceRange", + "short": "Provides guide for interpretation of component result", + "definition": "Guidance on how to interpret the value by comparison to a normal or recommended range.", + "comment": "Most observations only have one generic reference range. Systems MAY choose to restrict to only supplying the relevant reference range based on knowledge about the patient (e.g., specific to the patient's age, gender, weight and other factors), but this might not be possible or appropriate. Whenever more than one reference range is supplied, the differences between them SHOULD be provided in the reference range and/or age properties.", + "requirements": "Knowing what values are considered \"normal\" can help evaluate the significance of a particular result. Need to be able to provide multiple reference ranges for different contexts.", + "min": 0, + "max": "*", + "base": { + "path": "Observation.component.referenceRange", + "min": 0, + "max": "*" + }, + "contentReference": "http://hl7.org/fhir/StructureDefinition/Observation#Observation.referenceRange", + "constraint": [ + { + "key": "ele-1", + "severity": "error", + "human": "All FHIR elements must have a @value or children", + "expression": "hasValue() or (children().count() > id.count())", + "xpath": "@value|f:*|h:div", + "source": "http://hl7.org/fhir/StructureDefinition/Element" + } + ], + "isModifier": false, + "isSummary": false, + "mapping": [ + { + "identity": "v2", + "map": "OBX.7" + }, + { + "identity": "rim", + "map": "outboundRelationship[typeCode=REFV]/target[classCode=OBS, moodCode=EVN]" + } + ] + } + ] + }, + "differential": { + "element": [ + { + "id": "Observation", + "path": "Observation", + "short": "US Core Pulse Oximetry Profile", + "definition": "Defines constraints on the Observation resource to represent inspired O2 by pulse oximetry and inspired oxygen concentration observations with a standard LOINC codes and UCUM units of measure. This profile is derived from the US Core Vital Signs Profile.", + "mustSupport": false + }, + { + "id": "Observation.code", + "path": "Observation.code", + "short": "Oxygen Saturation by Pulse Oximetry", + "comment": "The code (59408-5 Oxygen saturation in Arterial blood by Pulse oximetry) is included as an additional observation code to FHIR Core vital Oxygen Saturation code (2708-6 Oxygen saturation in Arterial blood).", + "mustSupport": true + }, + { + "id": "Observation.code.coding", + "path": "Observation.code.coding", + "slicing": { + "discriminator": [ + { + "type": "pattern", + "path": "$this" + } + ], + "rules": "open" + }, + "mustSupport": true + }, + { + "id": "Observation.code.coding:PulseOx", + "path": "Observation.code.coding", + "sliceName": "PulseOx", + "min": 1, + "max": "1", + "type": [ + { + "code": "Coding" + } + ], + "patternCoding": { + "system": "http://loinc.org", + "code": "59408-5" + }, + "mustSupport": true + }, + { + "id": "Observation.code.coding:O2Sat", + "path": "Observation.code.coding", + "sliceName": "O2Sat", + "min": 1, + "max": "1", + "type": [ + { + "code": "Coding" + } + ], + "patternCoding": { + "system": "http://loinc.org", + "code": "2708-6" + }, + "mustSupport": true + }, + { + "id": "Observation.component", + "path": "Observation.component", + "slicing": { + "discriminator": [ + { + "type": "pattern", + "path": "code" + } + ], + "rules": "open" + }, + "short": "Used when reporting flow rates or oxygen concentration.", + "definition": "Used when reporting flow rates or oxygen concentration.", + "mustSupport": true + }, + { + "id": "Observation.component:FlowRate", + "path": "Observation.component", + "sliceName": "FlowRate", + "short": "Inhaled oxygen flow rate", + "min": 0, + "max": "1", + "mustSupport": true + }, + { + "id": "Observation.component:FlowRate.code", + "path": "Observation.component.code", + "type": [ + { + "code": "CodeableConcept" + } + ], + "patternCodeableConcept": { + "coding": [ + { + "system": "http://loinc.org", + "code": "3151-8" + } + ] + }, + "mustSupport": true + }, + { + "id": "Observation.component:FlowRate.valueQuantity", + "path": "Observation.component.valueQuantity", + "mustSupport": true + }, + { + "id": "Observation.component:FlowRate.valueQuantity.value", + "path": "Observation.component.valueQuantity.value", + "min": 1, + "max": "1", + "mustSupport": true + }, + { + "id": "Observation.component:FlowRate.valueQuantity.unit", + "path": "Observation.component.valueQuantity.unit", + "min": 1, + "max": "1", + "mustSupport": true + }, + { + "id": "Observation.component:FlowRate.valueQuantity.system", + "path": "Observation.component.valueQuantity.system", + "min": 1, + "max": "1", + "type": [ + { + "code": "uri" + } + ], + "fixedUri": "http://unitsofmeasure.org", + "mustSupport": true + }, + { + "id": "Observation.component:FlowRate.valueQuantity.code", + "path": "Observation.component.valueQuantity.code", + "min": 1, + "max": "1", + "type": [ + { + "code": "code" + } + ], + "fixedCode": "L/min", + "mustSupport": true + }, + { + "id": "Observation.component:Concentration", + "path": "Observation.component", + "sliceName": "Concentration", + "short": "Inhaled oxygen concentration", + "min": 0, + "max": "1", + "mustSupport": true + }, + { + "id": "Observation.component:Concentration.code", + "path": "Observation.component.code", + "type": [ + { + "code": "CodeableConcept" + } + ], + "patternCodeableConcept": { + "coding": [ + { + "system": "http://loinc.org", + "code": "3150-0" + } + ] + }, + "mustSupport": true + }, + { + "id": "Observation.component:Concentration.valueQuantity", + "path": "Observation.component.valueQuantity", + "mustSupport": true + }, + { + "id": "Observation.component:Concentration.valueQuantity.value", + "path": "Observation.component.valueQuantity.value", + "min": 1, + "max": "1", + "mustSupport": true + }, + { + "id": "Observation.component:Concentration.valueQuantity.unit", + "path": "Observation.component.valueQuantity.unit", + "min": 1, + "max": "1", + "mustSupport": true + }, + { + "id": "Observation.component:Concentration.valueQuantity.system", + "path": "Observation.component.valueQuantity.system", + "min": 1, + "max": "1", + "type": [ + { + "code": "uri" + } + ], + "fixedUri": "http://unitsofmeasure.org", + "mustSupport": true + }, + { + "id": "Observation.component:Concentration.valueQuantity.code", + "path": "Observation.component.valueQuantity.code", + "min": 1, + "max": "1", + "type": [ + { + "code": "code" + } + ], + "fixedCode": "%", + "mustSupport": true + } + ] + } +} \ No newline at end of file diff --git a/spec/fixtures/metadata/condition_problems_health_concerns_v501.yml b/spec/fixtures/metadata/condition_problems_health_concerns_v501.yml new file mode 100644 index 000000000..d6cb6293e --- /dev/null +++ b/spec/fixtures/metadata/condition_problems_health_concerns_v501.yml @@ -0,0 +1,359 @@ +--- +:name: us_core_condition_problems_health_concerns +:class_name: USCorev501ConditionProblemsHealthConcernsSequence +:version: v5.0.1 +:reformatted_version: v501 +:resource: Condition +:profile_url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-condition-problems-health-concerns +:profile_name: US Core Condition Problems and Health Concerns Profile +:profile_version: 5.0.1 +:title: Condition Problems and Health Concerns +:short_description: Verify support for the server capabilities required by the US + Core Condition Problems and Health Concerns Profile. +:is_delayed: false +:interactions: +- :code: create + :expectation: MAY +- :code: search-type + :expectation: SHALL +- :code: read + :expectation: SHALL +- :code: vread + :expectation: SHOULD +- :code: update + :expectation: MAY +- :code: patch + :expectation: MAY +- :code: delete + :expectation: MAY +- :code: history-instance + :expectation: SHOULD +- :code: history-type + :expectation: MAY +:operations: [] +:searches: +- :names: + - patient + :expectation: SHALL + :names_not_must_support_or_mandatory: [] + :must_support_or_mandatory: true +- :expectation: SHOULD + :names: + - patient + - abatement-date + :names_not_must_support_or_mandatory: [] + :must_support_or_mandatory: true +- :expectation: SHOULD + :names: + - patient + - asserted-date + :names_not_must_support_or_mandatory: + - asserted-date + :must_support_or_mandatory: false +- :expectation: SHOULD + :names: + - patient + - code + :names_not_must_support_or_mandatory: [] + :must_support_or_mandatory: true +- :expectation: SHOULD + :names: + - patient + - category + - encounter + :names_not_must_support_or_mandatory: + - encounter + :must_support_or_mandatory: false +- :expectation: SHOULD + :names: + - patient + - category + :names_not_must_support_or_mandatory: [] + :must_support_or_mandatory: true +- :expectation: SHOULD + :names: + - patient + - recorded-date + :names_not_must_support_or_mandatory: [] + :must_support_or_mandatory: true +- :expectation: SHOULD + :names: + - patient + - onset-date + :names_not_must_support_or_mandatory: [] + :must_support_or_mandatory: true +- :expectation: SHOULD + :names: + - patient + - clinical-status + :names_not_must_support_or_mandatory: [] + :must_support_or_mandatory: true +:search_definitions: + :patient: + :paths: + - subject + :full_paths: + - Condition.subject + :comparators: {} + :values: [] + :type: Reference + :contains_multiple: false + :multiple_or: MAY + :abatement-date: + :paths: + - abatementDateTime + - abatementPeriod + :full_paths: + - Condition.abatementDateTime + - Condition.abatementPeriod + :comparators: + :eq: MAY + :ne: MAY + :gt: SHALL + :ge: SHALL + :lt: SHALL + :le: SHALL + :sa: MAY + :eb: MAY + :ap: MAY + :values: [] + :type: date + :contains_multiple: false + :multiple_or: MAY + :asserted-date: + :paths: + - extension.where(url='http://hl7.org/fhir/StructureDefinition/condition-assertedDate').valueDateTime + :full_paths: + - Condition.extension.where(url='http://hl7.org/fhir/StructureDefinition/condition-assertedDate').valueDateTime + :comparators: + :eq: MAY + :ne: MAY + :gt: SHALL + :ge: SHALL + :lt: SHALL + :le: SHALL + :sa: MAY + :eb: MAY + :ap: MAY + :values: [] + :type: dateTime + :contains_multiple: false + :multiple_or: MAY + :code: + :paths: + - code + :full_paths: + - Condition.code + :comparators: {} + :values: + - '160245001' + :type: CodeableConcept + :contains_multiple: false + :multiple_or: MAY + :category: + :paths: + - category + :full_paths: + - Condition.category + :comparators: {} + :values: + - problem-list-item + - health-concern + :type: CodeableConcept + :contains_multiple: true + :multiple_or: MAY + :encounter: + :paths: + - encounter + :full_paths: + - Condition.encounter + :comparators: {} + :values: [] + :type: Reference + :contains_multiple: false + :multiple_or: MAY + :recorded-date: + :paths: + - recordedDate + :full_paths: + - Condition.recordedDate + :comparators: + :eq: MAY + :ne: MAY + :gt: SHALL + :ge: SHALL + :lt: SHALL + :le: SHALL + :sa: MAY + :eb: MAY + :ap: MAY + :values: [] + :type: dateTime + :contains_multiple: false + :multiple_or: MAY + :onset-date: + :paths: + - onsetDateTime + - onsetPeriod + :full_paths: + - Condition.onsetDateTime + - Condition.onsetPeriod + :comparators: + :eq: MAY + :ne: MAY + :gt: SHALL + :ge: SHALL + :lt: SHALL + :le: SHALL + :sa: MAY + :eb: MAY + :ap: MAY + :values: [] + :type: date + :contains_multiple: false + :multiple_or: MAY + :clinical-status: + :paths: + - clinicalStatus + :full_paths: + - Condition.clinicalStatus + :comparators: {} + :values: + - active + - recurrence + - relapse + - inactive + - remission + - resolved + :type: CodeableConcept + :contains_multiple: false + :multiple_or: MAY +:include_params: [] +:revincludes: +- Provenance:target +:required_concepts: +- clinicalStatus +- verificationStatus +- category +:must_supports: + :extensions: + - :id: Condition.extension:assertedDate + :path: extension + :url: http://hl7.org/fhir/StructureDefinition/condition-assertedDate + :slices: + - :slice_id: Condition.category:us-core + :slice_name: us-core + :path: category + :discriminator: + :type: requiredBinding + :path: '' + :values: + - :system: http://terminology.hl7.org/CodeSystem/condition-category + :code: problem-list-item + - :system: http://hl7.org/fhir/us/core/CodeSystem/condition-category + :code: health-concern + - :slice_id: Condition.category:sdoh + :slice_name: sdoh + :path: category + :discriminator: + :type: patternCodeableConcept + :path: '' + :code: sdoh + :system: http://hl7.org/fhir/us/core/CodeSystem/us-core-tags + :elements: + - :path: clinicalStatus + - :path: verificationStatus + - :path: category + - :path: code + - :path: subject + :types: + - Reference + :target_profiles: + - http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient + - :path: onsetDateTime + :original_path: onset[x] + - :path: abatementDateTime + :original_path: abatement[x] + - :path: recordedDate + :choices: + - :paths: + - onsetDateTime + :extension_ids: + - Condition.extension:assertedDate +:mandatory_elements: +- Condition.category +- Condition.code +- Condition.subject +:bindings: +- :type: CodeableConcept + :strength: required + :system: http://hl7.org/fhir/ValueSet/condition-clinical + :path: clinicalStatus +- :type: CodeableConcept + :strength: required + :system: http://hl7.org/fhir/ValueSet/condition-ver-status + :path: verificationStatus +- :type: CodeableConcept + :strength: required + :system: http://hl7.org/fhir/us/core/ValueSet/us-core-problem-or-health-concern + :path: category + :required_binding_slice: true +:references: +- :path: Condition.subject + :profiles: + - http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient +- :path: Condition.encounter + :profiles: + - http://hl7.org/fhir/StructureDefinition/Encounter +- :path: Condition.recorder + :profiles: + - http://hl7.org/fhir/StructureDefinition/Practitioner + - http://hl7.org/fhir/StructureDefinition/PractitionerRole + - http://hl7.org/fhir/StructureDefinition/Patient + - http://hl7.org/fhir/StructureDefinition/RelatedPerson +- :path: Condition.asserter + :profiles: + - http://hl7.org/fhir/StructureDefinition/Practitioner + - http://hl7.org/fhir/StructureDefinition/PractitionerRole + - http://hl7.org/fhir/StructureDefinition/Patient + - http://hl7.org/fhir/StructureDefinition/RelatedPerson +- :path: Condition.stage.assessment + :profiles: + - http://hl7.org/fhir/StructureDefinition/ClinicalImpression + - http://hl7.org/fhir/StructureDefinition/DiagnosticReport + - http://hl7.org/fhir/StructureDefinition/Observation +- :path: Condition.evidence.detail + :profiles: + - http://hl7.org/fhir/StructureDefinition/Resource +:tests: +- :id: us_core_v501_condition_problems_health_concerns_patient_search_test + :file_name: condition_problems_health_concerns_patient_search_test.rb +- :id: us_core_v501_condition_problems_health_concerns_patient_abatement_date_search_test + :file_name: condition_problems_health_concerns_patient_abatement_date_search_test.rb +- :id: us_core_v501_condition_problems_health_concerns_patient_asserted_date_search_test + :file_name: condition_problems_health_concerns_patient_asserted_date_search_test.rb +- :id: us_core_v501_condition_problems_health_concerns_patient_code_search_test + :file_name: condition_problems_health_concerns_patient_code_search_test.rb +- :id: us_core_v501_condition_problems_health_concerns_patient_category_encounter_search_test + :file_name: condition_problems_health_concerns_patient_category_encounter_search_test.rb +- :id: us_core_v501_condition_problems_health_concerns_patient_category_search_test + :file_name: condition_problems_health_concerns_patient_category_search_test.rb +- :id: us_core_v501_condition_problems_health_concerns_patient_recorded_date_search_test + :file_name: condition_problems_health_concerns_patient_recorded_date_search_test.rb +- :id: us_core_v501_condition_problems_health_concerns_patient_onset_date_search_test + :file_name: condition_problems_health_concerns_patient_onset_date_search_test.rb +- :id: us_core_v501_condition_problems_health_concerns_patient_clinical_status_search_test + :file_name: condition_problems_health_concerns_patient_clinical_status_search_test.rb +- :id: us_core_v501_condition_problems_health_concerns_read_test + :file_name: condition_problems_health_concerns_read_test.rb +- :id: us_core_v501_condition_problems_health_concerns_provenance_revinclude_search_test + :file_name: condition_problems_health_concerns_provenance_revinclude_search_test.rb +- :id: us_core_v501_condition_problems_health_concerns_validation_test + :file_name: condition_problems_health_concerns_validation_test.rb +- :id: us_core_v501_condition_problems_health_concerns_must_support_test + :file_name: condition_problems_health_concerns_must_support_test.rb +- :id: us_core_v501_condition_problems_health_concerns_reference_resolution_test + :file_name: condition_problems_health_concerns_reference_resolution_test.rb +:id: us_core_v501_condition_problems_health_concerns +:file_name: condition_problems_health_concerns_group.rb +:delayed_references: [] diff --git a/spec/fixtures/metadata/coverage_v610.yml b/spec/fixtures/metadata/coverage_v610.yml new file mode 100644 index 000000000..c85a16460 --- /dev/null +++ b/spec/fixtures/metadata/coverage_v610.yml @@ -0,0 +1,167 @@ +--- +:name: us_core_coverage +:class_name: USCorev610CoverageSequence +:version: v6.1.0 +:reformatted_version: v610 +:resource: Coverage +:profile_url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-coverage +:profile_name: US Core Coverage Profile +:profile_version: 6.1.0 +:title: Coverage +:short_description: Verify support for the server capabilities required by the US + Core Coverage Profile. +:is_delayed: false +:interactions: +- :code: create + :expectation: MAY +- :code: search-type + :expectation: SHALL +- :code: read + :expectation: SHALL +- :code: vread + :expectation: SHOULD +- :code: update + :expectation: MAY +- :code: patch + :expectation: MAY +- :code: delete + :expectation: MAY +- :code: history-instance + :expectation: SHOULD +- :code: history-type + :expectation: MAY +:operations: [] +:searches: +- :names: + - patient + :expectation: SHALL + :names_not_must_support_or_mandatory: [] + :must_support_or_mandatory: true +:search_definitions: + :patient: + :paths: + - beneficiary + :full_paths: + - Coverage.beneficiary + :comparators: {} + :values: [] + :type: Reference + :contains_multiple: false + :multiple_or: MAY +:include_params: [] +:revincludes: +- Provenance:target +:required_concepts: [] +:must_supports: + :extensions: [] + :slices: + - :slice_id: Coverage.identifier:memberid + :slice_name: memberid + :path: identifier + :discriminator: + :type: patternCodeableConcept + :path: type + :code: MB + :system: http://terminology.hl7.org/CodeSystem/v2-0203 + - :slice_id: Coverage.class:group + :slice_name: group + :path: class + :discriminator: + :type: patternCodeableConcept + :path: type + :code: group + :system: http://terminology.hl7.org/CodeSystem/coverage-class + - :slice_id: Coverage.class:plan + :slice_name: plan + :path: class + :discriminator: + :type: patternCodeableConcept + :path: type + :code: plan + :system: http://terminology.hl7.org/CodeSystem/coverage-class + :elements: + - :path: identifier + - :path: identifier:memberid.type + - :path: status + - :path: type + - :path: subscriberId + - :path: beneficiary + :types: + - Reference + :target_profiles: + - http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient + - :path: relationship + - :path: period + - :path: payor + :types: + - Reference + :target_profiles: + - http://hl7.org/fhir/us/core/StructureDefinition/us-core-organization + - :path: class + - :path: class:group.value + - :path: class:group.name + - :path: class:plan.value + - :path: class:plan.name +:mandatory_elements: +- Coverage.identifier.type +- Coverage.status +- Coverage.beneficiary +- Coverage.relationship +- Coverage.payor +- Coverage.class.type +- Coverage.class.value +- Coverage.costToBeneficiary.value[x] +- Coverage.costToBeneficiary.exception.type +:bindings: +- :type: code + :strength: required + :system: http://hl7.org/fhir/ValueSet/identifier-use + :path: identifier.use +- :type: code + :strength: required + :system: http://hl7.org/fhir/ValueSet/fm-status + :path: status +:references: +- :path: Coverage.identifier.assigner + :profiles: + - http://hl7.org/fhir/StructureDefinition/Organization +- :path: Coverage.policyHolder + :profiles: + - http://hl7.org/fhir/StructureDefinition/Patient + - http://hl7.org/fhir/StructureDefinition/RelatedPerson + - http://hl7.org/fhir/StructureDefinition/Organization +- :path: Coverage.subscriber + :profiles: + - http://hl7.org/fhir/StructureDefinition/Patient + - http://hl7.org/fhir/StructureDefinition/RelatedPerson +- :path: Coverage.beneficiary + :profiles: + - http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient +- :path: Coverage.payor + :profiles: + - http://hl7.org/fhir/us/core/StructureDefinition/us-core-organization + - http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient + - http://hl7.org/fhir/us/core/StructureDefinition/us-core-relatedperson +- :path: Coverage.contract + :profiles: + - http://hl7.org/fhir/StructureDefinition/Contract +:tests: +- :id: us_core_v610_coverage_patient_search_test + :file_name: coverage_patient_search_test.rb +- :id: us_core_v610_coverage_read_test + :file_name: coverage_read_test.rb +- :id: us_core_v610_coverage_provenance_revinclude_search_test + :file_name: coverage_provenance_revinclude_search_test.rb +- :id: us_core_v610_coverage_validation_test + :file_name: coverage_validation_test.rb +- :id: us_core_v610_coverage_must_support_test + :file_name: coverage_must_support_test.rb +- :id: us_core_v610_coverage_reference_resolution_test + :file_name: coverage_reference_resolution_test.rb +:id: us_core_v610_coverage +:file_name: coverage_group.rb +:delayed_references: +- :path: payor + :resources: + - Organization + - RelatedPerson diff --git a/spec/fixtures/metadata/heart_rate_v610.yml b/spec/fixtures/metadata/heart_rate_v610.yml new file mode 100644 index 000000000..7b37184d2 --- /dev/null +++ b/spec/fixtures/metadata/heart_rate_v610.yml @@ -0,0 +1,290 @@ +--- +:name: us_core_heart_rate +:class_name: USCorev610HeartRateSequence +:version: v6.1.0 +:reformatted_version: v610 +:resource: Observation +:profile_url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-heart-rate +:profile_name: US Core Heart Rate Profile +:profile_version: 6.1.0 +:title: Observation Heart Rate +:short_description: Verify support for the server capabilities required by the US + Core Heart Rate Profile. +:is_delayed: false +:interactions: +- :code: create + :expectation: MAY +- :code: search-type + :expectation: SHALL +- :code: read + :expectation: SHALL +- :code: vread + :expectation: SHOULD +- :code: update + :expectation: MAY +- :code: patch + :expectation: MAY +- :code: delete + :expectation: MAY +- :code: history-instance + :expectation: SHOULD +- :code: history-type + :expectation: MAY +:operations: [] +:searches: +- :expectation: SHALL + :names: + - patient + - code + :names_not_must_support_or_mandatory: [] + :must_support_or_mandatory: true +- :expectation: SHOULD + :names: + - patient + - code + - date + :names_not_must_support_or_mandatory: [] + :must_support_or_mandatory: true +- :expectation: SHOULD + :names: + - patient + - category + - status + :names_not_must_support_or_mandatory: [] + :must_support_or_mandatory: true +- :expectation: SHALL + :names: + - patient + - category + - date + :names_not_must_support_or_mandatory: [] + :must_support_or_mandatory: true +- :expectation: SHALL + :names: + - patient + - category + :names_not_must_support_or_mandatory: [] + :must_support_or_mandatory: true +:search_definitions: + :patient: + :paths: + - subject + :full_paths: + - Observation.subject + :comparators: {} + :values: [] + :type: Reference + :contains_multiple: false + :multiple_or: MAY + :code: + :paths: + - code + :full_paths: + - Observation.code + :comparators: {} + :values: + - 8867-4 + :type: CodeableConcept + :contains_multiple: false + :multiple_or: SHOULD + :date: + :paths: + - effective + :full_paths: + - Observation.effective + :comparators: + :eq: MAY + :ne: MAY + :gt: SHALL + :ge: SHALL + :lt: SHALL + :le: SHALL + :sa: MAY + :eb: MAY + :ap: MAY + :values: [] + :type: date + :contains_multiple: false + :multiple_or: MAY + :category: + :paths: + - category + :full_paths: + - Observation.category + :comparators: {} + :values: + - vital-signs + :type: CodeableConcept + :contains_multiple: true + :multiple_or: MAY + :status: + :paths: + - status + :full_paths: + - Observation.status + :comparators: {} + :values: + - registered + - preliminary + - final + - amended + - corrected + - cancelled + - entered-in-error + - unknown + :type: code + :contains_multiple: false + :multiple_or: SHALL +:include_params: [] +:revincludes: +- Provenance:target +:required_concepts: [] +:must_supports: + :extensions: [] + :slices: + - :slice_id: Observation.value[x]:valueQuantity + :slice_name: valueQuantity + :path: value[x] + :discriminator: + :type: type + :code: Quantity + - :slice_id: Observation.category:VSCat + :slice_name: VSCat + :path: category + :discriminator: + :type: value + :values: + - :path: coding.code + :value: vital-signs + - :path: coding.system + :value: http://terminology.hl7.org/CodeSystem/observation-category + :elements: + - :path: status + - :path: category + - :path: category:VSCat.coding + - :path: category:VSCat.coding.system + :fixed_value: http://terminology.hl7.org/CodeSystem/observation-category + - :path: category:VSCat.coding.code + :fixed_value: vital-signs + - :path: code.coding.code + :fixed_value: 8867-4 + - :path: subject + :types: + - Reference + :target_profiles: + - http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient + - :path: effectiveDateTime + :original_path: effective[x] + - :path: valueQuantity + :original_path: value[x] + - :path: valueQuantity:valueQuantity.value + :original_path: value[x]:valueQuantity.value + - :path: valueQuantity:valueQuantity.unit + :original_path: value[x]:valueQuantity.unit + - :path: valueQuantity:valueQuantity.system + :original_path: value[x]:valueQuantity.system + :fixed_value: http://unitsofmeasure.org + - :path: valueQuantity:valueQuantity.code + :original_path: value[x]:valueQuantity.code + :fixed_value: "/min" +:mandatory_elements: +- Observation.status +- Observation.category +- Observation.category.coding +- Observation.category.coding.system +- Observation.category.coding.code +- Observation.code +- Observation.subject +- Observation.effective[x] +- Observation.value[x].value +- Observation.value[x].unit +- Observation.value[x].system +- Observation.value[x].code +- Observation.component.code +:bindings: +- :type: code + :strength: required + :system: http://hl7.org/fhir/ValueSet/observation-status + :path: status +- :type: code + :strength: required + :system: http://hl7.org/fhir/ValueSet/quantity-comparator + :path: value.comparator +:references: +- :path: Observation.basedOn + :profiles: + - http://hl7.org/fhir/StructureDefinition/CarePlan + - http://hl7.org/fhir/StructureDefinition/DeviceRequest + - http://hl7.org/fhir/StructureDefinition/ImmunizationRecommendation + - http://hl7.org/fhir/StructureDefinition/MedicationRequest + - http://hl7.org/fhir/StructureDefinition/NutritionOrder + - http://hl7.org/fhir/StructureDefinition/ServiceRequest +- :path: Observation.partOf + :profiles: + - http://hl7.org/fhir/StructureDefinition/MedicationAdministration + - http://hl7.org/fhir/StructureDefinition/MedicationDispense + - http://hl7.org/fhir/StructureDefinition/MedicationStatement + - http://hl7.org/fhir/StructureDefinition/Procedure + - http://hl7.org/fhir/StructureDefinition/Immunization + - http://hl7.org/fhir/StructureDefinition/ImagingStudy +- :path: Observation.subject + :profiles: + - http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient +- :path: Observation.focus + :profiles: + - http://hl7.org/fhir/StructureDefinition/Resource +- :path: Observation.encounter + :profiles: + - http://hl7.org/fhir/StructureDefinition/Encounter +- :path: Observation.performer + :profiles: + - http://hl7.org/fhir/StructureDefinition/Practitioner + - http://hl7.org/fhir/StructureDefinition/PractitionerRole + - http://hl7.org/fhir/StructureDefinition/Organization + - http://hl7.org/fhir/StructureDefinition/CareTeam + - http://hl7.org/fhir/StructureDefinition/Patient + - http://hl7.org/fhir/StructureDefinition/RelatedPerson +- :path: Observation.specimen + :profiles: + - http://hl7.org/fhir/StructureDefinition/Specimen +- :path: Observation.device + :profiles: + - http://hl7.org/fhir/StructureDefinition/Device + - http://hl7.org/fhir/StructureDefinition/DeviceMetric +- :path: Observation.hasMember + :profiles: + - http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse + - http://hl7.org/fhir/StructureDefinition/MolecularSequence + - http://hl7.org/fhir/StructureDefinition/vitalsigns +- :path: Observation.derivedFrom + :profiles: + - http://hl7.org/fhir/StructureDefinition/DocumentReference + - http://hl7.org/fhir/StructureDefinition/ImagingStudy + - http://hl7.org/fhir/StructureDefinition/Media + - http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse + - http://hl7.org/fhir/StructureDefinition/MolecularSequence + - http://hl7.org/fhir/StructureDefinition/vitalsigns +:tests: +- :id: us_core_v610_heart_rate_patient_code_search_test + :file_name: heart_rate_patient_code_search_test.rb +- :id: us_core_v610_heart_rate_patient_code_date_search_test + :file_name: heart_rate_patient_code_date_search_test.rb +- :id: us_core_v610_heart_rate_patient_category_status_search_test + :file_name: heart_rate_patient_category_status_search_test.rb +- :id: us_core_v610_heart_rate_patient_category_date_search_test + :file_name: heart_rate_patient_category_date_search_test.rb +- :id: us_core_v610_heart_rate_patient_category_search_test + :file_name: heart_rate_patient_category_search_test.rb +- :id: us_core_v610_heart_rate_read_test + :file_name: heart_rate_read_test.rb +- :id: us_core_v610_heart_rate_provenance_revinclude_search_test + :file_name: heart_rate_provenance_revinclude_search_test.rb +- :id: us_core_v610_heart_rate_validation_test + :file_name: heart_rate_validation_test.rb +- :id: us_core_v610_heart_rate_must_support_test + :file_name: heart_rate_must_support_test.rb +- :id: us_core_v610_heart_rate_reference_resolution_test + :file_name: heart_rate_reference_resolution_test.rb +:id: us_core_v610_heart_rate +:file_name: heart_rate_group.rb +:delayed_references: [] diff --git a/spec/fixtures/metadata/medication_request_v501.yml b/spec/fixtures/metadata/medication_request_v501.yml new file mode 100644 index 000000000..9ec0189ea --- /dev/null +++ b/spec/fixtures/metadata/medication_request_v501.yml @@ -0,0 +1,305 @@ +--- +:name: us_core_medicationrequest +:class_name: USCorev501MedicationrequestSequence +:version: v5.0.1 +:reformatted_version: v501 +:resource: MedicationRequest +:profile_url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-medicationrequest +:profile_name: US Core MedicationRequest Profile +:profile_version: 5.0.1 +:title: MedicationRequest +:short_description: Verify support for the server capabilities required by the US + Core MedicationRequest Profile. +:is_delayed: false +:interactions: +- :code: create + :expectation: MAY +- :code: search-type + :expectation: SHALL +- :code: read + :expectation: SHALL +- :code: vread + :expectation: SHOULD +- :code: update + :expectation: MAY +- :code: patch + :expectation: MAY +- :code: delete + :expectation: MAY +- :code: history-instance + :expectation: SHOULD +- :code: history-type + :expectation: MAY +:operations: [] +:searches: +- :expectation: SHALL + :names: + - patient + - intent + :names_not_must_support_or_mandatory: [] + :must_support_or_mandatory: true +- :expectation: SHALL + :names: + - patient + - intent + - status + :names_not_must_support_or_mandatory: [] + :must_support_or_mandatory: true +- :expectation: SHOULD + :names: + - patient + - intent + - authoredon + :names_not_must_support_or_mandatory: [] + :must_support_or_mandatory: true +- :expectation: SHOULD + :names: + - patient + - intent + - encounter + :names_not_must_support_or_mandatory: [] + :must_support_or_mandatory: true +:search_definitions: + :patient: + :paths: + - subject + :full_paths: + - MedicationRequest.subject + :comparators: {} + :values: [] + :type: Reference + :contains_multiple: false + :multiple_or: MAY + :intent: + :paths: + - intent + :full_paths: + - MedicationRequest.intent + :comparators: {} + :values: + - proposal + - plan + - order + - original-order + - reflex-order + - filler-order + - instance-order + - option + :type: code + :contains_multiple: false + :multiple_or: SHALL + :status: + :paths: + - status + :full_paths: + - MedicationRequest.status + :comparators: {} + :values: + - active + - on-hold + - cancelled + - completed + - entered-in-error + - stopped + - draft + - unknown + :type: code + :contains_multiple: false + :multiple_or: SHALL + :authoredon: + :paths: + - authoredOn + :full_paths: + - MedicationRequest.authoredOn + :comparators: + :eq: MAY + :ne: MAY + :gt: SHALL + :ge: SHALL + :lt: SHALL + :le: SHALL + :sa: MAY + :eb: MAY + :ap: MAY + :values: [] + :type: dateTime + :contains_multiple: false + :multiple_or: MAY + :encounter: + :paths: + - encounter + :full_paths: + - MedicationRequest.encounter + :comparators: {} + :values: [] + :type: Reference + :contains_multiple: false + :multiple_or: MAY +:include_params: +- MedicationRequest:medication +:revincludes: +- Provenance:target +:required_concepts: +- category +:must_supports: + :extensions: [] + :slices: + - :slice_id: MedicationRequest.category:us-core + :slice_name: us-core + :path: category + :discriminator: + :type: requiredBinding + :path: '' + :values: + - :system: http://terminology.hl7.org/CodeSystem/medicationrequest-category + :code: inpatient + - :system: http://terminology.hl7.org/CodeSystem/medicationrequest-category + :code: outpatient + - :system: http://terminology.hl7.org/CodeSystem/medicationrequest-category + :code: community + - :system: http://terminology.hl7.org/CodeSystem/medicationrequest-category + :code: discharge + :elements: + - :path: status + - :path: intent + - :path: category + - :path: reportedBoolean + :original_path: reported[x] + - :path: reportedReference + :original_path: reported[x] + :types: + - Reference + :target_profiles: + - http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitioner + - :path: medication[x] + :types: + - Reference + - :path: subject + :types: + - Reference + :target_profiles: + - http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient + - :path: encounter + :types: + - Reference + :target_profiles: + - http://hl7.org/fhir/us/core/StructureDefinition/us-core-encounter + - :path: authoredOn + - :path: requester + :types: + - Reference + :target_profiles: + - http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitioner + - :path: dosageInstruction + - :path: dosageInstruction.text + :choices: + - :paths: + - reportedBoolean + - reportedReference +:mandatory_elements: +- MedicationRequest.status +- MedicationRequest.intent +- MedicationRequest.medication[x] +- MedicationRequest.subject +- MedicationRequest.requester +- MedicationRequest.substitution.allowed[x] +:bindings: +- :type: code + :strength: required + :system: http://hl7.org/fhir/ValueSet/medicationrequest-status + :path: status +- :type: code + :strength: required + :system: http://hl7.org/fhir/ValueSet/medicationrequest-intent + :path: intent +- :type: code + :strength: required + :system: http://hl7.org/fhir/ValueSet/request-priority + :path: priority +:references: +- :path: MedicationRequest.subject + :profiles: + - http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient +- :path: MedicationRequest.encounter + :profiles: + - http://hl7.org/fhir/us/core/StructureDefinition/us-core-encounter +- :path: MedicationRequest.supportingInformation + :profiles: + - http://hl7.org/fhir/StructureDefinition/Resource +- :path: MedicationRequest.requester + :profiles: + - http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitioner + - http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient + - http://hl7.org/fhir/us/core/StructureDefinition/us-core-organization + - http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitionerrole + - http://hl7.org/fhir/us/core/StructureDefinition/us-core-relatedperson + - http://hl7.org/fhir/StructureDefinition/Device +- :path: MedicationRequest.performer + :profiles: + - http://hl7.org/fhir/StructureDefinition/Practitioner + - http://hl7.org/fhir/StructureDefinition/PractitionerRole + - http://hl7.org/fhir/StructureDefinition/Organization + - http://hl7.org/fhir/StructureDefinition/Patient + - http://hl7.org/fhir/StructureDefinition/Device + - http://hl7.org/fhir/StructureDefinition/RelatedPerson + - http://hl7.org/fhir/StructureDefinition/CareTeam +- :path: MedicationRequest.recorder + :profiles: + - http://hl7.org/fhir/StructureDefinition/Practitioner + - http://hl7.org/fhir/StructureDefinition/PractitionerRole +- :path: MedicationRequest.reasonReference + :profiles: + - http://hl7.org/fhir/StructureDefinition/Condition + - http://hl7.org/fhir/StructureDefinition/Observation +- :path: MedicationRequest.basedOn + :profiles: + - http://hl7.org/fhir/StructureDefinition/CarePlan + - http://hl7.org/fhir/StructureDefinition/MedicationRequest + - http://hl7.org/fhir/StructureDefinition/ServiceRequest + - http://hl7.org/fhir/StructureDefinition/ImmunizationRecommendation +- :path: MedicationRequest.insurance + :profiles: + - http://hl7.org/fhir/StructureDefinition/Coverage + - http://hl7.org/fhir/StructureDefinition/ClaimResponse +- :path: MedicationRequest.dispenseRequest.performer + :profiles: + - http://hl7.org/fhir/StructureDefinition/Organization +- :path: MedicationRequest.priorPrescription + :profiles: + - http://hl7.org/fhir/StructureDefinition/MedicationRequest +- :path: MedicationRequest.detectedIssue + :profiles: + - http://hl7.org/fhir/StructureDefinition/DetectedIssue +- :path: MedicationRequest.eventHistory + :profiles: + - http://hl7.org/fhir/StructureDefinition/Provenance +:tests: +- :id: us_core_v501_medication_request_patient_intent_search_test + :file_name: medication_request_patient_intent_search_test.rb +- :id: us_core_v501_medication_request_patient_intent_status_search_test + :file_name: medication_request_patient_intent_status_search_test.rb +- :id: us_core_v501_medication_request_patient_intent_authoredon_search_test + :file_name: medication_request_patient_intent_authoredon_search_test.rb +- :id: us_core_v501_medication_request_patient_intent_encounter_search_test + :file_name: medication_request_patient_intent_encounter_search_test.rb +- :id: us_core_v501_medication_request_read_test + :file_name: medication_request_read_test.rb +- :id: us_core_v501_medication_request_provenance_revinclude_search_test + :file_name: medication_request_provenance_revinclude_search_test.rb +- :id: us_core_v501_medication_request_validation_test + :file_name: medication_request_validation_test.rb +- :id: us_core_v501_medication_validation_test + :file_name: medication_validation_test.rb +- :id: us_core_v501_medication_request_must_support_test + :file_name: medication_request_must_support_test.rb +- :id: us_core_v501_medication_request_reference_resolution_test + :file_name: medication_request_reference_resolution_test.rb +:id: us_core_v501_medication_request +:file_name: medication_request_group.rb +:delayed_references: +- :path: requester + :resources: + - Practitioner + - Organization + - PractitionerRole + - RelatedPerson diff --git a/spec/fixtures/metadata/patient_v311.yml b/spec/fixtures/metadata/patient_v311.yml new file mode 100644 index 000000000..c008ab41c --- /dev/null +++ b/spec/fixtures/metadata/patient_v311.yml @@ -0,0 +1,325 @@ +--- +:name: us_core_patient +:class_name: USCorev311PatientSequence +:version: v3.1.1 +:reformatted_version: v311 +:resource: Patient +:profile_url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient +:profile_name: US Core Patient Profile +:profile_version: 3.1.1 +:title: Patient +:short_description: Verify support for the server capabilities required by the US + Core Patient Profile. +:is_delayed: false +:interactions: +- :code: create + :expectation: MAY +- :code: search-type + :expectation: SHALL +- :code: read + :expectation: SHALL +- :code: vread + :expectation: SHOULD +- :code: update + :expectation: MAY +- :code: patch + :expectation: MAY +- :code: delete + :expectation: MAY +- :code: history-instance + :expectation: SHOULD +- :code: history-type + :expectation: MAY +:operations: [] +:searches: +- :names: + - _id + :expectation: SHALL + :names_not_must_support_or_mandatory: [] + :must_support_or_mandatory: true +- :names: + - identifier + :expectation: SHALL + :names_not_must_support_or_mandatory: [] + :must_support_or_mandatory: true +- :names: + - name + :expectation: SHALL + :names_not_must_support_or_mandatory: [] + :must_support_or_mandatory: true +- :expectation: SHOULD + :names: + - birthdate + - family + :names_not_must_support_or_mandatory: [] + :must_support_or_mandatory: true +- :expectation: SHOULD + :names: + - family + - gender + :names_not_must_support_or_mandatory: [] + :must_support_or_mandatory: true +- :expectation: SHALL + :names: + - birthdate + - name + :names_not_must_support_or_mandatory: [] + :must_support_or_mandatory: true +- :expectation: SHALL + :names: + - gender + - name + :names_not_must_support_or_mandatory: [] + :must_support_or_mandatory: true +:search_definitions: + :_id: + :paths: + - id + :full_paths: + - Patient.id + :comparators: {} + :values: [] + :type: http://hl7.org/fhirpath/System.String + :contains_multiple: false + :multiple_or: MAY + :identifier: + :paths: + - identifier + :full_paths: + - Patient.identifier + :comparators: {} + :values: [] + :type: Identifier + :contains_multiple: true + :multiple_or: MAY + :name: + :paths: + - name + :full_paths: + - Patient.name + :comparators: {} + :values: [] + :type: HumanName + :contains_multiple: true + :multiple_or: MAY + :birthdate: + :paths: + - birthDate + :full_paths: + - Patient.birthDate + :comparators: + :eq: MAY + :ne: MAY + :gt: MAY + :ge: MAY + :lt: MAY + :le: MAY + :sa: MAY + :eb: MAY + :ap: MAY + :values: [] + :type: date + :contains_multiple: false + :multiple_or: MAY + :family: + :paths: + - name.family + :full_paths: + - Patient.name.family + :comparators: {} + :values: [] + :type: string + :contains_multiple: false + :multiple_or: MAY + :gender: + :paths: + - gender + :full_paths: + - Patient.gender + :comparators: {} + :values: [] + :type: code + :contains_multiple: false + :multiple_or: MAY +:include_params: [] +:revincludes: +- Provenance:target +:required_concepts: [] +:must_supports: + :extensions: + - :id: Patient.extension:race + :path: extension + :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-race + - :id: Patient.extension:ethnicity + :path: extension + :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity + - :id: Patient.extension:birthsex + :path: extension + :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex + :slices: [] + :elements: + - :path: identifier + - :path: identifier.system + - :path: identifier.value + - :path: name + - :path: name.family + - :path: name.given + - :path: telecom + - :path: telecom.system + - :path: telecom.value + - :path: telecom.use + - :path: gender + - :path: birthDate + - :path: address + - :path: address.line + - :path: address.city + - :path: address.state + - :path: address.postalCode + - :path: address.period.end + :uscdi_only: true + - :path: communication + - :path: communication.language + - :path: name.period.end + :uscdi_only: true + - :path: name.use + :fixed_value: old + :uscdi_only: true + - :path: address.use + :fixed_value: old + :uscdi_only: true + :choices: + - :paths: + - address.period.end + - address.use + :uscdi_only: true + - :paths: + - name.period.end + - name.use + :uscdi_only: true +:mandatory_elements: +- Patient.identifier +- Patient.identifier.system +- Patient.identifier.value +- Patient.name +- Patient.telecom.system +- Patient.telecom.value +- Patient.gender +- Patient.communication.language +- Patient.link.other +- Patient.link.type +:bindings: +- :type: code + :strength: required + :system: http://hl7.org/fhir/ValueSet/identifier-use + :path: identifier.use +- :type: code + :strength: required + :system: http://hl7.org/fhir/ValueSet/name-use + :path: name.use +- :type: code + :strength: required + :system: http://hl7.org/fhir/ValueSet/contact-point-system + :path: telecom.system +- :type: code + :strength: required + :system: http://hl7.org/fhir/ValueSet/contact-point-use + :path: telecom.use +- :type: code + :strength: required + :system: http://hl7.org/fhir/ValueSet/administrative-gender + :path: gender +- :type: code + :strength: required + :system: http://hl7.org/fhir/ValueSet/address-use + :path: address.use +- :type: code + :strength: required + :system: http://hl7.org/fhir/ValueSet/address-type + :path: address.type +- :type: code + :strength: required + :system: http://hl7.org/fhir/ValueSet/administrative-gender + :path: contact.gender +- :type: code + :strength: required + :system: http://hl7.org/fhir/ValueSet/link-type + :path: link.type +- :type: Coding + :strength: required + :system: http://hl7.org/fhir/us/core/ValueSet/omb-race-category + :path: value + :extensions: + - http://hl7.org/fhir/us/core/StructureDefinition/us-core-race + - ombCategory +- :type: Coding + :strength: required + :system: http://hl7.org/fhir/us/core/ValueSet/detailed-race + :path: value + :extensions: + - http://hl7.org/fhir/us/core/StructureDefinition/us-core-race + - detailed +- :type: Coding + :strength: required + :system: http://hl7.org/fhir/us/core/ValueSet/omb-ethnicity-category + :path: value + :extensions: + - http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity + - ombCategory +- :type: Coding + :strength: required + :system: http://hl7.org/fhir/us/core/ValueSet/detailed-ethnicity + :path: value + :extensions: + - http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity + - detailed +- :type: code + :strength: required + :system: http://hl7.org/fhir/us/core/ValueSet/birthsex + :path: value + :extensions: + - http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex +:references: +- :path: Patient.identifier.assigner + :profiles: + - http://hl7.org/fhir/StructureDefinition/Organization +- :path: Patient.contact.organization + :profiles: + - http://hl7.org/fhir/StructureDefinition/Organization +- :path: Patient.generalPractitioner + :profiles: + - http://hl7.org/fhir/StructureDefinition/Organization + - http://hl7.org/fhir/StructureDefinition/Practitioner + - http://hl7.org/fhir/StructureDefinition/PractitionerRole +- :path: Patient.managingOrganization + :profiles: + - http://hl7.org/fhir/StructureDefinition/Organization +- :path: Patient.link.other + :profiles: + - http://hl7.org/fhir/StructureDefinition/Patient + - http://hl7.org/fhir/StructureDefinition/RelatedPerson +:tests: +- :id: us_core_v311_patient__id_search_test + :file_name: patient_id_search_test.rb +- :id: us_core_v311_patient_identifier_search_test + :file_name: patient_identifier_search_test.rb +- :id: us_core_v311_patient_name_search_test + :file_name: patient_name_search_test.rb +- :id: us_core_v311_patient_birthdate_family_search_test + :file_name: patient_birthdate_family_search_test.rb +- :id: us_core_v311_patient_family_gender_search_test + :file_name: patient_family_gender_search_test.rb +- :id: us_core_v311_patient_birthdate_name_search_test + :file_name: patient_birthdate_name_search_test.rb +- :id: us_core_v311_patient_gender_name_search_test + :file_name: patient_gender_name_search_test.rb +- :id: us_core_v311_patient_read_test + :file_name: patient_read_test.rb +- :id: us_core_v311_patient_provenance_revinclude_search_test + :file_name: patient_provenance_revinclude_search_test.rb +- :id: us_core_v311_patient_validation_test + :file_name: patient_validation_test.rb +- :id: us_core_v311_patient_must_support_test + :file_name: patient_must_support_test.rb +:id: us_core_v311_patient +:file_name: patient_group.rb +:delayed_references: [] diff --git a/spec/fixtures/metadata/questionnaire_response_v610.yml b/spec/fixtures/metadata/questionnaire_response_v610.yml new file mode 100644 index 000000000..e134e0a63 --- /dev/null +++ b/spec/fixtures/metadata/questionnaire_response_v610.yml @@ -0,0 +1,236 @@ +--- +:name: us_core_questionnaireresponse +:class_name: USCorev610QuestionnaireresponseSequence +:version: v6.1.0 +:reformatted_version: v610 +:resource: QuestionnaireResponse +:profile_url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-questionnaireresponse +:profile_name: US Core QuestionnaireResponse Profile +:profile_version: 6.1.0 +:title: QuestionnaireResponse +:short_description: Verify support for the server capabilities required by the US + Core QuestionnaireResponse Profile. +:is_delayed: false +:interactions: +- :code: create + :expectation: MAY +- :code: search-type + :expectation: SHOULD +- :code: read + :expectation: SHOULD +- :code: vread + :expectation: SHOULD +- :code: update + :expectation: MAY +- :code: patch + :expectation: MAY +- :code: delete + :expectation: MAY +- :code: history-instance + :expectation: SHOULD +- :code: history-type + :expectation: MAY +:operations: [] +:searches: +- :names: + - patient + :expectation: SHALL + :names_not_must_support_or_mandatory: [] + :must_support_or_mandatory: true +- :names: + - _id + :expectation: SHALL + :names_not_must_support_or_mandatory: [] + :must_support_or_mandatory: true +- :expectation: SHOULD + :names: + - patient + - questionnaire + :names_not_must_support_or_mandatory: [] + :must_support_or_mandatory: true +- :expectation: SHOULD + :names: + - patient + - authored + :names_not_must_support_or_mandatory: [] + :must_support_or_mandatory: true +- :expectation: SHOULD + :names: + - patient + - status + :names_not_must_support_or_mandatory: [] + :must_support_or_mandatory: true +:search_definitions: + :_id: + :paths: + - id + :full_paths: + - QuestionnaireResponse.id + :comparators: {} + :values: [] + :type: http://hl7.org/fhirpath/System.String + :contains_multiple: false + :multiple_or: MAY + :patient: + :paths: + - subject + :full_paths: + - QuestionnaireResponse.subject + :comparators: {} + :values: [] + :type: Reference + :contains_multiple: false + :multiple_or: MAY + :questionnaire: + :paths: + - questionnaire + :full_paths: + - QuestionnaireResponse.questionnaire + :comparators: {} + :values: [] + :type: canonical + :contains_multiple: false + :multiple_or: MAY + :authored: + :paths: + - authored + :full_paths: + - QuestionnaireResponse.authored + :comparators: + :eq: MAY + :ne: MAY + :gt: SHALL + :ge: SHALL + :lt: SHALL + :le: SHALL + :sa: MAY + :eb: MAY + :ap: MAY + :values: [] + :type: dateTime + :contains_multiple: false + :multiple_or: MAY + :status: + :paths: + - status + :full_paths: + - QuestionnaireResponse.status + :comparators: {} + :values: + - in-progress + - completed + - amended + - entered-in-error + - stopped + :type: code + :contains_multiple: false + :multiple_or: SHALL +:include_params: [] +:revincludes: +- Provenance:target +:required_concepts: [] +:must_supports: + :extensions: + - :id: QuestionnaireResponse.questionnaire.extension:questionnaireDisplay + :path: questionnaire.extension + :url: http://hl7.org/fhir/StructureDefinition/display + - :id: QuestionnaireResponse.questionnaire.extension:url + :path: questionnaire.extension + :url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-extension-questionnaire-uri + :slices: [] + :elements: + - :path: identifier + - :path: questionnaire + - :path: status + - :path: subject + :types: + - Reference + :target_profiles: + - http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient + - :path: authored + - :path: author + :types: + - Reference + :target_profiles: + - http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitioner + - :path: item + - :path: item.linkId + - :path: item.text + - :path: item.answer + - :path: item.answer.valueDecimal + :original_path: item.answer.value[x] + - :path: item.answer.valueString + :original_path: item.answer.value[x] + - :path: item.answer.valueCoding + :original_path: item.answer.value[x] + - :path: item.answer.item + - :path: item.item +:mandatory_elements: +- QuestionnaireResponse.questionnaire +- QuestionnaireResponse.status +- QuestionnaireResponse.subject +- QuestionnaireResponse.authored +- QuestionnaireResponse.item.linkId +:bindings: +- :type: code + :strength: required + :system: http://hl7.org/fhir/ValueSet/questionnaire-answers-status + :path: status +:references: +- :path: QuestionnaireResponse.basedOn + :profiles: + - http://hl7.org/fhir/StructureDefinition/CarePlan + - http://hl7.org/fhir/StructureDefinition/ServiceRequest +- :path: QuestionnaireResponse.partOf + :profiles: + - http://hl7.org/fhir/StructureDefinition/Observation + - http://hl7.org/fhir/StructureDefinition/Procedure +- :path: QuestionnaireResponse.subject + :profiles: + - http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient +- :path: QuestionnaireResponse.encounter + :profiles: + - http://hl7.org/fhir/StructureDefinition/Encounter +- :path: QuestionnaireResponse.author + :profiles: + - http://hl7.org/fhir/us/core/StructureDefinition/us-core-practitioner + - http://hl7.org/fhir/us/core/StructureDefinition/us-core-organization + - http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient + - http://hl7.org/fhir/StructureDefinition/PractitionerRole + - http://hl7.org/fhir/StructureDefinition/Device + - http://hl7.org/fhir/us/core/StructureDefinition/us-core-relatedperson +- :path: QuestionnaireResponse.source + :profiles: + - http://hl7.org/fhir/StructureDefinition/Patient + - http://hl7.org/fhir/StructureDefinition/Practitioner + - http://hl7.org/fhir/StructureDefinition/PractitionerRole + - http://hl7.org/fhir/StructureDefinition/RelatedPerson +:tests: +- :id: us_core_v610_questionnaire_response_patient_search_test + :file_name: questionnaire_response_patient_search_test.rb +- :id: us_core_v610_questionnaire_response__id_search_test + :file_name: questionnaire_response_id_search_test.rb +- :id: us_core_v610_questionnaire_response_patient_questionnaire_search_test + :file_name: questionnaire_response_patient_questionnaire_search_test.rb +- :id: us_core_v610_questionnaire_response_patient_authored_search_test + :file_name: questionnaire_response_patient_authored_search_test.rb +- :id: us_core_v610_questionnaire_response_patient_status_search_test + :file_name: questionnaire_response_patient_status_search_test.rb +- :id: us_core_v610_questionnaire_response_read_test + :file_name: questionnaire_response_read_test.rb +- :id: us_core_v610_questionnaire_response_provenance_revinclude_search_test + :file_name: questionnaire_response_provenance_revinclude_search_test.rb +- :id: us_core_v610_questionnaire_response_validation_test + :file_name: questionnaire_response_validation_test.rb +- :id: us_core_v610_questionnaire_response_must_support_test + :file_name: questionnaire_response_must_support_test.rb +- :id: us_core_v610_questionnaire_response_reference_resolution_test + :file_name: questionnaire_response_reference_resolution_test.rb +:id: us_core_v610_questionnaire_response +:file_name: questionnaire_response_group.rb +:delayed_references: +- :path: author + :resources: + - Practitioner + - Organization + - RelatedPerson diff --git a/spec/fixtures/metadata/smokingstatus_v400.yml b/spec/fixtures/metadata/smokingstatus_v400.yml new file mode 100644 index 000000000..6765aebf5 --- /dev/null +++ b/spec/fixtures/metadata/smokingstatus_v400.yml @@ -0,0 +1,258 @@ +--- +:name: us_core_smokingstatus +:class_name: USCorev400SmokingstatusSequence +:version: v4.0.0 +:reformatted_version: v400 +:resource: Observation +:profile_url: http://hl7.org/fhir/us/core/StructureDefinition/us-core-smokingstatus +:profile_name: US Core Smoking Status Observation Profile +:profile_version: 4.0.0 +:title: Observation Smoking Status +:short_description: Verify support for the server capabilities required by the US + Core Smoking Status Observation Profile. +:is_delayed: false +:interactions: +- :code: create + :expectation: MAY +- :code: search-type + :expectation: SHALL +- :code: read + :expectation: SHALL +- :code: vread + :expectation: SHOULD +- :code: update + :expectation: MAY +- :code: patch + :expectation: MAY +- :code: delete + :expectation: MAY +- :code: history-instance + :expectation: SHOULD +- :code: history-type + :expectation: MAY +:operations: [] +:searches: +- :expectation: SHALL + :names: + - patient + - code + :names_not_must_support_or_mandatory: [] + :must_support_or_mandatory: true +- :expectation: SHOULD + :names: + - patient + - category + - status + :names_not_must_support_or_mandatory: [] + :must_support_or_mandatory: true +- :expectation: SHOULD + :names: + - patient + - code + - date + :names_not_must_support_or_mandatory: [] + :must_support_or_mandatory: true +- :expectation: SHALL + :names: + - patient + - category + :names_not_must_support_or_mandatory: [] + :must_support_or_mandatory: true +- :expectation: SHALL + :names: + - patient + - category + - date + :names_not_must_support_or_mandatory: [] + :must_support_or_mandatory: true +:search_definitions: + :patient: + :paths: + - subject + :full_paths: + - Observation.subject + :comparators: {} + :values: [] + :type: Reference + :contains_multiple: false + :multiple_or: MAY + :category: + :paths: + - category + :full_paths: + - Observation.category + :comparators: {} + :values: + - social-history + :type: CodeableConcept + :contains_multiple: true + :multiple_or: MAY + :status: + :paths: + - status + :full_paths: + - Observation.status + :comparators: {} + :values: + - final + - entered-in-error + :type: code + :contains_multiple: false + :multiple_or: SHALL + :code: + :paths: + - code + :full_paths: + - Observation.code + :comparators: {} + :values: + - 72166-2 + :type: CodeableConcept + :contains_multiple: false + :multiple_or: SHOULD + :date: + :paths: + - effective + :full_paths: + - Observation.effective + :comparators: + :eq: MAY + :ne: MAY + :gt: SHALL + :ge: SHALL + :lt: SHALL + :le: SHALL + :sa: MAY + :eb: MAY + :ap: MAY + :values: [] + :type: date + :contains_multiple: false + :multiple_or: MAY +:include_params: [] +:revincludes: +- Provenance:target +:required_concepts: [] +:must_supports: + :extensions: [] + :slices: + - :slice_id: Observation.category:SocialHistory + :slice_name: SocialHistory + :path: category + :discriminator: + :type: patternCodeableConcept + :path: '' + :code: social-history + :system: http://terminology.hl7.org/CodeSystem/observation-category + - :slice_id: Observation.effective[x]:effectiveDateTime + :slice_name: effectiveDateTime + :path: effective[x] + :discriminator: + :type: type + :code: DateTime + - :slice_id: Observation.value[x]:valueCodeableConcept + :slice_name: valueCodeableConcept + :path: value[x] + :discriminator: + :type: type + :code: CodeableConcept + :elements: + - :path: status + - :path: category + - :path: code + - :path: subject + :types: + - Reference + :target_profiles: + - http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient +:mandatory_elements: +- Observation.status +- Observation.category +- Observation.code +- Observation.subject +- Observation.effective[x] +- Observation.value[x] +- Observation.component.code +:bindings: +- :type: code + :strength: required + :system: http://hl7.org/fhir/us/core/ValueSet/us-core-observation-smoking-status-status + :path: status +:references: +- :path: Observation.basedOn + :profiles: + - http://hl7.org/fhir/StructureDefinition/CarePlan + - http://hl7.org/fhir/StructureDefinition/DeviceRequest + - http://hl7.org/fhir/StructureDefinition/ImmunizationRecommendation + - http://hl7.org/fhir/StructureDefinition/MedicationRequest + - http://hl7.org/fhir/StructureDefinition/NutritionOrder + - http://hl7.org/fhir/StructureDefinition/ServiceRequest +- :path: Observation.partOf + :profiles: + - http://hl7.org/fhir/StructureDefinition/MedicationAdministration + - http://hl7.org/fhir/StructureDefinition/MedicationDispense + - http://hl7.org/fhir/StructureDefinition/MedicationStatement + - http://hl7.org/fhir/StructureDefinition/Procedure + - http://hl7.org/fhir/StructureDefinition/Immunization + - http://hl7.org/fhir/StructureDefinition/ImagingStudy +- :path: Observation.subject + :profiles: + - http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient +- :path: Observation.focus + :profiles: + - http://hl7.org/fhir/StructureDefinition/Resource +- :path: Observation.encounter + :profiles: + - http://hl7.org/fhir/StructureDefinition/Encounter +- :path: Observation.performer + :profiles: + - http://hl7.org/fhir/StructureDefinition/Practitioner + - http://hl7.org/fhir/StructureDefinition/PractitionerRole + - http://hl7.org/fhir/StructureDefinition/Organization + - http://hl7.org/fhir/StructureDefinition/CareTeam + - http://hl7.org/fhir/StructureDefinition/Patient + - http://hl7.org/fhir/StructureDefinition/RelatedPerson +- :path: Observation.specimen + :profiles: + - http://hl7.org/fhir/StructureDefinition/Specimen +- :path: Observation.device + :profiles: + - http://hl7.org/fhir/StructureDefinition/Device + - http://hl7.org/fhir/StructureDefinition/DeviceMetric +- :path: Observation.hasMember + :profiles: + - http://hl7.org/fhir/StructureDefinition/Observation + - http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse + - http://hl7.org/fhir/StructureDefinition/MolecularSequence +- :path: Observation.derivedFrom + :profiles: + - http://hl7.org/fhir/StructureDefinition/DocumentReference + - http://hl7.org/fhir/StructureDefinition/ImagingStudy + - http://hl7.org/fhir/StructureDefinition/Media + - http://hl7.org/fhir/StructureDefinition/QuestionnaireResponse + - http://hl7.org/fhir/StructureDefinition/Observation + - http://hl7.org/fhir/StructureDefinition/MolecularSequence +:tests: +- :id: us_core_v400_smokingstatus_patient_code_search_test + :file_name: smokingstatus_patient_code_search_test.rb +- :id: us_core_v400_smokingstatus_patient_category_status_search_test + :file_name: smokingstatus_patient_category_status_search_test.rb +- :id: us_core_v400_smokingstatus_patient_code_date_search_test + :file_name: smokingstatus_patient_code_date_search_test.rb +- :id: us_core_v400_smokingstatus_patient_category_search_test + :file_name: smokingstatus_patient_category_search_test.rb +- :id: us_core_v400_smokingstatus_patient_category_date_search_test + :file_name: smokingstatus_patient_category_date_search_test.rb +- :id: us_core_v400_smokingstatus_read_test + :file_name: smokingstatus_read_test.rb +- :id: us_core_v400_smokingstatus_provenance_revinclude_search_test + :file_name: smokingstatus_provenance_revinclude_search_test.rb +- :id: us_core_v400_smokingstatus_validation_test + :file_name: smokingstatus_validation_test.rb +- :id: us_core_v400_smokingstatus_must_support_test + :file_name: smokingstatus_must_support_test.rb +- :id: us_core_v400_smokingstatus_reference_resolution_test + :file_name: smokingstatus_reference_resolution_test.rb +:id: us_core_v400_smokingstatus +:file_name: smokingstatus_group.rb +:delayed_references: [] diff --git a/spec/inferno/dsl/fhir_evaluation/profile_conformance_helper_spec.rb b/spec/inferno/dsl/fhir_evaluation/profile_conformance_helper_spec.rb new file mode 100644 index 000000000..0907408e4 --- /dev/null +++ b/spec/inferno/dsl/fhir_evaluation/profile_conformance_helper_spec.rb @@ -0,0 +1,140 @@ +require_relative '../../../../lib/inferno/dsl/fhir_evaluation/profile_conformance_helper' + +RSpec.describe Inferno::DSL::FHIREvaluation::ProfileConformanceHelper do + let(:checker_class) do + Class.new do + include Inferno::DSL::FHIREvaluation::ProfileConformanceHelper + end + end + + let(:checker) { checker_class.new } + + let(:patient_profile) do + FHIR::StructureDefinition.new( + url: 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient', + version: '3.1.1', + name: 'USCorePatientProfile', + kind: 'resource', + abstract: false, + type: 'Patient' + ) + end + + let(:patient) do + FHIR::Patient.new( + meta: { profile: ['http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient'] }, + identifier: [{ system: 'system', value: 'value' }], + name: [{ use: 'old', family: 'family', given: ['given'], suffix: ['suffix'], period: { end: '2022-12-12' } }], + telecom: [{ system: 'phone', value: 'value', use: 'home' }], + gender: 'male', + birthDate: '2020-01-01', + deceasedDateTime: '2022-12-12', + address: [{ use: 'old', line: 'line', city: 'city', state: 'state', postalCode: 'postalCode', + period: { start: '2020-01-01' } }], + communication: [{ language: { text: 'text' } }], + extension: [ + { + url: 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-race', + extension: [ + { url: 'ombCategory', valueCoding: { display: 'display' } }, + { url: 'text', valueString: 'valueString' } + ] + }, + { + url: 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity', + extension: [ + { url: 'ombCategory', valueCoding: { display: 'display' } }, + { url: 'text', valueString: 'valueString' } + ] + }, + { + url: 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex', + valueCode: 'M' + }, + { + url: 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-tribal-affiliation', + extension: [{ url: 'tribalAffiliation', valueCodeableConcept: { text: 'text' } }] + }, + { + url: 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex', + valueCode: 'M' + }, + { + url: 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-genderIdentity', + valueCodeableConcept: { text: 'text' } + } + ] + ) + end + + describe '#conforms_to_profile?' do + it 'returns false for the wrong resource type' do + options = {} + observation = FHIR::Observation.new + result = checker.conforms_to_profile?(observation, patient_profile, options) + + expect(result).to be(false) + end + + it 'returns true for the right resource type if considerOnlyResourceType' do + options = { + considerMetaProfile: true, + considerOnlyResourceType: true + } + patient = FHIR::Patient.new + + result = checker.conforms_to_profile?(patient, patient_profile, options) + expect(result).to be(true) + end + + it 'returns true for a resource declaring meta.profile if considerMetaProfile' do + options = { + considerMetaProfile: true, + considerOnlyResourceType: false + } + result = checker.conforms_to_profile?(patient, patient_profile, options) + + expect(result).to be(true) + end + + it 'returns true for a resource declaring versioned meta.profile if considerMetaProfile' do + options = { + considerMetaProfile: true, + considerOnlyResourceType: false + } + patient.meta.profile[0] = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient|3.1.1' + result = checker.conforms_to_profile?(patient, patient_profile, options) + + expect(result).to be(true) + end + + it 'raises for Not Yet Implemented if considerValidationResults' do + options = { + considerMetaProfile: false, + considerOnlyResourceType: false, + considerValidationResults: true + } + validator = nil + expect do + checker.conforms_to_profile?(patient, patient_profile, options, validator) + end.to raise_error(StandardError, /Profile validation is not yet implemented/) + end + + it 'returns true for a resource when the block returns true' do + options = { + considerMetaProfile: false, + considerOnlyResourceType: false, + considerValidationResults: false + } + + result = checker.conforms_to_profile?(patient, patient_profile, options) + expect(result).to be(false) + + result = checker.conforms_to_profile?(patient, patient_profile, options) { |_r| false } + expect(result).to be(false) + + result = checker.conforms_to_profile?(patient, patient_profile, options) { |_r| true } + expect(result).to be(true) + end + end +end diff --git a/spec/inferno/dsl/fhir_evaluation/rules/all_must_supports_present_spec.rb b/spec/inferno/dsl/fhir_evaluation/rules/all_must_supports_present_spec.rb new file mode 100644 index 000000000..92b192596 --- /dev/null +++ b/spec/inferno/dsl/fhir_evaluation/rules/all_must_supports_present_spec.rb @@ -0,0 +1,923 @@ +require 'extract_tgz_helper' +require 'ostruct' + +require_relative '../../../../../lib/inferno/dsl/fhir_evaluation/evaluator' + +RSpec.describe Inferno::DSL::FHIREvaluation::Rules::AllMustSupportsPresent do + include ExtractTGZHelper + + let(:uscore3_package) { File.realpath(File.join(Dir.pwd, 'spec/fixtures/uscore311.tgz')) } + let(:patient_ref) { 'Patient/85' } + let(:patient) do + FHIR::Patient.new( + meta: { profile: ['http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient'] }, + identifier: [{ system: 'system', value: 'value' }], + name: [{ use: 'old', family: 'family', given: ['given'], suffix: ['suffix'], period: { end: '2022-12-12' } }], + telecom: [{ system: 'phone', value: 'value', use: 'home' }], + gender: 'male', + birthDate: '2020-01-01', + deceasedDateTime: '2022-12-12', + address: [{ use: 'old', line: 'line', city: 'city', state: 'state', postalCode: 'postalCode', + period: { start: '2020-01-01' } }], + communication: [{ language: { text: 'text' } }], + extension: [ + { + url: 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-race', + extension: [ + { url: 'ombCategory', valueCoding: { display: 'display' } }, + { url: 'text', valueString: 'valueString' } + ] + }, + { + url: 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-ethnicity', + extension: [ + { url: 'ombCategory', valueCoding: { display: 'display' } }, + { url: 'text', valueString: 'valueString' } + ] + }, + { + url: 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-birthsex', + valueCode: 'M' + }, + { + url: 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-tribal-affiliation', + extension: [{ url: 'tribalAffiliation', valueCodeableConcept: { text: 'text' } }] + }, + { + url: 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-sex', + valueCode: 'M' + }, + { + url: 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-genderIdentity', + valueCodeableConcept: { text: 'text' } + } + ] + ) + end + let(:uscore3_untarred) { extract_tgz(uscore3_package) } + + def fixture(filename) + path = File.join(uscore3_untarred, 'package', filename) + FHIR::Json.from_json(File.read(path)) + end + + def metadata_fixture(filename) + path = File.realpath(File.join(Dir.pwd, 'spec/fixtures/metadata', filename)) + metadata_yaml = YAML.load_file(path) + OpenStruct.new(metadata_yaml) # so that the top-level keys can be accessed directly, ie metadata.must_supports[...] + end + + after { cleanup(uscore3_untarred) } + + describe '#check' do + it 'identifies when all MS elements are used' do + profiles = [fixture('StructureDefinition-us-core-patient.json')] + ig = instance_double(Inferno::Entities::IG, profiles:) + data = [patient] + config = Inferno::DSL::FHIREvaluation::Config.new + validator = nil + context = Inferno::DSL::FHIREvaluation::EvaluationContext.new(ig, data, config, validator) + + described_class.new.check(context) + result = context.results[0] + + expect(result.message).to eq('All MustSupports are present') + end + + it 'identifies when no relevant resources are present' do + profiles = [fixture('StructureDefinition-us-core-medication.json')] + ig = instance_double(Inferno::Entities::IG, profiles:) + data = [patient] + config = Inferno::DSL::FHIREvaluation::Config.new + validator = nil + context = Inferno::DSL::FHIREvaluation::EvaluationContext.new(ig, data, config, validator) + + described_class.new.check(context) + result = context.results[0] + + expect(result.message).to end_with('No matching resources were found to check') + end + + it 'identifies when not all MS elements are used' do + profiles = [fixture('StructureDefinition-us-core-medication.json')] + ig = instance_double(Inferno::Entities::IG, profiles:) + empty_med = FHIR::Medication.new( + meta: { profile: ['http://hl7.org/fhir/us/core/StructureDefinition/us-core-medication'] } + ) + data = [empty_med] + config = Inferno::DSL::FHIREvaluation::Config.new + validator = nil + context = Inferno::DSL::FHIREvaluation::EvaluationContext.new(ig, data, config, validator) + + described_class.new.check(context) + result = context.results[0] + + expect(result.message).to end_with('http://hl7.org/fhir/us/core/StructureDefinition/us-core-medication: code') + end + end + + def run(profile, resources, _resource_type, ig = nil, &block) + described_class.new.perform_must_support_test(profile, resources, ig, &block) + end + + def run_with_metadata(resources, metadata) + described_class.new.perform_must_support_test_with_metadata(resources, metadata) + end + + describe 'must support test for choice elements and regular elements' do + let(:device_profile) { fixture('StructureDefinition-us-core-implantable-device.json') } + let(:device) do + FHIR::Device.new( + udiCarrier: [{ deviceIdentifier: '43069338026389', carrierHRF: 'carrierHRF' }], + distinctIdentifier: '43069338026389', + manufactureDate: '2000-03-02T18:33:18-05:00', + expirationDate: '2025-03-17T19:33:18-04:00', + lotNumber: '1134', + serialNumber: '842026117977', + type: { + text: 'Implantable defibrillator, device (physical object)' + }, + patient: { + reference: patient_ref + } + ) + end + + it 'fails if server supports none of the choice' do + device.udiCarrier.first.carrierHRF = nil + + result = run(device_profile, [device], 'Device') + expect(result).to include('udiCarrier.carrierAIDC', 'udiCarrier.carrierHRF') + end + + it 'fails if server supports only one choice without extra metadata provided' do + result = run(device_profile, [device], 'Device') + expect(result).to include('udiCarrier.carrierAIDC') + end + + it 'passes if server supports at least one of the choice and choice metadata is provided' do + choices = [{ paths: ['udiCarrier.carrierAIDC', 'udiCarrier.carrierHRF'] }] + + result = run(device_profile, [device], 'Device') do |metadata| + metadata.must_supports[:choices] = choices + end + expect(result).to be_empty + end + + it 'fails if server does not support one MS element' do + device.distinctIdentifier = nil + + result = run(device_profile, [device], 'Device') + expect(result).to include('distinctIdentifier') + end + end + + describe 'must support test for extensions' do + let(:patient_profile) { fixture('StructureDefinition-us-core-patient.json') } + + it 'passes if server suports all MS extensions' do + result = run(patient_profile, [patient], 'Patient') + expect(result).to be_empty + end + + it 'fails if server does not suport one MS extensions' do + patient.extension.delete_at(0) + + result = run(patient_profile, [patient], 'Patient') + expect(result).to include('Patient.extension:race') + end + end + + describe 'must support test for slices' do + context 'with patternCodeableConcept slicing' do + let(:careplan_profile) { fixture('StructureDefinition-us-core-careplan.json') } + let(:careplan) do + FHIR::CarePlan.new( + text: { status: 'status' }, + status: 'status', + intent: 'intent', + category: [ + { + coding: [ + { + system: 'http://hl7.org/fhir/us/core/CodeSystem/careplan-category', + code: 'assess-plan' + } + ] + } + ], + subject: { + reference: patient_ref + } + ) + end + + it 'passes if server suports all MS slices' do + result = run(careplan_profile, [careplan], 'CarePlan') + + expect(result).to be_empty + end + + it 'fails if server does not suport one MS extensions' do + careplan.category.first.coding.first.code = 'something else' + + result = run(careplan_profile, [careplan], 'CarePlan') + expect(result).to include('CarePlan.category:AssessPlan') + end + end + + context 'with patternCodeableConcept slicing and mulitple codings' do + let(:coverage_metadata) { metadata_fixture('coverage_v610.yml') } + let(:coverage) do + FHIR::Coverage.new( + identifier: [ + { + system: 'local-id', + value: '123' + }, + { + type: { + coding: [ + { + system: 'http://terminology.hl7.org/CodeSystem/v2-0203', + code: 'MB', + display: 'Member Number' + } + ] + }, + value: 'member-id' + } + ], + status: 'active', + type: { + coding: [ + { + system: 'local-type', + code: 'medicare' + } + ] + }, + subscriberId: 'abc', + beneficiary: { + reference: 'Patient/1' + }, + relationship: { + coding: [ + { + system: 'local-relationship', + code: '01' + } + ] + }, + period: { + start: '2022-03-04' + }, + payor: [ + { + reference: 'Organization/1' + } + ], + class: [ + { + type: { + coding: [ + { + system: 'http://terminology.hl7.org/CodeSystem/coverage-class', + code: 'plan' + } + ] + }, + value: '10603', + name: 'MEDICARE PART A & B' + }, + { + type: { + coding: [ + { + system: 'http://terminology.hl7.org/CodeSystem/coverage-class', + code: 'group' + } + ] + }, + value: '123', + name: 'group' + } + ] + ) + end + + it 'passes if server suports all MS slices' do + result = run_with_metadata([coverage], coverage_metadata) + expect(result).to be_empty + end + end + + context 'with type slicing' do + let(:smokingstatus_metadata) { metadata_fixture('smokingstatus_v400.yml') } + let(:observation) do + FHIR::Observation.new( + status: 'final', + category: [ + { + coding: [ + { + system: 'http://terminology.hl7.org/CodeSystem/observation-category', + code: 'social-history' + } + ] + } + ], + code: { + coding: [ + { + system: 'http://loinc.org', + code: '72166-2' + } + ], + text: 'Tobacco smoking status' + }, + subject: { + reference: 'Patient/902' + }, + effectiveDateTime: '2013-04-23T21:07:05Z', + valueCodeableConcept: { + coding: [ + { + system: 'http://snomed.info/sct', + code: '449868002' + } + ] + } + ) + end + + it 'passes if server suports all MS slices' do + result = run_with_metadata([observation], smokingstatus_metadata) + + expect(result).to be_empty + end + + it 'skips if datetime format is not correct' do + observation.effectiveDateTime = 'not a date time' + result = run_with_metadata([observation], smokingstatus_metadata) + + expect(result).to include('Observation.effective[x]:effectiveDateTime') + end + end + + context 'with requiredBinding slicing' do + context 'when Condition ProblemsHealthConcerns' do + let(:condition_problems_health_concerns_metadata) do + metadata_fixture('condition_problems_health_concerns_v501.yml') + end + let(:condition) do + FHIR::Condition.new( + extension: [ + { + url: 'http://hl7.org/fhir/StructureDefinition/condition-assertedDate', + valueDateTime: '2016-08-10' + } + ], + clinicalStatus: { + coding: [ + { + system: 'http://terminology.hl7.org/CodeSystem/condition-clinical', + code: 'active' + } + ] + }, + verificationStatus: { + coding: [ + { + system: 'http://terminology.hl7.org/CodeSystem/condition-ver-status', + code: 'confirmed' + } + ] + }, + category: [ + { + coding: [ + { + system: 'http://terminology.hl7.org/CodeSystem/condition-category', + code: 'problem-list-item' + } + ] + }, + { + coding: [ + { + system: 'http://hl7.org/fhir/us/core/CodeSystem/us-core-tags', + code: 'sdoh' + } + ] + } + ], + code: { + coding: [ + { + system: 'http://snomed.info/sct', + code: '445281000124101' + } + ] + }, + subject: { + reference: 'Patient/123' + }, + recordedDate: '2016-08-10T07:15:07-08:00', + onsetDateTime: '2016-08-10T07:15:07-08:00', + abatementDateTime: '2016-08-10T07:15:07-08:00' + ) + end + + it 'passes if server suports all MS slices' do + result = run_with_metadata([condition], condition_problems_health_concerns_metadata) + expect(result).to be_empty + end + + it 'fails if server does not support category:us-core slice' do + condition.category.delete_if { |category| category.coding.first.code == 'problem-list-item' } + + result = run_with_metadata([condition], condition_problems_health_concerns_metadata) + expect(result).to include('Condition.category:us-core') + end + end + + context 'with patternIdentifier slicing' do + let(:practitioner_profile) { fixture('StructureDefinition-us-core-practitioner.json') } + let(:practitioner) do + FHIR::Practitioner.new( + identifier: [ + { + system: 'http://hl7.org/fhir/sid/us-npi', + value: '9941339108' + } + ], + name: [ + { + family: 'Bone', + given: ['Ronald'], + prefix: ['Dr'] + } + ], + address: [ + { + use: 'home', + line: ['1003 Healthcare Drive'], + city: 'Amherst', + state: 'MA', + postalCode: '01002' + } + ] + ) + end + + it 'passes when NPI identifier slice present' do + result = run(practitioner_profile, [practitioner], 'Practitioner') + expect(result).to be_empty + end + + it 'fails when no identifier present' do + practitioner.identifier = [] + result = run(practitioner_profile, [practitioner], 'Practitioner') + expect(result).to include('Practitioner.identifier:NPI') + end + + it 'fails when identifier slice not present' do + practitioner.identifier[0].system = 'http://example.com' + result = run(practitioner_profile, [practitioner], 'Practitioner') + expect(result).to include('Practitioner.identifier:NPI') + end + end + + context 'when MedicationRequest' do + let(:medication_request_metadata) { metadata_fixture('medication_request_v501.yml') } + let(:medication_request1) do + FHIR::MedicationRequest.new( + status: 'active', + intent: 'order', + category: [ + { + coding: [ + system: 'http://terminology.hl7.org/CodeSystem/medicationrequest-category', + code: 'outpatient' + ] + } + ], + reportedBoolean: false, + medicationReference: { + reference: 'Medication/m1' + }, + subject: { + reference: 'Patient/p1' + }, + encounter: { + reference: 'Encounter/e1' + }, + authoredOn: '2021-08-04T00:00:00-04:00', + requester: { + reference: 'Practitioner/p2' + }, + dosageInstruction: [ + { + text: 'this is a dosage instruction' + } + ] + ) + end + + it 'passes if server suports all MS slices' do + result = run_with_metadata([medication_request1], medication_request_metadata) + expect(result).to be_empty + end + end + end + end + + describe 'must support test for choices' do + let(:condition_problems_health_concerns_metadata) do + metadata_fixture('condition_problems_health_concerns_v501.yml') + end + let(:condition) do + FHIR::Condition.new( + extension: [ + { + url: 'http://hl7.org/fhir/StructureDefinition/condition-assertedDate', + valueDateTime: '2016-08-10' + } + ], + clinicalStatus: { + coding: [ + { + system: 'http://terminology.hl7.org/CodeSystem/condition-clinical', + code: 'active' + } + ] + }, + verificationStatus: { + coding: [ + { + system: 'http://terminology.hl7.org/CodeSystem/condition-ver-status', + code: 'confirmed' + } + ] + }, + category: [ + { + coding: [ + { + system: 'http://terminology.hl7.org/CodeSystem/condition-category', + code: 'problem-list-item' + } + ] + }, + { + coding: [ + { + system: 'http://hl7.org/fhir/us/core/CodeSystem/us-core-tags', + code: 'sdoh' + } + ] + } + ], + code: { + coding: [ + { + system: 'http://snomed.info/sct', + code: '445281000124101' + } + ] + }, + subject: { + reference: 'Patient/123' + }, + recordedDate: '2016-08-10T07:15:07-08:00', + onsetDateTime: '2016-08-10T07:15:07-08:00', + abatementDateTime: '2016-08-10T07:15:07-08:00' + ) + end + + it 'passes if server suports assertDate extension' do + condition.onsetDateTime = nil + + result = run_with_metadata([condition], condition_problems_health_concerns_metadata) + expect(result).to be_empty + end + + it 'passes if server suports onsetDate' do + condition.extension = [] + + result = run_with_metadata([condition], condition_problems_health_concerns_metadata) + expect(result).to be_empty + end + + it 'fails if server suports none of assertDate extension and onsetDate' do + condition.onsetDateTime = nil + condition.extension = [] + + result = run_with_metadata([condition], condition_problems_health_concerns_metadata) + expect(result).to include('onsetDateTime') + expect(result).to include('Condition.extension:assertedDate') + end + end + + describe 'must support test for Patient previous name choices' do + let(:patient_profile) { fixture('StructureDefinition-us-core-patient.json') } + + context 'without custom metadata' do + it 'passes if both use=old and period.end are provided' do + result = run(patient_profile, [patient], 'Patient') + expect(result).to be_empty + end + + it 'passes if only use=old is presented' do + patient.name[0].period = nil + + result = run(patient_profile, [patient], 'Patient') + expect(result).to be_empty + end + + it 'passes if only period.end is presented' do + patient.name[0].use = nil + + result = run(patient_profile, [patient], 'Patient') + expect(result).to be_empty + end + + it 'passes if neither use=old nor period.end is presented' do + # This one should pass since these are defined as MS by narrative only + patient.name[0].use = nil + patient.name[0].period = nil + + result = run(patient_profile, [patient], 'Patient') + expect(result).to be_empty + end + end + + context 'with metadata block' do + def add_previous_name_metadata(metadata) + # See https://github.com/inferno-framework/us-core-test-kit/blob/b480ccf3e296b190dce5511d595de5e1a07e9c1a/lib/us_core_test_kit/generator/must_support_metadata_extractor_us_core_3.rb#L33 + metadata.must_supports[:elements] << { + path: 'name.period.end', + uscdi_only: true + } + metadata.must_supports[:elements] << { + path: 'name.use', + fixed_value: 'old', + uscdi_only: true + } + + metadata.must_supports[:choices] ||= [] + metadata.must_supports[:choices] << { + paths: ['name.period.end', 'name.use'], + uscdi_only: true + } + end + + it 'passes if both use=old and period.end are provided' do + result = run(patient_profile, [patient], 'Patient') { |metadata| add_previous_name_metadata(metadata) } + expect(result).to be_empty + end + + it 'passes if only use=old is presented' do + patient.name[0].period = nil + + result = run(patient_profile, [patient], 'Patient') { |metadata| add_previous_name_metadata(metadata) } + expect(result).to be_empty + end + + it 'passes if only period.end is presented' do + patient.name[0].use = nil + + result = run(patient_profile, [patient], 'Patient') { |metadata| add_previous_name_metadata(metadata) } + expect(result).to be_empty + end + + it 'fails if neither use=old nor period.end is presented' do + patient.name[0].use = nil + patient.name[0].period = nil + + result = run(patient_profile, [patient], 'Patient') { |metadata| add_previous_name_metadata(metadata) } + expect(result).to include('name.period.end') + expect(result).to include('name.use:old') + end + end + + context 'with full provided metadata' do + let(:patient_metadata) { metadata_fixture('patient_v311.yml') } + + it 'passes if both use=old and period.end are provided' do + result = run_with_metadata([patient], patient_metadata) + expect(result).to be_empty + end + + it 'passes if only use=old is presented' do + patient.name[0].period = nil + + result = run_with_metadata([patient], patient_metadata) + expect(result).to be_empty + end + + it 'passes if only period.end is presented' do + patient.name[0].use = nil + + result = run_with_metadata([patient], patient_metadata) + expect(result).to be_empty + end + + it 'fails if neither use=old nor period.end is presented' do + patient.name[0].use = nil + patient.name[0].period = nil + + result = run_with_metadata([patient], patient_metadata) + expect(result).to include('name.period.end') + expect(result).to include('name.use:old') + end + end + end + + describe 'must support tests for sub elements of slices' do + let(:coverage_metadata) { metadata_fixture('coverage_v610.yml') } + let(:group_class) do + FHIR::Coverage::Class.new.tap do |loc_class| + loc_class.type = FHIR::CodeableConcept.new.tap do |code_concept| + code_concept.coding = [FHIR::Coding.new.tap do |coding| + coding.system = 'http://terminology.hl7.org/CodeSystem/coverage-class' + coding.code = 'group' + end] + end + loc_class.value = 'group-class-value' + loc_class.name = 'group-class-name' + end + end + let(:plan_class) do + FHIR::Coverage::Class.new.tap do |loc_class| + loc_class.type = FHIR::CodeableConcept.new.tap do |code_concept| + code_concept.coding = [FHIR::Coding.new.tap do |coding| + coding.system = 'http://terminology.hl7.org/CodeSystem/coverage-class' + coding.code = 'plan' + end] + end + loc_class.value = 'plan-class-value' + loc_class.name = 'plan-class-name' + end + end + let(:coverage_with_two_classes) do + FHIR::Coverage.new.tap do |cov| + cov.status = 'active' + cov.type = FHIR::CodeableConcept.new.tap do |code_concept| + code_concept.coding = [FHIR::Coding.new.tap do |coding| + coding.system = 'https://nahdo.org/sopt' + coding.code = '3712' + coding.display = 'PPO' + end, + FHIR::Coding.new.tap do |coding| + coding.system = 'http://terminology.hl7.org/CodeSystem/v3-ActCode' + coding.code = 'PPO' + coding.display = 'preferred provider organization policy' + end], + code_concept.text = 'PPO' + end, + cov.subscriberId = '888009335' + cov.beneficiary = FHIR::Reference.new.tap do |ref| + ref.reference = 'Patient/example' + end + cov.relationship = FHIR::CodeableConcept.new.tap do |code_concept| + code_concept.coding = [FHIR::Coding.new.tap do |coding| + coding.system = 'http://terminology.hl7.org/CodeSystem/subscriber-relationship' + coding.code = 'self' + end], + code_concept.text = 'Self' + end, + cov.period = FHIR::Period.new.tap do |period| + period.start = '2020-01-01' + end + cov.payor = [FHIR::Reference.new.tap do |ref| + ref.reference = 'Organization/acme-payer' + ref.display = 'Acme Health Plan' + end], + cov.local_class = [group_class, plan_class] + cov.identifier = [FHIR::Identifier.new.tap do |identifier| + identifier.type = FHIR::CodeableConcept.new.tap do |code_concept| + code_concept.coding = [FHIR::Coding.new.tap do |coding| + coding.system = 'http://terminology.hl7.org/CodeSystem/v2-0203' + coding.code = 'MB' + end] + end + identifier.system = 'https://github.com/inferno-framework/us-core-test-kit' + identifier.value = 'f4a375d2-4e53-4f81-ba95-345e7573b550' + end] + end + end + + it 'passes if resources cover all must support sub elements of slices' do + result = run_with_metadata([coverage_with_two_classes], coverage_metadata) + expect(result).to be_empty + end + + it 'fails if resources do not cover all must support sub elements of slices' do + coverage_with_just_group = coverage_with_two_classes.dup + coverage_with_just_group.local_class = [group_class] + + result = run_with_metadata([coverage_with_just_group], coverage_metadata) + expect(result).to include('class:plan.value', 'class:plan.name', 'Coverage.class:plan') + end + + it 'passes if resources cover all must support elements over multiple elements' do + coverage_with_just_group = coverage_with_two_classes.clone + coverage_with_just_group.local_class = [group_class] + coverage_with_just_plan = coverage_with_two_classes.clone + coverage_with_just_plan.local_class = [plan_class] + + result = run_with_metadata([coverage_with_two_classes], coverage_metadata) + expect(result).to be_empty + end + end + + describe 'must support tests for primitive extension' do + let(:qr_metadata) { metadata_fixture('questionnaire_response_v610.yml') } + let(:qr) { FHIR.from_contents(File.read('spec/fixtures/QuestionnaireResponse.json')) } + + it 'passes if server suports all MS slices' do + result = run_with_metadata([qr], qr_metadata) + expect(result).to be_empty + end + + it 'fails if both MS extensions in a primitive are not provided' do + qr.source_hash['_questionnaire']['extension'][0]['url'] = 'http://example.com/extension' + qr.source_hash['_questionnaire']['extension'][1]['url'] = 'http://example.com/extension' + new_qr = FHIR::QuestionnaireResponse.new(qr.source_hash) + + result = run_with_metadata([new_qr], qr_metadata) + expect(result).to include('QuestionnaireResponse.questionnaire.extension:questionnaireDisplay') + expect(result).to include('QuestionnaireResponse.questionnaire.extension:url') + end + + it 'fails if both MS extensions and MS element in a primitive are not provided' do + qr.source_hash['_questionnaire']['extension'][0]['url'] = 'http://example.com/extension' + qr.source_hash['_questionnaire']['extension'][1]['url'] = 'http://example.com/extension' + new_qr = FHIR::QuestionnaireResponse.new(qr.source_hash) + new_qr.questionnaire = nil + + result = run_with_metadata([new_qr], qr_metadata) + expect(result).to include('QuestionnaireResponse.questionnaire.extension:questionnaireDisplay') + expect(result).to include('QuestionnaireResponse.questionnaire.extension:url') + expect(result).to include('questionnaire') + end + + it 'fails if one of MS extensions in a primitive is not provided' do + qr.source_hash['_questionnaire']['extension'][0]['url'] = 'http://example.com/extension' + new_qr = FHIR::QuestionnaireResponse.new(qr.source_hash) + + result = run_with_metadata([new_qr], qr_metadata) + expect(result).to include('QuestionnaireResponse.questionnaire.extension:questionnaireDisplay') + expect(result).to_not include('QuestionnaireResponse.questionnaire.extension:url') + expect(result).to_not include('questionnaire') + end + + it 'fails if MS primitive value is missing' do + new_hash = qr.source_hash.except('status') + new_qr = FHIR::QuestionnaireResponse.new(new_hash) + + result = run_with_metadata([new_qr], qr_metadata) + expect(result).to include('status') + end + + it 'fails if regular extension is provided for MS primitive without MS extension' do + new_hash = qr.source_hash.except('status') + new_hash['_status'] = { + 'extension' => [ + { + 'url' => 'http://example.com/extension', + 'valueString' => 'value' + } + ] + } + + new_qr = FHIR::QuestionnaireResponse.new(new_hash) + + result = run_with_metadata([new_qr], qr_metadata) + expect(result).to include('status') + end + + it 'fails if MS element (not primitive) is missing' do + qr.subject = nil + + result = run_with_metadata([qr], qr_metadata) + expect(result).to include('subject') + end + + it 'fails if regular extension is provided for MS element (not primitive)' do + qr.subject = FHIR::Reference.new( + extension: [ + { + url: 'http://example.com/extension', + valueString: 'value' + } + ] + ) + + result = run_with_metadata([qr], qr_metadata) + expect(result).to include('subject') + end + end +end diff --git a/spec/inferno/dsl/fhir_resource_navigation_spec.rb b/spec/inferno/dsl/fhir_resource_navigation_spec.rb new file mode 100644 index 000000000..f6c625ffd --- /dev/null +++ b/spec/inferno/dsl/fhir_resource_navigation_spec.rb @@ -0,0 +1,176 @@ +require_relative '../../../lib/inferno/dsl/fhir_resource_navigation' + +RSpec.describe Inferno::DSL::FHIRResourceNavigation do + # Using a new class to perform navigation in order to have access to metadata. + let(:including_class) do + Class.new do + include Inferno::DSL::FHIRResourceNavigation + attr_accessor :metadata + end + end + let(:must_support_coverage_test) do + # originally, USCoreTestKit::USCoreV610::CoverageMustSupportTest.new + msc_test = including_class.new + msc_test.metadata = metadata_fixture('coverage_v610.yml') + msc_test + end + let(:must_support_heartrate_test) do + # originally, USCoreTestKit::USCoreV610::HeartRateMustSupportTest.new + mshr_test = including_class.new + mshr_test.metadata = metadata_fixture('heart_rate_v610.yml') + mshr_test + end + let(:coverage_with_two_classes) do + FHIR::Coverage.new.tap do |cov| + cov.local_class = [FHIR::Coverage::Class.new.tap do |loc_class| + loc_class.type = FHIR::CodeableConcept.new.tap do |code_concept| + code_concept.coding = [FHIR::Coding.new.tap do |coding| + coding.system = 'http://terminology.hl7.org/CodeSystem/coverage-class' + coding.code = 'group' + end] + end + loc_class.value = 'groupclass' + end, + FHIR::Coverage::Class.new.tap do |loc_class| + loc_class.type = FHIR::CodeableConcept.new.tap do |code_concept| + code_concept.coding = [FHIR::Coding.new.tap do |coding| + coding.system = 'http://terminology.hl7.org/CodeSystem/coverage-class' + coding.code = 'plan' + end] + end + loc_class.value = 'planclass' + end] + cov.identifier = [FHIR::Identifier.new.tap do |identifier| + identifier.type = FHIR::CodeableConcept.new.tap do |code_concept| + code_concept.coding = [FHIR::Coding.new.tap do |coding| + coding.system = 'http://terminology.hl7.org/CodeSystem/v2-0203' + coding.code = 'MB' + end] + end + identifier.system = 'https://github.com/inferno-framework/us-core-test-kit' + identifier.value = 'f4a375d2-4e53-4f81-ba95-345e7573b550' + end] + end + end + let(:heartrate_by_value) do + FHIR::Observation.new.tap do |observation| + observation.category = [FHIR::CodeableConcept.new.tap do |code_concept| + code_concept.coding = [FHIR::Coding.new.tap do |code| + code.system = 'something-else' + code.code = 'vital-signs' + end] + code_concept.text = 'heartrate-example-wrong-system' + end, + FHIR::CodeableConcept.new.tap do |code_concept| + code_concept.coding = [FHIR::Coding.new.tap do |code| + code.system = 'http://terminology.hl7.org/CodeSystem/observation-category' + code.code = 'something-else' + end] + code_concept.text = 'heartrate-example-wrong-code' + end, + FHIR::CodeableConcept.new.tap do |code_concept| + code_concept.coding = [FHIR::Coding.new.tap do |code| + code.system = 'http://terminology.hl7.org/CodeSystem/observation-category' + code.code = 'vital-signs' + end] + code_concept.text = 'heartrate-example' + end] + observation.valueQuantity = FHIR::Quantity.new.tap do |quantity| + quantity.value = 44 + quantity.unit = 'beats/min' + quantity.system = 'http://unitsofmeasure.org' + quantity.code = '/min' + end + end + end + + def metadata_fixture(filename) + path = File.realpath(File.join(Dir.pwd, 'spec/fixtures/metadata', filename)) + metadata_yaml = YAML.load_file(path) + OpenStruct.new(metadata_yaml) # so that the top-level keys can be accessed directly, ie metadata.must_supports[...] + end + + describe '#resolve_path' do + it 'gets a value' do + expect(must_support_coverage_test.resolve_path(heartrate_by_value, 'value.value')).to contain_exactly(44) + end + end + + describe '#find_a_value_at' do + it 'finds the first value when not given a specific slice' do + expect(must_support_coverage_test.find_a_value_at(coverage_with_two_classes, 'class.value')).to eq('groupclass') + end + + it 'finds a specific slice value when given a specific slice' do + expect(must_support_coverage_test.find_a_value_at(coverage_with_two_classes, + 'class:plan.value')).to eq('planclass') + end + + it 'can find fixed elements given a specific slice' do + expect(must_support_coverage_test.find_a_value_at(coverage_with_two_classes, + 'identifier:memberid.type.coding.code')).to eq('MB') + end + + it 'can find an element in a specific slice discriminated by values' do + expect(must_support_heartrate_test.find_a_value_at(heartrate_by_value, + 'category:VSCat.text')).to eq('heartrate-example') + end + + it 'can find an element in a specific slice discriminated by type' do + expect(must_support_heartrate_test.find_a_value_at(heartrate_by_value, + 'value[x]:valueQuantity.code')).to eq('/min') + end + end + + describe '#matching_type_slice?' do + let(:matcher) { including_class.new } + + it 'matches on Date for a valid Date' do + slice = '2024-05-06' + discriminator = { code: 'Date' } + expect(matcher).to be_matching_type_slice(slice, discriminator) + end + + it 'does not match on Date for an invalid Date' do + slice = 'hello' + discriminator = { code: 'Date' } + expect(matcher).to_not be_matching_type_slice(slice, discriminator) + end + + it 'matches on DateTime for a valid DateTime' do + slice = '2024-05-06T07:08:09' + discriminator = { code: 'DateTime' } + expect(matcher).to be_matching_type_slice(slice, discriminator) + end + + it 'does not match on DateTime for an invalid DateTime' do + slice = 'hello' + discriminator = { code: 'DateTime' } + expect(matcher).to_not be_matching_type_slice(slice, discriminator) + end + + it 'matches on String for a String' do + slice = 'some value here' + discriminator = { code: 'String' } + expect(matcher).to be_matching_type_slice(slice, discriminator) + end + + it 'does not match on String for a non-String' do + slice = FHIR::Quantity.new + discriminator = { code: 'String' } + expect(matcher).to_not be_matching_type_slice(slice, discriminator) + end + + it 'matches on other type for the appropriate type' do + slice = FHIR::Quantity.new + discriminator = { code: 'Quantity' } + expect(matcher).to be_matching_type_slice(slice, discriminator) + end + + it 'does not match on other type for the wrong type' do + slice = FHIR::Period.new + discriminator = { code: 'Quantity' } + expect(matcher).to_not be_matching_type_slice(slice, discriminator) + end + end +end diff --git a/spec/inferno/dsl/must_support_metadata_extractor_spec.rb b/spec/inferno/dsl/must_support_metadata_extractor_spec.rb new file mode 100644 index 000000000..28938f9c9 --- /dev/null +++ b/spec/inferno/dsl/must_support_metadata_extractor_spec.rb @@ -0,0 +1,193 @@ +require_relative '../../../lib/inferno/dsl/must_support_metadata_extractor' + +RSpec.describe Inferno::DSL::MustSupportMetadataExtractor do + include ExtractTGZHelper + + let(:uscore3_package) { File.expand_path('../../fixtures/uscore311.tgz', __dir__) } + let(:uscore3_ig) { Inferno::Entities::IG.from_file(uscore3_package) } + + let(:extractor) { described_class.new([profile_element], profile, 'resourceConstructor', ig_resources) } + + let(:profile) do + profile = double + allow(profile).to receive_messages(baseDefinition: 'baseDefinition', name: 'name', type: 'type', version: 'version') + profile + end + let(:ig_resources) do + ig_resources = double + allow(ig_resources).to receive(:value_set_by_url).and_return(nil) + ig_resources + end + + let(:type) do + type = double + allow(type).to receive(:profile).and_return(['profile_url']) + type + end + + let(:profile_element) { double } + + before do + allow(profile_element).to receive_messages(mustSupport: true, path: 'foo.extension', id: 'id', type: [type]) + end + + describe '#get_type_must_support_metadata' do + let(:metadata) do + { path: 'path' } + end + + let(:type) do + type = double + allow(type).to receive_messages(extension: 'extension', code: 'code') + type + end + + let(:element) do + element = double + allow(element).to receive(:type).and_return([type]) + element + end + + it 'returns a path and an original path when type_must_support_extension' do + allow(extractor).to receive(:type_must_support_extension?).and_return(true) + + result = extractor.get_type_must_support_metadata(metadata, element) + + expected = [{ original_path: 'path', path: 'pathCode' }] + expect(result).to eq(expected) + end + + it 'returns empty when not type_must_support_extension' do + allow(extractor).to receive(:type_must_support_extension?).and_return(false) + + result = extractor.get_type_must_support_metadata(metadata, element) + + expected = [] + expect(result).to eq(expected) + end + end + + describe '#type_slices' do + let(:goal_profile) { uscore3_ig.profile_by_url('http://hl7.org/fhir/us/core/StructureDefinition/us-core-goal') } + let(:goal_extractor) do + described_class.new(goal_profile.snapshot.element, goal_profile, goal_profile.type, uscore3_ig) + end + + it 'extracts slices from profile with slicing by type' do + slices = goal_extractor.type_slices + + # Goal profile has a slice on target.due[x], fixed to type date (ie, dueDate) + # rubocop:disable Layout/LineLength + # https://www.hl7.org/fhir/us/core/STU3.1.1/StructureDefinition-us-core-goal-definitions.html#Goal.target.due[x]:dueDate + # rubocop:enable Layout/LineLength + + expect(slices.length).to be(1) + expect(slices[0][:slice_id]).to eq('Goal.target.due[x]:dueDate') + expect(slices[0][:path]).to eq('target.due[x]') + expect(slices[0][:discriminator][:type]).to eq('type') + expect(slices[0][:discriminator][:code]).to eq('Date') + end + end + + describe '#value_slices' do + let(:pulseox_profile) { uscore3_ig.profile_by_url('http://hl7.org/fhir/us/core/StructureDefinition/us-core-pulse-oximetry') } + let(:pulseox_extractor) do + described_class.new(pulseox_profile.snapshot.element, pulseox_profile, pulseox_profile.type, uscore3_ig) + end + + it 'extracts slices from profile with slicing by value' do + slices = pulseox_extractor.value_slices + + # https://www.hl7.org/fhir/us/core/STU3.1.1/StructureDefinition-us-core-pulse-oximetry.html + # PulseOximetry profile has 2 slices by value, 1 on category, 1 on code.coding + # and 2 slices by pattern on component. + + expect(slices.length).to eq(4) + expect(slices[0][:slice_id]).to eq('Observation.category:VSCat') + expect(slices[0][:path]).to eq('category') + expect(slices[0][:discriminator][:type]).to eq('value') + expect(slices[0][:discriminator][:values][0]).to eq({ path: 'coding.code', value: 'vital-signs' }) + + expect(slices[1][:slice_id]).to eq('Observation.code.coding:PulseOx') + expect(slices[1][:path]).to eq('code.coding') + expect(slices[1][:discriminator][:type]).to eq('value') + expect(slices[1][:discriminator][:values][0]).to eq({ path: 'code', value: '59408-5' }) + + expect(slices[2][:slice_id]).to eq('Observation.component:FlowRate') + expect(slices[2][:path]).to eq('component') + expect(slices[2][:discriminator][:type]).to eq('patternCodeableConcept') + expect(slices[2][:discriminator][:code]).to eq('3151-8') + + expect(slices[3][:slice_id]).to eq('Observation.component:Concentration') + expect(slices[3][:path]).to eq('component') + expect(slices[3][:discriminator][:type]).to eq('patternCodeableConcept') + expect(slices[3][:discriminator][:code]).to eq('3150-0') + end + end + + describe '#must_support_elements' do + let(:ped_weight_for_height_profile) do + uscore3_ig.profile_by_url('http://hl7.org/fhir/us/core/StructureDefinition/pediatric-weight-for-height') + end + + it 'extracts the expected MS elements' do + pwh_extractor = described_class.new(ped_weight_for_height_profile.snapshot.element, + ped_weight_for_height_profile, ped_weight_for_height_profile.type, uscore3_ig) + + ms_elements = pwh_extractor.must_support_elements + # https://www.hl7.org/fhir/us/core/STU3.1.1/StructureDefinition-pediatric-weight-for-height.html#profile + # note also the inhereted elements from the core vital-signs profile + # http://hl7.org/fhir/R4/vitalsigns.html + + expect(ms_elements).to include( + { path: 'category' }, + { path: 'category:VSCat.coding' }, + { path: 'category:VSCat.coding.code', fixed_value: 'vital-signs' }, + { path: 'category:VSCat.coding.system', + fixed_value: 'http://terminology.hl7.org/CodeSystem/observation-category' }, + { path: 'code.coding.code', fixed_value: '77606-2' }, + { path: 'subject', types: ['Reference'], + target_profiles: ['http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient'] }, + { path: 'value[x]' }, + { path: 'value[x]:valueQuantity.value' }, + { path: 'value[x]:valueQuantity.unit' }, + { path: 'value[x]:valueQuantity.system', fixed_value: 'http://unitsofmeasure.org' }, + { path: 'value[x]:valueQuantity.code', fixed_value: '%' } + ) + end + end + + describe '#by_requirement_extension_only?' do + let(:dr_profile) do + # unfortunately there are no profiles in US Core 3 with a uscdi-requirement extension + # so this one comes from US Core 6.1.0 + FHIR.from_contents(File.read('spec/fixtures/StructureDefinition-us-core-documentreference_v610.json')) + end + + let(:dr_category_slice_element) do + dr_profile.snapshot.element.find { |e| e.id == 'DocumentReference.category:uscore' } + end + + it 'identifies uscdi elements when provided the uscdi extension url' do + extension_url = 'http://hl7.org/fhir/us/core/StructureDefinition/uscdi-requirement' + dr_extractor = described_class.new(dr_profile.snapshot.element, dr_profile, dr_profile.type, uscore3_ig, + extension_url) + + expect(dr_extractor).to be_by_requirement_extension_only(dr_category_slice_element) + end + + it 'ignores uscdi elements when provided no requirement extension' do + dr_extractor = described_class.new(dr_profile.snapshot.element, dr_profile, dr_profile.type, uscore3_ig) + + expect(dr_extractor).to_not be_by_requirement_extension_only(dr_category_slice_element) + end + + it 'ignores uscdi elements when provided a different requirement extension' do + extension_url = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-interpreter-needed' + dr_extractor = described_class.new(dr_profile.snapshot.element, dr_profile, dr_profile.type, uscore3_ig, + extension_url) + + expect(dr_extractor).to_not be_by_requirement_extension_only(dr_category_slice_element) + end + end +end diff --git a/spec/inferno/dsl/value_extractor_spec.rb b/spec/inferno/dsl/value_extractor_spec.rb new file mode 100644 index 000000000..66692d00a --- /dev/null +++ b/spec/inferno/dsl/value_extractor_spec.rb @@ -0,0 +1,186 @@ +require_relative '../../../lib/inferno/dsl/value_extractor' +require 'extract_tgz_helper' + +RSpec.describe Inferno::DSL::ValueExtractor do + include ExtractTGZHelper + + let(:uscore3_package) { File.expand_path('../../fixtures/uscore311.tgz', __dir__) } + let(:uscore3_untarred) { extract_tgz(uscore3_package) } + let(:uscore3_ig) { Inferno::Entities::IG.from_file(uscore3_untarred) } + + def fixture(filename) + path = File.join(uscore3_untarred, 'package', filename) + FHIR::Json.from_json(File.read(path)) + end + + after { cleanup(uscore3_untarred) } + + describe '#values_from_fixed_codes' do + let(:bmi_for_age_profile) { fixture('StructureDefinition-pediatric-bmi-for-age.json') } + + it 'extracts codes from an element with fixedCode' do + elements = bmi_for_age_profile.snapshot.element + extractor = described_class.new(nil, bmi_for_age_profile.type, elements) + # https://www.hl7.org/fhir/us/core/STU3.1.1/StructureDefinition-pediatric-bmi-for-age.html + # category.coding.code is fixed to "vital-signs" + + category_element = elements.find { |e| e.path == 'Observation.category' } + + expect(extractor.values_from_fixed_codes(category_element, 'CodeableConcept')).to contain_exactly('vital-signs') + end + end + + describe '#values_from_pattern_coding' do + let(:pulse_ox_profile) do + # unfortunately there are no profiles in US Core 3 with a patternCoding + # so this one comes from US Core 4 + FHIR.from_contents(File.read('spec/fixtures/StructureDefinition-us-core-pulse-oximetry_v400.json')) + end + + it 'extracts codes from an element with patternCoding' do + elements = pulse_ox_profile.snapshot.element + extractor = described_class.new(nil, pulse_ox_profile.type, elements) + # https://hl7.org/fhir/us/core/STU4/StructureDefinition-us-core-pulse-oximetry.html + # Observation.code has 2 slices: + # PulseOx: {system: "http://loinc.org", code: "59408-5"} + # O2Sat: {system: "http://loinc.org", code: "2708-6"} + code_element = elements.find { |e| e.path == 'Observation.code' } + + expect(extractor.values_from_pattern_coding(code_element, + 'CodeableConcept')).to contain_exactly('59408-5', '2708-6') + end + end + + describe '#values_from_pattern_codeable_concept' do + let(:observation_lab_profile) { fixture('StructureDefinition-us-core-observation-lab.json') } + + it 'extracts codes from an element with patternCodeableConcept' do + elements = observation_lab_profile.snapshot.element + extractor = described_class.new(nil, observation_lab_profile.type, elements) + # https://www.hl7.org/fhir/us/core/STU3.1.1/StructureDefinition-us-core-observation-lab.html + + category_element = elements.find { |e| e.path == 'Observation.category' } + + expect(extractor.values_from_pattern_codeable_concept(category_element, + 'CodeableConcept')).to contain_exactly('laboratory') + end + end + + describe '#bound_systems' do + let(:smoking_status_profile) do + uscore3_ig.profile_by_url('http://hl7.org/fhir/us/core/StructureDefinition/us-core-smokingstatus') + end + let(:smoking_status_vs) do + uscore3_ig.value_set_by_url('http://hl7.org/fhir/us/core/ValueSet/us-core-smoking-status-observation-codes') + end + let(:condition_profile) do + uscore3_ig.profile_by_url('http://hl7.org/fhir/us/core/StructureDefinition/us-core-condition') + end + let(:condition_category_vs) do + uscore3_ig.value_set_by_url('http://hl7.org/fhir/us/core/ValueSet/us-core-condition-category') + end + + let(:condition_category_code_system) do + FHIR::CodeSystem.new( + { + resourceType: 'CodeSystem', + id: 'condition-category', + url: 'http://terminology.hl7.org/CodeSystem/condition-category', + identifier: [ + { + system: 'urn:ietf:rfc:3986', + value: 'urn:oid:2.16.840.1.113883.4.642.1.1073' + } + ], + version: '0.5.0', + name: 'ConditionCategoryCodes', + title: 'Condition Category Codes', + description: 'Preferred value set for Condition Categories.', + caseSensitive: true, + valueSet: 'http://terminology.hl7.org/ValueSet/condition-category', + content: 'complete', + concept: [ + { + code: 'problem-list-item', + display: 'Problem List Item', + definition: 'An item on a problem list that can be managed over time[...]' + }, + { + code: 'encounter-diagnosis', + display: 'Encounter Diagnosis', + definition: 'A point in time diagnosis (e.g. from a physician or nurse) in context of an encounter.' + } + ] + } + ) + end + + it 'gets systems for VS with include.concept' do + # ValueSet-us-core-smoking-status-observation-codes.json + elements = smoking_status_profile.snapshot.element + extractor = described_class.new(uscore3_ig, smoking_status_profile.type, elements) + + code_field = elements.find { |e| e.path == 'Observation.code' } + + result = extractor.bound_systems(code_field) + + expect(result[0]).to be_a(FHIR::R4::ValueSet::Compose::Include) + expect(result[0].system).to eq('http://loinc.org') + expect(result[0].concept[0].code).to eq('72166-2') + end + + it 'gets systems for VS with include.system without concept or filter' do + # ValueSet-us-core-condition-category.json + elements = condition_profile.snapshot.element + extractor = described_class.new(uscore3_ig, condition_profile.type, elements) + + # NOTE: we cheat here, this VS references codesystem: + # http://terminology.hl7.org/CodeSystem/condition-category + # which is a core FHIR codesystem, not part of the IG. + # for this test we add it to the IG so the local lookup works + uscore3_ig.handle_resource(condition_category_code_system, '') + + category_field = elements.find { |e| e.path == 'Condition.category' } + result = extractor.bound_systems(category_field) + + expect(result[0]).to be_a(FHIR::CodeSystem) + expect(result[0].url).to eq('http://terminology.hl7.org/CodeSystem/condition-category') + end + end + + describe '#codes_from_value_set_binding' do + let(:smoking_status_profile) do + uscore3_ig.profile_by_url('http://hl7.org/fhir/us/core/StructureDefinition/us-core-smokingstatus') + end + + it 'extracts code when the VS has bound systems' do + elements = smoking_status_profile.snapshot.element + extractor = described_class.new(uscore3_ig, smoking_status_profile.type, elements) + code_field = elements.find { |e| e.path == 'Observation.code' } + + result = extractor.codes_from_value_set_binding(code_field) + expect(result).to contain_exactly('72166-2') + end + end + + describe '#values_from_resource_metadata' do + it 'extracts fixed values for a given field' do + extractor = described_class.new(nil, 'Location', nil) + # Location.status has just a few possible codes + # https://hl7.org/fhir/r4/valueset-location-status.html + field_with_valid_codes = 'status' + field_without_valid_codes = 'name' + paths = [field_with_valid_codes, field_without_valid_codes] + result = extractor.values_from_resource_metadata(paths) + + sys = 'http://hl7.org/fhir/location-status' + expected_results = [ + { system: sys, code: 'active' }, + { system: sys, code: 'suspended' }, + { system: sys, code: 'inactive' } + ] + + expect(result).to match_array(expected_results) + end + end +end diff --git a/spec/inferno/entities/ig_spec.rb b/spec/inferno/entities/ig_spec.rb index 7ecc92775..6b2e618ae 100644 --- a/spec/inferno/entities/ig_spec.rb +++ b/spec/inferno/entities/ig_spec.rb @@ -19,7 +19,7 @@ expect_uscore3_loaded_properly(ig) end - def expect_uscore3_loaded_properly(ig) # rubocop:disable Naming/MethodParameterName, Metrics/CyclomaticComplexity + def expect_uscore3_loaded_properly(ig) # rubocop:disable Metrics/CyclomaticComplexity # For each artifact type in the IG, check: # the right number are loaded, # they're all the expected type, @@ -37,18 +37,36 @@ def expect_uscore3_loaded_properly(ig) # rubocop:disable Naming/MethodParameterN expect(ig.extensions.map(&:id)).to include('us-core-race', 'us-core-ethnicity') # https://www.hl7.org/fhir/us/core/STU3.1.1/terminology.html - expect(ig.value_sets.length).to eq(32) - expect(ig.value_sets.map(&:resourceType).uniq).to eq(['ValueSet']) - expect(ig.value_sets.map(&:id)).to include('us-core-usps-state', 'simple-language') + value_sets = ig.resources_by_type['ValueSet'] + expect(value_sets.length).to eq(32) + expect(value_sets.map(&:resourceType).uniq).to eq(['ValueSet']) + expect(value_sets.map(&:id)).to include('us-core-usps-state', 'simple-language') # https://www.hl7.org/fhir/us/core/STU3.1.1/searchparameters.html - expect(ig.search_params.length).to eq(74) - expect(ig.search_params.map(&:resourceType).uniq).to eq(['SearchParameter']) - expect(ig.search_params.map(&:id)).to include('us-core-patient-name', 'us-core-encounter-id') + search_params = ig.resources_by_type['SearchParameter'] + expect(search_params.length).to eq(74) + expect(search_params.map(&:resourceType).uniq).to eq(['SearchParameter']) + expect(search_params.map(&:id)).to include('us-core-patient-name', 'us-core-encounter-id') # https://www.hl7.org/fhir/us/core/STU3.1.1/all-examples.html expect(ig.examples.length).to eq(84) expect(ig.examples.map(&:id)).to include('child-example', 'self-tylenol') + + patient_profile_url = 'http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient' + + expect(ig.resource_for_profile(patient_profile_url)).to eq('Patient') + + patient_profile = ig.profile_by_url(patient_profile_url) + expect(patient_profile.resourceType).to eq('StructureDefinition') + expect(patient_profile.id).to eq('us-core-patient') + + condition_codes_vs = ig.value_set_by_url('http://hl7.org/fhir/us/core/ValueSet/us-core-condition-code') + expect(condition_codes_vs.resourceType).to eq('ValueSet') + expect(condition_codes_vs.title).to eq('US Core Condition Code') + + race_ethnicity_cs = ig.code_system_by_url('urn:oid:2.16.840.1.113883.6.238') + expect(race_ethnicity_cs.resourceType).to eq('CodeSystem') + expect(race_ethnicity_cs.title).to eq('Race & Ethnicity - CDC') end end end