hapifhir / hapi-fhir-jpaserver-starter

Apache License 2.0
391 stars 1.05k forks source link

Unable to validate a coverageeligibilityrequest against profiles other than HL7 #394

Closed saurabh-singh-17 closed 6 months ago

saurabh-singh-17 commented 2 years ago

Hello Team,

I am using RepositoryValidatingInterceptor to validate coverageeligibiltyrequest against profile https://ig.hcxprotocol.io/v0.7/StructureDefinition-CoverageEligibilityRequestDocument.html

Changes done to jpa stater

  1. enable_repository_validating_interceptor: true 2.added code to RepositoryValidationInterceptorFactoryR4.java

repositoryValidatingRuleBuilder.forResourcesOfType("CoverageEligibilityRequest").requireAtLeastOneProfileOf("http://hl7.org/fhir/us/core/StructureDefinition/us-core-patient","https://ig.hcxprotocol.io/v0.7/StructureDefinition-CoverageEligibilityRequestDocument.html").and().requireValidationToDeclaredProfiles();

Did a post call to {{local}}/CoverageEligibilityRequest/$validate { "resourceType": "CoverageEligibilityRequest", "id": "70e02576-f5f5-424f-b115-b5f1029704d4", "meta": { "versionId": "1", "lastUpdated": "2022-06-27T23:43:30.918+00:00", "source": "#lSkr2tR0GfhcsntI", "profile": [ "https://ig.hcxprotocol.io/v0.7/StructureDefinition-CoverageEligibilityRequestDocument.html" ] }, "identifier": [ { "system": "http://sgh.com.sa/identifier/coverageeligibilityrequest", "value": "req_70e02576-f5f5-424f-b115-b5f1029704d4" } ], "status": "active", "priority": { "coding": [ { "system": "http://terminology.hl7.org/CodeSystem/processpriority", "code": "normal" } ] }, "purpose": [ "benefits", "validation" ], "patient": { "reference": "Patient/7fc21737-57f7-46ad-941e-354bcd0b9c10" }, "servicedPeriod": { "start": "2022-06-01", "end": "2022-06-15" }, "created": "2022-06-27", "provider": { "reference": "http://sgh.com.sa/Organization/bff3aa1fbd3648619ac082357bf135db" }, "insurer": { "reference": "http://sgh.com.sa/Organization/bff3aa1fbd3648619ac082357bf135db" }, "facility": { "reference": "http://sgh.com.sa/Location/4461281" }, "insurance": [ { "coverage": { "reference": "http://sgh.com.sa/Coverage/49f78b52-cd28-46cd-80b5-2bf8ff343d54" } } ] }

Response from API call

{ "resourceType": "OperationOutcome", "text": { "status": "generated", "div": "<div xmlns=\"http://www.w3.org/1999/xhtml\">

Operation Outcome

<table border=\"0\"><td style=\"font-weight: bold;\">WARNING[CoverageEligibilityRequest, Line 1, Col 2]
dom-6: 'A resource should have narrative for robust management' Rule 'A resource should have narrative for robust management' Failed
\n\t\t\t\n\t\t\t\n\t\t\t\t<td style=\"font-weight: bold;\">ERROR\n\t\t\t\t[CoverageEligibilityRequest.meta.profile[0], Line 1, Col 2]\n\t\t\t\t
Profile reference 'https://ig.hcxprotocol.io/v0.7/StructureDefinition-CoverageEligibilityRequestDocument' has not been checked because it is unknown, and the validator is set to not fetch unknown profiles
\n\t\t\t\n\t\t\n\t
" }, "issue": [ { "severity": "warning", "code": "processing", "diagnostics": "dom-6: 'A resource should have narrative for robust management' Rule 'A resource should have narrative for robust management' Failed", "location": [ "CoverageEligibilityRequest", "Line 1, Col 2" ] }, { "severity": "error", "code": "processing", "diagnostics": "Profile reference 'https://ig.hcxprotocol.io/v0.7/StructureDefinition-CoverageEligibilityRequestDocument' has not been checked because it is unknown, and the validator is set to not fetch unknown profiles", "location": [ "CoverageEligibilityRequest.meta.profile[0]", "Line 1, Col 2" ] } ] }

Where am i going wrong. Can someone help me here?

psavva commented 2 years ago

Have you loaded the StructureDefinition to the FHIR Server?

Please notice 2 things: 1) "diagnostics": "dom-6: 'A resource should have narrative for robust management' Rule 'A resource should have narrative for robust management' Failed" is a warning as you are missing the "div" tag. This will not cause the validation to fail, but raises warning that you're missing the div. https://www.hl7.org/fhir/domainresource.html

2) "diagnostics": "Profile reference 'https://ig.hcxprotocol.io/v0.7/StructureDefinition-CoverageEligibilityRequestDocument' has not been checked because it is unknown, and the validator is set to not fetch unknown profiles" The actual error you're facing is that the fhir server cannot "find" the profile. It means that you have not loaded the StructureDefinition (POST) into the FHIR Server.

Load the Structure Definitions you are using so that the fhir server can "know" the profile.

jkiddo commented 6 months ago

Closing as stale