FHIR Chat · hapi with newest java validation · hapi

Stream: hapi

Topic: hapi with newest java validation


view this post on Zulip Patrick Werner (Oct 26 2020 at 10:08):

The current hapi master branch uses fhir.core 5.1.0. This version doesn't support slicing by pattern on name and address (what we are doing in the german base profiles). This was fixed in fhir.core 5.1.10+

view this post on Zulip Patrick Werner (Oct 26 2020 at 10:09):

I tried updating the fhir.core version for hapi (whole core, and only validation) with 5.10 and 5.16 without success.

view this post on Zulip Patrick Werner (Oct 26 2020 at 10:09):

Caused by: java.lang.reflect.InvocationTargetException: null
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
        at java.base/jdk.internal.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
        at java.base/jdk.internal.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
        at java.base/java.lang.reflect.Method.invoke(Method.java:566)
        at ca.uhn.fhir.rest.server.method.BaseMethodBinding.invokeServerMethod(BaseMethodBinding.java:245)
        ... 54 common frames omitted
Caused by: java.lang.NoSuchMethodError: org.hl7.fhir.r5.elementmodel.Element.hasParentForValidator()Z
        at org.hl7.fhir.validation.instance.InstanceValidator.setParents(InstanceValidator.java:5096)
        at org.hl7.fhir.validation.instance.InstanceValidator.validate(InstanceValidator.java:697)
        at org.hl7.fhir.validation.instance.InstanceValidator.validate(InstanceValidator.java:553)
        at org.hl7.fhir.common.hapi.validation.validator.ValidatorWrapper.validate(ValidatorWrapper.java:165)
        at org.hl7.fhir.common.hapi.validation.validator.FhirInstanceValidator.validate(FhirInstanceValidator.java:211)
        at org.hl7.fhir.common.hapi.validation.validator.BaseValidatorBridge.doValidate(BaseValidatorBridge.java:22)
        at org.hl7.fhir.common.hapi.validation.validator.BaseValidatorBridge.validateResource(BaseValidatorBridge.java:45)
        at org.hl7.fhir.common.hapi.validation.validator.FhirInstanceValidator.validateResource(FhirInstanceValidator.java:29)
        at ca.uhn.fhir.validation.FhirValidator.validateWithResult(FhirValidator.java:245)

view this post on Zulip Patrick Werner (Oct 26 2020 at 10:10):

The structure of the methods in the java validator aren't fitting anymore. Did anyone else tried the same, or started a branch with a newer fhir.core which i didn't see?

view this post on Zulip Oliver Egger (Oct 26 2020 at 10:25):

@Patrick Werner : I have our validator working with the combo hapi 5.2.0-snapshot and fhir.core.version 5.1.15, later is not yet possible due to class name changes, see https://github.com/ahdis/hapi-fhir-jpaserver-validator/releases/tag/v1.1.0 if interested.

view this post on Zulip Patrick Werner (Oct 26 2020 at 10:26):

Wow, very helpful. Thank you @Oliver Egger

view this post on Zulip Patrick Werner (Oct 26 2020 at 10:27):

Wondering why i got errors wit 5.1.10. Have you tried validating an jnstance against a profile with patternSlicing on name or address? This triggers the reflection nullpointer in my case

view this post on Zulip Patrick Werner (Oct 26 2020 at 12:10):

Ok tried to apply your pom changes to the current jpa starter:

  • hapi snapshot 5.2.0 is currently broken, tried 5.1.0
  • upped *core to 5.1.15
  • hapi can't resolve datatype strucdefs which have been posted to the server during validation. I then added the data type profiles via ig -> kind of works
  • now the validator returns:
{
            "severity": "error",
            "code": "processing",
            "diagnostics": "Expected 0 but found 2 prefix elements",
            "location": [
                "Patient.name[0]",
                "Line 24, Col 6"
            ]
        },
        {
            "severity": "error",
            "code": "processing",
            "diagnostics": "Expected 0 but found 2 suffix elements",
            "location": [
                "Patient.name[0]",
                "Line 24, Col 6"
            ]
        }

view this post on Zulip Patrick Werner (Oct 26 2020 at 12:11):

The patient example i'm validating doesn't include any name prefis or suffix elements...

view this post on Zulip Oliver Egger (Oct 26 2020 at 12:17):

no sorry, I don't think i have patternSlicing on name or address in our ig's

view this post on Zulip Patrick Werner (Oct 26 2020 at 12:25):

no worries, thanks again for your response!

view this post on Zulip Patrick Werner (Oct 26 2020 at 12:26):

In the java validator everything just works.. will try to get the core dependency to a up to date version in the hapi project.

view this post on Zulip David Meyers (Feb 18 2021 at 12:40):

Hello everyone, were facing a similar response when trying to validate our patient resource against the mii kds person profile. The Structure definition file looks fine imo, so i guess its an hapi related issue. were using 5.2.0 numbat version.

example:

"address": [
{
"type": "both",
"line": [
  "Musterstr. 1"
],
  "city": "Darmstadt",
  "postalCode": "64283",
  "country": "DE"
 }
]

results in:

"severity": "error",
"code": "processing",
"diagnostics": "Expected 0 but found 1 line elements",
"location": [
"Patient.address[0]",
"Line 36, Col 10"
]
}

If you omit the line, however, the validator then also complains (which is correct):

{
"severity": "error",
"code": "processing",
"diagnostics": "Patient.address:Strassenanschrift.line: minimum required = 1, but only found 0 (from https://www.medizininformatik-initiative.de/fhir/core/modul-person/StructureDefinition/Patient)",
"location": [
"Patient.address[0]",
"Line 36, Col 10"
] }

If u need further information, just let me know pls. thx so far.

view this post on Zulip David Meyers (Mar 03 2021 at 09:05):

We have just checked if the problem is also present in version 5.3.0 -> unfortunately it is.

view this post on Zulip Patrick Werner (Mar 08 2021 at 07:51):

its a bug. I already added a PR here: https://github.com/hapifhir/org.hl7.fhir.core/pull/424
I will add Changelog and Testcase this week, so this bug will be fixed soon.


Last updated: Apr 12 2022 at 19:14 UTC