Splitting Patient Identifier into multiple bundles (#9)

* Adding the SEDISH MPI Enterprise Client ID to Haiti Core for testing

* ISANT-75 updating the haiticore Patient Identifier Type bundles to allow for installing individual patient identifier types
This commit is contained in:
Craig Appl authored and Mark Goodrich committed 2017-08-31 16:39:30 -04:00
1 parent 45685e0a70
commit d78cb07555
5 files changed
+41 -6

No files matched your search

@@ -4,7 +4,8 @@ import org.openmrs.api.context.Context;
import org.openmrs.module.haiticore.metadata.HaitiAddressBundle;
import org.openmrs.module.haiticore.metadata.HaitiEncounterTypeBundle;
import org.openmrs.module.haiticore.metadata.HaitiPersonAttributeTypeBundle;
import org.openmrs.module.haiticore.metadata.HaitiPatientIdentifierTypeBundle;
import org.openmrs.module.haiticore.metadata.patientidentifiertypebundles.HaitiBiometricPatientIdentifierTypeBundle;
import org.openmrs.module.haiticore.metadata.patientidentifiertypebundles.HaitiSedishMpiPatientIdentifierTypeBundle;
import org.openmrs.module.metadatadeploy.api.MetadataDeployService;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.stereotype.Component;
@@ -19,7 +20,8 @@ public class HaitiCoreInstaller {
metadataDeployService.installBundle(Context.getRegisteredComponents(HaitiPersonAttributeTypeBundle.class).get(0));
metadataDeployService.installBundle(Context.getRegisteredComponents(HaitiEncounterTypeBundle.class).get(0));
metadataDeployService.installBundle(Context.getRegisteredComponents(HaitiAddressBundle.class).get(0));
metadataDeployService.installBundle(Context.getRegisteredComponents(HaitiPatientIdentifierTypeBundle.class).get(0));
metadataDeployService.installBundle(Context.getRegisteredComponents(HaitiBiometricPatientIdentifierTypeBundle.class).get(0));
metadataDeployService.installBundle(Context.getRegisteredComponents(HaitiSedishMpiPatientIdentifierTypeBundle.class).get(0));
}
}
@@ -27,4 +27,10 @@ public class HaitiPatientIdentifierTypes {
public String description() { return "Code referencing a patient's record in an external biometrics system"; }
};
public static PatientIdentifierTypeDescriptor SEDISH_MPI_ECID = new PatientIdentifierTypeDescriptor() {
public String uuid() { return "f54ed6b9-f5b9-4fd5-a588-8f7561a78401"; }
public String name() { return "ECID"; }
public String description() { return "Code referencing a patient's record in the SEDISH Master Person Index (Enterprise Client ID)"; }
};
}
@@ -1,16 +1,16 @@
package org.openmrs.module.haiticore.metadata;
package org.openmrs.module.haiticore.metadata.patientidentifiertypebundles;
import org.openmrs.module.metadatadeploy.bundle.AbstractMetadataBundle;
import org.openmrs.module.haiticore.metadata.HaitiPatientIdentifierTypes;
import org.springframework.stereotype.Component;
@Component
public class HaitiPatientIdentifierTypeBundle extends AbstractMetadataBundle {
public class HaitiBiometricPatientIdentifierTypeBundle extends AbstractMetadataBundle {
@Override
public void install() throws Exception {
log.info("Installing PatientIdentifierTypes");
log.info("Installing Biometric PatientIdentifierType");
install(HaitiPatientIdentifierTypes.BIOMETRIC_REF_NUMBER);
}
@@ -0,0 +1,18 @@
package org.openmrs.module.haiticore.metadata.patientidentifiertypebundles;
import org.openmrs.module.metadatadeploy.bundle.AbstractMetadataBundle;
import org.openmrs.module.haiticore.metadata.HaitiPatientIdentifierTypes;
import org.springframework.stereotype.Component;
@Component
public class HaitiSedishMpiPatientIdentifierTypeBundle extends AbstractMetadataBundle {
@Override
public void install() throws Exception {
log.info("Installing SEDISH MPI PatientIdentifierType");
install(HaitiPatientIdentifierTypes.SEDISH_MPI_ECID);
}
}
@@ -3,6 +3,7 @@ package org.openmrs.module.haiticore;
import org.junit.Assert;
import org.junit.Test;
import org.openmrs.api.PersonService;
import org.openmrs.api.PatientService;
import org.openmrs.api.context.Context;
import org.openmrs.module.addresshierarchy.AddressField;
import org.openmrs.module.addresshierarchy.AddressHierarchyLevel;
@@ -10,6 +11,8 @@ import org.openmrs.module.addresshierarchy.service.AddressHierarchyService;
import org.openmrs.module.haiticore.metadata.HaitiAddressBundle;
import org.openmrs.module.haiticore.metadata.HaitiPersonAttributeTypeBundle;
import org.openmrs.module.haiticore.metadata.HaitiPersonAttributeTypes;
import org.openmrs.module.haiticore.metadata.HaitiPatientIdentifierTypes;
import org.openmrs.test.BaseModuleContextSensitiveTest;
import org.springframework.beans.factory.annotation.Autowired;
@@ -27,13 +30,16 @@ public class HaitiCoreActivatorTest extends BaseModuleContextSensitiveTest {
@Autowired
private PersonService personService;
@Autowired
private PatientService patientService;
@Autowired
private HaitiPersonAttributeTypeBundle personAttributeTypeBundle;
@Autowired
private HaitiAddressBundle addressBundle;
@Test
public void testMetadataBundles() throws Exception {
@@ -43,6 +49,9 @@ public class HaitiCoreActivatorTest extends BaseModuleContextSensitiveTest {
assertThat(personService.getAllPersonAttributeTypes().size(), is(7)); // the 4 that the bundle installs + the 3 from standard test dataset
assertNotNull(personService.getPersonAttributeTypeByUuid(HaitiPersonAttributeTypes.MOTHERS_FIRST_NAME.uuid()));
// test the patient identifier type is loaded
assertNotNull(patientService.getPatientIdentifierTypeByUuid(HaitiPatientIdentifierTypes.BIOMETRIC_REF_NUMBER.uuid()));
// test the address hierarchy
verifyAddressHierarchyLevelsCreated();
verifyAddressHierarchyLoaded();