use of org.openmrs.module.pihcore.config.Config in project openmrs-module-mirebalais by PIH.
the class MirebalaisHospitalActivatorComponentTest method beforeEachTest.
@Before
public void beforeEachTest() throws Exception {
initializeInMemoryDatabase();
executeDataSet("requiredDataTestDataset.xml");
executeDataSet("globalPropertiesTestDataset.xml");
executeDataSet("mirebalaisProviderIdentifierGeneratorComponentTestDataset.xml");
executeDataSet("fromMirebalaisMetadataModule.xml");
executeDataSet("serializedReportingDataset.xml");
authenticate();
deployService.installBundle(conceptsFromMetadataSharing);
haitiPersonAttributeTypeBundle.install();
// run the emrapi activator
emrApiActivator = new EmrApiActivator();
emrApiActivator.started();
// run the appointmentschedulingui manager
appointmentSchedulingUIActivator = new AppointmentSchedulingUIActivator();
appointmentSchedulingUIActivator.started();
// set up metadata from pih core first
pihCoreActivator = new PihCoreActivator();
Config config = mock(Config.class);
when(config.getCountry()).thenReturn(ConfigDescriptor.Country.HAITI);
when(config.getSite()).thenReturn(ConfigDescriptor.Site.MIREBALAIS);
when(config.getBiometricsConfig()).thenReturn(new BiometricsConfigDescriptor());
pihCoreActivator.setConfig(config);
pihCoreActivator.started();
mirebalaisHospitalActivator = new MirebalaisHospitalActivator();
// TODO: get ReportSetup to work while testing so we no longer need this
mirebalaisHospitalActivator.setTestMode(true);
mirebalaisHospitalActivator.willRefreshContext();
mirebalaisHospitalActivator.contextRefreshed();
mirebalaisHospitalActivator.willStart();
mirebalaisHospitalActivator.started();
}
use of org.openmrs.module.pihcore.config.Config in project openmrs-module-mirebalais by PIH.
the class CustomAppLoaderComponentTest method shouldSetUpAppsAndExtensions.
@Test
public void shouldSetUpAppsAndExtensions() throws Exception {
deployService.installBundle(socioEconomicConcepts);
factory.setConfig(new Config());
factory.getExtensions();
factory.getAppDescriptors();
}
use of org.openmrs.module.pihcore.config.Config in project openmrs-module-mirebalais by PIH.
the class PatientRegistrationAppTest method shouldCreateAppDescriptor.
@Test
public void shouldCreateAppDescriptor() throws Exception {
executeDataSet("org/openmrs/module/pihcore/coreMetadata.xml");
authenticate();
deployService.installBundle(socioEconomicConcepts);
AppDescriptor d = patientRegistrationApp.getAppDescriptor(new Config());
assertThat(d.getId(), is(CustomAppLoaderConstants.Apps.PATIENT_REGISTRATION));
assertThat(d.getDescription(), is("registrationapp.registerPatient"));
assertThat(d.getLabel(), is("registrationapp.app.registerPatient.label"));
assertThat(d.getIcon(), is("icon-user"));
assertThat(d.getUrl(), is("registrationapp/findPatient.page?appId=" + CustomAppLoaderConstants.Apps.PATIENT_REGISTRATION));
assertThat(d.getRequiredPrivilege(), is("App: registrationapp.registerPatient"));
assertThat(d.getConfig().get("afterCreatedUrl").getTextValue(), is("mirebalais/patientRegistration/afterRegistration.page?patientId={{patientId}}&encounterId={{encounterId}}"));
assertThat(d.getConfig().get("patientDashboardLink").getTextValue(), is("registrationapp/registrationSummary.page?appId=registrationapp.registerPatient"));
assertThat(d.getConfig().get("registrationEncounter").get("encounterType").getTextValue(), is(EncounterTypes.PATIENT_REGISTRATION.uuid()));
assertThat(d.getConfig().get("registrationEncounter").get("encounterRole").getTextValue(), is(EncounterRoleBundle.EncounterRoles.ADMINISTRATIVE_CLERK));
assertTrue(d.getConfig().get("allowRetrospectiveEntry").getBooleanValue());
assertTrue(d.getConfig().get("allowUnknownPatients").getBooleanValue());
assertTrue(d.getConfig().get("allowManualIdentifier").getBooleanValue());
JsonNode demographicsSection = assertSectionFound(d.getConfig(), 0, "demographics", "", 1);
assertPersonAttributeQuestionFound(demographicsSection, 0, HaitiPersonAttributeTypes.MOTHERS_FIRST_NAME.uuid(), true);
JsonNode contactInfoSection = assertSectionFound(d.getConfig(), 1, "contactInfo", "registrationapp.patient.contactInfo.label", 2);
assertSingleFieldQuestion(contactInfoSection, 0, "personAddress");
assertPersonAttributeQuestionFound(contactInfoSection, 1, HaitiPersonAttributeTypes.TELEPHONE_NUMBER.uuid(), false);
JsonNode socialSection = assertSectionFound(d.getConfig(), 2, "social", "zl.registration.patient.social.label", 4);
assertSingleFieldQuestion(socialSection, 0, "personAddress");
assertObsQuestionFound(socialSection, 1, "obs.PIH:CIVIL STATUS");
assertObsQuestionFound(socialSection, 2, "obs.PIH:Occupation");
assertObsQuestionFound(socialSection, 3, "obs.PIH:Religion");
assertSectionFound(d.getConfig(), 3, "contacts", "zl.registration.patient.contactPerson.label", 3);
}
use of org.openmrs.module.pihcore.config.Config in project openmrs-module-mirebalais by PIH.
the class PatientRegistrationApp method getFingerprintWidget.
protected ObjectNode getFingerprintWidget(Config config, FeatureToggleProperties featureToggles) {
BiometricsConfigDescriptor biometricsConfig = config.getBiometricsConfig();
FingerprintWidget w = new FingerprintWidget();
FingerprintWidget.Config c = new FingerprintWidget.Config();
c.setFormat(biometricsConfig.getTemplateFormat());
c.setScanUrl(biometricsConfig.getScanUrl());
c.setDevicesUrl(biometricsConfig.getDevicesUrl());
// TODO these two toggles can probably be removed, I just added them so we would have a quick way of turning off the collection of either finger if we change our minds again
if (!featureToggles.isFeatureEnabled("hideLeftIndex")) {
c.addFinger(new FingerprintWidget.FingerprintFormField("leftIndexTemplate", "zl.registration.patient.biometrics.fingerprints.leftIndexLabel", "LEFT_INDEX_FINGER"));
}
if (!featureToggles.isFeatureEnabled("hideRightIndex")) {
c.addFinger(new FingerprintWidget.FingerprintFormField("rightIndexTemplate", "zl.registration.patient.biometrics.fingerprints.rightIndexLabel", "RIGHT_INDEX_FINGER"));
}
w.setConfig(c);
return toObjectNode(w);
}
use of org.openmrs.module.pihcore.config.Config in project openmrs-module-mirebalais by PIH.
the class MirebalaisHospitalActivator method started.
/**
* @see ModuleActivator#started()
*/
public void started() {
try {
// currently only one of these
Config config = Context.getRegisteredComponents(Config.class).get(0);
AdministrationService administrationService = Context.getAdministrationService();
ReportService reportService = Context.getService(ReportService.class);
ReportDefinitionService reportDefinitionService = Context.getService(ReportDefinitionService.class);
SerializedObjectDAO serializedObjectDAO = Context.getRegisteredComponents(SerializedObjectDAO.class).get(0);
PrinterService printerService = Context.getService(PrinterService.class);
DispositionService dispositionService = Context.getService(DispositionService.class);
removeOldPrivileges();
setDispositionConfig(config, dispositionService);
// register our custom print handlers
PrinterSetup.registerPrintHandlers(printerService);
// set up html forms--this must happen *after* MDS packages are installed, so that forms defined in code/github
// take precedent over any in MDS packages; therefore we still do this in the Mirebalais module, not PIH Core
HtmlFormSetup.setupHtmlForms(config);
// configure default dashboard in coreapps
updateGlobalProperty(CoreAppsConstants.GP_DASHBOARD_URL, config.getDashboardUrl());
// configure default visits page in coreapps
updateGlobalProperty(CoreAppsConstants.GP_VISITS_PAGE_URL, config.getVisitPageUrl());
// configure default specific visit detail page in coreapps
updateGlobalProperty(CoreAppsConstants.GP_VISITS_PAGE_WITH_SPECIFIC_URL, config.getVisitsPageWithSpecificUrl());
if (config.isComponentEnabled(Components.LEGACY_MPI)) {
LegacyMasterPatientIndexSetup.setupConnectionToMasterPatientIndex(customProperties);
}
if (config.isComponentEnabled(Components.ARCHIVES)) {
ArchivesSetup.setupCloseStaleCreateRequestsTask();
ArchivesSetup.setupCloseStalePullRequestsTask();
}
if (config.isComponentEnabled(Components.APPOINTMENT_SCHEDULING)) {
AppointmentSchedulingSetup.setupMarkAppointmentAsMissedOrCompletedTask();
if (config.getCountry().equals(ConfigDescriptor.Country.HAITI)) {
AppointmentSchedulingSetup.customizeDailyAppointmentsDataSet();
}
}
if (config.isComponentEnabled(Components.RADIOLOGY) && config.getSite().equals(ConfigDescriptor.Site.MIREBALAIS)) {
updateGlobalProperty(OpenmrsConstants.GP_ORDER_NUMBER_GENERATOR_BEAN_ID, MirebalaisConstants.RADIOLOGY_ORDER_NUMBER_GENERATOR_BEAN_ID);
}
if (!testMode) {
if (config.isComponentEnabled(Components.OVERVIEW_REPORTS) || config.isComponentEnabled(Components.DATA_EXPORTS)) {
// must happen after location tags have been configured
ReportSetup.setupReports(reportService, reportDefinitionService, administrationService, serializedObjectDAO, config);
}
// do app and extension configuration
Context.getRegisteredComponent("customAppLoaderFactory", CustomAppLoaderFactory.class).setReadyForRefresh(true);
ModuleFactory.getStartedModuleById("appframework").getModuleActivator().contextRefreshed();
// on first startup, these modules may not have been able to configure their global propertes correctly because
// all metadata was not loaded; we call the started method here to complete setup
ModuleFactory.getStartedModuleById("registrationapp").getModuleActivator().started();
}
} catch (Exception e) {
Module mod = ModuleFactory.getModuleById(MirebalaisConstants.MIREBALAIS_MODULE_ID);
ModuleFactory.stopModule(mod);
throw new RuntimeException("failed to setup the required modules", e);
}
log.info("Mirebalais Hospital Module started");
}
Aggregations