FHIR Chat · Hybrid InMemoryTerminologyServerValidationSupport with Remot · hapi

Stream: hapi

Topic: Hybrid InMemoryTerminologyServerValidationSupport with Remot


view this post on Zulip Kevin Mayfield (Nov 06 2021 at 10:39):

In our validator we are primarily using the InMemoryTerminologyServerValidationSupport class but for SNOMED and other large codesystems we want to pass that to a Terminology Server.

At present I've created an extension InMemoryTerminologyServerValidationSupport with parts of RemoteTerminologyServiceValidationSupport

So if the codeSystem is SNOMED it is sent to the validation is sent in, it uses code from RemoteTerminologyServiceValidationSupport

https://github.com/NHSDigital/validation-service-fhir-r4/blob/feature/terminologyServer/src/main/kotlin/com/example/fhirvalidator/shared/TerminologyValidationSupport.java

Is this the right way to do this?
I've not missed a different approach.

view this post on Zulip Brian Postlethwaite (Nov 06 2021 at 21:34):

That's a decent approach.

view this post on Zulip Brian Postlethwaite (Nov 06 2021 at 21:36):

We have something similar in our server where it uses the local TS implementation, and if it doesn't know about the valueaet/codesystem calls out to a remote system if configured.

view this post on Zulip Patrick Werner (Nov 08 2021 at 12:25):

@Kevin Mayfield i think you also could just add both terminology services to the validation chain. The Chain will then try to pick the validation service capable of this VS/CS

view this post on Zulip Kevin Mayfield (Nov 08 2021 at 12:58):

I'll have another look. I think the InMemory validation was rejecting resources the RemoteValidation could handle (It had the ValueSet but not CodeSystem?)

view this post on Zulip Kevin Mayfield (Nov 18 2021 at 06:44):

We're back with two classes.

Roughly the problem we have is

We have ValueSets in the the validator which reference external CodeSystems (in a remote terminology server)

So we are overriding validateCodeInValueSet in InMemoryTerminologyServerValidationSupport to disable validation of these valuesets (if the codesystem is on a terminology server)
Also overriding validateCode in RemoteTerminologyServiceValidationSupport to use the validator ValueSet (not the one on the remote terminology server).

Wondering if their is a better way of doing this\?

view this post on Zulip Grahame Grieve (Nov 18 2021 at 12:42):

to do what exactly?

view this post on Zulip James Agnew (Nov 18 2021 at 18:28):

Personally I'd do the following: Create your own class that extends RemoteTerminologyServiceValidationSupport and put it at the very top of the chain, but also put InMemory farther down the chain.

In your extended class, override the validateCode methods so that they return null when the system is not one you want handed by the remote service. When a validateCode method returns null the chain moves on to the next item in the chain.

view this post on Zulip Kevin Mayfield (Nov 19 2021 at 09:15):

Thanks @James Agnew

It does look like that would nearly work. I think we may be suggesting changing this

protected CodeValidationResult invokeRemoteValidateCode
(https://github.com/hapifhir/hapi-fhir/blob/92e98592724afcbb4476ecb7eefb7d3915cf21b0/hapi-fhir-validation/src/main/java/org/hl7/fhir/common/hapi/validation/support/RemoteTerminologyServiceValidationSupport.java#L182)

So it is accessible in our override methods for validateCode and validateCodeInValuSet
(we want to pass a ValueSet to the terminology server not a valueSet.url as we want to use our definition not the terminology servers definition)

view this post on Zulip Jens Villadsen (Jan 05 2022 at 09:21):

@Kevin Mayfield I believe it would be very valuable to the community to have an exmaple hybrid validation support module as part of the HAPI FHIR starter project as it is common to have the large codesystems like LOINC and SNOMED placed on an already existing terminology server (@Patrick Werner / @Oliver Egger don't you guys agree?). Would you care to draft a PR to the starter project that enables this feature?

view this post on Zulip Kevin Mayfield (Jan 05 2022 at 10:06):

yep willing to contribute.

view this post on Zulip Patrick Werner (Jan 06 2022 at 11:56):

i agree. Ideally configurable through the application.yaml

view this post on Zulip Jens Villadsen (Jan 31 2022 at 19:05):

@Kevin Mayfield any progress on the contribution?

view this post on Zulip Kevin Mayfield (Feb 01 2022 at 09:18):

I'm still working on getting suport/permission.

view this post on Zulip Michael Lawley (Feb 02 2022 at 03:34):

How well does this work when the ValueSet in question includes codes from both local and remote code systems?

view this post on Zulip Jens Villadsen (Feb 02 2022 at 07:13):

That 'can' be considered a case not supported


Last updated: Apr 12 2022 at 19:14 UTC