Skip to content

Validation doesn't consider loaded IG immediately #4934

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

Closed
volodymyr-korzh opened this issue May 24, 2023 · 0 comments · Fixed by #4935
Closed

Validation doesn't consider loaded IG immediately #4934

volodymyr-korzh opened this issue May 24, 2023 · 0 comments · Fixed by #4935
Assignees

Comments

@volodymyr-korzh
Copy link
Collaborator

After loading an IG, it is not immediately used by validation

Steps To Reproduce

  1. Add fhir_endpoint request validation and a validation dependency to persistence.
  2. Try to persist a not-IG-compliant resource (uses a profile from an IG not yet loaded). Returns correct error: profile doesn’t exist.
  3. load the UKCore IG (adjust url to your file location)
  4. Try to persist same resource again. Returns incorrect error: profile doesn’t.
Requests Examples:
  1. module.fhir_endpoint.config.request_validating.enabled=true
  2. POST http://localhost:8000/Patient with UKCore-Patient profile.
{
  "resourceType": "Patient",
  "meta": {
		"profile": ["https://fhir.nhs.uk/R4/StructureDefinition/UKCore-Patient" ]
	},
  "identifier": [ { "system": "https://fhir.nhs.uk/Id/nhs-number" } ],
  "name": [ {
      "family": "Chalmers123",
      "given": [ "Peter", "James" ]
  } ],
  "gender": "male",
  "birthDate": "1974-01-13",
  "address": [ {
      "line": [ "534 Erewhon St" ],
      "city": "PleasantVille",
      "state": "Vic",
      "postalCode": "3999"
  } ]
}
  1. PUT http://localhost:8002/write/install/by-spec
{
  "name": "UK.Core.r4",
  "version": "1.1.0",
  "devDependencies": null,
  "canonicals": null,
  "fhirVersions": [
    "4.0.1"
  ],
  "url":"file://Users/path_to_project/hapi-fhir/hapi-fhir-jpaserver-test-utilities/src/main/resources/packages/UK.Core.r4-1.1.0.tgz"
}

Actual result
Error returns that profile does not exist (same as in 2.)

Response Example:
{
	"resourceType": "OperationOutcome",
	"issue": [
		{
			"severity": "error",
			"code": "processing",
			"details": {
				"coding": [
					{
						"system": "http://hl7.org/fhir/java-core-messageId",
						"code": "VALIDATION_VAL_PROFILE_UNKNOWN_NOT_POLICY"
					}
				]
			},
			"diagnostics": "Profile reference 'https://fhir.nhs.uk/R4/StructureDefinition/UKCore-Patient' has not been checked because it is unknown, and the validator is set to not fetch unknown profiles",
			"location": [
				"Patient.meta.profile[0]",
				"Line 1, Col 2"
			]
		}
	]
}

Expected behavior
Error should be returned indicating no-compliance.

Response Example:
{
	"resourceType": "OperationOutcome",
	"issue": [
		{
			"severity": "error",
			"code": "processing",
			"details": {
				"coding": [
					{
						"system": "http://hl7.org/fhir/java-core-messageId",
						"code": "Validation_VAL_Profile_Minimum"
					}
				]
			},
			"diagnostics": "Patient.identifier:nhsNumber.extension:nhsNumberVerificationStatus: minimum required = 1, but only found 0 (from https://fhir.nhs.uk/R4/StructureDefinition/UKCore-Patient|1.0.0)",
			"location": [
				"Patient.identifier[0]",
				"Line 6, Col 68"
			]
		},
		{
			"severity": "error",
			"code": "processing",
			"details": {
				"coding": [
					{
						"system": "http://hl7.org/fhir/java-core-messageId",
						"code": "Validation_VAL_Profile_Minimum"
					}
				]
			},
			"diagnostics": "Patient.identifier:nhsNumber.value: minimum required = 1, but only found 0 (from https://fhir.nhs.uk/R4/StructureDefinition/UKCore-Patient|1.0.0)",
			"location": [
				"Patient.identifier[0]",
				"Line 6, Col 68"
			]
		}
	]
}
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

Successfully merging a pull request may close this issue.

1 participant