Skip to content

Commit

Permalink
OZ-348: Alignment with eip-client and upgrade to Java 17.
Browse files Browse the repository at this point in the history
  • Loading branch information
corneliouzbett authored Jan 25, 2024
1 parent 352d134 commit 8c2c422
Show file tree
Hide file tree
Showing 117 changed files with 6,473 additions and 11,092 deletions.
22 changes: 20 additions & 2 deletions .gitignore
Original file line number Diff line number Diff line change
@@ -1,10 +1,28 @@
/.classpath
/.settings
/.project
.idea/
/target

/.idea
*.iml
*.DS_Store
.java-version

## Maven
log/
target/
pom.xml.tag
pom.xml.releaseBackup
dependency-reduced-pom.xml

## IntelliJ IDEA
*.iws
.idea
.idea/

## Visual Studio Code
.vscode

## Environment
!/dev/.env
/dev/dev.env

65 changes: 36 additions & 29 deletions README.md
Original file line number Diff line number Diff line change
@@ -1,84 +1,91 @@
# EIP Odoo OpenMRS
Contains integration logic between an OpenMRS and Odoo system
# EIP Odoo OpenMRS

Apache camel routes that integrate Odoo and OpenMRS.

## Table of Contents

1. [Technical Overview](#technical-overview)
2. [Dependencies](#dependencies)
3. [Integrations](#integrations)
1. [Observations](#observation-based-integration)
2. [Orders](#order-based-integration)
1. [Observations](#observation-based-integration)
2. [Orders](#order-based-integration)
4. [Installation](#installation)
1. [PRP Integration](docs/prp/README.md)
2. [Orders Based Integration](docs/orders/README.md)
1. [PRP Integration](docs/prp/README.md)
2. [Orders Based Integration](docs/orders/README.md)

### Technical Overview
The project is built on top of [OpenMRS-EIP core](https://github.com/openmrs/openmrs-eip), so the assumption is that
you have an existing OpenMRS EIP based application and wish to add to it odoo integration logic. The project contains
camel routes that track inserts, updates and delete operations in specific tables in an OpenMRS database to take

The project is built on top of [OpenMRS-EIP core](https://github.com/openmrs/openmrs-eip), so the assumption is that
you have an existing OpenMRS EIP based application and wish to add to it odoo integration logic. The project contains
camel routes that track inserts, updates and delete operations in specific tables in an OpenMRS database to take
appropriate action in an odoo system.

If you don't have an existing OpenMRS EIP based application, you will need to first create one as
If you don't have an existing OpenMRS EIP based application, you will need to first create one as
[documented here](https://github.com/openmrs/openmrs-eip/tree/master/docs/custom), then add the camel routes
provided in this project and application properties as documented under [installation](#installation).

### Dependencies
You will need to include the following dependencies on the classpath in a deployment environment of your OpenMRS based

You will need to include the following dependencies on the classpath in a deployment environment of your OpenMRS based
application,

[xmlrpc-client 3.1.3](https://mvnrepository.com/artifact/org.apache.xmlrpc/xmlrpc-client/3.1.3)

### Integrations
The current integration logic only supports tracking orders, observations database events (inserts, updates, deletes)

The current integration logic only supports tracking orders, observations database events (inserts, updates, deletes)
in OpenMRS in order to take some appropriate action in the odoo instance.

All integrations involve tracking database inserts, updates and deletes in the common tables below containing patient
All integrations involve tracking database inserts, updates and deletes in the common tables below containing patient
demographic data,
1. patient
2. person_name
3. person_address
4. patient_identifier

When a database insert, update or delete event is received from the above tables, the camel routes take the follow
When a database insert, update or delete event is received from the above tables, the camel routes take the follow
actions,
1. If the patient is not voided, a customer record is created in odoo for the associated patient if it doesn't exist
otherwise the existing customer record gets updated.
1. If the patient is not voided, a customer record is created in odoo for the associated patient if it doesn't exist
otherwise the existing customer record gets updated.
2. If the patient is voided and, they have a customer record in odoo, the odoo record is archived.
3. If it is a patient delete event and, the associated patient has a customer record in odoo, the odoo record is
archived and if they have any existing quotations they get cancelled.
3. If it is a patient delete event and, the associated patient has a customer record in odoo, the odoo record is
archived and if they have any existing quotations they get cancelled.

See below for more details for extra tables for each integration.

#### Observation Based Integration

The routes for obs based integration involves tracking database inserts, updates and deletes in the extra tables below,
1. obs

When a database insert or update event is received from the obs table and, the obs is not voided, the camel routes
When a database insert or update event is received from the obs table and, the obs is not voided, the camel routes
create a customer record in odoo for the associated patient if it doesn't exist.

When a database insert or update event is received from the obs table and, the obs is not voided and has the expected
question and answer, the camel routes create a customer record in odoo for the associated patient if they don't exist
yet otherwise the existing record is updated.

#### Order Based Integration

The routes for orders based integration involves tracking database inserts, updates and deletes in the tables below,
1. orders
2. test_order
3. drug_order

When a database insert or update event is received from any of the above 3 tables, the camel routes do the following,
1. For a new or revision order that is not voided, a customer record gets created in odoo for the associated patient if
none exists, a quotation is started for the patient if none exists, the item(order line) is added to the quotation
for the ordered item if none exists. In case of a revision of a drug order and, the quantity has changed, the quantity
for the item gets updated on the existing quotation.
2. If the order is voided or is a Discontinuation order, and the associated patient doesn't exist in odoo, the event is
ignored.
3. If the order is voided or is a Discontinuation order, and the associated patient has an active quotation in odoo
that was created by this integration i.e. the creator of the quotation matches the odoo user configured for the
integration, the item(order line) gets removed from the quotation and if the quotation is left with no more items,
it gets cancelled.
1. For a new or revision order that is not voided, a customer record gets created in odoo for the associated patient if
none exists, a quotation is started for the patient if none exists, the item(order line) is added to the quotation
for the ordered item if none exists. In case of a revision of a drug order and, the quantity has changed, the quantity
for the item gets updated on the existing quotation.
2. If the order is voided or is a Discontinuation order, and the associated patient doesn't exist in odoo, the event is
ignored.
3. If the order is voided or is a Discontinuation order, and the associated patient has an active quotation in odoo
that was created by this integration i.e. the creator of the quotation matches the odoo user configured for the
integration, the item(order line) gets removed from the quotation and if the quotation is left with no more items,
it gets cancelled.

### Installation

1. [PRP Integration](docs/prp/README.md)
2. [Orders Based Integration](docs/orders/README.md)

25 changes: 0 additions & 25 deletions assembly.xml

This file was deleted.

48 changes: 48 additions & 0 deletions dev/.env
Original file line number Diff line number Diff line change
@@ -0,0 +1,48 @@
# OpenMRS configuration
OPENMRS_URL=localhost:8080/openmrs
OPENMRS_USER=superman
OPENMRS_PASSWORD=Admin123
OPENMRS_RESULTS_ENCOUNTER_TYPE_UUID=
OPENMRS_IDENTIFIER_TYPE_UUID=
OPENMRS_CONCEPT_COMPLEX_UUID=

# Odoo configuration
ODOO_URL=localhost:8069
ODOO_USER=admin
ODOO_PASSWORD=admin
ODOO_DATABASE=odoo
EMR_WEIGHT_CONCEPT=
CREATE_CUSTOMER_IF_NOT_EXIST=false
ODOO_CUSTOMER_EXTERNAL_ID=comment
ODOO_CUSTOMER_DOB_FIELD=
ODOO_CUSTOMER_WEIGHT_FIELD=
ODOO_ENABLE_EXTRA_CUSTOMER_FIELDS_ROUTE=false
ODOO_ENABLE_EXTRA_QUOTATION_FIELDS_ROUTE=false

# Bahmni specific
BAHMNI_TEST_ORDER_TYPE_UUID=

# General EIP configuration
EIP_WATCHED_TABLES=patient,person_name,person_address,patient_identifier,orders,test_order,drug_order
DB_EVENT_DESTINATIONS_ODOO=direct:odoo-event-listener
EIP_DB_NAME_ODOO=openmrs_eip_mgt_odoo
EIP_DB_USER_ODOO=openmrs_eip_mgt_odoo
EIP_DB_PASSWORD_ODOO=password

# OAuth2 Client
OAUTH_ENABLED=true
OAUTH_CLIENT_ID=eip
OAUTH_CLIENT_SECRET=_demo_sample_key_to_be_replaced_
OAUTH_CLIENT_SCOPE=email
OAUTH_ACCESS_TOKEN_URL=http://localhost:8080/openmrs/oauth/token

# Debezium MySQL Connector (CDC) configuration
MYSQL_ADMIN_USER=admin
MYSQL_ADMIN_USER_PASSWORD=password

# OpenMRS Datasource configuration
OPENMRS_DB_USER=openmrs
OPENMRS_DB_PASSWORD=password
OPENMRS_DB_NAME=openmrs
OPENMRS_DB_HOST=localhost
OPENMRS_DB_PORT=3306
11 changes: 11 additions & 0 deletions dev/docker-compose.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
version: '3'
services:
eip-client:
container_name: ozone-eip-client
env_file:
- .env
image: mekomsolutions/eip-client
ports:
- "8085:8080"
volumes:
- ../target/eip-odoo-openmrs-2.0.0-SNAPSHOT.jar:/eip-client/routes/eip-odoo-openmrs-2.0.0-SNAPSHOT.jar
2 changes: 0 additions & 2 deletions docs/orders/README.md

This file was deleted.

12 changes: 0 additions & 12 deletions docs/prp/README.md

This file was deleted.

Loading

0 comments on commit 8c2c422

Please sign in to comment.