FHIR Chat · FHIR Version extension URIs · implementers

Stream: implementers

Topic: FHIR Version extension URIs


view this post on Zulip Michael Lawley (Jan 24 2022 at 05:58):

This section of the FHIR spec: http://build.fhir.org/versions.html#extensions describes / defines how to use URIs of the form http://hl7.org/fhir/[version]/StructureDefinition/extension-[Path] to reference elements from an arbitrary FHIR Version as an extension element.

It also states:

The [Path] is actually the ElementDefinition.id from the relevant StructureDefinition for the element.

However, the ElementDefinition.id I wish to refer to ends with .value[x] which contains the characters "[" and "]" which are not permitted in a URI.

Should I instead be %-encoding these values leading to an extension looking like:

  "extension": [{
    "url": "http://hl7.org/fhir/5.0/StructureDefinition/extension-ConceptMap.group.element.target.dependsOn.value%5Bx%5D",
    "valueDateTime": "2015-03-13"
  }]

view this post on Zulip Brian Postlethwaite (Jan 24 2022 at 12:23):

I think they were replaced with _ but I'm not 100% sure, I'll see if I can dig something out as reference material

view this post on Zulip Michael Lawley (Jan 25 2022 at 03:42):

Thanks @Brian Postlethwaite , _ would be good because %-encoding introduces variability around case (%5b %5B etc)

view this post on Zulip Michael Lawley (Jan 25 2022 at 04:17):

The other question I have about this relates to what should be done in the case of a "sibling" element that is defined in terms of another element via a contentReference. In my case, ConceptMap.group.element.target.product is defined by reference to ConceptMap.group.element.target.dependsOn, so does this imply correspondingly re-based element Paths/Ids?

view this post on Zulip Brian Postlethwaite (Jan 25 2022 at 04:17):

image.png
Yup, underscore.

view this post on Zulip Michael Lawley (Jan 25 2022 at 04:22):

Great, so:

  "extension": [{
    "url": "http://hl7.org/fhir/5.0/StructureDefinition/extension-ConceptMap.group.element.target.dependsOn.value_x_",
    "valueDateTime": "2015-03-13"
  }]

and

  "extension": [{
    "url": "http://hl7.org/fhir/5.0/StructureDefinition/extension-ConceptMap.group.element.target.product.value_x_",
    "valueDateTime": "2015-03-13"
  }]

view this post on Zulip Michael Lawley (Jan 27 2022 at 08:30):

@Brian Postlethwaite is that underscore replacement approach documented somewhere in the spec?

view this post on Zulip Brian Postlethwaite (Jan 27 2022 at 09:18):

I don't remember.

view this post on Zulip Michael Lawley (Feb 18 2022 at 00:27):

I've now tried running the latest command line validator on a ValueSet resource containing one of these extensions and it "doesn't work".
The input included:

        "contains": [ {
        "extension": [ {
        "url": "http://hl7.org/fhir/5.0/StructureDefinition/extension-ValueSet.expansion.contains.property",
        "extension": [ {
            "url": "code",
            "valueCode": "inactive"
        }, {
            "url": "value[x]",
            "valueBoolean": false
        } ]
        }, {
        "url": "http://hl7.org/fhir/5.0/StructureDefinition/extension-ValueSet.expansion.contains.property",
        "extension": [ {
            "url": "code",
            "valueCode": "parent"
        }, {
            "url": "value_x_",
            "valueCode": "302168000"
        } ]
        } ],
        "system": "http://snomed.info/sct",
        "code": "74400008",
        "display": "Appendicitis"
    } ]

and it accepts the value[x] (which includes the URI-invalid characters '[' and ']'), but rejects value_x_

FHIR Validation tool Version 5.6.34 (Git# edd2c43e64b7). Built 2022-02-16T14:24:56.912Z (33 hours old)
  Java:   11.0.11 from /Library/Java/JavaVirtualMachines/zulu-11.jdk/Contents/Home on aarch64 (64bit). 8192MB available
  Paths:  Current = /Users/law223/Documents/SRC/ontoserver4, Package Cache = /Users/law223/.fhir/packages
  Params: -version 4.0 /tmp/vs.json
Loading
  Load FHIR v4.0 from hl7.fhir.r4.core#4.0.1 - 4575 resources (00:02.0868)
  Load hl7.terminology#3.0.0 - 3795 resources (00:01.0289)
  Terminology server http://tx.fhir.org - Version 2.0.12-SNAPSHOT (00:02.0789)
  Get set...  go (00:00.0067)
Validating
  Validate /tmp/vs.json   ..Detect format for /tmp/vs.json
Internal error in location for message: 'Error @1, 1: Premature ExpressionNode termination at unexpected token "["', loc = 'ValueSet.expansion.contains[0].extension[1].extension[1][url='value_x_']', err = 'Sub-extension url 'value_x_' is not defined by the Extension http://hl7.org/fhir/5.0/StructureDefinition/extension-ValueSet.expansion.contains.property'
 00:02.0549
Done. Times: Loading: 00:07.0143, validation: 00:02.0549. Memory = 845Mb

*FAILURE*: 1 errors, 0 warnings, 1 notes
  Error @ ValueSet.expansion.contains[0].extension[1].extension[1][url='value_x_'] (line 40, col7): Sub-extension url 'value_x_' is not defined by the Extension http://hl7.org/fhir/5.0/StructureDefinition/extension-ValueSet.expansion.contains.property
  Information @ ValueSet.expansion.contains[0].extension[1].extension[1] (line 40, col7): This element does not match any known slice defined in the profile http://hl7.org/fhir/5.0/StructureDefinition/extension-ValueSet.expansion.contains.property

@Grahame Grieve this looks like a tooling error?

view this post on Zulip Grahame Grieve (Feb 18 2022 at 01:23):

it should be just value according to decision made by FHIR-I

view this post on Zulip Michael Lawley (Feb 18 2022 at 01:25):

Which also gives an error:

Internal error in location for message: 'Error @1, 1: Premature ExpressionNode termination at unexpected token "["', loc = 'ValueSet.expansion.contains[0].extension[0].extension[1][url='value']', err = 'Sub-extension url 'value' is not defined by the Extension http://hl7.org/fhir/5.0/StructureDefinition/extension-ValueSet.expansion.contains.property'
Internal error in location for message: 'Error @1, 1: Premature ExpressionNode termination at unexpected token "["', loc = 'ValueSet.expansion.contains[0].extension[1].extension[1][url='value']', err = 'Sub-extension url 'value' is not defined by the Extension http://hl7.org/fhir/5.0/StructureDefinition/extension-ValueSet.expansion.contains.property'

view this post on Zulip Michael Lawley (Feb 18 2022 at 01:39):

I'm also running into questions with elements defined by content reference e.g.,

  "ConceptMap.group.element.target.product": {
    "types": [
      "@ConceptMap.group.element.target.dependsOn"
    ]
  },

the URI http://hl7.org/fhir/5.0/StructureDefinition/extension-ConceptMap.group.element.target.product.value[x] is rejected, and if I instead attempt to use http://hl7.org/fhir/5.0/StructureDefinition/extension-ConceptMap.group.element.target.product with a nested extension for the value[x] part, then the validator throws org.hl7.fhir.exceptions.DefinitionException

Validation Infrastructure fail validating /tmp/cm.json: StructureDefinition http://hl7.org/fhir/5.0/StructureDefinition/extension-ConceptMap.group.element.target.product at Extension.value[x]: illegal constrained type @ConceptMap.group.element.target.dependsOn from base64Binary, boolean, canonical, code, date, dateTime, decimal, id, instant, integer, markdown, oid, positiveInt, string, time, unsignedInt, uri, url, uuid, Address, Age, Annotation, Attachment, CodeableConcept, Coding, ContactPoint, Count, Distance, Duration, HumanName, Identifier, Money, Period, Quantity, Range, Ratio, Reference, SampledData, Signature, Timing, ContactDetail, Contributor, DataRequirement, Expression, ParameterDefinition, RelatedArtifact, TriggerDefinition, UsageContext, Dosage, Meta in http://hl7.org/fhir/StructureDefinition/Extension
Exception in thread "main" org.hl7.fhir.exceptions.FHIRException: org.hl7.fhir.exceptions.DefinitionException: StructureDefinition http://hl7.org/fhir/5.0/StructureDefinition/extension-ConceptMap.group.element.target.product at Extension.value[x]: illegal constrained type @ConceptMap.group.element.target.dependsOn from base64Binary, boolean, canonical, code, date, dateTime, decimal, id, instant, integer, markdown, oid, positiveInt, string, time, unsignedInt, uri, url, uuid, Address, Age, Annotation, Attachment, CodeableConcept, Coding, ContactPoint, Count, Distance, Duration, HumanName, Identifier, Money, Period, Quantity, Range, Ratio, Reference, SampledData, Signature, Timing, ContactDetail, Contributor, DataRequirement, Expression, ParameterDefinition, RelatedArtifact, TriggerDefinition, UsageContext, Dosage, Meta in http://hl7.org/fhir/StructureDefinition/Extension
    at org.hl7.fhir.validation.ValidationEngine.validate(ValidationEngine.java:419)
    at org.hl7.fhir.validation.cli.services.ValidationService.validateSources(ValidationService.java:106)
    at org.hl7.fhir.validation.ValidatorCli.doValidation(ValidatorCli.java:279)
    at org.hl7.fhir.validation.ValidatorCli.main(ValidatorCli.java:164)
Caused by: org.hl7.fhir.exceptions.DefinitionException: StructureDefinition http://hl7.org/fhir/5.0/StructureDefinition/extension-ConceptMap.group.element.target.product at Extension.value[x]: illegal constrained type @ConceptMap.group.element.target.dependsOn from base64Binary, boolean, canonical, code, date, dateTime, decimal, id, instant, integer, markdown, oid, positiveInt, string, time, unsignedInt, uri, url, uuid, Address, Age, Annotation, Attachment, CodeableConcept, Coding, ContactPoint, Count, Distance, Duration, HumanName, Identifier, Money, Period, Quantity, Range, Ratio, Reference, SampledData, Signature, Timing, ContactDetail, Contributor, DataRequirement, Expression, ParameterDefinition, RelatedArtifact, TriggerDefinition, UsageContext, Dosage, Meta in http://hl7.org/fhir/StructureDefinition/Extension
    at org.hl7.fhir.r5.conformance.ProfileUtilities.checkTypeDerivation(ProfileUtilities.java:3199)
    at org.hl7.fhir.r5.conformance.ProfileUtilities.updateFromDefinition(ProfileUtilities.java:3056)
    at org.hl7.fhir.r5.conformance.ProfileUtilities.processPaths(ProfileUtilities.java:1230)
    at org.hl7.fhir.r5.conformance.ProfileUtilities.processPaths(ProfileUtilities.java:1094)
    at org.hl7.fhir.r5.conformance.ProfileUtilities.generateSnapshot(ProfileUtilities.java:658)
    at org.hl7.fhir.r5.context.SimpleWorkerContext.generateSnapshot(SimpleWorkerContext.java:816)
    at org.hl7.fhir.r5.context.SimpleWorkerContext.generateSnapshot(SimpleWorkerContext.java:786)
    at org.hl7.fhir.validation.BaseValidator.getXverExt(BaseValidator.java:1010)
    at org.hl7.fhir.validation.instance.InstanceValidator.checkExtension(InstanceValidator.java:1680)
    at org.hl7.fhir.validation.instance.InstanceValidator.checkChildByDefinition(InstanceValidator.java:5012)
    at org.hl7.fhir.validation.instance.InstanceValidator.checkChild(InstanceValidator.java:4861)
    at org.hl7.fhir.validation.instance.InstanceValidator.validateElement(InstanceValidator.java:4813)
    at org.hl7.fhir.validation.instance.InstanceValidator.checkChildByDefinition(InstanceValidator.java:5035)
    at org.hl7.fhir.validation.instance.InstanceValidator.checkChild(InstanceValidator.java:4861)
    at org.hl7.fhir.validation.instance.InstanceValidator.validateElement(InstanceValidator.java:4813)
    at org.hl7.fhir.validation.instance.InstanceValidator.checkChildByDefinition(InstanceValidator.java:5035)
    at org.hl7.fhir.validation.instance.InstanceValidator.checkChild(InstanceValidator.java:4861)
    at org.hl7.fhir.validation.instance.InstanceValidator.validateElement(InstanceValidator.java:4813)
    at org.hl7.fhir.validation.instance.InstanceValidator.checkChildByDefinition(InstanceValidator.java:5035)
    at org.hl7.fhir.validation.instance.InstanceValidator.checkChild(InstanceValidator.java:4861)
    at org.hl7.fhir.validation.instance.InstanceValidator.validateElement(InstanceValidator.java:4813)
    at org.hl7.fhir.validation.instance.InstanceValidator.checkChildByDefinition(InstanceValidator.java:5035)
    at org.hl7.fhir.validation.instance.InstanceValidator.checkChild(InstanceValidator.java:4861)
    at org.hl7.fhir.validation.instance.InstanceValidator.validateElement(InstanceValidator.java:4813)
    at org.hl7.fhir.validation.instance.InstanceValidator.startInner(InstanceValidator.java:4503)
    at org.hl7.fhir.validation.instance.InstanceValidator.start(InstanceValidator.java:4366)
    at org.hl7.fhir.validation.instance.InstanceValidator.validateResource(InstanceValidator.java:5637)
    at org.hl7.fhir.validation.instance.InstanceValidator.validate(InstanceValidator.java:763)
    at org.hl7.fhir.validation.instance.InstanceValidator.validate(InstanceValidator.java:611)
    at org.hl7.fhir.validation.ValidationEngine.validate(ValidationEngine.java:441)
    at org.hl7.fhir.validation.ValidationEngine.validate(ValidationEngine.java:411)
    ... 3 more

view this post on Zulip Michael Lawley (Feb 21 2022 at 23:11):

Based on current behaviour of the validator, it seems that I should be using http://hl7.org/fhir/5.0/StructureDefinition/extension-ConceptMap.group.element.target.dependsOn.value in the context of target.product.
Does this seem correct @Grahame Grieve ?

view this post on Zulip Grahame Grieve (Feb 22 2022 at 00:28):

on my todo list

view this post on Zulip Michael Lawley (Feb 22 2022 at 01:52):

which bit ? At the moment I just need clarity on what the extension URI should be so I can push out a stable release for a customer

view this post on Zulip Grahame Grieve (Mar 01 2022 at 09:31):

hey @Michael Lawley just getting to this now (sorry). Quoting from https://jira.hl7.org/browse/FHIR-31348:

Will clarify that when referencing a polymorphic type, the extension URL is always for the base element. E.g. "http://hl7.org/fhir/5.0/StructureDefinition/extension-Observation.value". This is true even if the referenced element already exists in the version referencing the extension and only one or two 'distinct' polymorphic types are trying to be referenced.

Therefore, this is correct:

  "expansion": {
    "contains": [
      {
        "extension": [
          {
            "url": "http://hl7.org/fhir/5.0/StructureDefinition/extension-ValueSet.expansion.contains.property",
            "extension": [
              {
                "url": "code",
                "valueCode": "inactive"
              },
              {
                "url": "value",
                "valueBoolean": false
              }
            ]
          },
          {
            "url": "http://hl7.org/fhir/5.0/StructureDefinition/extension-ValueSet.expansion.contains.property",
            "extension": [
              {
                "url": "code",
                "valueCode": "parent"
              },
              {
                "url": "value",
                "valueCode": "302168000"
              }
            ]
          }
        ],
        "system": "http://snomed.info/sct",
        "code": "74400008",
        "display": "Appendicitis"
      }
    ]
  }

view this post on Zulip Grahame Grieve (Mar 01 2022 at 09:31):

the next release of the validator will call that valid (bug in the current one, nothing can be valid)

view this post on Zulip Michael Lawley (Mar 01 2022 at 10:02):

Awesome, that's very helpful!


Last updated: Apr 12 2022 at 19:14 UTC