Skip to content

ConstraintGenerator should handle versioned extension canonicals #3654

@lmsurpre

Description

@lmsurpre

Describe the bug
For #3653 I'd like to ensure that when an instance is validated against a formulary profile from version 1.0.1 of that IG, then the extensions in that instance are conformant to version 1.0.1 of the corresponding extension definition.

To accomplish this, I tried adding a version postfix to the type.profile on the element definition in the profile definition.
For example, from StructureDefinition-usdf-CoveragePlan:

            {
                "id": "List.extension:usdf-Network-extension",
                "path": "List.extension",
                "sliceName": "usdf-Network-extension",
                "min": 1,
                "max": "*",
                "type": [
                    {
                        "code": "Extension",
                        "profile": [
                            "http://hl7.org/fhir/us/davinci-drug-formulary/StructureDefinition/usdf-Network-extension***|1.0.1***"
                        ]
                    }
                ],
                "mustSupport": true
            },

I think this is valid.
However, our ConstraintGenerator currently builds a constraint like this one for that:
extension('http://hl7.org/fhir/us/davinci-drug-formulary/StructureDefinition/usdf-Network-extension|1.0.1').count() >= 1

Based on the definition of the extension function, this is guaranteed to fail because FHIR extension URLs are not canonicals... i.e. should not include the |1.0.1 version suffix.

At the very least, we should strip the version suffix before generating constraints like this.
Event better would be to generate a constraint to test that a given usdf-Network-extension extension actual conformsTo this particular version of the extension (our current validation logic will only test it against the 'latest' extension definition with this URL).

Environment
Which version of IBM FHIR Server?

To Reproduce
Steps to reproduce the behavior:

  1. Go to '...'
  2. Click on '....'
  3. Scroll down to '....'
  4. See error

Expected behavior
A clear and concise description of what you expected to happen.

Additional context
As an aside, I wish that extension URLs in instance data could be versioned.
I've mentioned that on chat.fhir.org a few times, most recently at https://chat.fhir.org/#narrow/stream/179166-implementers/topic/Extension.20with.20multiple.20versions/near/273818766
However, I've not actually submitted a tracker for it...pretty sure it would get rejected.

Metadata

Metadata

Assignees

Labels

bugSomething isn't working

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions