Issue with validation module using BodyTemp profile

65 views
Skip to first unread message

R4j4h

unread,
Apr 29, 2020, 6:47:55 PM4/29/20
to HAPI FHIR
Hi all,

I just started to work on a new project using HAPI FHIR (v4.2.0) in order to build an API for creating DiagnosticReport and Observation resources.
Unfortunately, I encounter some issues with the validation module.
We are using the standard BodyTemp profile (http://hl7.org/fhir/StructureDefinition/bodytemp) that is "supported" in the current HAPI FHIR version.
However when I turn on the validation using the RequestValidatinInterceptor as defined above:
@Bean
public RequestValidatingInterceptor requestValidatingInterceptor() {
   
ValidationSupportChain chain = new ValidationSupportChain();
    chain
.addValidationSupport(new DefaultProfileValidationSupport());
    chain
.addValidationSupport(prePopulatedValidationSupport());
   
   
FhirInstanceValidator module = new FhirInstanceValidator(new CachingValidationSupport(chain));
   
module.setErrorForUnknownProfiles(true);
   
module.setNoTerminologyChecks(!validationEnabled);
   
   
RequestValidatingInterceptor interceptor = new RequestValidatingInterceptor();
    interceptor
.addValidatorModule(module);
   
return interceptor;
}
And try to submit the following payload to my ObserbationResourceProvider:
{
 
"resourceType": "Observation",
 
"id": "bodytemp",
 
"meta": {
   
"profile": [
     
"http://hl7.org/fhir/StructureDefinition/bodytemp"
   
]
 
},
 
"status": "final",
 
"category": [
   
{
     
"coding": [
       
{
         
"system": "http://terminology.hl7.org/CodeSystem/observation-category",
         
"code": "vital-signs"
       
}
     
]
   
}
 
],
 
"code": {
   
"coding": [
     
{
       
"system": "http://loinc.org",
       
"code": "8310-5"
     
}
   
]
 
},
 
"subject": {
   
"reference": "Patient/1"
 
},
 
"effectiveDateTime": "2020-04-30T12:00:00+01:00",
 
"valueQuantity": {
   
"value": 37.5,
   
"unit": "Cel",
   
"system": "http://unitsofmeasure.org",
   
"code": "Cel"
 
}
}

I receive the following error:
{
   
"resourceType": "OperationOutcome",
   
"issue": [
       
{
           
"severity": "warning",
           
"code": "processing",
           
"diagnostics": "None of the codes provided are in the value set http://hl7.org/fhir/ValueSet/observation-vitalsignresult (http://hl7.org/fhir/ValueSet/observation-vitalsignresult, and a code should come from this value set unless it has no suitable code) (codes = http://loinc.org#8310-5)",
           
"location": [
               
"Observation.code",
               
"Line 21, Col 16"
           
]
       
},
       
{
           
"severity": "error",
           
"code": "processing",
           
"diagnostics": "The value provided ('Cel') is not in the value set http://hl7.org/fhir/ValueSet/ucum-bodytemp|4.0.0 (http://hl7.org/fhir/ValueSet/ucum-bodytemp, and a code is required from this value set) (error message = Unknown code[Cel] in system[(none)])",
           
"location": [
               
"Observation.value.ofType(Quantity).code",
               
"Line 37, Col 4"
           
]
       
}
   
]
}
I do not understand why I receive the second error. I checked the valuesets.xml file that is loaded from the  jar and the value set http://hl7.org/fhir/ValueSet/ucum-bodytemp contains two UCUM codes Cel and [degF].
I tried using the FhirValidator class in a unit test and I receive exaclty the same error.

Do you have any idea?

Kind regards

R4j4h

unread,
Apr 29, 2020, 6:49:52 PM4/29/20
to HAPI FHIR
I forgot to say that when I turn off the validation on the terminology, everything is fine.

James Agnew

unread,
Apr 30, 2020, 10:48:46 AM4/30/20
to R4j4h, HAPI FHIR
Oddly enough, this was already being worked on and will be addressed in HAPI FHIR 5.0.0.

I've turned your example into a test case on the PR: https://github.com/jamesagnew/hapi-fhir/pull/1824

Cheers,
James

On Wed, Apr 29, 2020 at 6:49 PM R4j4h <rsub...@gmail.com> wrote:
I forgot to say that when I turn off the validation on the terminology, everything is fine.

--
You received this message because you are subscribed to the Google Groups "HAPI FHIR" group.
To unsubscribe from this group and stop receiving emails from it, send an email to hapi-fhir+...@googlegroups.com.
To view this discussion on the web visit https://groups.google.com/d/msgid/hapi-fhir/de08e1c8-1fb3-4ee5-977e-840213cc44d6%40googlegroups.com.
Reply all
Reply to author
Forward
0 new messages