Skip to content

Commit

Permalink
mdm match_only mode (#6503)
Browse files Browse the repository at this point in the history
* 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 <[email protected]>
  • Loading branch information
fil512 and Ken Stevens authored Dec 3, 2024
1 parent 744a0d7 commit 0a88c31
Show file tree
Hide file tree
Showing 91 changed files with 244 additions and 109 deletions.
2 changes: 1 addition & 1 deletion hapi-deployable-pom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-android/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*/
Expand Down
4 changes: 2 additions & 2 deletions hapi-fhir-bom/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,15 +4,15 @@
<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>

<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>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-checkstyle/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-cli/hapi-fhir-cli-api/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-cli/hapi-fhir-cli-app/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-cli/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-client-okhttp/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-client/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-converter/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-dist/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-docs/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Original file line number Diff line number Diff line change
@@ -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."
2 changes: 1 addition & 1 deletion hapi-fhir-jacoco/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-jaxrsserver-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-jpa/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-jpaserver-base/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-jpaserver-elastic-test-utilities/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-jpaserver-hfql/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-jpaserver-ips/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-jpaserver-mdm/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,6 +24,7 @@
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;
Expand All @@ -46,6 +47,11 @@ public 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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@

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;
Expand Down Expand Up @@ -52,6 +53,12 @@ public void updateSubscriptions() {
return;
}

myMdmProviderLoader.loadPatientMatchProvider();

if (myMdmSettings.getMode() == MdmModeEnum.MATCH_ONLY) {
return;
}

myMdmProviderLoader.loadProvider();
ourLog.info("MDM provider registered");

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,7 @@
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;
Expand All @@ -28,6 +29,7 @@

public abstract class BaseProviderR4Test extends BaseMdmR4Test {
protected MdmProviderDstu3Plus myMdmProvider;
protected PatientMatchProvider myPatientMatchProvider;
@Autowired
protected IMdmControllerSvc myMdmControllerSvc;
@Autowired
Expand Down Expand Up @@ -64,6 +66,7 @@ public void before() throws Exception {
myMdmSubmitSvc,
myInterceptorBroadcaster,
myMdmSettings);
myPatientMatchProvider = new PatientMatchProvider(myMdmHelper);
defaultScript = myMdmSettings.getScriptText();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public void testCreateLinkWithMatchResultOnDifferentPartitions() {
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);
}

Expand All @@ -63,7 +63,7 @@ public void testCreateLinkWithMatchResultOnDifferentPartitionsWithoutSearchAllPa
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();
}

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ public void testMatch() {
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);
Expand Down Expand Up @@ -118,7 +118,7 @@ public void testMatchOrder() throws Exception {

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);
Expand All @@ -142,7 +142,7 @@ public void testMismatch() throws Exception {
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();
}

Expand All @@ -154,7 +154,7 @@ public void testMatchWithEmptySearchParamCandidates() throws Exception {
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());
}
Expand Down Expand Up @@ -226,7 +226,7 @@ public void testMatchWithCoarseDateGranularity() throws Exception {
}""";

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);
}

Expand Down Expand Up @@ -268,7 +268,7 @@ public void testNicknameMatch() throws IOException {
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();
}

Expand All @@ -289,7 +289,7 @@ public void testNicknameMatch() throws IOException {

{
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);
}
}
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-jpaserver-model/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-jpaserver-searchparam/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-jpaserver-subscription/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>

Expand Down
2 changes: 1 addition & 1 deletion hapi-fhir-jpaserver-test-dstu2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -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>
Expand Down
Loading

0 comments on commit 0a88c31

Please sign in to comment.