From cd6e17d744c96d8316413db7f87e2ca66bcf8d20 Mon Sep 17 00:00:00 2001 From: x-rodubou <romuald.dubourg@kereval.com> Date: Tue, 18 Jun 2024 11:40:33 +0200 Subject: [PATCH] [Update] Add missing parameters --- .../DocumentReferencesResourceProvider.java | 39 +++++++++++-------- .../server/buisness/ListResourceProvider.java | 21 +++++----- .../controler/MHDRestfullServer.java | 8 +--- ...DocumentReferencesProviderServiceImpl.java | 4 +- .../technical/ws/ListProviderServiceImpl.java | 5 ++- .../src/main/resources/application.properties | 2 +- .../MHDFhirValidationServiceMapperTest.java | 2 +- 7 files changed, 44 insertions(+), 37 deletions(-) diff --git a/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/buisness/DocumentReferencesResourceProvider.java b/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/buisness/DocumentReferencesResourceProvider.java index 7e06bfb..362f0a9 100644 --- a/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/buisness/DocumentReferencesResourceProvider.java +++ b/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/buisness/DocumentReferencesResourceProvider.java @@ -4,14 +4,17 @@ package net.ihe.gazelle.fhir.server.buisness; import ca.uhn.fhir.rest.annotation.*; import ca.uhn.fhir.rest.api.server.RequestDetails; import ca.uhn.fhir.rest.param.DateParam; -import ca.uhn.fhir.rest.param.StringParam; -import ca.uhn.fhir.rest.param.TokenParam; +import ca.uhn.fhir.rest.param.ReferenceAndListParam; +import ca.uhn.fhir.rest.param.StringAndListParam; +import ca.uhn.fhir.rest.param.TokenAndListParam; import ca.uhn.fhir.rest.server.IResourceProvider; import jakarta.inject.Inject; import net.ihe.gazelle.fhir.server.technical.ws.DocumentReferencesProviderService; import org.hl7.fhir.instance.model.api.IBaseResource; import org.hl7.fhir.instance.model.api.IIdType; -import org.hl7.fhir.r4.model.*; +import org.hl7.fhir.r4.model.Bundle; +import org.hl7.fhir.r4.model.DocumentReference; + import java.util.List; public class DocumentReferencesResourceProvider implements IResourceProvider { @@ -32,25 +35,30 @@ public class DocumentReferencesResourceProvider implements IResourceProvider { } @Read - public DocumentReference readDocumentReference( @IdParam IIdType theId) { + public DocumentReference readDocumentReference(@IdParam IIdType theId) { return documentReferencesProviderService.getDocumentReference(theId.getValue()); } @Search() public List<DocumentReference> findDocumentReference( - @OptionalParam(name = DocumentReference.SP_PATIENT) TokenParam thePatient, + @OptionalParam(name = "author.given") StringAndListParam authorGiven, + @OptionalParam(name = "author.family") StringAndListParam authorFamily, + @OptionalParam(name = DocumentReference.SP_CATEGORY) TokenAndListParam category, + @OptionalParam(name = "creation") DateParam creation, @OptionalParam(name = DocumentReference.SP_DATE) DateParam date, - @OptionalParam(name = DocumentReference.SP_AUTHOR) StringParam author, - @OptionalParam(name = DocumentReference.SP_STATUS) StringParam status, - @OptionalParam(name = DocumentReference.SP_CATEGORY) StringParam category, - @OptionalParam(name = DocumentReference.SP_TYPE) StringParam type, - @OptionalParam(name = DocumentReference.SP_SETTING) StringParam setting, + @OptionalParam(name = DocumentReference.SP_EVENT) TokenAndListParam event, + @OptionalParam(name = DocumentReference.SP_FACILITY) TokenAndListParam facilty, + @OptionalParam(name = DocumentReference.SP_FORMAT) TokenAndListParam format, + @OptionalParam(name = DocumentReference.SP_IDENTIFIER) TokenAndListParam identifier, + @OptionalParam(name = DocumentReference.SP_PATIENT) ReferenceAndListParam patient, + @OptionalParam(name = "patient.identifier") TokenAndListParam patientIdentifier, @OptionalParam(name = DocumentReference.SP_PERIOD) DateParam period, - @OptionalParam(name = DocumentReference.SP_FACILITY) StringParam facilty, - @OptionalParam(name = DocumentReference.SP_EVENT) StringParam event, - @OptionalParam(name = DocumentReference.SP_SECURITY_LABEL) StringParam securityLabel, - @OptionalParam(name = DocumentReference.SP_FORMAT) StringParam format, - @OptionalParam(name = DocumentReference.SP_RELATED) StringParam related, RequestDetails requestDetails) { + @OptionalParam(name = DocumentReference.SP_RELATED) ReferenceAndListParam related, + @OptionalParam(name = DocumentReference.SP_SECURITY_LABEL) TokenAndListParam securityLabel, + @OptionalParam(name = DocumentReference.SP_SETTING) TokenAndListParam setting, + @OptionalParam(name = DocumentReference.SP_STATUS) TokenAndListParam status, + @OptionalParam(name = DocumentReference.SP_TYPE) TokenAndListParam type, + RequestDetails requestDetails) { return documentReferencesProviderService.searchDocumentReferences(requestDetails); } @@ -61,5 +69,4 @@ public class DocumentReferencesResourceProvider implements IResourceProvider { } - } diff --git a/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/buisness/ListResourceProvider.java b/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/buisness/ListResourceProvider.java index 3d60c32..8f85d33 100644 --- a/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/buisness/ListResourceProvider.java +++ b/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/buisness/ListResourceProvider.java @@ -4,18 +4,17 @@ package net.ihe.gazelle.fhir.server.buisness; import ca.uhn.fhir.rest.annotation.OptionalParam; import ca.uhn.fhir.rest.annotation.Search; import ca.uhn.fhir.rest.api.server.RequestDetails; -import ca.uhn.fhir.rest.param.DateParam; -import ca.uhn.fhir.rest.param.TokenParam; +import ca.uhn.fhir.rest.param.*; import ca.uhn.fhir.rest.server.IResourceProvider; import jakarta.inject.Inject; import net.ihe.gazelle.fhir.server.technical.ws.ListProviderService; import org.hl7.fhir.instance.model.api.IBaseResource; +import org.hl7.fhir.r4.model.DocumentReference; import org.hl7.fhir.r4.model.ListResource; import java.util.List; - public class ListResourceProvider implements IResourceProvider { @@ -31,18 +30,22 @@ public class ListResourceProvider implements IResourceProvider { public Class<? extends IBaseResource> getResourceType() { return ListResource.class; } + @Search() - public List<ListResource> findListResource(@OptionalParam(name = ListResource.SP_CODE) TokenParam code, + public List<ListResource> findListResource(@OptionalParam(name = ListResource.SP_CODE) TokenAndListParam code, @OptionalParam(name = ListResource.SP_DATE) DateParam date, - @OptionalParam(name = ListResource.SP_PATIENT) TokenParam patient, - @OptionalParam(name = ListResource.SP_SOURCE) TokenParam source, - @OptionalParam(name = ListResource.SP_STATUS) String status, - @OptionalParam(name = ListResource.SP_SUBJECT) TokenParam subject, + @OptionalParam(name = "designationType") TokenAndListParam designationType, + @OptionalParam(name = "identifier") TokenAndListParam identifier, + @OptionalParam(name = DocumentReference.SP_PATIENT) ReferenceAndListParam patient, + @OptionalParam(name = "patient.identifier") TokenAndListParam patientIdentifier, + @OptionalParam(name = "source.given") StringAndListParam sourceGiven, + @OptionalParam(name = "source.family") StringAndListParam sourceFamily, + @OptionalParam(name = "sourceId") TokenAndListParam sourceId, + @OptionalParam(name = ListResource.SP_STATUS) TokenAndListParam status, RequestDetails requestDetails ) { return listProviderService.searchListResource(requestDetails); } - } diff --git a/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/technical/controler/MHDRestfullServer.java b/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/technical/controler/MHDRestfullServer.java index 6188d1c..03b6084 100644 --- a/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/technical/controler/MHDRestfullServer.java +++ b/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/technical/controler/MHDRestfullServer.java @@ -5,25 +5,23 @@ import ca.uhn.fhir.narrative.DefaultThymeleafNarrativeGenerator; import ca.uhn.fhir.narrative.INarrativeGenerator; import ca.uhn.fhir.rest.server.IResourceProvider; import ca.uhn.fhir.rest.server.RestfulServer; +import net.ihe.gazelle.fhir.server.buisness.DocumentReferencesResourceProvider; +import net.ihe.gazelle.fhir.server.buisness.ListResourceProvider; import net.ihe.gazelle.fhir.server.technical.FhirValidatorInterceptor; import net.ihe.gazelle.fhir.server.technical.HTTPValidatorInterceptor; import net.ihe.gazelle.fhir.server.technical.mapper.MHDFhirValidationServiceMapper; import net.ihe.gazelle.fhir.server.technical.mapper.MHDHttpValidationServiceMapper; import net.ihe.gazelle.fhir.server.technical.ws.DocumentReferencesProviderServiceImpl; import net.ihe.gazelle.fhir.server.technical.ws.ListProviderServiceImpl; -import net.ihe.gazelle.fhir.server.buisness.DocumentReferencesResourceProvider; -import net.ihe.gazelle.fhir.server.buisness.ListResourceProvider; import org.eclipse.microprofile.config.ConfigProvider; import java.util.ArrayList; import java.util.List; - public class MHDRestfullServer extends RestfulServer { - public MHDRestfullServer() { super(FhirContext.forR4Cached()); } @@ -46,8 +44,6 @@ public class MHDRestfullServer extends RestfulServer { registerInterceptor(new FhirValidatorInterceptor(evsEndpoint, new MHDFhirValidationServiceMapper())); - - } } diff --git a/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/technical/ws/DocumentReferencesProviderServiceImpl.java b/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/technical/ws/DocumentReferencesProviderServiceImpl.java index e092553..5aabe38 100644 --- a/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/technical/ws/DocumentReferencesProviderServiceImpl.java +++ b/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/technical/ws/DocumentReferencesProviderServiceImpl.java @@ -10,6 +10,7 @@ import org.eclipse.microprofile.config.ConfigProvider; import org.hl7.fhir.instance.model.api.IBaseBundle; import org.hl7.fhir.r4.model.Bundle; import org.hl7.fhir.r4.model.DocumentReference; + import java.util.List; import java.util.Map; @@ -41,8 +42,7 @@ public class DocumentReferencesProviderServiceImpl implements DocumentReferences IQuery<IBaseBundle> query = client.search().forResource(DocumentReference.class); for (Map.Entry<String, String[]> entry : parameterMap.entrySet()) { String key = entry.getKey(); - String value = entry.getValue()[0]; - query = query.where(new StringClientParam(key).matches().value(value)); + query = query.where(new StringClientParam(key).matches().values(entry.getValue())); } return query.returnBundle(org.hl7.fhir.r4.model.Bundle.class) .execute() diff --git a/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/technical/ws/ListProviderServiceImpl.java b/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/technical/ws/ListProviderServiceImpl.java index bb3e66c..9ed8669 100644 --- a/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/technical/ws/ListProviderServiceImpl.java +++ b/mhd-fhir-server-simulator/src/main/java/net/ihe/gazelle/fhir/server/technical/ws/ListProviderServiceImpl.java @@ -9,6 +9,7 @@ import jakarta.enterprise.context.ApplicationScoped; import org.eclipse.microprofile.config.ConfigProvider; import org.hl7.fhir.instance.model.api.IBaseBundle; import org.hl7.fhir.r4.model.ListResource; + import java.util.List; import java.util.Map; @@ -32,8 +33,8 @@ public class ListProviderServiceImpl implements ListProviderService { IQuery<IBaseBundle> query = client.search().forResource(ListResource.class); for (Map.Entry<String, String[]> entry : parameterMap.entrySet()) { String key = entry.getKey(); - String value = entry.getValue()[0]; - query = query.where(new StringClientParam(key).matches().value(value)); + + query = query.where(new StringClientParam(key).matches().values(entry.getValue())); } return query.returnBundle(org.hl7.fhir.r4.model.Bundle.class) .execute() diff --git a/mhd-fhir-server-simulator/src/main/resources/application.properties b/mhd-fhir-server-simulator/src/main/resources/application.properties index c7374be..b6926a9 100644 --- a/mhd-fhir-server-simulator/src/main/resources/application.properties +++ b/mhd-fhir-server-simulator/src/main/resources/application.properties @@ -6,5 +6,5 @@ http.validation.schematron.name-iti-67=CH_ITI-67-FindDocumentReferences-GET_MHD_ http.validation.schematron.name-iti-68=CH_ITI-68-RetrieveDocument-GET_MHD_Request fhir.validation.name=Matchbox -fhir.validation.schematron.name-iti-65=CH:MHD [ITI-65] Provide Document Bundle Comprehensive Response +fhir.validation.schematron.name-iti-65=http://fhir.ch/ig/ch-epr-fhir/StructureDefinition/ch-mhd-providedocumentbundle-comprehensive evs.endpoint=https://qualification.ihe-europe.net/evs/rest/validations diff --git a/mhd-fhir-server-simulator/src/test/java/net/ihe/gazelle/fhir/server/taechnical/mapper/MHDFhirValidationServiceMapperTest.java b/mhd-fhir-server-simulator/src/test/java/net/ihe/gazelle/fhir/server/taechnical/mapper/MHDFhirValidationServiceMapperTest.java index 5c9fd75..078790a 100644 --- a/mhd-fhir-server-simulator/src/test/java/net/ihe/gazelle/fhir/server/taechnical/mapper/MHDFhirValidationServiceMapperTest.java +++ b/mhd-fhir-server-simulator/src/test/java/net/ihe/gazelle/fhir/server/taechnical/mapper/MHDFhirValidationServiceMapperTest.java @@ -27,7 +27,7 @@ public class MHDFhirValidationServiceMapperTest { ValidationService validationService = mapper.getValidationService(requestDetails); - assertEquals("CH:MHD [ITI-65] Provide Document Bundle Comprehensive Response", validationService.getValidator()); + assertEquals("http://fhir.ch/ig/ch-epr-fhir/StructureDefinition/ch-mhd-providedocumentbundle-comprehensive", validationService.getValidator()); assertEquals("Matchbox", validationService.getName()); } } -- GitLab