mdm match_only mode (#6503)

* Started implementing mdm passive mode

* check subscriptions

* check kafka consumers

* switch boolean to enum

* hapi changelog

* renamed enum values per slack conversation

* checkstyle

* review feedback
move developers section out to developers.xml

* version bump

* revert moving developers out

* review feedback

* review feedback

---------

Co-authored-by: Ken Stevens <ken@smiledigitalhealth.com>
This commit is contained in:
Ken Stevens 2024-12-03 12:36:54 -05:00 committed by GitHub
parent 744a0d7096
commit 0a88c31cf3
No known key found for this signature in database
GPG Key ID: B5690EEEBB952194
91 changed files with 244 additions and 109 deletions

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -48,6 +48,11 @@ public interface IBaseInterceptorService<POINTCUT extends IPointcut> extends IBa
*/
List<Object> getAllRegisteredInterceptors();
default boolean hasRegisteredInterceptor(Class<?> theInterceptorClass) {
return getAllRegisteredInterceptors().stream()
.anyMatch(t -> t.getClass().equals(theInterceptorClass));
}
/**
* Unregisters all registered interceptors.
*/

View File

@ -4,7 +4,7 @@
<modelVersion>4.0.0</modelVersion>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-bom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<packaging>pom</packaging>
<name>HAPI FHIR BOM</name>
@ -12,7 +12,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-cli</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -0,0 +1,6 @@
---
type: add
issue: 6495
title: "A new MdmSettings mode field was added (default value `MATCH_AND_LINK`). When the MdmSettings mode is set to
`MATCH_ONLY` mode, then MDM operations are disabled and no MDM processing occurs. This is useful if, for example,
you want to use the Patient/$match operation without having the overhead of creating links and golden resources."

View File

@ -11,7 +11,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -3,7 +3,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -24,6 +24,7 @@ import ca.uhn.fhir.jpa.subscription.channel.api.IChannelFactory;
import ca.uhn.fhir.jpa.subscription.channel.api.IChannelReceiver;
import ca.uhn.fhir.jpa.subscription.model.ResourceModifiedJsonMessage;
import ca.uhn.fhir.mdm.api.IMdmSettings;
import ca.uhn.fhir.mdm.api.MdmModeEnum;
import ca.uhn.fhir.mdm.log.Logs;
import com.google.common.annotations.VisibleForTesting;
import jakarta.annotation.PreDestroy;
@ -46,6 +47,11 @@ public class MdmQueueConsumerLoader {
myMdmSettings = theMdmSettings;
myMdmMessageHandler = theMdmMessageHandler;
if (myMdmSettings.getMode() == MdmModeEnum.MATCH_ONLY) {
ourLog.info("MDM running in {} mode. MDM channel consumer disabled.", myMdmSettings.getMode());
return;
}
startListeningToMdmChannel();
}

View File

@ -21,6 +21,7 @@ package ca.uhn.fhir.jpa.mdm.config;
import ca.uhn.fhir.IHapiBootOrder;
import ca.uhn.fhir.mdm.api.IMdmSettings;
import ca.uhn.fhir.mdm.api.MdmModeEnum;
import ca.uhn.fhir.mdm.provider.MdmProviderLoader;
import org.slf4j.Logger;
import org.slf4j.LoggerFactory;
@ -52,6 +53,12 @@ public class MdmLoader {
return;
}
myMdmProviderLoader.loadPatientMatchProvider();
if (myMdmSettings.getMode() == MdmModeEnum.MATCH_ONLY) {
return;
}
myMdmProviderLoader.loadProvider();
ourLog.info("MDM provider registered");

View File

@ -6,6 +6,7 @@ import ca.uhn.fhir.mdm.api.IMdmControllerSvc;
import ca.uhn.fhir.mdm.api.IMdmSubmitSvc;
import ca.uhn.fhir.mdm.provider.MdmControllerHelper;
import ca.uhn.fhir.mdm.provider.MdmProviderDstu3Plus;
import ca.uhn.fhir.mdm.provider.PatientMatchProvider;
import ca.uhn.fhir.mdm.rules.config.MdmSettings;
import ca.uhn.fhir.mdm.rules.svc.MdmResourceMatcherSvc;
import ca.uhn.fhir.mdm.util.MessageHelper;
@ -28,6 +29,7 @@ import java.util.List;
public abstract class BaseProviderR4Test extends BaseMdmR4Test {
protected MdmProviderDstu3Plus myMdmProvider;
protected PatientMatchProvider myPatientMatchProvider;
@Autowired
protected IMdmControllerSvc myMdmControllerSvc;
@Autowired
@ -64,6 +66,7 @@ public abstract class BaseProviderR4Test extends BaseMdmR4Test {
myMdmSubmitSvc,
myInterceptorBroadcaster,
myMdmSettings);
myPatientMatchProvider = new PatientMatchProvider(myMdmHelper);
defaultScript = myMdmSettings.getScriptText();
}

View File

@ -54,7 +54,7 @@ public class MdmProviderCrossPartitionR4Test extends BaseProviderR4Test{
myMdmSettings.setSearchAllPartitionForMatch(true);
createPatientOnPartition(buildJanePatient(), RequestPartitionId.fromPartitionId(1));
Bundle result = (Bundle) myMdmProvider.match(buildJanePatient(), new SystemRequestDetails().setRequestPartitionId(RequestPartitionId.fromPartitionId(2)));
Bundle result = (Bundle) myPatientMatchProvider.match(buildJanePatient(), new SystemRequestDetails().setRequestPartitionId(RequestPartitionId.fromPartitionId(2)));
assertThat(result.getEntry()).hasSize(1);
}
@ -63,7 +63,7 @@ public class MdmProviderCrossPartitionR4Test extends BaseProviderR4Test{
myMdmSettings.setSearchAllPartitionForMatch(false);
createPatientOnPartition(buildJanePatient(), RequestPartitionId.fromPartitionId(1));
Bundle result = (Bundle) myMdmProvider.match(buildJanePatient(), new SystemRequestDetails().setRequestPartitionId(RequestPartitionId.fromPartitionId(2)));
Bundle result = (Bundle) myPatientMatchProvider.match(buildJanePatient(), new SystemRequestDetails().setRequestPartitionId(RequestPartitionId.fromPartitionId(2)));
assertThat(result.getEntry()).isEmpty();
}

View File

@ -43,7 +43,7 @@ public class MdmProviderMatchR4Test extends BaseProviderR4Test {
Patient createdJane = createPatient(jane);
Patient newJane = buildJanePatient();
Bundle result = (Bundle) myMdmProvider.match(newJane, new SystemRequestDetails());
Bundle result = (Bundle) myPatientMatchProvider.match(newJane, new SystemRequestDetails());
assertThat(result.getEntry()).hasSize(1);
Bundle.BundleEntryComponent entry0 = result.getEntry().get(0);
@ -118,7 +118,7 @@ public class MdmProviderMatchR4Test extends BaseProviderR4Test {
Patient newJane = buildJanePatient();
Bundle result = (Bundle) myMdmProvider.match(newJane, new SystemRequestDetails());
Bundle result = (Bundle) myPatientMatchProvider.match(newJane, new SystemRequestDetails());
assertThat(result.getEntry()).hasSize(2);
Bundle.BundleEntryComponent entry0 = result.getEntry().get(0);
@ -142,7 +142,7 @@ public class MdmProviderMatchR4Test extends BaseProviderR4Test {
Patient paul = buildPaulPatient();
paul.setActive(true);
Bundle result = (Bundle) myMdmProvider.match(paul, new SystemRequestDetails());
Bundle result = (Bundle) myPatientMatchProvider.match(paul, new SystemRequestDetails());
assertThat(result.getEntry()).isEmpty();
}
@ -154,7 +154,7 @@ public class MdmProviderMatchR4Test extends BaseProviderR4Test {
Patient createdJane = createPatient(jane);
Patient newJane = buildJanePatient();
Bundle result = (Bundle) myMdmProvider.match(newJane, new SystemRequestDetails());
Bundle result = (Bundle) myPatientMatchProvider.match(newJane, new SystemRequestDetails());
assertThat(result.getEntry()).hasSize(1);
assertEquals(createdJane.getId(), result.getEntryFirstRep().getResource().getId());
}
@ -226,7 +226,7 @@ public class MdmProviderMatchR4Test extends BaseProviderR4Test {
}""";
IBaseResource coarseResource = myFhirContext.newJsonParser().parseResource(coarsePatient);
Bundle result = (Bundle) myMdmProvider.match((Patient) coarseResource, new SystemRequestDetails());
Bundle result = (Bundle) myPatientMatchProvider.match((Patient) coarseResource, new SystemRequestDetails());
assertThat(result.getEntry()).hasSize(1);
}
@ -268,7 +268,7 @@ public class MdmProviderMatchR4Test extends BaseProviderR4Test {
Patient noMatchPatient = (Patient) myFhirContext.newJsonParser().parseResource(noMatchPatientJson);
createPatient(noMatchPatient);
{
Bundle result = (Bundle) myMdmProvider.match(noMatchPatient, new SystemRequestDetails());
Bundle result = (Bundle) myPatientMatchProvider.match(noMatchPatient, new SystemRequestDetails());
assertThat(result.getEntry()).isEmpty();
}
@ -289,7 +289,7 @@ public class MdmProviderMatchR4Test extends BaseProviderR4Test {
{
Patient nickPatient = (Patient) myFhirContext.newJsonParser().parseResource(nickPatientJson);
Bundle result = (Bundle) myMdmProvider.match(nickPatient, new SystemRequestDetails());
Bundle result = (Bundle) myPatientMatchProvider.match(nickPatient, new SystemRequestDetails());
assertThat(result.getEntry()).hasSize(1);
}
}

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -6,7 +6,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -72,4 +72,9 @@ public interface IMdmSettings {
default void setAutoExpungeGoldenResources(boolean theShouldAutoExpunge) {
throw new UnsupportedOperationException(Msg.code(2427));
}
// In MATCH_ONLY mode, the Patient/$match operation is available, but no mdm processing takes place.
default MdmModeEnum getMode() {
return MdmModeEnum.MATCH_AND_LINK;
}
}

View File

@ -0,0 +1,35 @@
/*-
* #%L
* HAPI FHIR - Master Data Management
* %%
* Copyright (C) 2014 - 2024 Smile CDR, Inc.
* %%
* 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.
* #L%
*/
package ca.uhn.fhir.mdm.api;
public enum MdmModeEnum {
/**
* Normal MDM processing that creates Golden Resources and maintains links
*/
MATCH_AND_LINK,
/**
* in MATCH_ONLY mode, MDM operations are disabled and no MDM processing occurs. This is useful if, for example,
* you want to use the Patient/$match operation without having the overhead of creating links and golden resources.
*/
MATCH_ONLY
// TODO KHS possible future mode MATCH_AND_MERGE where incoming matched resources have their data merged into the
// golden resource and then deleted with all references updated to point to the golden resource
}

View File

@ -103,23 +103,6 @@ public class MdmProviderDstu3Plus extends BaseMdmProvider {
myMdmSettings = theIMdmSettings;
}
/**
* Searches for matches for the provided patient resource
* @param thePatient - the patient resource
* @param theRequestDetails - the request details
* @return - any matches to the provided patient resource
*/
@Operation(name = ProviderConstants.EMPI_MATCH, typeName = "Patient")
public IBaseBundle match(
@OperationParam(name = ProviderConstants.MDM_MATCH_RESOURCE, min = 1, max = 1, typeName = "Patient")
IAnyResource thePatient,
RequestDetails theRequestDetails) {
if (thePatient == null) {
throw new InvalidRequestException(Msg.code(1498) + "resource may not be null");
}
return myMdmControllerHelper.getMatchesAndPossibleMatchesForResource(thePatient, "Patient", theRequestDetails);
}
/**
* Searches for matches for hte provided resource.
*

View File

@ -61,8 +61,24 @@ public class MdmProviderLoader {
private IInterceptorBroadcaster myInterceptorBroadcaster;
private Supplier<Object> myMdmProviderSupplier;
private Supplier<Object> myPatientMatchProviderSupplier;
private Supplier<Object> myMdmHistoryProviderSupplier;
public void loadPatientMatchProvider() {
switch (myFhirContext.getVersion().getVersion()) {
case DSTU3:
case R4:
case R5:
// We store the supplier so that removeSupplier works properly
myPatientMatchProviderSupplier = () -> new PatientMatchProvider(myMdmControllerHelper);
myResourceProviderFactory.addSupplier(myPatientMatchProviderSupplier);
break;
default:
throw new ConfigurationException(Msg.code(2574) + "Patient/$match not supported for FHIR version "
+ myFhirContext.getVersion().getVersion());
}
}
public void loadProvider() {
switch (myFhirContext.getVersion().getVersion()) {
case DSTU3:
@ -76,7 +92,6 @@ public class MdmProviderLoader {
myMdmSubmitSvc,
myInterceptorBroadcaster,
myMdmSettings);
// We store the supplier so that removeSupplier works properly
myResourceProviderFactory.addSupplier(myMdmProviderSupplier);
if (myStorageSettings.isNonResourceDbHistoryEnabled()) {
myMdmHistoryProviderSupplier = () -> new MdmLinkHistoryProviderDstu3Plus(
@ -98,5 +113,8 @@ public class MdmProviderLoader {
if (myMdmHistoryProviderSupplier != null) {
myResourceProviderFactory.removeSupplier(myMdmHistoryProviderSupplier);
}
if (myPatientMatchProviderSupplier != null) {
myResourceProviderFactory.removeSupplier(myPatientMatchProviderSupplier);
}
}
}

View File

@ -0,0 +1,54 @@
/*-
* #%L
* HAPI FHIR - Master Data Management
* %%
* Copyright (C) 2014 - 2024 Smile CDR, Inc.
* %%
* 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.
* #L%
*/
package ca.uhn.fhir.mdm.provider;
import ca.uhn.fhir.i18n.Msg;
import ca.uhn.fhir.rest.annotation.Operation;
import ca.uhn.fhir.rest.annotation.OperationParam;
import ca.uhn.fhir.rest.api.server.RequestDetails;
import ca.uhn.fhir.rest.server.exceptions.InvalidRequestException;
import ca.uhn.fhir.rest.server.provider.ProviderConstants;
import org.hl7.fhir.instance.model.api.IAnyResource;
import org.hl7.fhir.instance.model.api.IBaseBundle;
public class PatientMatchProvider {
private final MdmControllerHelper myMdmControllerHelper;
public PatientMatchProvider(MdmControllerHelper theMdmControllerHelper) {
myMdmControllerHelper = theMdmControllerHelper;
}
/**
* Searches for matches for the provided patient resource
* @param thePatient - the patient resource
* @param theRequestDetails - the request details
* @return - any matches to the provided patient resource
*/
@Operation(name = ProviderConstants.PATIENT_MATCH, typeName = "Patient")
public IBaseBundle match(
@OperationParam(name = ProviderConstants.MDM_MATCH_RESOURCE, min = 1, max = 1, typeName = "Patient")
IAnyResource thePatient,
RequestDetails theRequestDetails) {
if (thePatient == null) {
throw new InvalidRequestException(Msg.code(1498) + "resource may not be null");
}
return myMdmControllerHelper.getMatchesAndPossibleMatchesForResource(thePatient, "Patient", theRequestDetails);
}
}

View File

@ -21,6 +21,7 @@ package ca.uhn.fhir.mdm.rules.config;
import ca.uhn.fhir.mdm.api.IMdmRuleValidator;
import ca.uhn.fhir.mdm.api.IMdmSettings;
import ca.uhn.fhir.mdm.api.MdmModeEnum;
import ca.uhn.fhir.mdm.rules.json.MdmRulesJson;
import ca.uhn.fhir.util.JsonUtil;
import org.springframework.beans.factory.annotation.Autowired;
@ -28,6 +29,8 @@ import org.springframework.stereotype.Component;
import java.io.IOException;
import static ca.uhn.fhir.mdm.api.MdmModeEnum.MATCH_AND_LINK;
@Component
public class MdmSettings implements IMdmSettings {
public static final int DEFAULT_CANDIDATE_SEARCH_LIMIT = 10000;
@ -42,6 +45,7 @@ public class MdmSettings implements IMdmSettings {
private String myGoldenResourcePartitionName;
private boolean mySearchAllPartitionForMatch = false;
private boolean myShouldAutoDeleteGoldenResources = true;
private MdmModeEnum myMdmMode = MATCH_AND_LINK;
/**
* If disabled, the underlying MDM system will operate under the following assumptions:
@ -169,4 +173,13 @@ public class MdmSettings implements IMdmSettings {
public void setAutoExpungeGoldenResources(boolean theShouldAutoExpunge) {
myShouldAutoDeleteGoldenResources = theShouldAutoExpunge;
}
public void setMdmMode(MdmModeEnum theMdmMode) {
myMdmMode = theMdmMode;
}
@Override
public MdmModeEnum getMode() {
return myMdmMode;
}
}

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -67,9 +67,9 @@ public class ProviderConstants {
public static final String DIFF_INCLUDE_META_PARAMETER = "includeMeta";
/**
* EMPI Operations
* MDM Operations
*/
public static final String EMPI_MATCH = "$match";
public static final String PATIENT_MATCH = "$match";
public static final String MDM_MATCH = "$mdm-match";
public static final String MDM_MATCH_RESOURCE = "resource";

View File

@ -7,7 +7,7 @@
<parent>
<artifactId>hapi-fhir-serviceloaders</artifactId>
<groupId>ca.uhn.hapi.fhir</groupId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<artifactId>hapi-fhir-serviceloaders</artifactId>
<groupId>ca.uhn.hapi.fhir</groupId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>
@ -21,7 +21,7 @@
<dependency>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-caching-api</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
</dependency>
<dependency>

View File

@ -7,7 +7,7 @@
<parent>
<artifactId>hapi-fhir-serviceloaders</artifactId>
<groupId>ca.uhn.hapi.fhir</groupId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<artifactId>hapi-fhir</artifactId>
<groupId>ca.uhn.hapi.fhir</groupId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<artifactId>hapi-deployable-pom</artifactId>
<groupId>ca.uhn.hapi.fhir</groupId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot-samples</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
</parent>
<artifactId>hapi-fhir-spring-boot-sample-client-apache</artifactId>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot-samples</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot-samples</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir-spring-boot</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-deployable-pom</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../pom.xml</relativePath>
</parent>

View File

@ -8,7 +8,7 @@
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<packaging>pom</packaging>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<name>HAPI-FHIR</name>
<description>An open-source implementation of the FHIR specification in Java.</description>
@ -2644,7 +2644,7 @@
<plugin>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-tinder-plugin</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<executions>
<execution>
<goals>

View File

@ -7,7 +7,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -4,7 +4,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>

View File

@ -5,7 +5,7 @@
<parent>
<groupId>ca.uhn.hapi.fhir</groupId>
<artifactId>hapi-fhir</artifactId>
<version>7.7.9-SNAPSHOT</version>
<version>7.7.10-SNAPSHOT</version>
<relativePath>../../pom.xml</relativePath>
</parent>