David Reche · Mar 17, 2017 go to post

Hello,

The common approach is set the schema category in the Business Service. If you want to capture everything at BS, this is the right approach if you are using only one HL7 Schema (2.5 for example). But if you use several HL7 Schemas then is better to get them separate in order to use different BS (each one with their own schema).

In any case you can use a main entry point (BS) don't set the HL7 category at BS and set it "manually" at Business Process stage. This approach is not the most elegant because all the messages arrives at BP (with map errors, and without the DocType set). Then search or process them is more complicated.

Hope this help

David Reche · Mar 27, 2017 go to post

Maybe you can develop a COS script that you can reuse. This script should create the accounts and make some checks.

We have a project where combine this script with a OS level script (using any shell you want) able to execute the COS task in each instance. It's a lot of work to make it but once developed it saves a lot of time. 

David Reche · May 23, 2017 go to post

I was waiting for the answer 

:-(

Another one, There is something like "Goto (F12)" (in the right click menu) in Atelier?

David Reche · Jul 14, 2017 go to post

But Eduard, the file order is not alphabetical, I guess your solution is only for alphabetical consumption

Right?

David Reche · Feb 22, 2018 go to post

Yes you are true in your observation. There are severals things to improve.

Regarding get several files in an easy way you can use an Studio Project in order to pack everything you need and select the project in the Deployment screen.

David Reche · Jul 17, 2018 go to post

I guess you are using Studio (Not Atelier) in order to create the Studio Project. Right?

Then the idea is simple. You have to create a new Studio Project, add any class to the project, save the project from "File/Save Project As..." and after use the Project from the Deployment Page at Management Portal.

What's the thing not working?

David Reche · Dec 15, 2018 go to post

Hello Lassi,

You should create a new Business Service class extending the HL7 Business Service of your election (TCP, HTTP, etc) and after overwrite this method:

method OnConstructReply(Output pReplyDoc As EnsLib.EDI.Document, pOriginalDoc As EnsLib.EDI.Document, ByRef pReplyCode As %String, ByRef pSC As %Status, pEarlyAck As %Boolean) as %Status

Override this method to construct a customized reply document. Inputs are the original document and the reply code and the status code that the framework produced in processing the original document. If you change the status code but do not construct a reply document, the framework will use the new value to construct a standard reply document. 
If you construct a non-HL7 object it must still have a property called 'Envelope'. Piece:2 of this value will be written verbatim.

Consider this example (I didn't test it):

method OnConstructReply(Output pReplyDoc As EnsLib.EDI.Document, pOriginalDoc As EnsLib.EDI.Document, ByRef pReplyCode As %String, ByRef pSC As %Status, pEarlyAck As %Boolean) as %Status

{

    Set pReplyDoc=pOriginalDoc.NewReplyDocument(,..LocalFacilityApplication)
    Set pReplyDoc.Source=pOriginalDoc.%Id()
    Do:..#UseOriginalControlId pReplyDoc.SetValueAt(pOriginalDoc.GetValueAt("1:10"),"1:10") ; copy the control id to the ack control id
    Set tAckMSA=##class(EnsLib.HL7.Segment).%New($LB("",1))
    Set tAckMSA.Separators=pReplyDoc.Separators
    Do tAckMSA.SetValueAt("MSA",0)
    Do tAckMSA.SetValueAt("CE",1)
    Do tAckMSA.SetValueAt(pOriginalDoc.GetValueAt("1:10"),2)
    Do:$G($$$ExpectedSequenceNumber) tAckMSA.SetValueAt($$$ExpectedSequenceNumber,4)
    Do pReplyDoc.AppendSegment(tAckMSA)
    Set pReplyDoc.IsMutable=0
    Quit $$$OK

}

David Reche · May 22, 2019 go to post

Hello @Jeff Moffett

Do you mean HS Health Connect? or HS Information Exchange?.

I think the only place for get the installer right now  is WRC 

Regards

David Reche · Apr 6, 2020 go to post

I see.

So I guess I should use EnsLib.HL7.SchemaDocument class https://docs.intersystems.com/irisforhealthlatest/csp/documatic/%25CSP.Documatic.cls?APP=1&LIBRARY=ENSLIB&CLASSNAME=EnsLib.HL7.SchemaDocument but can't find an example of how import/export programatically.

In response to @Evgeny Shvarov I am talking about Custom HL7 Schemas (https://docs.intersystems.com/irisforhealthlatest/csp/docbook/Doc.View.cls?KEY=EHL72_tools#EHL72_customhl7schema_editor) in IRIS for Health. Use custom schemas is something very usual and I think that to include this import feature in Installer could be very useful... I'll try to make it works and if I am success I'll post the how-to :-D

David Reche · Apr 13, 2020 go to post

There is a way (right now) of create automatically a BO and related Messages to consume a REST API described in Swagger? I am thinking in something like the WSDL Wizard in Studio but using Swagger. If not I think this is a very good idea for this contest.

David Reche · Apr 22, 2020 go to post

Hello @Mohamed Hassan Anver,

I think that the tutorial is for EF 6 that is designed for .NET Framework. And MS is not promoting more EF Framework, right now, MS has EF core as goal (check this: https://docs.microsoft.com/es-es/ef/efcore-and-ef6/ ) and is the right EF to go in my opinion.

However IRIS is not supporting EF Core https://community.intersystems.com/post/how-can-i-use-iris-net-core-entity-framework. :-( 

Any thought @Bob Kuszewski ?
 

David Reche · Feb 7, 2021 go to post

Hello,

I am trying to use a simple Production with an Operation using EnsLib.SQL.OutboundAdapter. As I am running inside a Dcoker container I am trying to use your approach of running the JavaGateway in another container (https://github.com/intersystems-community/JavaGatewayImage).

So I configure the docker-compose in order to up two containers.

version: '3.6'
services:
  jgw:
    build:
      context: jgw
      dockerfile: Dockerfile
    restart: always
    ports: 
      - 2021:55555
  iris:
    build: 
      context: .
      dockerfile: Dockerfile
    restart: always
    ports: 
      - 51773
      - 52773
      - 53773
    volumes:
      - ~/iris.key:/usr/irissys/mgr/iris.key
      - ./:/irisdev/app

as you can see I am getting the JGW from port 2021.

I configured the JGW in a production:

  <Item Name="JGW" Category="" ClassName="EnsLib.JavaGateway.Service" PoolSize="1" Enabled="true" Foreground="false" Comment="" LogTraceEvents="false" Schedule="">
    <Setting Target="Host" Name="Address">host.docker.internal</Setting>
    <Setting Target="Host" Name="Port">2021</Setting>
  </Item>

I am using Mac so I have to use "host.docker.internal" or explicit IP in order to reach the right host.

Finally I configured a BO using SQL.OutboundAdapter in order to connect to an external PostgreSQL database:

  <Item Name="DbOperation" Category="" ClassName="demo.DbOperation" PoolSize="1" Enabled="true" Foreground="false" Comment="" LogTraceEvents="true" Schedule="">
    <Setting Target="Adapter" Name="Credentials">Demo</Setting>
    <Setting Target="Adapter" Name="DSN">jdbc:postgresql://host.docker.internal:5432/demo</Setting>
    <Setting Target="Adapter" Name="JDBCDriver">org.postgresql.Driver</Setting>
    <Setting Target="Adapter" Name="JGService">JGW</Setting>
  </Item>

As I want to use the configures JGW then I set the JGW config name at JGService setting.

Well the BO is UNABLE to connect to the database... after spend hours of investigation and testing, I check that from the JG container I can connect to the database without problems, but the problem persist. With a Ensemble trace level I can see the next:

The JG service connects and communicate with the external container without problems. I see this trace:

JGW -- JG PING: Invoking ##class(%Net.Remote.Gateway).%Ping(host.docker.internal, 2021, 4) JGW -- Returned OK from OnProcessInput(); Output=, %WaitForNextCallInterval=1, %QuitTask=0

The JGW perfectly goes to host.docker.internal... but

SQLOperation -- Connecting to JavaGateway: 127.0.0.1:2021+%Net.Remote.Java.JDBCGateway: SQLOperation -- ERROR <Ens>ErrOutConnectFailed: JDBC Connect failed for 'jdbc:postgresql://host.docker.internal:5432/demo' / 'Demo' with error ERROR #5023: Remote Gateway Error: Connection cannot be established

Please see the 127.0.0.1 ... Do you have experience this? Do you have any workaround?

It seems like the EnsLib.SQL.OutboundAdaptor don't get the Server setting from JG and always use 127.0.0.1... that's crazy

Any help???

David Reche · Feb 7, 2021 go to post

I forget to add IRIS version:

IRIS for UNIX (Ubuntu Server LTS for x86-64 Containers) 2020.1 (Build 215U) Mon Mar 30 2020 20:27:11 EDT

David Reche · Feb 7, 2021 go to post

Tell me what is this in EnsLib.JavaGateway.Common??

Method initJG() As %Status
{
	Set ..%JavaGateway = ##class(%Net.Remote.Java.JavaGateway).%New()
	If ""'=..JGService {
		Set tItem=##class(Ens.Host).GetShadowInstance(..JGService,.tSC)  Quit:$$$ISERR(tSC) tSC
		//Set ..%JGServer=tItem.Server
		Set ..%JGPort=tItem.Port
		//Set ..%JGConnectTimeout=tItem.ConnectTimeout
		//Set ..%JGSSLConfig=tItem.SSLConfig
	} ElseIf ..#REQUIREJGSERVICE {
		Quit $$$ERROR($$$EnsErrGeneral,"In order to work this Adapter requires the JGService setting to be configured")
	}
	Quit $$$OK
}

This line is commented:

//Set ..%JGServer=tItem.Server

I test that if you replace or insert a new line instead of that with:

Set ..%JGServer=tItem.Address

And Set ENSLIB Database to Read/Write and compile the BO can connect!!!

David Reche · Feb 7, 2021 go to post

Although I found the bug in EnsLib.JavaGateway.Common, I still unable to connect to the database. this is a trace from JG log:

<< CONNECT

Received: (20:40:50:976) [Job number = -1] [ThreadID = 14]
  0000:  17  00  00  00  02  00  00  00  00  00  00  00  59  57      ............YW
  000E:  17  01  6F  72  67  2E  70  6F  73  74  67  72  65  73      ..org.postgres
  001C:  71  6C  2E  44  72  69  76  65  72                          ql.Driver


 >> LOAD_JAVA_CLASS_SYNCH: org.postgresql.Driver

Sent: (20:40:50:977) [Job number = -1] [ThreadID = 14]
  0000:  00  00  00  00  02  00  00  00  00  00  00  00  59  57      ............YW
     


 << LOAD_JAVA_CLASS_SYNCH

Received: (20:40:50:979) [Job number = -1] [ThreadID = 14]
  0000:  5C  00  00  00  02  00  00  00  00  00  00  00  59  4D      \...........YM
  000E:  03  04  0B  1E  01  64  72  69  76  65  72  3A  6F  72      .....driver:or
  001C:  67  2E  70  6F  73  74  67  72  65  73  71  6C  2E  44      g.postgresql.D
  002A:  72  69  76  65  72  31  01  6A  64  62  63  3A  70  6F      river1.jdbc:po
  0038:  73  74  67  72  65  73  71  6C  3A  2F  2F  68  6F  73      stgresql://hos
  0046:  74  2E  64  6F  63  6B  65  72  2E  69  6E  74  65  72      t.docker.inter
  0054:  6E  61  6C  3A  35  34  33  32  2F  6C  63  77  05  01      nal:5432/demo..
  0062:  6C  63  77  05  01  6C  63  77                              demo..demo


 >> MESSAGE: 

  msgId: 11

Sent: (20:40:51:018) [Job number = -1] [ThreadID = 14]
  0000:  02  00  00  00  00  00  00  00  00  00  00  00  59  4D      ............YM
  000E:  02  05                                                      ..


 << MESSAGE

Received: (20:40:51:020) [Job number = -1] [ThreadID = 14]
  0000:  03  00  00  00  02  00  00  00  00  00  00  00  59  4D      ............YM
  000E:  03  04  01                                                  ...


 >> MESSAGE: 

  msgId: 1

Sent: (20:40:51:020) [Job number = -1] [ThreadID = 14]
  0000:  50  00  00  00  00  00  00  00  00  00  00  00  59  4D      P...........YM
  000E:  50  01  52  65  6D  6F  74  65  20  4A  44  42  43  20      P.Remote JDBC 
  001C:  65  72  72  6F  72  3A  20  4E  6F  20  73  75  69  74      error: No suit
  002A:  61  62  6C  65  20  64  72  69  76  65  72  20  66  6F      able driver fo
  0038:  75  6E  64  20  66  6F  72  20  64  72  69  76  65  72      und for driver
  0046:  3A  6F  72  67  2E  70  6F  73  74  67  72  65  73  71      :org.postgresq
  0054:  6C  2E  44  72  69  76  65  72  2E  20                      l.Driver. 


 << MESSAGE

Received: (20:40:51:023) [Job number = -1] [ThreadID = 14]
  0000:  00  00  00  00  00  00  00  00  00  00  00  00  59  34      ............Y4
     


 >> DISCONNECT

I am having "No suitable driver found for driver:org.postgresql.Driver". But the postgre JDBC jar file is in the /jgw directory... any help?

The directory show:

root@06fac93de710:/jgw# ls -l
total 1844
-rw-r--r-- 1 root  root     1796 Feb  7 17:19 JDBCTest.jar
-rwxr-xr-x 1 51773 52773  241622 Jun 26  2020 gson-2.8.5.jar
-rwxr-xr-x 1 51773 52773  116930 Jun 26  2020 intersystems-gateway-3.1.0.jar
-rwxr-xr-x 1 51773 52773  426856 Jun 26  2020 intersystems-jdbc-3.1.0.jar
-rwxr-xr-x 1 51773 52773   85272 Jun 26  2020 intersystems-utils-3.1.0.jar
-rw------- 1 root  root  1004719 Oct 15 13:11 postgresql-42.2.18.jar

And the JG is started with:

root@06fac93de710:/jgw# ps -ef
UID        PID  PPID  C STIME TTY          TIME CMD
root         1     0  0 20:37 ?        00:00:00 /bin/sh -c java $JVMARGS -Xrs -classpath "$GWDIR/*" com.intersystems.gateway.JavaGateway $PORT $LOG 2>&1
root         8     1  0 20:37 ?        00:00:06 java -Xrs -classpath /jgw/* com.intersystems.gateway.JavaGateway 55555 /tmp/jgw-trace.log
root       161     0  0 20:59 pts/0    00:00:00 bash
root       193   161  0 21:02 pts/0    00:00:00 ps -ef
root@06fac93de710:/jgw# 
David Reche · Feb 7, 2021 go to post
  1. No, the postgresql is not in the docker-compose, but is easy to include:
version: '3.6'
services:
  db:
    image: postgres
    restart: always
    environment:
      POSTGRES_USER : demo
      POSTGRES_DB: demo
      POSTGRES_PASSWORD: demo
    container_name: demo-pg
    volumes:
      - ${PWD}/pg-scripts:/docker-entrypoint-initdb.d/
    ports:
      - 5432:5432

The Docker file is a bit messy because testing... sure you can clean it:

FROM openjdk:8 AS builder
ARG APP_HOME=/tmp/app

# copy JDBCTest
COPY src $APP_HOME/src

# copy JGW jars
COPY --from=intersystemsdc/jgw:latest /jgw/*.jar $APP_HOME/jgw/

# compile and create JDBCTest
WORKDIR $APP_HOME/src
RUN javac -classpath $APP_HOME/jar/*:$APP_HOME/jgw/* JDBCTest.java && \
    mkdir $APP_HOME/jar && \
    jar -cvf $APP_HOME/jar/JDBCTest.jar JDBCTest.class

WORKDIR $APP_HOME/jar/
ADD https://jdbc.postgresql.org/download/postgresql-42.2.18.jar .

FROM openjdk:8u252-jre

ENV GWDIR /jgw
ENV PORT 55555
# add LOG
ENV LOG /tmp/jgw-trace.log
ENV ISC_PACKAGE_INSTALLDIR /usr/irissys
ENV ISC_JARDIR $ISC_PACKAGE_INSTALLDIR/dev/java/lib/JDK18

COPY --from=store/intersystems/iris-community:2020.2.0.211.0 \
     $ISC_JARDIR/intersystems-gateway-3.1.0.jar \
     $ISC_JARDIR/intersystems-jdbc-3.1.0.jar \
     $ISC_JARDIR/intersystems-utils-3.1.0.jar \
     $ISC_PACKAGE_INSTALLDIR/dev/java/lib/gson/gson-2.8.5.jar \
     $GWDIR/

CMD java $JVMARGS -Xrs -classpath "$GWDIR/*" com.intersystems.gateway.JavaGateway $PORT $LOG 2>&1

COPY --from=builder /tmp/app/jar/*.jar $GWDIR/

## install additional packages for debug
RUN apt-get update && apt-get install -y procps

JDBCTest is a simple JDBC java class for testing the connection

I have manually set chmod +777 to jars but still getting the same error

David Reche · Feb 16, 2021 go to post

The SQL Inbound Adapter is normally used in such a way that produces a new message per Row.

The File Outbound Adapter is normally used in such a way that produces a new File per received message. Check the overwrite setting (put it to false to append new lines) and verify that when you use PutLine you are using the same file name.