Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

HAPI FHIR validation shows errors for ValueSet codes, but FHIR validation CLI says there are no ValueSet code errors #5907

Open
benjamin-reddy opened this issue May 7, 2024 · 0 comments

Comments

@benjamin-reddy
Copy link

Describe the bug
I am running a HAPI FHIR server that is using a custom FHIR IG package. The server is using FHIR version R4B. It is also using RemoteTerminologyServiceValidationSupport with https://tx.fhir.org/r4. When I run a validation using the HAPI FHIR server, I receive several error messages that look like the following:

<severity value="error"/>
        <code value="processing"/>
        <details>
            <coding>
                <system value="http://hl7.org/fhir/java-core-messageId"/>
                <code value="Terminology_TX_NoValid_1_CC"/>
            </coding>
        </details>
        <diagnostics value="None of the codings provided are in the value set 'SPL Document Codes' ([http://hl7.org/fhir/us/spl/ValueSet/splDocumentCodes|0.1.0](http://hl7.org/fhir/us/spl/ValueSet/splDocumentCodes%7C0.1.0)), and a coding from this value set is required) (codes = [http://loinc.org#34391-3](http://loinc.org/#34391-3))"/>
        <location value="Bundle.entry[0].resource.type"/>
        <location value="Line[33] Col[15]"/>

I posted my issue to the Fhir Server Github issue forum here:
HealthIntersections/fhirserver#235

From the conversation, I learned about the FHIR validator CLI, and used that to test my input.
https://github.com/hapifhir/org.hl7.fhir.core/releases/latest/download/validator_cli.jar

The validator gave the same ValueSet error messages I saw in my HAPIFHIR validation result. However, I found that the cause of the issue was that the input display element was incorrect. When I re-tested with the FHIR validator CLI using the correct display elements for a couple of ValueSets, there were no more error messages for those ValueSet codes. I made sure that the FHIR validation CLI was running with FHIR version R4B.

However, when I used the same input with the correct display values in the HAPI FHIR validator, I still get the same ValueSet errors for all the ValueSet codes. I am not sure if HAPI FHIR’s validation method is supposed to be different from the FHIR validator CLI, or there is a bug with the HAPIFHIR validator itself when it comes to these ValueSets.

To Reproduce
Steps to reproduce the behavior:

  1. Add the following code to StarterJpaConfig:
//NEW validationSupportChain for terminology support
	@Primary
	@Bean
	public CachingValidationSupport validationSupportChain(JpaValidationSupportChain theJpaValidationSupportChain, IFhirSystemDao<?, ?> fhirSystemDao) {
		FhirContext ctx = fhirSystemDao.getContext();
	
		DefaultProfileValidationSupport defaultSupport = new DefaultProfileValidationSupport(ctx);
		theJpaValidationSupportChain.addValidationSupport(defaultSupport);
	
		System.out.println("RemoteTerminologyServiceValidationSupport BEFORE INVOKE");

		RemoteTerminologyServiceValidationSupport remoteTermSvc = new RemoteTerminologyServiceValidationSupport(ctx, "https://tx.fhir.org/r4");

		theJpaValidationSupportChain.addValidationSupport(remoteTermSvc);
	
		System.out.println("RemoteTerminologyServiceValidationSupport IS INVOKED");
		
		return ValidationSupportConfigUtil.newCachingValidationSupport(theJpaValidationSupportChain);
	}
	
	//NEW validatorModule for terminology support
	@Primary
	@Bean
	public IValidatorModule validatorModule(CachingValidationSupport validationSupport) {
		return new FhirInstanceValidator(validationSupport);
	}
  1. Have the following enabled in application.yaml
hapi.fhir.enable_repository_validating_interceptor = true
hapi.fhir.tester.home.validation.requests_enabled = true
hapi.fhir.tester.home.validation.responses_enabled = true
hapi:
  fhir:
    implementationguides:
       spl_dev:
          packageUrl: classpath:Package/hl7.fhir.us.spl.tgz
          name: hl7.fhir.us.spl
          version: dev
  1. Download the custom FHIR IG from here:
    https://github.com/HL7/fhir-spl/blob/main/package/hl7.fhir.us.spl.tgz

After you download, run the following commands to remove the index files to prevent issues:

tar -xvzf hl7.fhir.us.spl.tgz
rm .index.json .index.db usage.ini hl7.fhir.us.spl.tgz
tar -cvzf hl7.fhir.us.spl.tgz package

After the package is put back into tar, put the package under /src/main/resources/Package

  1. Start up HAPI FHIR server

  2. Create POST request using postman with the URL http://localhost:8080/fhir/Bundle/$validate. Use the following XML in the body to test:
    HapiFhir-Bundle-AllopurinolTabletLabelBundle.zip

The ValueSets I have been testing with for now are 34391-3, 34089-3, 34090-1. The correct display codes are these:
SPL Doc Codes
SPL Section Codes

  1. See the validation results

Expected behavior
The ValueSet codes with the correct description (34391-3, 34089-3, 34090-1) should not have any errors in the validation result.

Environment (please complete the following information):

  • HAPI FHIR Version: R4B
  • OS: Windows 11
  • Browser: Chrome
  • Java 17

Additional context
There is one other validation issue that looks like this:

<severity value="error"/>
        <code value="processing"/>
        <details>
            <coding>
                <system value="http://hl7.org/fhir/java-core-messageId"/>
                <code value="Validation_VAL_Profile_Minimum"/>
            </coding>
        </details>
        <diagnostics value="Bundle.entry:Composition: minimum required = 1, but only found 0 (from http://hl7.org/fhir/us/spl/StructureDefinition/ProductSubmissionBundle|0.1.0)"/>
        <location value="Bundle"/>
        <location value="Line[3] Col[37]"/>

The result says there are 0 Bundle Entries, even though there is one. This may be related to the validation issue above. For now, I'm trying to figure out the ValueSet issue first.

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

No branches or pull requests

1 participant