Electronic Health Record SE epSOS SE User - Fi

Electronic Health Record SE
epSOS SE
User and Programmer Guide
Version 0.1
Release ALPHA
1. Introduction
This guide provides an overview of the available REST APIs as well as a short example how to
use the installation.
2. Installation
For deploying the alpha version of epSOS SE from start in a server (Ubuntu), the following are required:

Java JDK 7
1. sudo apt-get install openjdk-7-jdk

MySQL
1. sudo apt-get install mysql-server
2. edit the /etc/mysql/my.cnf file to change the bind-address directive to the server's IP
address
bind-address = (server’s IP address)
3. import db from epsos_se.sql
mysql -u root –p [root_password] < epsos_se.sql

Access to the following enablers:
1. Security and Privacy SE
2. Timing Service SE

Update the IPs used in the source code
1. Update the IP of the security and privacy SE in EHR_SE/src/auth/SPConnector.java and
EHR_REP/src/auth/SPConnector.java as shown in the following figure.
2. Update the IP of the timing service as shown in the following figure.
3. Update the Hibernate connection parameters (username,password,url) from
EPSOS_REP/src/epsos_rep/hibernate/hibernate.cfg.xml shown in the following figure.

Create the WAR file from the eclipse project of EPSOS_REP
1. From Eclipse EE right click on the project, select export, select war
2. Follow the instructions shown in the following figure.

Apache Tomcat Server 7
1. sudo apt-get install tomcat7 tomcat7-admin
2. add in the /etc/tomcat7/tomcat-users.xml in the <tomcat-users> </tomcat-users> the
following:
<role rolename="manager-gui"/>
<role rolename="manager-script"/>
<role rolename="admin-gui"/>
<role rolename="admin-script"/>
<user username="adminUsername" password="adminPassword" roles="admingui,admin-script,manager-gui"/>
3. Open the tomcat manager (host:8080/manager/html)
4. Deploy the war file using the options shown in the following figure.

Create the jar file from the eclipse project of TimeServiceConnector
1. From Eclipse EE right click on the project, select export, select export
2. In the new window select Java->Runnable JAR file as shown in the following figure and
follow the instructions.

Periodic synchronization of the server time with the Time Service
1. Add the runnable JAR file in a folder of the server, eg.
/home/ubuntu/time_service_se/TimeServiceSE_exe.jar
2. Create a shell script to run this jar file e.g. run_timeService.sh having contents:
#!/bin/bash
myDate=$(java -jar /home/ubuntu/time_service_se/TimeServiceSE_exe.jar)
if [ -z "$myDate" ]
then
date --set="$myDate"
else
echo "Date from Time Service SE call was empty"
fi
It updates the time of the server using the datetime
format of your server. To check your server’s format, write the command date
to your server’s terminal.
date --set="$myDate":
3. At the aforementioned shell script to the path /etc/cron.daily. That means that you will
setup a cron job to run the jar file. The contents of cron.daily are being called once a
day.
3. HTTP REST APIs
An example request could be issued like,
curl -X POST -H "Content-Type: text/xml"
147.27.50.131:8080/EPSOS_REP/SelectDocument -d '<request>
<patientId>123lx</patientId> <docType> PS_XML </docType> </request>' --cookie
"access_token=xxxx"
where SelectDocument refers to the API servlet which returns a specified document. The value
of the –d parameter refers to the corresponding API data, whereas –cookie is used to add the
cookie with the access token for authentication.
For the authentication part, the Security and Privacy SE is used, since it ensures that only
authorized entities access the enabler and specifically the epSOS repository. In the alpha
version the authorization of a user is automatically performed whenever an API of the enabler
is called.
In case of unauthorized call to an epSOS SE API, the following message is returned:
<response>
<error> Unauthenticated </error>
<error_description> You are not logged in </error_description>
</response>
The API for the login of a user is shown in the following table:
Interface
Method Input Data
/UserLogin Post
Output Data
<request>
200:
<clientId>xxxx</clientId>
<clientSecret>xxxx</clientSecret>
<username>user</username>
<password>password</password>
<response>
</request>
400:
<access_token>xxxx</access_token>
</response>
<response>
<error> Bad Request </error>
<error_description> Could not
authenticate the given user
</error_description>
</response>
For the administrative part of the Security and Privacy SE, the administrator can use the APIs
provided by the Security and Privacy SE.
The epSOS REP exposes the following interfaces for authorized HTTP POST requests.
Interface
/ InsertPatientSummaryXML
/ InsertPatientSummaryPDF
/ InsertEPrescriptionXML
/ InsertEPrescriptionPDF
/ SelectDocument
Description
Insert a patient summary in XML form as
described by epSOS, for a specific
patient.
Insert a patient summary in PDF form as
described by epSOS, for a specific
patient.
Insert an ePrescription XML document as
described by epSOS for a patient.
Insert an ePrescription PDF document as
described by epSOS for a patient.
Select a patient’s specific document
/ InsertPatientSummaryXML
Input
Output
patientId=123
<response>
document=<ClinicalDocument> document content.. <patientId>123</patientId>
</ClinicalDocument>
<docType>PS_XML</docType>
</response>
/ InsertPatientSummaryPDF
Input
Output
patientId=123
<response>
document=<ClinicalDocument> document content.. <patientId>123</patientId>
</ClinicalDocument>
<docType>PS_PDF</docType>
</response>
/ InsertEPrescriptionXML
Input
Output
patientId=123
<response>
document=<ClinicalDocument> document content.. <patientId>123</patientId>
</ClinicalDocument>
<docType>EP_XML</docType>
</response>
/ InsertEPrescriptionPDF
Input
Output
patientId=123
<response>
document=<ClinicalDocument> document content.. <patientId>123</patientId>
</ClinicalDocument>
<docType>EP_PDF</docType>
</response>
/ SelectDocument
Input
<request>
<patientId>123</patientId>
<docType> PS_XML </docType>
</request>
Input
<ClinicalDocument>
document content..
</ClinicalDocument>