Skip to content

Commit 07f2377

Browse files
committed
mimick what is happening in api-2.5 pom
1 parent 2c757fd commit 07f2377

File tree

13 files changed

+147
-55
lines changed

13 files changed

+147
-55
lines changed

README.md

+2
Original file line numberDiff line numberDiff line change
@@ -150,6 +150,7 @@ This is the list of currently supported domains in their loading order:
150150
1. [Cohort Attribute Types (CSV files)](readme/cohort.md#domain-cohortattributetypes)
151151
1. [FHIR Concept Sources (CSV files)](readme/fhir.md#domain-fhirconceptsources)
152152
1. [FHIR Patient Identifier Systems (CSV Files)](readme/fhir.md#domain-fhirpatientidentifiersystems)
153+
2. [FHIR ContactPointMap (CSV Files)](https://github.com/mherman22/openmrs-module-initializer/blob/ContactPointMap-impl/readme/fhir.md#domain-fhircontactpointmap)
153154
1. [AMPATH Forms (JSON files)](readme/ampathforms.md)
154155
1. [AMPATH Forms Translations (JSON files)](readme/ampathformstranslations.md)
155156
1. [HTML Forms (XML files)](readme/htmlforms.md)
@@ -199,6 +200,7 @@ See the [documentation on Initializer's logging properties](readme/rtprops.md#lo
199200
* Added support for 'queues' domain.
200201
* Added support for 'addresshierarchy' domain.
201202
* Fix for Liquibase Loader to ensure compatibility with OpenMRS versions 2.5.5+
203+
* Added support for 'fhircontactpointmap' domain.
202204

203205
#### Version 2.6.0
204206
* Added support for 'cohorttypes' and 'cohortattributetypes' domains.

api-2.6/pom.xml

+29
Original file line numberDiff line numberDiff line change
@@ -51,6 +51,21 @@
5151
<type>test-jar</type>
5252
</dependency>
5353

54+
<dependency>
55+
<groupId>${project.parent.groupId}</groupId>
56+
<artifactId>${project.parent.artifactId}-api-2.5</artifactId>
57+
<version>${project.parent.version}</version>
58+
<scope>provided</scope>
59+
</dependency>
60+
61+
<dependency>
62+
<groupId>${project.parent.groupId}</groupId>
63+
<artifactId>${project.parent.artifactId}-api-2.5</artifactId>
64+
<version>${project.parent.version}</version>
65+
<scope>test</scope>
66+
<type>test-jar</type>
67+
</dependency>
68+
5469
<dependency>
5570
<groupId>${project.parent.groupId}</groupId>
5671
<artifactId>${project.parent.artifactId}-api-2.4</artifactId>
@@ -88,6 +103,13 @@
88103
<type>test-jar</type>
89104
</dependency>
90105

106+
<dependency>
107+
<groupId>org.openmrs.module</groupId>
108+
<artifactId>fhir2-api-2.5</artifactId>
109+
<version>${fhir2Version}</version>
110+
<scope>provided</scope>
111+
</dependency>
112+
91113
<dependency>
92114
<groupId>org.openmrs.module</groupId>
93115
<artifactId>fhir2-api-2.6</artifactId>
@@ -102,6 +124,13 @@
102124
<scope>provided</scope>
103125
</dependency>
104126

127+
<dependency>
128+
<groupId>org.openmrs.module</groupId>
129+
<artifactId>queue-api</artifactId>
130+
<version>${queueVersion}</version>
131+
<scope>provided</scope>
132+
</dependency>
133+
105134
</dependencies>
106135

107136
</project>

api-2.6/src/main/java/org/openmrs/module/initializer/api/fhir/cpm/FhirContactPointMapCsvParser.java

+12-13
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,15 @@
2222
import org.openmrs.module.initializer.api.CsvLine;
2323
import org.openmrs.module.initializer.api.CsvParser;
2424
import org.springframework.beans.factory.annotation.Autowired;
25+
import org.springframework.stereotype.Component;
2526

27+
@Component
2628
@OpenmrsProfile(modules = { "fhir2:1.11.* - 9.*" }, openmrsPlatformVersion = "2.6.3 - 2.6.*, 2.7.* - 9.*")
2729
public class FhirContactPointMapCsvParser extends CsvParser<FhirContactPointMap, BaseLineProcessor<FhirContactPointMap>> {
2830

2931
public static final String ATTRIBUTE_TYPE_DOMAIN_HEADER = "Entity name";
3032

31-
public static final String ATTRIBUTE_TYPE = "Attribute type";
33+
public static final String ATTRIBUTE_TYPE = "Attribute Type";
3234

3335
private static final String LOCATION = "location";
3436

@@ -45,8 +47,9 @@ public class FhirContactPointMapCsvParser extends CsvParser<FhirContactPointMap,
4547
private final FhirContactPointMapService fhirContactPointMapService;
4648

4749
@Autowired
48-
protected FhirContactPointMapCsvParser(FhirContactPointMapService fhirContactPointMapService,BaseLineProcessor<FhirContactPointMap> lineProcessor,
49-
LocationService locationService, PersonService personService, ProviderService providerService) {
50+
protected FhirContactPointMapCsvParser(FhirContactPointMapService fhirContactPointMapService,
51+
BaseLineProcessor<FhirContactPointMap> lineProcessor, LocationService locationService, PersonService personService,
52+
ProviderService providerService) {
5053
super(lineProcessor);
5154
this.fhirContactPointMapService = fhirContactPointMapService;
5255
this.locationService = locationService;
@@ -58,8 +61,7 @@ protected FhirContactPointMapCsvParser(FhirContactPointMapService fhirContactPoi
5861
public FhirContactPointMap bootstrap(CsvLine line) throws IllegalArgumentException {
5962
FhirContactPointMap contactPointMap = null;
6063
if (line.getUuid() != null) {
61-
contactPointMap = fhirContactPointMapService.getFhirContactPointMapByUuid(line.getUuid())
62-
.orElse(null);
64+
contactPointMap = fhirContactPointMapService.getFhirContactPointMapByUuid(line.getUuid()).orElse(null);
6365
}
6466

6567
if (contactPointMap != null) {
@@ -74,21 +76,21 @@ public FhirContactPointMap bootstrap(CsvLine line) throws IllegalArgumentExcepti
7476

7577
if (personAttributeType == null) {
7678
throw new IllegalArgumentException("PersonAttributeType " + attributeType
77-
+ " does not exist. Please ensure your Initializer configuration contains this attribute type.");
79+
+ " does not exist. Please ensure your Initializer configuration contains this attribute type.");
7880
}
7981

8082
contactPointMap = fhirContactPointMapService.getFhirContactPointMapForPersonAttributeType(personAttributeType)
81-
.orElse(null);
83+
.orElse(null);
8284
} else {
8385
BaseAttributeType<?> baseAttributeType = getBaseAttributeType(attributeTypeDomain, attributeType);
8486

8587
if (baseAttributeType == null) {
8688
throw new IllegalArgumentException(
87-
"Could not find attribute type " + attributeType + " for attribute domain " + attributeTypeDomain);
89+
"Could not find attribute type " + attributeType + " for attribute domain " + attributeTypeDomain);
8890
}
8991

9092
contactPointMap = fhirContactPointMapService.getFhirContactPointMapForAttributeType(baseAttributeType)
91-
.orElse(null);
93+
.orElse(null);
9294
}
9395

9496
if (contactPointMap != null) {
@@ -97,7 +99,6 @@ public FhirContactPointMap bootstrap(CsvLine line) throws IllegalArgumentExcepti
9799

98100
return new FhirContactPointMap();
99101
}
100-
101102

102103
@Override
103104
public FhirContactPointMap save(FhirContactPointMap instance) {
@@ -116,9 +117,7 @@ protected PersonAttributeType getPersonAttributeType(String attributeType) {
116117
return personAttributeType;
117118
}
118119

119-
personAttributeType = personService.getPersonAttributeTypeByUuid(attributeType);
120-
121-
return personAttributeType;
120+
return personService.getPersonAttributeTypeByUuid(attributeType);
122121
}
123122

124123
protected BaseAttributeType<?> getBaseAttributeType(String attributeDomain, String attributeType) {

api-2.6/src/main/java/org/openmrs/module/initializer/api/fhir/cpm/FhirContactPointMapLineProcessor.java

+5
Original file line numberDiff line numberDiff line change
@@ -15,15 +15,20 @@
1515
import org.openmrs.module.fhir2.model.FhirContactPointMap;
1616
import org.openmrs.module.initializer.api.BaseLineProcessor;
1717
import org.openmrs.module.initializer.api.CsvLine;
18+
import org.springframework.stereotype.Component;
1819

1920
import static org.openmrs.module.initializer.api.fhir.cpm.FhirContactPointMapCsvParser.ATTRIBUTE_TYPE_DOMAIN_HEADER;
2021

22+
@Component
2123
@OpenmrsProfile(modules = { "fhir2:1.11.* - 9.*" }, openmrsPlatformVersion = "2.6.3 - 2.6.*, 2.7.* - 9.*")
2224
public class FhirContactPointMapLineProcessor extends BaseLineProcessor<FhirContactPointMap> {
2325

2426
private static final String SYSTEM_HEADER = "system";
27+
2528
private static final String USE_HEADER = "use";
29+
2630
private static final String RANK_HEADER = "rank";
31+
2732
@Override
2833
public FhirContactPointMap fill(FhirContactPointMap instance, CsvLine line) throws IllegalArgumentException {
2934
String uuid = line.getUuid();

api-2.6/src/main/java/org/openmrs/module/initializer/api/fhir/cpm/FhirContactPointMapLoader.java

+2
Original file line numberDiff line numberDiff line change
@@ -13,7 +13,9 @@
1313
import org.openmrs.module.fhir2.model.FhirContactPointMap;
1414
import org.openmrs.module.initializer.api.loaders.BaseCsvLoader;
1515
import org.springframework.beans.factory.annotation.Autowired;
16+
import org.springframework.stereotype.Component;
1617

18+
@Component
1719
@OpenmrsProfile(modules = { "fhir2:1.11.* - 9.*" }, openmrsPlatformVersion = "2.6.3 - 2.6.*, 2.7.* - 9.*")
1820
public class FhirContactPointMapLoader extends BaseCsvLoader<FhirContactPointMap, FhirContactPointMapCsvParser> {
1921

api-2.6/src/test/java/org/openmrs/module/initializer/DomainBaseModuleContextSensitive_2_6_Test.java

+1-5
Original file line numberDiff line numberDiff line change
@@ -9,10 +9,6 @@
99
*/
1010
package org.openmrs.module.initializer;
1111

12-
public abstract class DomainBaseModuleContextSensitive_2_6_Test extends DomainBaseModuleContextSensitiveTest {
12+
public abstract class DomainBaseModuleContextSensitive_2_6_Test extends DomainBaseModuleContextSensitive_2_3_Test {
1313

14-
@Override
15-
public void updateSearchIndex() {
16-
// to prevent Data Filter's 'Illegal Record Access'
17-
}
1814
}

api-2.6/src/test/java/org/openmrs/module/initializer/api/FhirPatientContactPointMapIntegrationTest.java

+64-20
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@
3232
import static org.hamcrest.Matchers.is;
3333

3434
public class FhirPatientContactPointMapIntegrationTest extends DomainBaseModuleContextSensitive_2_6_Test {
35-
35+
3636
@Autowired
3737
private FhirContactPointMapService fhirContactPointMapService;
3838

@@ -58,19 +58,61 @@ public class FhirPatientContactPointMapIntegrationTest extends DomainBaseModuleC
5858

5959
@Before
6060
public void setup() {
61-
personAttributeType = new PersonAttributeType();
62-
providerAttributeType = new ProviderAttributeType();
63-
locationAttributeType = new LocationAttributeType();
64-
65-
fhirContactPointMap = new FhirContactPointMap();
66-
fhirContactPointMap.setUuid("fa48acc4-ef1f-46d6-b0af-150b00ddee9d");
67-
fhirContactPointMap.setAttributeTypeDomain("person");
68-
fhirContactPointMap.setAttributeTypeId(10001);
69-
fhirContactPointMap.setSystem(ContactPoint.ContactPointSystem.PHONE);
70-
fhirContactPointMap.setUse(ContactPoint.ContactPointUse.WORK);
71-
fhirContactPointMap.setRank(1);
72-
fhirContactPointMapService.saveFhirContactPointMap(fhirContactPointMap);
73-
personService.savePersonAttributeType(personAttributeType);
61+
{
62+
personAttributeType = new PersonAttributeType();
63+
personAttributeType.setId(10001);
64+
personAttributeType.setUuid("717ec942-3c4a-11ea-b024-ffc81a23382e");
65+
66+
fhirContactPointMap = new FhirContactPointMap();
67+
fhirContactPointMap.setUuid("fa48acc4-ef1f-46d6-b0af-150b00ddee9d");
68+
fhirContactPointMap.setAttributeTypeDomain("person");
69+
fhirContactPointMap.setAttributeTypeId(10001);
70+
fhirContactPointMap.setSystem(ContactPoint.ContactPointSystem.PHONE);
71+
fhirContactPointMap.setUse(ContactPoint.ContactPointUse.WORK);
72+
fhirContactPointMap.setRank(1);
73+
fhirContactPointMapService.saveFhirContactPointMap(fhirContactPointMap);
74+
}
75+
{
76+
personAttributeType = new PersonAttributeType();
77+
personAttributeType.setId(10002);
78+
personAttributeType.setUuid("PAT_RENAME_NEW_NAME");
79+
80+
fhirContactPointMap = new FhirContactPointMap();
81+
fhirContactPointMap.setUuid("");
82+
fhirContactPointMap.setAttributeTypeDomain("person");
83+
fhirContactPointMap.setAttributeTypeId(10002);
84+
fhirContactPointMap.setSystem(ContactPoint.ContactPointSystem.PHONE);
85+
fhirContactPointMap.setUse(ContactPoint.ContactPointUse.WORK);
86+
fhirContactPointMapService.saveFhirContactPointMap(fhirContactPointMap);
87+
}
88+
{
89+
providerAttributeType = new ProviderAttributeType();
90+
providerAttributeType.setId(10003);
91+
providerAttributeType.setUuid("Provider Speciality");
92+
93+
fhirContactPointMap = new FhirContactPointMap();
94+
fhirContactPointMap.setUuid("bcf23315-a236-42aa-be95-b9e0931e22b0");
95+
fhirContactPointMap.setAttributeTypeDomain("provider");
96+
fhirContactPointMap.setAttributeTypeId(10003);
97+
fhirContactPointMap.setSystem(ContactPoint.ContactPointSystem.EMAIL);
98+
fhirContactPointMap.setUse(ContactPoint.ContactPointUse.HOME);
99+
fhirContactPointMap.setRank(2);
100+
fhirContactPointMapService.saveFhirContactPointMap(fhirContactPointMap);
101+
}
102+
{
103+
locationAttributeType = new LocationAttributeType();
104+
locationAttributeType.setId(10004);
105+
locationAttributeType.setUuid("e7aacc6e-d151-4d9e-a808-6ed9ff761212");
106+
107+
fhirContactPointMap = new FhirContactPointMap();
108+
fhirContactPointMap.setUuid("800e48ba-666c-445c-b871-68e54eec6de8");
109+
fhirContactPointMap.setAttributeTypeDomain("location");
110+
fhirContactPointMap.setAttributeTypeId(10004);
111+
fhirContactPointMap.setSystem(ContactPoint.ContactPointSystem.PHONE);
112+
fhirContactPointMap.setUse(ContactPoint.ContactPointUse.TEMP);
113+
fhirContactPointMap.setRank(3);
114+
fhirContactPointMapService.saveFhirContactPointMap(fhirContactPointMap);
115+
}
74116
}
75117

76118
@Test
@@ -86,22 +128,24 @@ public void loader_shouldLoadFhirContactPointMapAccordingToCSVFiles() {
86128
assertThat(firstFhirContactPointMap.getUse(), equalTo(ContactPoint.ContactPointUse.WORK));
87129

88130
assertThat(secondFhirContactPointMap.getAttributeTypeDomain(), equalTo("provider"));
89-
assertThat(firstFhirContactPointMap.getSystem(), equalTo(ContactPoint.ContactPointSystem.EMAIL));
90-
assertThat(firstFhirContactPointMap.getUse(), equalTo(ContactPoint.ContactPointUse.HOME));
131+
assertThat(secondFhirContactPointMap.getSystem(), equalTo(ContactPoint.ContactPointSystem.EMAIL));
132+
assertThat(secondFhirContactPointMap.getUse(), equalTo(ContactPoint.ContactPointUse.HOME));
91133

92134
assertThat(thirdFhirContactPointMap.getAttributeTypeDomain(), equalTo("location"));
93-
assertThat(firstFhirContactPointMap.getSystem(), equalTo(ContactPoint.ContactPointSystem.URL));
94-
assertThat(firstFhirContactPointMap.getUse(), equalTo(ContactPoint.ContactPointUse.TEMP));
135+
assertThat(thirdFhirContactPointMap.getSystem(), equalTo(ContactPoint.ContactPointSystem.PHONE));
136+
assertThat(thirdFhirContactPointMap.getUse(), equalTo(ContactPoint.ContactPointUse.TEMP));
95137
}
96138

97139
protected FhirContactPointMap assertPersonAttributeType(PersonAttributeType attributeType) {
98-
Optional<FhirContactPointMap> contactPointMap = fhirContactPointMapService.getFhirContactPointMapForPersonAttributeType(attributeType);
140+
Optional<FhirContactPointMap> contactPointMap = fhirContactPointMapService
141+
.getFhirContactPointMapForPersonAttributeType(attributeType);
99142
assertThat(contactPointMap.isPresent(), is(true));
100143
return contactPointMap.get();
101144
}
102145

103146
protected FhirContactPointMap assertBaseAttributeType(BaseAttributeType<?> attributeType) {
104-
Optional<FhirContactPointMap> contactPointMap = fhirContactPointMapService.getFhirContactPointMapForAttributeType(attributeType);
147+
Optional<FhirContactPointMap> contactPointMap = fhirContactPointMapService
148+
.getFhirContactPointMapForAttributeType(attributeType);
105149
assertThat(contactPointMap.isPresent(), is(true));
106150
return contactPointMap.get();
107151
}

api-2.3/src/test/java/org/openmrs/module/initializer/api/loaders/LoadersOrderTest.java api-2.6/src/test/java/org/openmrs/module/initializer/api/LoadersOrderTest.java

+5-3
Original file line numberDiff line numberDiff line change
@@ -7,7 +7,7 @@
77
* Copyright (C) OpenMRS Inc. OpenMRS is a registered trademark and the OpenMRS
88
* graphic logo is a trademark of OpenMRS Inc.
99
*/
10-
package org.openmrs.module.initializer.api.loaders;
10+
package org.openmrs.module.initializer.api;
1111

1212
import static org.hamcrest.MatcherAssert.assertThat;
1313
import static org.hamcrest.Matchers.everyItem;
@@ -23,9 +23,10 @@
2323
import org.hamcrest.TypeSafeDiagnosingMatcher;
2424
import org.junit.Test;
2525
import org.openmrs.module.initializer.Domain;
26-
import org.openmrs.module.initializer.DomainBaseModuleContextSensitive_2_3_Test;
26+
import org.openmrs.module.initializer.DomainBaseModuleContextSensitive_2_6_Test;
27+
import org.openmrs.module.initializer.api.loaders.Loader;
2728

28-
public class LoadersOrderTest extends DomainBaseModuleContextSensitive_2_3_Test {
29+
public class LoadersOrderTest extends DomainBaseModuleContextSensitive_2_6_Test {
2930

3031
@Test
3132
public void getLoaders_shouldBeUnequivocallyOrdered() {
@@ -45,6 +46,7 @@ public void getLoaders_shouldBeUnequivocallyOrdered() {
4546

4647
List<Loader> runtimeLoaders = getService().getLoaders();
4748
assertThat(runtimeLoaders, everyItem(hasExpectedDomain()));
49+
4850
assertThat(runtimeLoaders, coversAllDomains());
4951
}
5052

Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
Uuid,Void/Retire,Entity name,Attribute Type,System,Use,Rank,_order:1000
2-
fa48acc4-ef1f-46d6-b0af-150b00ddee9d,,person,717ec942-3c4a-11ea-b024-ffc81a23382e,phone,work,1,
3-
,,person,PAT_RENAME_NEW_NAME,phone,home,,
4-
bcf23315-a236-42aa-be95-b9e0931e22b0,,provider,Provider Speciality,email,home,2,
5-
800e48ba-666c-445c-b871-68e54eec6de8,,location,e7aacc6e-d151-4d9e-a808-6ed9ff761212,phone,temp,3,
2+
fa48acc4-ef1f-46d6-b0af-150b00ddee9d,,person,717ec942-3c4a-11ea-b024-ffc81a23382e,PHONE,WORK,1,
3+
,,person,PAT_RENAME_NEW_NAME,PHONE,HOME,,
4+
bcf23315-a236-42aa-be95-b9e0931e22b0,,provider,Provider Speciality,EMAIL,HOME,2,
5+
800e48ba-666c-445c-b871-68e54eec6de8,,location,e7aacc6e-d151-4d9e-a808-6ed9ff761212,PHONE,TEMP,3,

omod/pom.xml

+6
Original file line numberDiff line numberDiff line change
@@ -42,6 +42,12 @@
4242
<artifactId>${project.parent.artifactId}-api-2.5</artifactId>
4343
<version>${project.parent.version}</version>
4444
</dependency>
45+
46+
<dependency>
47+
<groupId>${project.parent.groupId}</groupId>
48+
<artifactId>${project.parent.artifactId}-api-2.6</artifactId>
49+
<version>${project.parent.version}</version>
50+
</dependency>
4551

4652
<dependency>
4753
<groupId>${project.parent.groupId}</groupId>

pom.xml

+1-1
Original file line numberDiff line numberDiff line change
@@ -57,7 +57,7 @@
5757
<openmrsVersion2.3>2.3.6</openmrsVersion2.3>
5858
<openmrsVersion2.4>2.4.0</openmrsVersion2.4>
5959
<openmrsVersion2.5>2.5.5</openmrsVersion2.5>
60-
<openmrsVersion2.6>2.6.3-SNAPSHOT</openmrsVersion2.6>
60+
<openmrsVersion2.6>2.6.3</openmrsVersion2.6>
6161

6262
<openmrsPlatformVersion>${openmrsVersion2.1}</openmrsPlatformVersion>
6363

readme/fhir.md

+4-4
Original file line numberDiff line numberDiff line change
@@ -90,10 +90,10 @@ The format of this CSV should be as follows:
9090

9191
| Uuid | Void/Retire | Entity name | Attribute Type | System | Use | Rank | _order:1000 |
9292
|--------------------------------------|-------------|-------------|--------------------------------------|--------|------|------|-------------|
93-
| fa48acc4-ef1f-46d6-b0af-150b00ddee9d | | person | 717ec942-3c4a-11ea-b024-ffc81a23382e | phone | work | 1 | |
94-
| | | person | PAT_RENAME_NEW_NAME | phone | home | | |
95-
| bcf23315-a236-42aa-be95-b9e0931e22b0 | | provider | Provider Speciality | email | home | 2 | |
96-
| 800e48ba-666c-445c-b871-68e54eec6de8 | | location | e7aacc6e-d151-4d9e-a808-6ed9ff761212 | phone | temp | 3 | |
93+
| fa48acc4-ef1f-46d6-b0af-150b00ddee9d | | person | 717ec942-3c4a-11ea-b024-ffc81a23382e | PHONE | WORK | 1 | |
94+
| | | person | PAT_RENAME_NEW_NAME | PHONE | HOME | | |
95+
| bcf23315-a236-42aa-be95-b9e0931e22b0 | | provider | Provider Speciality | EMAIL | HOME | 2 | |
96+
| 800e48ba-666c-445c-b871-68e54eec6de8 | | location | e7aacc6e-d151-4d9e-a808-6ed9ff761212 | PHONE | TEMP | 3 | |
9797

9898
Headers that start with an underscore such as `_order:1000` are metadata headers. The values in the columns under those headers are never read by the CSV parser.
9999

0 commit comments

Comments
 (0)