Skip to content

Commit

Permalink
Merge branch 'main' into fhir-obs-category-maps
Browse files Browse the repository at this point in the history
  • Loading branch information
ibacher authored Jul 1, 2024
2 parents 795789d + c466451 commit 983fb80
Show file tree
Hide file tree
Showing 97 changed files with 2,558 additions and 276 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/build-test-publish.yml
Original file line number Diff line number Diff line change
Expand Up @@ -34,8 +34,8 @@ jobs:
"username": "${{ secrets.NEXUS_USERNAME }}",
"password": "${{ secrets.NEXUS_PASSWORD }}"
}]
if: ${{ github.ref == 'refs/heads/master' }}
if: ${{ github.ref == 'refs/heads/master' && github.repository_owner == 'mekomsolutions' }}

- name: Publish
run: mvn --batch-mode clean deploy -P validator
if: ${{ github.ref == 'refs/heads/master' }}
if: ${{ github.ref == 'refs/heads/master' && github.repository_owner == 'mekomsolutions' }}
10 changes: 8 additions & 2 deletions .github/workflows/build-test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -4,18 +4,24 @@ on:
pull_request:
branches: [master]

push:
branches-ignore: [master]

jobs:
build:
runs-on: ubuntu-latest
strategy:
matrix:
java: [ '8', '11']

steps:
- uses: actions/checkout@v2

- name: Set up JDK 8
- name: Set up JDK ${{ matrix.java }}
uses: actions/setup-java@v2
with:
distribution: 'temurin'
java-version: '8'
java-version: ${{ matrix.java }}

- name: Build and Test
run: mvn --batch-mode --update-snapshots clean package -P validator
7 changes: 4 additions & 3 deletions .ocd3.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
version: 1
build:
bash_commands: "mvn clean install -P Validator"
deploy:
# Do not deploy via OCD3. Initializer publishing is done via GitHub Actions now.
# Do skip OCD3 build. Initializer reference build is made through GitHub Actions.
bash_commands: "exit 0"
deploy:
# Do not deploy via OCD3. Initializer publishing is done via GitHub Actions.
bash_commands: "exit 0"
93 changes: 73 additions & 20 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,5 +1,31 @@
# OpenMRS Initializer module
### Introduction

- [Introduction](#introduction)
- [Goals](#goals)
- [Supported domains and default loading order](#supported-domains-and-default-loading-order)
- [Try it out](#try-it-out)
* [Runtime compatibility](#runtime-compatibility)
* [Test your OpenMRS configs](#test-your-openmrs-configs)
* [Finer control of domains loading at runtime](#finer-control-of-domains-loading-at-runtime)
* [Setting up and controlling logging](#setting-up-and-controlling-logging)
- [Get in touch](#get-in-touch)
- [Releases notes](#releases-notes)
+ [Version 2.7.0](#version-270)
+ [Version 2.6.0](#version-260)
+ [Version 2.5.2](#version-252)
+ [Version 2.5.1](#version-251)
+ [Version 2.5.0](#version-250)
+ [Version 2.4.0](#version-240)
+ [Version 2.3.0](#version-230)
+ [Version 2.2.0](#version-220)
+ [Version 2.1.0](#version-210)
+ [Version 2.0.0](#version-200)
+ [Version 1.1.0](#version-110)
+ [Version 1.0.1](#version-101)

<small><i><a href='http://ecotrust-canada.github.io/markdown-toc/'>(Table of contents generated with markdown-toc)</a></i></small>

## Introduction
The Initializer module is an API-only module that processes the content of the **configuration** folder when it is found inside OpenMRS' application data directory:

<pre>
Expand All @@ -22,13 +48,16 @@ configuration/
├── attributetypes/
├── autogenerationoptions/
├── bahmniforms/
├── cohorttypes/
├── cohortattributetypes/
├── conceptclasses/
├── conceptsources/
├── concepts/
├── conceptsets/
├── datafiltermappings/
├── drugs/
├── encountertypes/
├── encounterroles/
├── fhirconceptsources/
├── fhirobservationcategorymaps/
├── fhirpatientidentifiersystems/
Expand All @@ -54,14 +83,15 @@ configuration/
├── programs/
├── programworkflows/
├── programworkflowstates/
├── providerroles/
├── providerroles/
├── queues/
├── relationshiptypes/
└── roles/

```
Each domain-specific subfolder contains OpenMRS metadata configuration files that pertains to the domain.

### Objectives
## Goals
* This module loads an OpenMRS configuration consisting of OpenMRS metadata.
* CSV files are the preferred format, however a number of metadata domains rely on other file formats. See the list [below](#supported-domains-and-default-loading-order) for details.
* Initializer processes all configuration files upon starting up.
Expand All @@ -70,7 +100,7 @@ Each domain-specific subfolder contains OpenMRS metadata configuration files tha
* Each line of those CSV files represents an **OpenMRS metadata entity to be created, edited or retired**.
* Each line of those CSV files follows the WYSIWYG principle.

### Supported domains and default loading order
## Supported domains and default loading order
We suggest to go through the following before looking at the specifics for each supported domain:
* [Conventions for CSV files](readme/csv_conventions.md)

Expand All @@ -92,6 +122,7 @@ This is the list of currently supported domains in their loading order:
1. [Provider Roles (CSV files)](readme/providerroles.md)
1. [Locations (CSV files)](readme/loc.md)
1. [Location Tag Maps (CSV files)](readme/loctagmaps.md)
1. [Address Hierarchy (XML, CSV, .properties files)](readme/addresshierarchy.md)
1. [Bahmni Forms (JSON Files)](readme/bahmniforms.md)
1. [Concept Classes (CSV files)](readme/conceptclasses.md)
1. [Concept Sources (CSV files)](readme/conceptsources.md)
Expand All @@ -110,26 +141,29 @@ This is the list of currently supported domains in their loading order:
1. [Bahmni Appointment Specialities (CSV files)](readme/appointmentspecialities.md)
1. [Bahmni Appointment Service Definitions (CSV files)](readme/appointmentservices.md#domain-appointmentservicedefinitions)
1. [Bahmni Appointment Service Types (CSV files)](readme/appointmentservices.md#domain-appointmentservicetypes)
1. [Queues (CSV files)](readme/queues.md#domain-queues)
1. [Data Filter Entity-Basis Mappings (CSV files)](readme/datafiltermappings.md)
1. [Metadata Sets (CSV files)](readme/mdm.md#domain-metadatasets)
1. [Metadata Set Members (CSV files)](readme/mdm.md#domain-metadatasetmembers)
1. [Metadata Term Mappings (CSV files)](readme/mdm.md#domain-metadatatermmappings)
1. [Cohort Types (CSV files)](readme/cohort.md#domain-cohorttypes)
1. [Cohort Attribute Types (CSV files)](readme/cohort.md#domain-cohortattributetypes)
1. [FHIR Concept Sources (CSV files)](readme/fhir.md#domain-fhirconceptsources)
1. [FHIR Patient Identifier Systems (CSV Files)](readme/fhir.md#domain-fhirpatientidentifiersystems)
1. [FHIR Observation Category Maps (CSV Files)](readme/fhir.md#domain-fhirobservationcategorymaps)
1. [AMPATH Forms (JSON files)](readme/ampathforms.md)
1. [AMPATH Forms Translations (JSON files)](readme/ampathformstranslations.md)
1. [HTML Forms (XML files)](readme/htmlforms.md)

### How to try it out?
## Try it out
Build the master branch and install the built OMOD to your OpenMRS instance:
```bash
git clone https://github.com/mekomsolutions/openmrs-module-initializer/tree/master
cd openmrs-module-initializer
mvn clean package
```

##### Runtime requirements & compatibility
### Runtime compatibility
* OpenMRS Core 2.1.1 (*required*)
* Bahmni Appointments 1.2.1 (*compatible*)
* Bahmni Core 0.93 (*compatible*)
Expand All @@ -142,40 +176,59 @@ mvn clean package
* Open Concept Lab 1.2.9 (*compatible*)
* FHIR2 1.2.0 (*compatible*)

### How to test out your OpenMRS configs?
### Test your OpenMRS configs
See the [Initializer Validator README page](readme/validator.md).

### Finer control of domains loading at app runtime
### Finer control of domains loading at runtime
See the [documentation on Initializer's runtime properties](readme/rtprops.md).

### Control of logging setup
See the [documentation on Initializer's runtime properties](readme/rtprops.md).
### Setting up and controlling logging
See the [documentation on Initializer's logging properties](readme/rtprops.md#logging-properties).

### Get in touch
## Get in touch
* On [OpenMRS Talk](https://talk.openmrs.org/)
* Sign up, start a conversation and ping us with the mention [`@MekomSolutions`](https://talk.openmrs.org/g/MekomSolutions) in your post.
* On Slack:
* Join the [Initializer channel](https://openmrs.slack.com/archives/CPC20CBFH) and ping us with a `@Mekom` mention.

### Report an issue
https://github.com/mekomsolutions/openmrs-module-initializer/issues
* Report an issue:
* https://github.com/mekomsolutions/openmrs-module-initializer/issues

----

### Releases notes
## Releases notes

#### Version 2.8.0
* Support for FHIR2 module and domains related to the metadata needed for FHIR

#### Version 2.7.0
* Added support for 'queues' domain.
* Added support for 'addresshierarchy' domain.
* Fix for Liquibase Loader to ensure compatibility with OpenMRS versions 2.5.5+.
* Fix for OCL Loader to ensure it throws an Exception if the OCL import fails.
* Fix for Validator to not encounter failure upon repeated execution on the same JVM process.
* Fix for null config directory path in `DeleteDomainChecksumsChangeset`.

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

#### Version 2.5.2
* Updated versions of Validator's metadatamapping to 1.6.0 and metadatasharing to 1.9.0.

#### Version 2.5.1
* Enhanced Validator to prevent random failures because of `LazyInitializationException`, and better teardown cleanup for uses with Maven plugins such as [openmrs-packager-maven-plugin](https://github.com/openmrs/openmrs-contrib-packager-maven-plugin) 1.7.0.

#### Version 2.5.0
* Added support for AMPATH Forms translations: https://github.com/mekomsolutions/openmrs-module-initializer/issues/180
* Fix for Message Source when system default language is not English: https://github.com/mekomsolutions/openmrs-module-initializer/issues/212
* Added support for AMPATH Forms translations, see https://github.com/mekomsolutions/openmrs-module-initializer/issues/180 and https://github.com/mekomsolutions/openmrs-module-initializer/issues/221
* Fix for Message Source when system default language is not English, see https://github.com/mekomsolutions/openmrs-module-initializer/issues/212
* Logging now uses the configured level as a minimum.
* Added support for [drug reference maps](https://github.com/mekomsolutions/openmrs-module-initializer/issues/219) on the drugs domain.

#### Version 2.4.0
* Added support for 'fhirconceptsources' domain.
* Added support for 'fhirpatientidentifiersystems' domain.
* Enhancement to ensure that reloading Concept CSVs does not clear Members/Answers if those columns aren't part of CSV file.
* 'concepts' domain to support a new expandable `MAPPINGS` header, thereby discouraging the older `Same as mappings`.
* Concept references expanded to allow use of concept names in locales other than the default system locale
* Support for FHIR2 module and domains related to the metadata needed for FHIR
* Concept references expanded to allow use of concept names in locales other than the default system locale.

#### Version 2.3.0
* Added configuration options for logging.
Expand Down Expand Up @@ -245,7 +298,7 @@ https://github.com/mekomsolutions/openmrs-module-initializer/issues
* Bulk creation and edition of patient identifier types provided through CSV files in **configuration/patientidentifiertypes**.
* Bulk creation and edition of metadata terms mappings provided through CSV files in **configuration/metadatasets**.
* Bulk creation and edition of metadata terms mappings provided through CSV files in **configuration/metadatasetmembers**.
* Bulk creation and edition of bahmni forms provided JSON files in **configuration/bahmniforms**
* Bulk creation and edition of bahmni forms provided JSON files in **configuration/bahmniforms**.
* Support concept attributes.

#### Version 1.1.0
Expand Down
2 changes: 1 addition & 1 deletion api-2.2/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.openmrs.module</groupId>
<artifactId>initializer</artifactId>
<version>2.5.0-SNAPSHOT</version>
<version>2.8.0-SNAPSHOT</version>
</parent>

<artifactId>initializer-api-2.2</artifactId>
Expand Down
30 changes: 29 additions & 1 deletion api-2.3/pom.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
<parent>
<groupId>org.openmrs.module</groupId>
<artifactId>initializer</artifactId>
<version>2.5.0-SNAPSHOT</version>
<version>2.8.0-SNAPSHOT</version>
</parent>

<artifactId>initializer-api-2.3</artifactId>
Expand Down Expand Up @@ -67,12 +67,40 @@
<artifactId>openconceptlab-api</artifactId>
</dependency>

<dependency>
<groupId>org.openmrs.module</groupId>
<artifactId>queue-api</artifactId>
<version>${queueVersion}</version>
<scope>provided</scope>
</dependency>

<!-- Dependencies required to compile against Java 11 -->
<dependency>
<groupId>jakarta.xml.bind</groupId>
<artifactId>jakarta.xml.bind-api</artifactId>
<version>2.3.2</version>
<scope>test</scope>
</dependency>

<dependency>
<groupId>org.glassfish.jaxb</groupId>
<artifactId>jaxb-runtime</artifactId>
<version>2.3.2</version>
<scope>test</scope>
</dependency>

</dependencies>

<build>
<testResources>
<testResource>
<directory>../api/src/test/resources</directory>
<excludes>
<exclude>**/*/drugs.csv</exclude>
</excludes>
</testResource>
<testResource>
<directory>src/test/resources</directory>
</testResource>
</testResources>
</build>
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,44 @@
package org.openmrs.module.initializer.api.queues;

import org.apache.commons.lang3.StringUtils;
import org.openmrs.annotation.OpenmrsProfile;
import org.openmrs.module.initializer.Domain;
import org.openmrs.module.initializer.api.BaseLineProcessor;
import org.openmrs.module.initializer.api.CsvLine;
import org.openmrs.module.initializer.api.CsvParser;
import org.openmrs.module.queue.api.QueueService;
import org.openmrs.module.queue.model.Queue;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.beans.factory.annotation.Qualifier;

@OpenmrsProfile(modules = { "queue:*" })
public class QueueCsvParser extends CsvParser<Queue, BaseLineProcessor<Queue>> {

private final QueueService queueService;

@Autowired
public QueueCsvParser(@Qualifier("queue.QueueService") QueueService queueService, QueueLineProcessor processor) {
super(processor);
this.queueService = queueService;
}

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

@Override
public Queue bootstrap(CsvLine line) throws IllegalArgumentException {
String uuid = line.getUuid();
Queue queue = queueService.getQueueByUuid(uuid).orElse(new Queue());
if (StringUtils.isNotBlank(uuid)) {
queue.setUuid(uuid);
}
return queue;
}

@Override
public Queue save(Queue instance) {
return queueService.createQueue(instance);
}
}
Loading

0 comments on commit 983fb80

Please sign in to comment.