Skip to content

Commit

Permalink
run initializer-api-2.6 on fhir2:2.0.0
Browse files Browse the repository at this point in the history
  • Loading branch information
mherman22 committed Oct 25, 2023
1 parent 3aa66b2 commit 5d7bd68
Show file tree
Hide file tree
Showing 6 changed files with 43 additions and 54 deletions.
49 changes: 15 additions & 34 deletions api-2.6/pom.xml
Expand Up @@ -17,6 +17,7 @@

<properties>
<openmrsPlatformVersion>${openmrsVersion2.6}</openmrsPlatformVersion>
<fhir2Version>${fhir2Version2.0.0}</fhir2Version>
</properties>

<dependencies>
Expand All @@ -28,45 +29,25 @@
</dependency>

<dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>${project.parent.artifactId}-api</artifactId>
<version>${project.parent.version}</version>
<scope>test</scope>
<type>test-jar</type>
</dependency>

<dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>${project.parent.artifactId}-api-2.4</artifactId>
<version>${project.parent.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>${project.parent.artifactId}-api-2.3</artifactId>
<version>${project.parent.version}</version>
<groupId>org.openmrs.module</groupId>
<artifactId>fhir2-api</artifactId>
<version>${fhir2Version}</version>
<scope>provided</scope>
<exclusions>
<exclusion>
<groupId>org.openmrs.module</groupId>
<artifactId>fhir2-api-2.1</artifactId>
</exclusion>
<exclusion>
<groupId>org.openmrs.module</groupId>
<artifactId>fhir2-api-2.2</artifactId>
</exclusion>
</exclusions>
</dependency>

<dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>${project.parent.artifactId}-api-2.3</artifactId>
<version>${project.parent.version}</version>
<scope>test</scope>
<type>test-jar</type>
</dependency>

<dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>${project.parent.artifactId}-api-2.2</artifactId>
<version>${project.parent.version}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>${project.parent.groupId}</groupId>
<artifactId>${project.parent.artifactId}-api-2.2</artifactId>
<artifactId>${project.parent.artifactId}-api</artifactId>
<version>${project.parent.version}</version>
<scope>test</scope>
<type>test-jar</type>
Expand Down
Expand Up @@ -23,7 +23,9 @@
import org.openmrs.module.initializer.api.CsvParser;
import org.springframework.beans.factory.annotation.Autowired;

@OpenmrsProfile(modules = { "fhir2:1.11.* - 9.*" }, openmrsPlatformVersion = "2.6.3 - 2.6.*, 2.7.* - 9.*")
import static org.openmrs.module.initializer.Domain.FHIR_CONTACT_POINT_MAP;

@OpenmrsProfile(modules = { "fhir2:2.0.* - 9.*" }, openmrsPlatformVersion = "2.6.3 - 2.6.*, 2.7.* - 9.*")
public class FhirContactPointMapCsvParser extends CsvParser<FhirContactPointMap, BaseLineProcessor<FhirContactPointMap>> {

public static final String ATTRIBUTE_TYPE_DOMAIN_HEADER = "Entity name";
Expand All @@ -45,8 +47,9 @@ public class FhirContactPointMapCsvParser extends CsvParser<FhirContactPointMap,
private final FhirContactPointMapService fhirContactPointMapService;

@Autowired
protected FhirContactPointMapCsvParser(FhirContactPointMapService fhirContactPointMapService,BaseLineProcessor<FhirContactPointMap> lineProcessor,
LocationService locationService, PersonService personService, ProviderService providerService) {
protected FhirContactPointMapCsvParser(FhirContactPointMapService fhirContactPointMapService,
BaseLineProcessor<FhirContactPointMap> lineProcessor, LocationService locationService, PersonService personService,
ProviderService providerService) {
super(lineProcessor);
this.fhirContactPointMapService = fhirContactPointMapService;
this.locationService = locationService;
Expand All @@ -58,8 +61,7 @@ protected FhirContactPointMapCsvParser(FhirContactPointMapService fhirContactPoi
public FhirContactPointMap bootstrap(CsvLine line) throws IllegalArgumentException {
FhirContactPointMap contactPointMap = null;
if (line.getUuid() != null) {
contactPointMap = fhirContactPointMapService.getFhirContactPointMapByUuid(line.getUuid())
.orElse(null);
contactPointMap = fhirContactPointMapService.getFhirContactPointMapByUuid(line.getUuid()).orElse(null);
}

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

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

contactPointMap = fhirContactPointMapService.getFhirContactPointMapForPersonAttributeType(personAttributeType)
.orElse(null);
.orElse(null);
} else {
BaseAttributeType<?> baseAttributeType = getBaseAttributeType(attributeTypeDomain, attributeType);

if (baseAttributeType == null) {
throw new IllegalArgumentException(
"Could not find attribute type " + attributeType + " for attribute domain " + attributeTypeDomain);
"Could not find attribute type " + attributeType + " for attribute domain " + attributeTypeDomain);
}

contactPointMap = fhirContactPointMapService.getFhirContactPointMapForAttributeType(baseAttributeType)
.orElse(null);
.orElse(null);
}

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

return new FhirContactPointMap();
}


@Override
public FhirContactPointMap save(FhirContactPointMap instance) {
Expand All @@ -106,7 +107,7 @@ public FhirContactPointMap save(FhirContactPointMap instance) {

@Override
public Domain getDomain() {
return Domain.FHIR_CONTACT_POINT_MAP;
return FHIR_CONTACT_POINT_MAP;
}

protected PersonAttributeType getPersonAttributeType(String attributeType) {
Expand Down
Expand Up @@ -18,12 +18,15 @@

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

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

private static final String SYSTEM_HEADER = "system";

private static final String USE_HEADER = "use";

private static final String RANK_HEADER = "rank";

@Override
public FhirContactPointMap fill(FhirContactPointMap instance, CsvLine line) throws IllegalArgumentException {
String uuid = line.getUuid();
Expand Down
Expand Up @@ -14,7 +14,7 @@
import org.openmrs.module.initializer.api.loaders.BaseCsvLoader;
import org.springframework.beans.factory.annotation.Autowired;

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

@Autowired
Expand Down
Expand Up @@ -32,7 +32,7 @@
import static org.hamcrest.Matchers.is;

public class FhirPatientContactPointMapIntegrationTest extends DomainBaseModuleContextSensitive_2_6_Test {

@Autowired
private FhirContactPointMapService fhirContactPointMapService;

Expand Down Expand Up @@ -95,13 +95,15 @@ public void loader_shouldLoadFhirContactPointMapAccordingToCSVFiles() {
}

protected FhirContactPointMap assertPersonAttributeType(PersonAttributeType attributeType) {
Optional<FhirContactPointMap> contactPointMap = fhirContactPointMapService.getFhirContactPointMapForPersonAttributeType(attributeType);
Optional<FhirContactPointMap> contactPointMap = fhirContactPointMapService
.getFhirContactPointMapForPersonAttributeType(attributeType);
assertThat(contactPointMap.isPresent(), is(true));
return contactPointMap.get();
}

protected FhirContactPointMap assertBaseAttributeType(BaseAttributeType<?> attributeType) {
Optional<FhirContactPointMap> contactPointMap = fhirContactPointMapService.getFhirContactPointMapForAttributeType(attributeType);
Optional<FhirContactPointMap> contactPointMap = fhirContactPointMapService
.getFhirContactPointMapForAttributeType(attributeType);
assertThat(contactPointMap.isPresent(), is(true));
return contactPointMap.get();
}
Expand Down
10 changes: 6 additions & 4 deletions pom.xml
Expand Up @@ -56,6 +56,8 @@
<openmrsVersion2.3>2.3.6</openmrsVersion2.3>
<openmrsVersion2.4>2.4.0</openmrsVersion2.4>
<openmrsVersion2.6>2.6.3-SNAPSHOT</openmrsVersion2.6>
<fhir2Version1.11.0>1.11.0</fhir2Version1.11.0>
<fhir2Version2.0.0>2.0.0-SNAPSHOT</fhir2Version2.0.0>

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

Expand All @@ -69,7 +71,7 @@
<metadatasharingVersion>1.2.2</metadatasharingVersion>
<metadatamappingVersion>1.3.4</metadatamappingVersion>
<openconceptlabVersion>1.2.9</openconceptlabVersion>
<fhir2Version>1.11.0</fhir2Version>
<fhir2Version>${fhir2Version1.11.0}</fhir2Version>

<!-- Modules compatibility > Core 2.3.0 -->
<datafilterVersion>1.0.0</datafilterVersion>
Expand Down Expand Up @@ -233,21 +235,21 @@
<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>fhir2-api</artifactId>
<version>${fhir2Version}</version>
<version>${fhir2Version1.11.0}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>fhir2-api-2.1</artifactId>
<version>${fhir2Version}</version>
<version>${fhir2Version1.11.0}</version>
<scope>provided</scope>
</dependency>

<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>fhir2-api-2.2</artifactId>
<version>${fhir2Version}</version>
<version>${fhir2Version1.11.0}</version>
<scope>provided</scope>
</dependency>

Expand Down

0 comments on commit 5d7bd68

Please sign in to comment.