Missing classes in EtherCIS VirtualEhr

Hello,
I try to compile the EtherCIS project. I managed to compile the openehr-java-libs as well as the ehrservice projects. But I have a problem with the VirtualEhr:
In the project ecis-vehr-service there is a class FileDispatchMapper that uses the two classes com.ethercis.ehrserver.servicemap.Action and com.ethercis.ehrserver.servicemap.MapperDociument. However, there is no namespace com.ethercis.ehrserver and so those two classes also do not exist.
What am I missing ? Did i forget to import a missing project that includes those classes ?
Greetings
Georg

Hi George,

If you test EtherCIS, docker image is available and convenient. Please
clone from my repository.
https://github.com/alessfg/docker-ethercis
This is a working image, so I guess you can find what you are missing
compared with your environment.

Regards,
Shinji Kobayashi

Hi Shinji,
Oh, thank you for that hint. The docker image looks very promising. I started the image and tried to play a bit with the API but I have some questions:
- Most REST-commands require a session to be started first. When trying to start a session I have to provide a username and password. Is there already a default user that can be used ? How can additional users be added ?
- Which user/password credentials can be used to access and administrate the Postgres-Database in the container ? Is there an admin that can be used ?
- Would it be possible to use an existing Postgres-Server instead of the one included in the image ? What files would have to be modified to use an existing server ?
Greetings
Georg

Hi George,

To get session_id, I use the credential, ID: root, Password: secret.
The information about authentication is here.
https://github.com/skoba/docker-ethercis/blob/master/application/ethercis-1.2.0/conf/security/authenticate.ini

I have not tried to use existing postgres server out of docker, but it
might be possible by modification to Dockerfile and docker-compose.yml

Shinji Kobayashi

If you need to access potgresql server on docker image, port 2345 is opened.
For example, this command is available.

psql --host localhost --port 2345 --user postgres

Shinji

This pom.xml shows the credential to connect postgresql is user:
postgres and password: psotgres as default.
https://github.com/ethercis/ehrservice/blob/remote-github/jooq-pq/pom.xml

Shinji

Hello Shinji,
I still have a problem creating a session with the user "root" with password "secret".
I post a http request to the server via

curl -X POST -i http://localhost:8888/rest/v1/session

This causes a Shiro-Authentification-page to open in which I enter the credentials and accept with "OK".
The application inside the docker container then outputs this exception:

2018-08-29 14:34:25.286 WARNING 17-qtp1054932644-17 com.ethercis.logonservice.session.SessionManager connect: Access is denied: ServiceManagerException errorCode=[user.connect] location=[com.ethercis.authenticate.shiro.ShiroAuthenticate] message=[#1.0.0 Unknown account:ethercis]
INFO - com.ethercis.vehr.AccessLog.log(59) | unknown:post:rest/v1/session
INFO - com.ethercis.vehr.VEhrGateServlet.syncExecute(640) | Error trapped:#1.0.0 Unknown account:ethercis

Do you have an idea what could be the problem ?
Greetings
Georg

Hi Georg,

Just try this.

curl -X POST -i 'http://localhost:8888/rest/v1/session/?username=root&password=secret

then, you will get the followings. You should use http header
paramater key: Ehr-Session, and value:
sessionId:172.18.0.3-root-1535555490835--46776562-9 to the next query.

HTTP/1.1 200 OK
Content-Type: application/json;charset=UTF-8
x-reconnect: false
x-session-name: /node/ehrserver/client/root/-1
x-sessions-in-use: 1
Ehr-Session: sessionId:172.18.0.3-root-1535555490835--46776562-9
__rcvTimestampStr: 2018-08-29 15:11:30.859Z
x-session-timeout: 1800000
x-max-session: 20
Content-Language: en-US
Content-Length: 207
Server: Jetty(9.2.z-SNAPSHOT)

{
  "meta" : {
    "href" : "rest/v1/session?sessionId=sessionId:172.18.0.3-root-1535555490835--46776562-9"
  },
  "action" : "CREATE",
  "sessionId" : "sessionId:172.18.0.3-root-1535555490835--46776562-9"
}

Hi Shinji,
Cool, that worked, thank you.
I now got my sessionID and tried to create an EHR with

curl -X POST -H 'Ehr-Session: sessionId:172.18.0.3-root-1535570266743--2067865307-17' -i http://localhost:8888/rest/v1/ehr

That resulted in this response:

<html>
<head>
<meta http-equiv="Content-Type" content="text/html;charset=ISO-8859-1"/>
<title>Error 500 </title>
</head>
<body>
<h2>HTTP ERROR: 500</h2>
<p>Problem accessing /rest/v1/ehr. Reason:
<pre> #1.0.0 Invocation exception to method:create:org.jooq.exception.DataAccessException: SQL [select 1 as "one" where exists (select 1 as "one" from "ehr"."party_identified" where ("ehr"."party_identified"."party_ref_namespace" = ? and "ehr"."party_identified"."party_ref_scheme" = ? and "ehr"."party_identified"."party_ref_value" = ?))]; This connection has been closed.</pre></p>
<hr /><i><small>Powered by Jetty://</small></i>
</body>
</html>

This is the output of the application inside the Docker:

app_1 | INFO - com.ethercis.vehr.AccessLog.info(64) | userId=USER[SHIRO]_root,method=post,path=rest/v1/ehr,qryparams={x-client-ip=172.18.0.1;}
app_1 | WARN - com.ethercis.vehr.RequestDispatcher.dispatch(672) | Invocation exception to method:create
app_1 | org.jooq.exception.DataAccessException: SQL [select 1 as "one" where exists (select 1 as "one" from "ehr"."party_identified" where ("ehr"."party_identified"."party_ref_namespace" = ? and "ehr"."party_identified"."party_ref_scheme" = ? and "ehr"."party_identified"."party_ref_value" = ?))]; This connection has been closed.
app_1 | at org.jooq.impl.Tools.translate(Tools.java:1690)
app_1 | at org.jooq.impl.DefaultExecuteContext.sqlException(DefaultExecuteContext.java:660)
app_1 | at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:354)
app_1 | at org.jooq.impl.AbstractResultQuery.fetchLazy(AbstractResultQuery.java:341)
app_1 | at org.jooq.impl.AbstractResultQuery.fetchLazy(AbstractResultQuery.java:328)
app_1 | at org.jooq.impl.AbstractResultQuery.fetchOne(AbstractResultQuery.java:493)
app_1 | at org.jooq.impl.SelectImpl.fetchOne(SelectImpl.java:2735)
app_1 | at org.jooq.impl.DefaultDSLContext.fetchExists(DefaultDSLContext.java:2663)
app_1 | at org.jooq.impl.DefaultDSLContext.fetchExists(DefaultDSLContext.java:2673)
app_1 | at com.ethercis.dao.access.jooq.PartyIdentifiedAccess.findReferencedParty(PartyIdentifiedAccess.java:301)
app_1 | at com.ethercis.dao.access.jooq.PartyIdentifiedAccess.getOrCreateParty(PartyIdentifiedAccess.java:385)
app_1 | at com.ethercis.dao.access.interfaces.I_PartyIdentifiedAccess.getOrCreatePartyByExternalRef(I_PartyIdentifiedAccess.java:182)
app_1 | at com.ethercis.persistence.AuditSetter.getCommitter(AuditSetter.java:66)
app_1 | at com.ethercis.persistence.AuditSetter.handleProperties(AuditSetter.java:60)
app_1 | at com.ethercis.ehrservice.EhrService.create(EhrService.java:226)
app_1 | at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
app_1 | at sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
app_1 | at sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
app_1 | at java.lang.reflect.Method.invoke(Method.java:498)
app_1 | at com.ethercis.vehr.RequestDispatcher.dispatch(RequestDispatcher.java:654)
app_1 | at com.ethercis.vehr.RequestDispatcher.dispatch(RequestDispatcher.java:691)
app_1 | at com.ethercis.vehr.AccessGateService.queryHandler(AccessGateService.java:295)
app_1 | at com.ethercis.vehr.VEhrGateServlet.syncExecute(VEhrGateServlet.java:633)
app_1 | at com.ethercis.vehr.VEhrGateServlet.processRequest(VEhrGateServlet.java:611)
app_1 | at com.ethercis.vehr.VEhrGateServlet.doPost(VEhrGateServlet.java:451)
app_1 | at javax.servlet.http.HttpServlet.service(HttpServlet.java:707)
app_1 | at javax.servlet.http.HttpServlet.service(HttpServlet.java:790)
app_1 | at org.eclipse.jetty.servlet.ServletHolder.handle(ServletHolder.java:808)
app_1 | at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1669)
app_1 | at org.eclipse.jetty.servlets.CrossOriginFilter.handle(CrossOriginFilter.java:259)
app_1 | at org.eclipse.jetty.servlets.CrossOriginFilter.doFilter(CrossOriginFilter.java:222)
app_1 | at org.eclipse.jetty.servlet.ServletHandler$CachedChain.doFilter(ServletHandler.java:1652)
app_1 | at org.eclipse.jetty.servlet.ServletHandler.doHandle(ServletHandler.java:585)
app_1 | at org.eclipse.jetty.server.handler.ContextHandler.doHandle(ContextHandler.java:1127)
app_1 | at org.eclipse.jetty.servlet.ServletHandler.doScope(ServletHandler.java:515)
app_1 | at org.eclipse.jetty.server.handler.ContextHandler.doScope(ContextHandler.java:1061)
app_1 | at org.eclipse.jetty.server.handler.ScopedHandler.handle(ScopedHandler.java:141)
app_1 | at org.eclipse.jetty.server.handler.HandlerList.handle(HandlerList.java:52)
app_1 | at org.eclipse.jetty.server.handler.HandlerWrapper.handle(HandlerWrapper.java:97)
app_1 | at org.eclipse.jetty.server.Server.handle(Server.java:497)
app_1 | at org.eclipse.jetty.server.HttpChannel.handle(HttpChannel.java:310)
app_1 | at org.eclipse.jetty.server.HttpConnection.onFillable(HttpConnection.java:257)
app_1 | at org.eclipse.jetty.io.AbstractConnection$2.run(AbstractConnection.java:540)
app_1 | at org.eclipse.jetty.util.thread.QueuedThreadPool.runJob(QueuedThreadPool.java:635)
app_1 | at org.eclipse.jetty.util.thread.QueuedThreadPool$3.run(QueuedThreadPool.java:555)
app_1 | at java.lang.Thread.run(Thread.java:745)
app_1 | Caused by: org.postgresql.util.PSQLException: This connection has been closed.
app_1 | at org.postgresql.jdbc2.AbstractJdbc2Connection.checkClosed(AbstractJdbc2Connection.java:861)
app_1 | at org.postgresql.jdbc3.AbstractJdbc3Connection.prepareStatement(AbstractJdbc3Connection.java:281)
app_1 | at org.postgresql.jdbc2.AbstractJdbc2Connection.prepareStatement(AbstractJdbc2Connection.java:334)
app_1 | at org.jooq.impl.ProviderEnabledConnection.prepareStatement(ProviderEnabledConnection.java:112)
app_1 | at org.jooq.impl.SettingsEnabledConnection.prepareStatement(SettingsEnabledConnection.java:76)
app_1 | at org.jooq.impl.AbstractResultQuery.prepare(AbstractResultQuery.java:227)
app_1 | at org.jooq.impl.AbstractQuery.execute(AbstractQuery.java:314)
app_1 | ... 43 more
app_1 | INFO - com.ethercis.vehr.VEhrGateServlet.syncExecute(640)

Error trapped:#1.0.0 Invocation exception to

method:create:org.jooq.exception.DataAccessException: SQL [select 1 as "one" where exists (select 1 as "one" from "ehr"."party_identified" where ("ehr"."party_identified"."party_ref_namespace" = ? and "ehr"."party_identified"."party_ref_scheme" = ? and "ehr"."party_identified"."party_ref_value" = ?))]; This connection has been closed.

Did I use the POST command to create a new EHR correctly ? I have interpreted the API that there are no further parameters mandatory. What could have gone wrong ?
Greetings
Georg

thanks Georg, Shinji

Can I ask you to post a summary of this issue and its resolution as an issue here please?
https://github.com/ethercis/ethercis/issues

Appreciate you working through this and sharing your learning with the community, so we can improve the documentation etc

thanks
Tony

Dr. Tony Shannon
Director, Ripple Foundation ripple.foundation
Director, Apperta Foundation apperta.org
tony.shannon@ripple.foundation

+44.789.988.5068 (UK)

+353.89.457.6011 (Ireland)

Hi Georg,

No. You have to post subjectId(usually, UUID) to create EHR.
API of EtherCIS is similar to EhrScape.
https://code4health.org/platform/open_interfaces_apis/ehrscape/ehrscape_api_reference

I am sorry I pointed the former version of EhterCIS repository. My
repository is based on recent v1.2.0.
https://github.com/skoba/docker-ethercis

Off course, Tony. It is my great pleasure that my humble works could
contribute you.

Best regards,
Shinji Kobayashi

We appreciate your efforts Shinji
Many thanks again
Tony

Hello Shinji,
Thank you again for your advice.
With the subjectId and the subjectNamespace given the creation of an EHR worked.
When I use the Docker container with Version 1.2.0 the problem with the login via the Shiro webpage also worked as intended, so there the problem somehow seems to be fixed.

Hello Tony,
I just created an issue with my initial problem with the missing classes in the repository you mentioned. My other problems were rather my misunderstandings and wrong usages of the API.
Greetings
Georg