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.
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