FHIR Chat · Validation with Multiple IG Versions · hapi

Stream: hapi

Topic: Validation with Multiple IG Versions


view this post on Zulip Stephen MacVicar (Sep 28 2021 at 12:19):

Two part question:

  • Is it possible to load multiple versions of an IG into the validator?
  • Then is it possible to ensure that particular resources are validated against a particular IG version?

I've been looking through the validation code and I don't see an obvious way to do this. My impression is that IGs are tied to the context, so I would need to create a separate context for each IG version, and then select the appropriate context to use in validation. My understanding is that contexts are pretty heavy, so I'm hoping there's a better way.

view this post on Zulip Grahame Grieve (Sep 28 2021 at 12:49):

you should be able to load multiple versions of an IG into the same context

view this post on Zulip Grahame Grieve (Sep 28 2021 at 12:49):

then nominate the profile version you wish to validate against

view this post on Zulip Grahame Grieve (Sep 28 2021 at 12:50):

but I don't think we have test cases that exercise this scenario, so no guarantee it will work

view this post on Zulip Stephen MacVicar (Sep 28 2021 at 13:30):

I'm concerned that specifying a profile version may not be sufficient because profiles and resource instances don't generally use versioned extension and value set urls.

view this post on Zulip Grahame Grieve (Sep 28 2021 at 19:56):

the context should track the versioning from the packages implicitly. It would be great if you made up a test case to check

view this post on Zulip Stephen MacVicar (Sep 29 2021 at 12:46):

I'll work on making one.

view this post on Zulip Stephen MacVicar (Oct 01 2021 at 12:46):

OK, I've created a minimal test case, with two IG versions (0.1.0 and 0.2.0), but I haven't figured out how to make the validator validate against a specific profile version. I've loaded both IG versions, but this validates against 0.2.0:

List<String> profiles = new ArrayList<>();
profiles.add("http://example.org/validator-versions-test/StructureDefinition/multi-version-test-patient|0.1.0");
OperationOutcome op = ve.validate(FhirFormat.JSON, resource, profiles);

view this post on Zulip Grahame Grieve (Oct 01 2021 at 19:32):

then that's a bug outright. and the test case is a success at least

view this post on Zulip Stephen MacVicar (Oct 04 2021 at 15:02):

It looks like they were validating against the correct profile version, but not the correct extension version. I opened a PR with unit tests and more details: https://github.com/hapifhir/org.hl7.fhir.core/pull/614


Last updated: Apr 12 2022 at 19:14 UTC