Skip to content

Commit d7bdabb

Browse files
TipzCMleif stawnyczy
and
leif stawnyczy
authored
nickname svc refatoring (#5006)
* nickname svc refatoring * moving things around * cleanup * gitignore * removing factory * added changelog * version bump * fixing test * fix test --------- Co-authored-by: leif stawnyczy <[email protected]>
1 parent 20a9ad0 commit d7bdabb

File tree

90 files changed

+209
-127
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

90 files changed

+209
-127
lines changed

.gitignore

+1-1
Original file line numberDiff line numberDiff line change
@@ -167,6 +167,6 @@ Snap.*
167167
.vscode
168168

169169

170-
/database/
170+
/database*/
171171
/activemq-data/
172172
/.run/

hapi-deployable-pom/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>ca.uhn.hapi.fhir</groupId>
77
<artifactId>hapi-fhir</artifactId>
8-
<version>6.7.8-SNAPSHOT</version>
8+
<version>6.7.9-SNAPSHOT</version>
99

1010
<relativePath>../pom.xml</relativePath>
1111
</parent>

hapi-fhir-android/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>ca.uhn.hapi.fhir</groupId>
77
<artifactId>hapi-deployable-pom</artifactId>
8-
<version>6.7.8-SNAPSHOT</version>
8+
<version>6.7.9-SNAPSHOT</version>
99

1010
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
1111
</parent>

hapi-fhir-base/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>ca.uhn.hapi.fhir</groupId>
77
<artifactId>hapi-deployable-pom</artifactId>
8-
<version>6.7.8-SNAPSHOT</version>
8+
<version>6.7.9-SNAPSHOT</version>
99

1010
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
1111
</parent>

hapi-fhir-bom/pom.xml

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,15 +4,15 @@
44
<modelVersion>4.0.0</modelVersion>
55
<groupId>ca.uhn.hapi.fhir</groupId>
66
<artifactId>hapi-fhir-bom</artifactId>
7-
<version>6.7.8-SNAPSHOT</version>
7+
<version>6.7.9-SNAPSHOT</version>
88

99
<packaging>pom</packaging>
1010
<name>HAPI FHIR BOM</name>
1111

1212
<parent>
1313
<groupId>ca.uhn.hapi.fhir</groupId>
1414
<artifactId>hapi-deployable-pom</artifactId>
15-
<version>6.7.8-SNAPSHOT</version>
15+
<version>6.7.9-SNAPSHOT</version>
1616

1717
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
1818
</parent>

hapi-fhir-checkstyle/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>ca.uhn.hapi.fhir</groupId>
77
<artifactId>hapi-fhir</artifactId>
8-
<version>6.7.8-SNAPSHOT</version>
8+
<version>6.7.9-SNAPSHOT</version>
99

1010
<relativePath>../pom.xml</relativePath>
1111
</parent>

hapi-fhir-cli/hapi-fhir-cli-api/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>ca.uhn.hapi.fhir</groupId>
66
<artifactId>hapi-deployable-pom</artifactId>
7-
<version>6.7.8-SNAPSHOT</version>
7+
<version>6.7.9-SNAPSHOT</version>
88

99
<relativePath>../../hapi-deployable-pom/pom.xml</relativePath>
1010
</parent>

hapi-fhir-cli/hapi-fhir-cli-app/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>ca.uhn.hapi.fhir</groupId>
88
<artifactId>hapi-fhir-cli</artifactId>
9-
<version>6.7.8-SNAPSHOT</version>
9+
<version>6.7.9-SNAPSHOT</version>
1010

1111
<relativePath>../pom.xml</relativePath>
1212
</parent>

hapi-fhir-cli/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>ca.uhn.hapi.fhir</groupId>
77
<artifactId>hapi-fhir</artifactId>
8-
<version>6.7.8-SNAPSHOT</version>
8+
<version>6.7.9-SNAPSHOT</version>
99

1010
<relativePath>../pom.xml</relativePath>
1111
</parent>

hapi-fhir-client-okhttp/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>ca.uhn.hapi.fhir</groupId>
66
<artifactId>hapi-deployable-pom</artifactId>
7-
<version>6.7.8-SNAPSHOT</version>
7+
<version>6.7.9-SNAPSHOT</version>
88

99
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
1010
</parent>

hapi-fhir-client/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>ca.uhn.hapi.fhir</groupId>
66
<artifactId>hapi-deployable-pom</artifactId>
7-
<version>6.7.8-SNAPSHOT</version>
7+
<version>6.7.9-SNAPSHOT</version>
88

99
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
1010
</parent>

hapi-fhir-converter/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>ca.uhn.hapi.fhir</groupId>
77
<artifactId>hapi-deployable-pom</artifactId>
8-
<version>6.7.8-SNAPSHOT</version>
8+
<version>6.7.9-SNAPSHOT</version>
99

1010
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
1111
</parent>

hapi-fhir-dist/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>ca.uhn.hapi.fhir</groupId>
77
<artifactId>hapi-fhir</artifactId>
8-
<version>6.7.8-SNAPSHOT</version>
8+
<version>6.7.9-SNAPSHOT</version>
99

1010
<relativePath>../pom.xml</relativePath>
1111
</parent>

hapi-fhir-docs/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>ca.uhn.hapi.fhir</groupId>
77
<artifactId>hapi-deployable-pom</artifactId>
8-
<version>6.7.8-SNAPSHOT</version>
8+
<version>6.7.9-SNAPSHOT</version>
99

1010
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
1111
</parent>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,9 @@
1+
---
2+
type: fix
3+
issue: 5005
4+
title: "
5+
Nickname Service Config has been moved out of search parameters
6+
as an optional config to add.
7+
Nickname service now has an interface to allow flexibility
8+
in implementation.
9+
"

hapi-fhir-jacoco/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
<parent>
1212
<groupId>ca.uhn.hapi.fhir</groupId>
1313
<artifactId>hapi-deployable-pom</artifactId>
14-
<version>6.7.8-SNAPSHOT</version>
14+
<version>6.7.9-SNAPSHOT</version>
1515

1616
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
1717
</parent>

hapi-fhir-jaxrsserver-base/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
<parent>
55
<groupId>ca.uhn.hapi.fhir</groupId>
66
<artifactId>hapi-deployable-pom</artifactId>
7-
<version>6.7.8-SNAPSHOT</version>
7+
<version>6.7.9-SNAPSHOT</version>
88

99
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
1010
</parent>

hapi-fhir-jpa/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>ca.uhn.hapi.fhir</groupId>
77
<artifactId>hapi-deployable-pom</artifactId>
8-
<version>6.7.8-SNAPSHOT</version>
8+
<version>6.7.9-SNAPSHOT</version>
99

1010
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
1111
</parent>
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,35 @@
1+
package ca.uhn.fhir.jpa.nickname;
2+
3+
import org.springframework.core.io.Resource;
4+
5+
import java.util.Collection;
6+
import java.util.List;
7+
8+
public interface INicknameSvc {
9+
10+
/**
11+
* Set a custom nickname resource to use.
12+
* If not used, a default will be used instead.
13+
*/
14+
void setNicknameResource(Resource theNicknameResource);
15+
16+
/**
17+
* The number of nicknames in the nickname svc
18+
*/
19+
int size();
20+
21+
/**
22+
* If using a custom nickname resource,
23+
* processing will keep track of any badly
24+
* formatted rows.
25+
* These badly formatted rows can be accessed with this api.
26+
*/
27+
List<String> getBadRows();
28+
29+
/**
30+
* Gets a list of nicknames for the provided name
31+
* @param theName - the provided name
32+
* @return - a collection of similar/nicknames
33+
*/
34+
Collection<String> getEquivalentNames(String theName);
35+
}

hapi-fhir-jpa/src/main/java/ca/uhn/fhir/jpa/nickname/NicknameSvc.java

+2-3
Original file line numberDiff line numberDiff line change
@@ -45,15 +45,13 @@
4545
* -
4646
* If one is to be provided, it must be provided before nickname svc is invoked
4747
*/
48-
public class NicknameSvc {
48+
public class NicknameSvc implements INicknameSvc {
4949
private static final Logger ourLog = LoggerFactory.getLogger(NicknameSvc.class);
50-
5150
private NicknameMap myNicknameMap;
5251

5352
private Resource myNicknameResource;
5453

5554
public NicknameSvc() {
56-
5755
}
5856

5957
public void setNicknameResource(Resource theNicknameResource) {
@@ -98,6 +96,7 @@ List<String> getFormalNamesFromNickname(String theNickname) {
9896

9997
private void ensureMapInitialized() {
10098
if (myNicknameResource == null) {
99+
ourLog.debug("Loading defaults");
101100
myNicknameResource = new ClassPathResource("/nickname/names.csv");
102101
}
103102

hapi-fhir-jpaserver-base/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>ca.uhn.hapi.fhir</groupId>
77
<artifactId>hapi-deployable-pom</artifactId>
8-
<version>6.7.8-SNAPSHOT</version>
8+
<version>6.7.9-SNAPSHOT</version>
99

1010
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
1111
</parent>

hapi-fhir-jpaserver-elastic-test-utilities/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>ca.uhn.hapi.fhir</groupId>
88
<artifactId>hapi-deployable-pom</artifactId>
9-
<version>6.7.8-SNAPSHOT</version>
9+
<version>6.7.9-SNAPSHOT</version>
1010
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
1111
</parent>
1212

hapi-fhir-jpaserver-ips/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -3,7 +3,7 @@
33
<parent>
44
<groupId>ca.uhn.hapi.fhir</groupId>
55
<artifactId>hapi-deployable-pom</artifactId>
6-
<version>6.7.8-SNAPSHOT</version>
6+
<version>6.7.9-SNAPSHOT</version>
77

88
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
99
</parent>

hapi-fhir-jpaserver-mdm/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
<parent>
77
<groupId>ca.uhn.hapi.fhir</groupId>
88
<artifactId>hapi-deployable-pom</artifactId>
9-
<version>6.7.8-SNAPSHOT</version>
9+
<version>6.7.9-SNAPSHOT</version>
1010

1111
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
1212
</parent>

hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/config/MdmCommonConfig.java

+14-5
Original file line numberDiff line numberDiff line change
@@ -20,21 +20,19 @@
2020
package ca.uhn.fhir.jpa.mdm.config;
2121

2222
import ca.uhn.fhir.context.FhirContext;
23-
import ca.uhn.fhir.jpa.nickname.NicknameSvc;
24-
import ca.uhn.fhir.jpa.searchparam.config.NicknameServiceConfig;
23+
import ca.uhn.fhir.jpa.nickname.INicknameSvc;
2524
import ca.uhn.fhir.mdm.api.IMdmSettings;
2625
import ca.uhn.fhir.mdm.interceptor.MdmSearchExpandingInterceptor;
2726
import ca.uhn.fhir.mdm.rules.config.MdmRuleValidator;
2827
import ca.uhn.fhir.mdm.rules.matcher.IMatcherFactory;
2928
import ca.uhn.fhir.mdm.rules.matcher.MdmMatcherFactory;
29+
import ca.uhn.fhir.mdm.rules.svc.MdmResourceMatcherSvc;
3030
import ca.uhn.fhir.mdm.svc.MdmLinkDeleteSvc;
3131
import ca.uhn.fhir.rest.server.util.ISearchParamRegistry;
3232
import org.springframework.context.annotation.Bean;
3333
import org.springframework.context.annotation.Configuration;
34-
import org.springframework.context.annotation.Import;
3534
import org.springframework.context.annotation.Lazy;
3635

37-
@Import(NicknameServiceConfig.class)
3836
@Configuration
3937
public class MdmCommonConfig {
4038
@Bean
@@ -53,10 +51,21 @@ MdmLinkDeleteSvc mdmLinkDeleteSvc() {
5351
}
5452

5553
@Bean
54+
@Lazy
55+
MdmResourceMatcherSvc mdmResourceComparatorSvc(
56+
FhirContext theFhirContext,
57+
IMatcherFactory theIMatcherFactory,
58+
IMdmSettings theMdmSettings
59+
) {
60+
return new MdmResourceMatcherSvc(theFhirContext, theIMatcherFactory, theMdmSettings);
61+
}
62+
63+
@Bean
64+
@Lazy
5665
public IMatcherFactory matcherFactory(
5766
FhirContext theFhirContext,
5867
IMdmSettings theSettings,
59-
NicknameSvc theNicknameSvc
68+
INicknameSvc theNicknameSvc
6069
) {
6170
return new MdmMatcherFactory(
6271
theFhirContext,

hapi-fhir-jpaserver-mdm/src/main/java/ca/uhn/fhir/jpa/mdm/config/MdmConsumerConfig.java

+5-13
Original file line numberDiff line numberDiff line change
@@ -48,8 +48,6 @@
4848
import ca.uhn.fhir.jpa.mdm.svc.candidate.MdmCandidateSearchCriteriaBuilderSvc;
4949
import ca.uhn.fhir.jpa.mdm.svc.candidate.MdmCandidateSearchSvc;
5050
import ca.uhn.fhir.jpa.mdm.svc.candidate.MdmGoldenResourceFindingSvc;
51-
import ca.uhn.fhir.mdm.rules.matcher.IMatcherFactory;
52-
import ca.uhn.fhir.mdm.util.MdmPartitionHelper;
5351
import ca.uhn.fhir.jpa.partition.IRequestPartitionHelperSvc;
5452
import ca.uhn.fhir.jpa.subscription.channel.api.IChannelFactory;
5553
import ca.uhn.fhir.mdm.api.IGoldenResourceMergerSvc;
@@ -69,10 +67,10 @@
6967
import ca.uhn.fhir.mdm.log.Logs;
7068
import ca.uhn.fhir.mdm.provider.MdmControllerHelper;
7169
import ca.uhn.fhir.mdm.provider.MdmProviderLoader;
72-
import ca.uhn.fhir.mdm.rules.svc.MdmResourceMatcherSvc;
7370
import ca.uhn.fhir.mdm.svc.MdmSearchParamSvc;
7471
import ca.uhn.fhir.mdm.util.EIDHelper;
7572
import ca.uhn.fhir.mdm.util.GoldenResourceHelper;
73+
import ca.uhn.fhir.mdm.util.MdmPartitionHelper;
7674
import ca.uhn.fhir.mdm.util.MessageHelper;
7775
import ca.uhn.fhir.validation.IResourceLoader;
7876
import org.slf4j.Logger;
@@ -91,7 +89,9 @@ IMdmStorageInterceptor mdmStorageInterceptor() {
9189
}
9290

9391
@Bean
94-
IMdmSurvivorshipService mdmSurvivorshipService() { return new MdmSurvivorshipSvcImpl(); }
92+
IMdmSurvivorshipService mdmSurvivorshipService() {
93+
return new MdmSurvivorshipSvcImpl();
94+
}
9595

9696
@Bean
9797
MdmQueueConsumerLoader mdmQueueConsumerLoader(IChannelFactory theChannelFactory, IMdmSettings theMdmSettings, MdmMessageHandler theMdmMessageHandler) {
@@ -107,6 +107,7 @@ MdmMessageHandler mdmMessageHandler() {
107107
MdmMessageKeySvc mdmMessageKeySvc() {
108108
return new MdmMessageKeySvc();
109109
}
110+
110111
@Bean
111112
MdmMatchLinkSvc mdmMatchLinkSvc() {
112113
return new MdmMatchLinkSvc();
@@ -205,15 +206,6 @@ MdmCandidateSearchCriteriaBuilderSvc mdmCriteriaBuilderSvc() {
205206
return new MdmCandidateSearchCriteriaBuilderSvc();
206207
}
207208

208-
@Bean
209-
MdmResourceMatcherSvc mdmResourceComparatorSvc(
210-
FhirContext theFhirContext,
211-
IMatcherFactory theIMatcherFactory,
212-
IMdmSettings theMdmSettings
213-
) {
214-
return new MdmResourceMatcherSvc(theFhirContext, theIMatcherFactory, theMdmSettings);
215-
}
216-
217209
@Bean
218210
EIDHelper eidHelper(FhirContext theFhirContext, IMdmSettings theMdmSettings) {
219211
return new EIDHelper(theFhirContext, theMdmSettings);

hapi-fhir-jpaserver-mdm/src/test/java/ca/uhn/fhir/jpa/mdm/svc/MdmCandidateSearchSvcIT.java

+2-2
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,7 @@
44
import ca.uhn.fhir.jpa.mdm.BaseMdmR4Test;
55
import ca.uhn.fhir.jpa.mdm.svc.candidate.MdmCandidateSearchSvc;
66
import ca.uhn.fhir.jpa.mdm.svc.candidate.TooManyCandidatesException;
7-
import ca.uhn.fhir.jpa.nickname.NicknameSvc;
7+
import ca.uhn.fhir.jpa.nickname.INicknameSvc;
88
import ca.uhn.fhir.jpa.searchparam.MatchUrlService;
99
import ca.uhn.fhir.jpa.searchparam.SearchParameterMap;
1010
import ca.uhn.fhir.jpa.searchparam.nickname.NicknameInterceptor;
@@ -38,7 +38,7 @@ public class MdmCandidateSearchSvcIT extends BaseMdmR4Test {
3838
MatchUrlService myMatchUrlService;
3939

4040
@Autowired
41-
NicknameSvc myNicknameSvc;
41+
INicknameSvc myNicknameSvc;
4242

4343
private NicknameInterceptor myNicknameInterceptor;
4444

hapi-fhir-jpaserver-model/pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
<parent>
66
<groupId>ca.uhn.hapi.fhir</groupId>
77
<artifactId>hapi-deployable-pom</artifactId>
8-
<version>6.7.8-SNAPSHOT</version>
8+
<version>6.7.9-SNAPSHOT</version>
99

1010
<relativePath>../hapi-deployable-pom/pom.xml</relativePath>
1111
</parent>

0 commit comments

Comments
 (0)