Skip to content

Commit

Permalink
HAPI FHIR 7.4.5 and Spring 3.2.6
Browse files Browse the repository at this point in the history
  • Loading branch information
KevinMayfield committed Jan 16, 2025
1 parent 34f55b4 commit 47a0595
Show file tree
Hide file tree
Showing 6 changed files with 271 additions and 69 deletions.
2 changes: 1 addition & 1 deletion interoperability-standards-tools-skunkworks
Submodule interoperability-standards-tools-skunkworks updated 56 files
+14 −0 README.md
+11 −11 docs/404.html
+0 −1 docs/main.1d9442c33a0e2c1e.js
+1 −0 docs/main.971fc5f59fc40071.js
+1 −1 docs/styles.d48c690fbeb4f8dc.css
+27 −0 input/images-source/component-diagram.plantuml
+ input/images/component-diagram.png
+5 −4 src/app/api-documentation/api-documentation.component.html
+4 −2 src/app/app-routing.module.ts
+31 −4 src/app/app.module.ts
+2 −0 src/app/concept/concept-display/concept-display.component.html
+0 −0 src/app/concept/concept-display/concept-display.component.scss
+49 −0 src/app/concept/concept-display/concept-display.component.ts
+117 −0 src/app/concept/concept-popup/concept-popup.component.html
+3 −0 src/app/concept/concept-popup/concept-popup.component.scss
+249 −0 src/app/concept/concept-popup/concept-popup.component.ts
+1 −1 src/app/document/document-section/document-section.component.html
+3 −3 src/app/document/document.component.html
+1 −5 src/app/document/document.component.ts
+72 −0 src/app/ecl-builder/ecl-builder.component.html
+6 −0 src/app/ecl-builder/ecl-builder.component.scss
+383 −0 src/app/ecl-builder/ecl-builder.component.ts
+43 −0 src/app/ecl-builder/snomed-ecl-picker/snomed-ecl-picker.component.html
+0 −0 src/app/ecl-builder/snomed-ecl-picker/snomed-ecl-picker.component.scss
+215 −0 src/app/ecl-builder/snomed-ecl-picker/snomed-ecl-picker.component.ts
+9 −0 src/app/eclModel.ts
+5 −2 src/app/info-diaglog/info-diaglog.component.html
+1 −1 src/app/info-diaglog/info-diaglog.component.ts
+1 −1 src/app/markdown/markdown.component.html
+0 −431 src/app/questionnaire/Questionnaire/permission.json
+0 −116 src/app/questionnaire/Questionnaire/prescription-nomination.json
+0 −640 src/app/questionnaire/Questionnaire/vital-signs.json
+227 −0 ...onnaire/questionnaire-definition/questionnaire-definition-item/questionnaire-definition-item.component.html
+26 −0 ...onnaire/questionnaire-definition/questionnaire-definition-item/questionnaire-definition-item.component.scss
+256 −0 ...tionnaire/questionnaire-definition/questionnaire-definition-item/questionnaire-definition-item.component.ts
+20 −0 src/app/questionnaire/questionnaire-definition/questionnaire-definition.component.html
+0 −0 src/app/questionnaire/questionnaire-definition/questionnaire-definition.component.scss
+95 −0 src/app/questionnaire/questionnaire-definition/questionnaire-definition.component.ts
+9 −0 src/app/questionnaire/questionnaire-edit/questionnaire-edit.component.html
+1 −0 src/app/questionnaire/questionnaire-edit/questionnaire-edit.component.scss
+112 −0 src/app/questionnaire/questionnaire-edit/questionnaire-edit.component.ts
+26 −0 src/app/questionnaire/questionnaire-form-display/questionnaire-form.component.html
+0 −0 src/app/questionnaire/questionnaire-form-display/questionnaire-form.component.scss
+334 −0 src/app/questionnaire/questionnaire-form-display/questionnaire-form.component.ts
+99 −0 src/app/questionnaire/questionnaire-information/questionnaire-information.component.html
+3 −0 src/app/questionnaire/questionnaire-information/questionnaire-information.component.scss
+215 −0 src/app/questionnaire/questionnaire-information/questionnaire-information.component.ts
+59 −32 src/app/questionnaire/questionnaire.component.html
+3 −0 src/app/questionnaire/questionnaire.component.scss
+148 −119 src/app/questionnaire/questionnaire.component.ts
+1 −1 src/app/resource-dialog/resource-dialog.component.html
+16 −16 src/app/testing-main/testing-main.component.html
+6 −5 src/app/validate/validate.component.html
+1 −1 src/environments/environment.ts
+7 −7 src/index.html
+2 −2 src/theme.scss
6 changes: 3 additions & 3 deletions pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
<parent>
<groupId>org.springframework.boot</groupId>
<artifactId>spring-boot-starter-parent</artifactId>
<version>3.2.2</version>
<version>3.2.6</version>
<relativePath/> <!-- lookup parent from repository -->
</parent>
<groupId>uk.nhs.england</groupId>
Expand All @@ -17,8 +17,8 @@
<properties>
<java.version>20</java.version>
<kotlin.version>1.9.22</kotlin.version>
<fhir.version>7.0.2</fhir.version>
<swagger_version>2.2.20</swagger_version>
<fhir.version>7.4.5</fhir.version>
<swagger_version>2.2.25</swagger_version>
<parser_version>2.1.20</parser_version>
<jackson_databind_version>2.17.0</jackson_databind_version>
</properties>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,9 @@ import ca.uhn.fhir.context.support.ValidationSupportContext
import ca.uhn.fhir.rest.server.exceptions.UnprocessableEntityException
import ca.uhn.fhir.validation.FhirValidator
import com.fasterxml.jackson.databind.ObjectMapper
import io.swagger.v3.oas.models.examples.Example
import mu.KLogging
import org.hl7.fhir.common.hapi.validation.support.*
import org.hl7.fhir.common.hapi.validation.validator.FhirInstanceValidator
import org.hl7.fhir.r4.model.CapabilityStatement
import org.hl7.fhir.r4.model.ImplementationGuide
import org.hl7.fhir.r4.model.StructureDefinition
import org.hl7.fhir.utilities.json.model.JsonProperty
import org.hl7.fhir.utilities.npm.NpmPackage
Expand Down Expand Up @@ -195,9 +192,7 @@ open class ValidationConfiguration(
): uk.nhs.england.fhirvalidator.shared.RemoteTerminologyServiceValidationSupport {
logger.info("Using remote terminology server at ${terminologyValidationProperties.url}")
val validationSupport =
uk.nhs.england.fhirvalidator.shared.RemoteTerminologyServiceValidationSupport(
fhirContext
)
uk.nhs.england.fhirvalidator.shared.RemoteTerminologyServiceValidationSupport(fhirContext)
validationSupport.setBaseUrl(terminologyValidationProperties.url)

if (optionalAuthorizedClientManager.isPresent) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,6 @@ import org.hl7.fhir.instance.model.api.IBaseResource
import org.hl7.fhir.r4.hapi.ctx.HapiWorkerContext
import org.hl7.fhir.r4.model.*
import org.hl7.fhir.r4.model.OperationOutcome.OperationOutcomeIssueComponent
import org.hl7.fhir.r4.utils.FHIRPathEngine
import org.springframework.beans.factory.annotation.Qualifier
import org.springframework.stereotype.Component
import uk.nhs.england.fhirvalidator.interceptor.CapabilityStatementApplier
Expand All @@ -25,6 +24,9 @@ import uk.nhs.england.fhirvalidator.util.createOperationOutcome
import java.net.URLDecoder
import java.nio.charset.StandardCharsets
import jakarta.servlet.http.HttpServletRequest
import org.hl7.fhir.r4.fhirpath.FHIRPathEngine
import org.hl7.fhir.r4.model.Bundle.BundleType


@Component
class ValidateR4Provider (
Expand Down Expand Up @@ -52,7 +54,7 @@ class ValidateR4Provider (
if (expression==null) return returnResult
var hapiWorkerContext = HapiWorkerContext(fhirContext,supportChain)
var fhirPathEngine = FHIRPathEngine(hapiWorkerContext)
// var expression = "identifier.where(system='https://fhir.nhs.uk/Id/nhs-number').exists().not() or (identifier.where(system='https://fhir.nhs.uk/Id/nhs-number').exists() and identifier.where(system='https://fhir.nhs.uk/Id/nhs-number').value.matches('^([456789]{1}[0-9]{9})\$'))"
// var expression = "identifier.where(system='https://fhir.nhs.uk/Id/nhs-number').exists().not() or (identifier.where(system='https://fhir.nhs.uk/Id/nhs-number').exists() and identifier.where(system='https://fhir.nhs.uk/Id/nhs-number').value.matches('^([456789]{1}[0-9]{9})\$'))"
var decode = URLDecoder.decode(expression, StandardCharsets.UTF_8.name())
System.out.println(expression)
System.out.println(decode)
Expand Down Expand Up @@ -83,18 +85,18 @@ class ValidateR4Provider (
): IBaseResource? {
return resource
}
/*
Move to a STU3 RestfulServer, is asuming input is R4 at present
@Operation(name = "\$convertR4", idempotent = true)
@Throws(java.lang.Exception::class)
fun convertR4(
@ResourceParam resource: IBaseResource?
): IBaseResource? {
val convertor = VersionConvertor_30_40(BaseAdvisor_30_40())
val resourceR3 = resource as Resource
return convertor.convertResource(resourceR3)
}
*/
/*
Move to a STU3 RestfulServer, is asuming input is R4 at present
@Operation(name = "\$convertR4", idempotent = true)
@Throws(java.lang.Exception::class)
fun convertR4(
@ResourceParam resource: IBaseResource?
): IBaseResource? {
val convertor = VersionConvertor_30_40(BaseAdvisor_30_40())
val resourceR3 = resource as Resource
return convertor.convertResource(resourceR3)
}
*/
@Validate
fun validate(
servletRequest: HttpServletRequest,
Expand All @@ -117,38 +119,56 @@ class ValidateR4Provider (
operationOutcome = parseAndValidateResource(resource, profile, importProfile)
}
val methodOutcome = MethodOutcome()
if (operationOutcome != null ) {
if (operationOutcome.hasIssue()) {
if (operationOutcome.hasIssue()) {
// Temp workaround for onto validation issues around workflow code
for (issue in operationOutcome.issue) {
if (issue.hasDiagnostics() && issue.diagnostics.contains("404")) {
if(// issue.diagnostics.contains("https://fhir.nhs.uk/CodeSystem/Workflow-Code") ||
issue.diagnostics.contains("https://fhir.nhs.uk/CodeSystem/NHSDataModelAndDictionary-treatment-function")) {
issue.severity = OperationOutcome.IssueSeverity.INFORMATION
}
// This is to downgrade onto server issues to information.
if (!issue.diagnostics.contains(".uk") && (issue.diagnostics.contains("A usable code system with URL")
|| issue.diagnostics.contains("LOINC is not indexed!"))) {
// This is probably ontology server issue so degrade warning to information
issue.severity = OperationOutcome.IssueSeverity.INFORMATION
}
val newIssue = ArrayList<OperationOutcomeIssueComponent>()
for (issue in operationOutcome.issue) {

if (issue.hasLocation()) {
val newLocs = ArrayList<StringType>()
issue.location.forEach { str ->
if (str.value == null || !str.value.startsWith("Line")) newLocs.add(str)
}
if (issue.diagnostics.contains("http://unstats.un.org/unsd/")) {
issue.location = newLocs
}
if (issue.hasDiagnostics() && issue.diagnostics.contains("404")) {
if(// issue.diagnostics.contains("https://fhir.nhs.uk/CodeSystem/Workflow-Code") ||
issue.diagnostics.contains("https://fhir.nhs.uk/CodeSystem/NHSDataModelAndDictionary-treatment-function")) {
issue.severity = OperationOutcome.IssueSeverity.INFORMATION
}
if (issue.diagnostics.contains("note that the validator cannot judge what is suitable")) {
// This is to downgrade onto server issues to information.
if (!issue.diagnostics.contains(".uk") && (issue.diagnostics.contains("A usable code system with URL")
// || issue.diagnostics.contains("LOINC is not indexed!")
)) {
// This is probably ontology server issue so degrade warning to information
issue.severity = OperationOutcome.IssueSeverity.INFORMATION
}

}
if (issue.diagnostics.contains("http://unstats.un.org/unsd/")
|| issue.diagnostics.contains("note that the validator cannot judge what is suitable")
|| issue.diagnostics.contains("A resource should have narrative for robust management")) {
issue.severity = OperationOutcome.IssueSeverity.INFORMATION
}
if (//!issue.diagnostics.contains("Validation failed for 'http://loinc.org")
//&&
!issue.diagnostics.contains("because \"theCodeSystem\"")
&& !issue.diagnostics.contains("but you should check that it's not intended to match a slice")
&& !issue.diagnostics.contains("because &quot;theCodeSystem&quot; is null")
&& !issue.diagnostics.contains("A resource should have narrative for robust management" )
) {
newIssue.add(issue)
}
} else {
// https://nhsd-jira.digital.nhs.uk/browse/IOPS-829
operationOutcome.issue.add(OperationOutcome.OperationOutcomeIssueComponent()
.setCode(OperationOutcome.IssueType.INFORMATIONAL)
.setSeverity(OperationOutcome.IssueSeverity.INFORMATION)
.setDiagnostics("No issues detected during validation"))
}
operationOutcome.issue = newIssue
} else {
// https://nhsd-jira.digital.nhs.uk/browse/IOPS-829
operationOutcome.issue.add(OperationOutcome.OperationOutcomeIssueComponent()
.setCode(OperationOutcome.IssueType.INFORMATIONAL)
.setSeverity(OperationOutcome.IssueSeverity.INFORMATION)
.setDiagnostics("No issues detected during validation"))
}

methodOutcome.operationOutcome = operationOutcome
return methodOutcome
}
Expand Down Expand Up @@ -203,11 +223,21 @@ class ValidateR4Provider (
result = validator.validateWithResult(resource, ValidationOptions().addProfile(profile))
.toOperationOutcome() as? OperationOutcome
} else {
capabilityStatementApplier.applyCapabilityStatementProfiles(resource, importProfile)
val messageDefinitionErrors = fhirMessage.applyMessageDefinition(resource)
if (messageDefinitionErrors != null) {
messageDefinitionErrors.issue.forEach{
additionalIssues.add(it)
if (resource is Bundle && resource.type.equals(BundleType.DOCUMENT)) {
// enforce local profiles in the FHIR document
(resource as Bundle).entry.forEach { entry ->
if (entry.hasResource()) {
capabilityStatementApplier.applyCapabilityStatementProfiles(entry.resource, importProfile)
}
}
capabilityStatementApplier.applyCapabilityStatementProfiles(resource, importProfile)
} else {
capabilityStatementApplier.applyCapabilityStatementProfiles(resource, importProfile)
val messageDefinitionErrors = fhirMessage.applyMessageDefinition(resource)
if (messageDefinitionErrors != null) {
messageDefinitionErrors.issue.forEach{
additionalIssues.add(it)
}
}
}
if (importProfile !== null && importProfile && resource is Bundle) fhirDocumentApplier.applyDocumentDefinition(resource)
Expand Down
Loading

0 comments on commit 47a0595

Please sign in to comment.