-
Notifications
You must be signed in to change notification settings - Fork 65
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge branch 'feature/iti119' into feature/ipf5prep
- Loading branch information
Showing
27 changed files
with
1,023 additions
and
8 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
26 changes: 26 additions & 0 deletions
26
...n/java/org/openehealth/ipf/commons/ihe/fhir/iti119/AdditionalResourceMetadataKeyEnum.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,26 @@ | ||
/* | ||
* Copyright 2024 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.openehealth.ipf.commons.ihe.fhir.iti119; | ||
|
||
import ca.uhn.fhir.model.api.ResourceMetadataKeyEnum; | ||
import org.hl7.fhir.r4.model.codesystems.MatchGrade; | ||
|
||
public abstract class AdditionalResourceMetadataKeyEnum { | ||
|
||
public static final ResourceMetadataKeyEnum<MatchGrade> ENTRY_MATCH_GRADE = | ||
new ResourceMetadataKeyEnum<>("ENTRY_MATCH_GRADE", MatchGrade.class) {}; | ||
|
||
} |
62 changes: 62 additions & 0 deletions
62
...pixpdq/src/main/java/org/openehealth/ipf/commons/ihe/fhir/iti119/Iti119AuditStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,62 @@ | ||
/* | ||
* Copyright 2024 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.openehealth.ipf.commons.ihe.fhir.iti119; | ||
|
||
import org.hl7.fhir.r4.model.Parameters; | ||
import org.openehealth.ipf.commons.audit.AuditContext; | ||
import org.openehealth.ipf.commons.audit.model.AuditMessage; | ||
import org.openehealth.ipf.commons.ihe.fhir.audit.FhirQueryAuditDataset; | ||
import org.openehealth.ipf.commons.ihe.fhir.audit.FhirQueryAuditStrategy; | ||
import org.openehealth.ipf.commons.ihe.fhir.audit.codes.FhirEventTypeCode; | ||
import org.openehealth.ipf.commons.ihe.fhir.audit.codes.FhirParticipantObjectIdTypeCode; | ||
import org.openehealth.ipf.commons.ihe.fhir.audit.events.BalpQueryInformationBuilder; | ||
|
||
import java.util.Map; | ||
|
||
/** | ||
* Strategy for auditing ITI-78 transactions | ||
* | ||
* @author Christian Ohr | ||
* @since 3.6 | ||
*/ | ||
class Iti119AuditStrategy extends FhirQueryAuditStrategy { | ||
|
||
protected Iti119AuditStrategy(boolean serverSide) { | ||
super(serverSide); | ||
} | ||
|
||
@Override | ||
public AuditMessage[] makeAuditMessage(AuditContext auditContext, FhirQueryAuditDataset auditDataset) { | ||
return new BalpQueryInformationBuilder(auditContext, auditDataset, FhirEventTypeCode.PatientDemographicsMatch) | ||
.addPatients(auditDataset.getPatientIds()) | ||
.setQueryParameters( | ||
"PatientDemographicsMatch", | ||
FhirParticipantObjectIdTypeCode.PatientDemographicsMatch, | ||
auditDataset.getQueryString()) | ||
|
||
.getMessages(); | ||
} | ||
|
||
@Override | ||
public FhirQueryAuditDataset enrichAuditDatasetFromRequest(FhirQueryAuditDataset auditDataset, Object request, Map<String, Object> parameters) { | ||
var dataset = super.enrichAuditDatasetFromRequest(auditDataset, request, parameters); | ||
if (request instanceof Parameters p && auditDataset.getFhirContext() != null) { | ||
dataset.setQueryString(auditDataset.getFhirContext().newJsonParser().encodeToString(p)); | ||
} | ||
return dataset; | ||
} | ||
|
||
} |
30 changes: 30 additions & 0 deletions
30
.../src/main/java/org/openehealth/ipf/commons/ihe/fhir/iti119/Iti119ClientAuditStrategy.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
/* | ||
* Copyright 2024 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
package org.openehealth.ipf.commons.ihe.fhir.iti119; | ||
|
||
/** | ||
* Strategy for auditing ITI-119 transactions on the client side | ||
* | ||
* @author Christian Ohr | ||
* @since 5.0 | ||
*/ | ||
public class Iti119ClientAuditStrategy extends Iti119AuditStrategy { | ||
|
||
public Iti119ClientAuditStrategy() { | ||
super(false); | ||
} | ||
|
||
} |
70 changes: 70 additions & 0 deletions
70
...src/main/java/org/openehealth/ipf/commons/ihe/fhir/iti119/Iti119ClientRequestFactory.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,70 @@ | ||
/* | ||
* Copyright 2024 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.openehealth.ipf.commons.ihe.fhir.iti119; | ||
|
||
import ca.uhn.fhir.rest.client.api.IGenericClient; | ||
import ca.uhn.fhir.rest.gclient.IClientExecutable; | ||
import ca.uhn.fhir.rest.gclient.IOperationUntypedWithInput; | ||
import org.hl7.fhir.r4.model.Bundle; | ||
import org.hl7.fhir.r4.model.Parameters; | ||
import org.hl7.fhir.r4.model.Patient; | ||
import org.hl7.fhir.r4.model.StringType; | ||
import org.openehealth.ipf.commons.ihe.fhir.ClientRequestFactory; | ||
|
||
import java.util.Map; | ||
|
||
import static org.openehealth.ipf.commons.ihe.fhir.iti119.Iti119Constants.RESOURCE; | ||
|
||
/** | ||
* Request Factory for Iti-119 requests | ||
* | ||
* @author Christian Ohr | ||
* @since 5.0 | ||
*/ | ||
public class Iti119ClientRequestFactory implements ClientRequestFactory<IOperationUntypedWithInput<Bundle>> { | ||
|
||
@Override | ||
public IClientExecutable<IOperationUntypedWithInput<Bundle>, ?> getClientExecutable(IGenericClient client, Object requestData, Map<String, Object> parameters) { | ||
|
||
if (requestData instanceof Parameters p) { | ||
return getClientExecutable(client, p); | ||
} | ||
|
||
var p = new Parameters(); | ||
if (requestData instanceof Patient patient) { | ||
p.addParameter().setResource(patient); | ||
} else if (parameters.containsKey(RESOURCE) && parameters.get(RESOURCE) instanceof Patient patient) { | ||
p.addParameter().setResource(patient); | ||
} | ||
parameters.entrySet().stream() | ||
.filter(entry -> Iti119Constants.ITI119_PARAMETERS.contains(entry.getKey())) | ||
.forEach(entry -> p.addParameter() | ||
.setName(entry.getKey()) | ||
.setValue(new StringType(entry.getValue().toString()))); | ||
|
||
return getClientExecutable(client, p); | ||
} | ||
|
||
|
||
private IClientExecutable<IOperationUntypedWithInput<Bundle>, ?> getClientExecutable(IGenericClient client, Parameters requestData) { | ||
return client.operation() | ||
.onType(Patient.class) | ||
.named(Iti119Constants.PDQM_MATCH_OPERATION_NAME) | ||
.withParameters(requestData) | ||
.returnResourceType(Bundle.class); | ||
} | ||
} |
40 changes: 40 additions & 0 deletions
40
.../r4/pixpdq/src/main/java/org/openehealth/ipf/commons/ihe/fhir/iti119/Iti119Constants.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,40 @@ | ||
/* | ||
* Copyright 2024 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.openehealth.ipf.commons.ihe.fhir.iti119; | ||
|
||
import org.openehealth.ipf.commons.ihe.fhir.Constants; | ||
|
||
import java.util.Arrays; | ||
import java.util.HashSet; | ||
import java.util.Set; | ||
|
||
/** | ||
* @author Christian Ohr | ||
* @since 5.0 | ||
*/ | ||
public interface Iti119Constants { | ||
|
||
String RESOURCE = "resource"; | ||
String ONLY_CERTAIN_MATCHES = "onlyCertainMatches"; | ||
String COUNT = "count"; | ||
|
||
Set<String> ITI119_PARAMETERS = new HashSet<>(Arrays.asList( | ||
ONLY_CERTAIN_MATCHES, | ||
COUNT)); | ||
|
||
String PDQM_MATCH_OPERATION_NAME = "$match"; | ||
} |
80 changes: 80 additions & 0 deletions
80
...pdq/src/main/java/org/openehealth/ipf/commons/ihe/fhir/iti119/Iti119ResourceProvider.java
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,80 @@ | ||
/* | ||
* Copyright 2024 the original author or authors. | ||
* | ||
* Licensed under the Apache License, Version 2.0 (the "License"); | ||
* you may not use this file except in compliance with the License. | ||
* You may obtain a copy of the License at | ||
* | ||
* http://www.apache.org/licenses/LICENSE-2.0 | ||
* | ||
* Unless required by applicable law or agreed to in writing, software | ||
* distributed under the License is distributed on an "AS IS" BASIS, | ||
* WITHOUT WARRANTIES OR CONDITIONS OF ANY KIND, either express or implied. | ||
* See the License for the specific language governing permissions and | ||
* limitations under the License. | ||
*/ | ||
|
||
package org.openehealth.ipf.commons.ihe.fhir.iti119; | ||
|
||
import ca.uhn.fhir.model.api.Include; | ||
import ca.uhn.fhir.model.valueset.BundleTypeEnum; | ||
import ca.uhn.fhir.rest.annotation.IncludeParam; | ||
import ca.uhn.fhir.rest.annotation.Operation; | ||
import ca.uhn.fhir.rest.annotation.OperationParam; | ||
import ca.uhn.fhir.rest.annotation.Sort; | ||
import ca.uhn.fhir.rest.api.SortSpec; | ||
import ca.uhn.fhir.rest.api.server.IBundleProvider; | ||
import ca.uhn.fhir.rest.api.server.RequestDetails; | ||
import jakarta.servlet.http.HttpServletRequest; | ||
import jakarta.servlet.http.HttpServletResponse; | ||
import org.hl7.fhir.r4.model.BooleanType; | ||
import org.hl7.fhir.r4.model.Patient; | ||
import org.hl7.fhir.r4.model.PositiveIntType; | ||
import org.hl7.fhir.r4.model.ResourceType; | ||
import org.openehealth.ipf.commons.ihe.fhir.AbstractPlainProvider; | ||
import org.openehealth.ipf.commons.ihe.fhir.iti78.PdqPatient; | ||
|
||
import java.util.Set; | ||
|
||
import static org.openehealth.ipf.commons.ihe.fhir.iti119.Iti119Constants.*; | ||
|
||
/** | ||
* Resource Provider for PDQm Match (ITI-119) for R4 | ||
* | ||
* @author Christian Ohr | ||
* @since 5.0 | ||
*/ | ||
public class Iti119ResourceProvider extends AbstractPlainProvider { | ||
|
||
/** | ||
* Handles the PDQm Match request | ||
* | ||
* @param resource patient match input | ||
* @param onlyCertainMatches may be optionally set to true to indicate that the Patient Demographics Consumer | ||
* would only like matches returned when they are certain to be matches for the subject of the request | ||
* @param count can be used to limit the number of results the Patient Demographics Supplier returns | ||
* @param httpServletRequest servlet request | ||
* @param httpServletResponse servlet response | ||
* @param sortSpec sort specification | ||
* @param includeSpec include specification | ||
* @param requestDetails request details | ||
* @return {@link IBundleProvider} instance that manages retrieving patients | ||
*/ | ||
@SuppressWarnings("unused") | ||
@Operation(name = PDQM_MATCH_OPERATION_NAME, type = PdqPatient.class, bundleType = BundleTypeEnum.SEARCHSET) | ||
public IBundleProvider pdqmMatch( | ||
@OperationParam(name = RESOURCE, type = Patient.class) Patient resource, | ||
@OperationParam(name = ONLY_CERTAIN_MATCHES, type = BooleanType.class) BooleanType onlyCertainMatches, | ||
@OperationParam(name = COUNT, type = PositiveIntType.class) PositiveIntType count, | ||
@Sort SortSpec sortSpec, | ||
@IncludeParam Set<Include> includeSpec, | ||
RequestDetails requestDetails, | ||
HttpServletRequest httpServletRequest, | ||
HttpServletResponse httpServletResponse) { | ||
|
||
// Run down the route | ||
return requestBundleProvider(requestDetails.getResource(), null, ResourceType.Patient.name(), | ||
httpServletRequest, httpServletResponse, requestDetails); | ||
} | ||
|
||
} |
Oops, something went wrong.