Skip to content

Commit

Permalink
renamed enum values per slack conversation
Browse files Browse the repository at this point in the history
  • Loading branch information
Ken Stevens committed Nov 22, 2024
1 parent 2d3d027 commit cead71d
Show file tree
Hide file tree
Showing 12 changed files with 76 additions and 35 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -48,9 +48,9 @@ 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));
return getAllRegisteredInterceptors().stream()
.anyMatch(t -> t.getClass().equals(theInterceptorClass));
}

/**
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
---
type: add
issue: 6495
title: "A new MdmSettings mode field was added (default value LINK_PROCESSING). When the MdmSettings mode is set to
RULES mode, then MDM operations are disabled and no MDM processing occurs. This is useful if, for example,
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."
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public MdmQueueConsumerLoader(
myMdmSettings = theMdmSettings;
myMdmMessageHandler = theMdmMessageHandler;

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

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public void updateSubscriptions() {

myMdmProviderLoader.loadPatientMatchProvider();

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

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
Original file line number Diff line number Diff line change
Expand Up @@ -73,6 +73,6 @@ default void setAutoExpungeGoldenResources(boolean theShouldAutoExpunge) {
throw new UnsupportedOperationException(Msg.code(2427));
}

// In RULES mode, the Patient/$match operation is available, but no mdm processing takes place.
// In MATCH_ONLY mode, the Patient/$match operation is available, but no mdm processing takes place.
MdmModeEnum getMode();
}
Original file line number Diff line number Diff line change
@@ -1,16 +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
*/
LINK_PROCESSING,
MATCH_AND_LINK,
/**
* in RULES mode, MDM operations are disabled and no MDM processing occurs. This is useful if, for example,
* 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.
*/
RULES
MATCH_ONLY

// TODO KHS possible future mode DEDUPLICATION 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
// 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
}
Original file line number Diff line number Diff line change
Expand Up @@ -75,7 +75,7 @@ public void loadPatientMatchProvider() {
break;
default:
throw new ConfigurationException(Msg.code(1497) + "MDM not supported for FHIR version "
+ myFhirContext.getVersion().getVersion());
+ myFhirContext.getVersion().getVersion());
}
}

Expand All @@ -86,22 +86,22 @@ public void loadProvider() {
case R5:
// We store the supplier so that removeSupplier works properly
myMdmProviderSupplier = () -> new MdmProviderDstu3Plus(
myFhirContext,
myMdmControllerSvc,
myMdmControllerHelper,
myMdmSubmitSvc,
myInterceptorBroadcaster,
myMdmSettings);
myFhirContext,
myMdmControllerSvc,
myMdmControllerHelper,
myMdmSubmitSvc,
myInterceptorBroadcaster,
myMdmSettings);
myResourceProviderFactory.addSupplier(myMdmProviderSupplier);
if (myStorageSettings.isNonResourceDbHistoryEnabled()) {
myMdmHistoryProviderSupplier = () -> new MdmLinkHistoryProviderDstu3Plus(
myFhirContext, myMdmControllerSvc, myInterceptorBroadcaster);
myFhirContext, myMdmControllerSvc, myInterceptorBroadcaster);
myResourceProviderFactory.addSupplier(myMdmHistoryProviderSupplier);
}
break;
default:
throw new ConfigurationException(Msg.code(1497) + "MDM not supported for FHIR version "
+ myFhirContext.getVersion().getVersion());
+ myFhirContext.getVersion().getVersion());
}
}

Expand Down
Original file line number Diff line number Diff line change
@@ -1,3 +1,22 @@
/*-
* #%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;
Expand All @@ -24,9 +43,9 @@ public PatientMatchProvider(MdmControllerHelper theMdmControllerHelper) {
*/
@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) {
@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");
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

import java.io.IOException;

import static ca.uhn.fhir.mdm.api.MdmModeEnum.LINK_PROCESSING;
import static ca.uhn.fhir.mdm.api.MdmModeEnum.MATCH_AND_LINK;

@Component
public class MdmSettings implements IMdmSettings {
Expand All @@ -45,7 +45,7 @@ public class MdmSettings implements IMdmSettings {
private String myGoldenResourcePartitionName;
private boolean mySearchAllPartitionForMatch = false;
private boolean myShouldAutoDeleteGoldenResources = true;
private MdmModeEnum myMdmMode = LINK_PROCESSING;
private MdmModeEnum myMdmMode = MATCH_AND_LINK;

/**
* If disabled, the underlying MDM system will operate under the following assumptions:
Expand Down

0 comments on commit cead71d

Please sign in to comment.