Public | Automated Build

Last pushed: 2 years ago
Short Description
Short description is empty for this repo.
Full Description

TOTORO

Setup

Requirements

  • python (2.7.x)
  • python-pip
  • python-virtualenv
  • git
  • byacc
  • tcl-dev
  • flex
  • check
  • libreadline-dev
  • libncurses5-dev
  • libxml2
  • libxml2-dev
  • openssl
  • python-mysqldb
  • libmysqlclient-dev

All compilation has been tested with $CC=gcc-4.8.

On Ubuntu 14.04:

Run: sudo apt-get install -y git byacc bison tcl-dev flex check libreadline-dev libncurses5-dev libxml2 libxml2-dev openssl python-pip python-virtualenv python-mysqldb libmysqlclient-dev mysqltcl to install all dependencies on ubuntu

To install the application after its dependencies have been installed:

make

The application also requires OpenEMR to be configured on the current machine.
We do not use or interact with the OpenEMR web application, but we require
its database to be created and running.

To set up OpenEMR use you can go to this address:
http://www.open-emr.org/wiki/index.php/OpenEMR_4.2.0_Linux_Installation

Download and follow instructions in INSTALL

Alternativly if you want to run a docker you can use:
https://github.com/CS4098Group/OpenEMR-in-docker

Ensure that you MySQL database you are using with OpenEMR can
be accessed on port 3306

Create a DB in MySQL called openemr with a user called openemr
and a password openemr before going through the OpenEMR instalation completely
or use other values and change them in this next script also.

You can then use the python script

source env/bin/activate
python scripts/realistic_patient_list.py

to fill this database with data. (You may need to set the IP to localhost)

You can now run

make run

to run the application.

make test will run the unit tests only.

Development using Docker

If you'd rather use Docker than install the above dependencies, or are not on
Ubuntu 14.04 then follow the below instructions.

Note: We provide a Docker container purely as a development convenience, it is
not necessary to follow any of this section to get the application building
and running on Ubuntu 14.04. Working knowledge of Docker, Docker-Compose, and
boot2docker is assumed.

(Note: OS X users will need to install boot2docker)

(Quick OSX instructions:

boot2docker init
boot2docker up
$(boot2docker shellinit)

)

Install docker-compose with:

pip install docker-compose

and run docker-compose up from the repository to run the application.

Run docker-compose build to trigger a rebuild.

OSX specific quirks:

1) You'll need to go to your boot2docker IP rather than 0.0.0.0. You can
get it by running boot2docker ip
2) If you're using Homebrew python and openssl you'll need to
brew switch openssl 1.0.1j_1 if docker-compose complains about
SSL certs.

Release 1:

Note: The majority of Release 1 functionality has been removed because
of the pivot to backend-only Release 2. The OpenEMR integration and
realistic patient list are still in the application, but are showcased
elsewhere.

Pathway Support

Decision support currently available on right hand menu of app based of
original "Arch" interface. Can be accessed by clicking the "Decision
Support" button on top of interface.

Pathway View

Pathway view not currently implemented but set for work in next iteration.

Real EMR Interface

We use OpenEMR as our EMR interface at the moment.

This enables us to have actual patient data stored and
our application can work with an industry standard appliation.

We have taken OpenEMR out to a seperate repository because of the
size and complexity of the project. To make it a lot simpler to deploy
we have built it in a docker container. But the same
program can be built by following the OpenEMR steps on the download page also.

Since there is no api to OpenEMR (or any other EMRs really) we use raw
sql querys to interact with the data it stores

Realistic Patient List

The Realistic patient list is created by using the file
tests/realistic_patient_list.py.

Currently it creates 200 users along with a testing user
which are entirely integrated into OpenEMR. Because they are
integrated with OpenEMR they have diagnostics and patient history
readily available to us.

It does this using raw SQL querys to the OpenEMR database.

Mobile Friendly

Site was designed with tablets++ in mind but is fully responsive and will
be perfectly functional on mobile devices also.

A simulation of this can be viewed in your browser through the following
steps:

Chrome:

  • Menu > More tools > Developer tools
  • Click on phone icon on top left of overlay that appears (beside magnifying glass)
  • Click "Select Model" at top of screen
  • You may need to then reload the page to view correctly

Firefox:

  • Tools > Web Developer > Responsive Design View

Kernel Interface

PEOS is vendored, shipped, and built as part of the Totoro build chain.

After a full make all, one can verify that the PEOS binary
exists in os/kernel/peos.

A PEOS wrapper library, and API endpoints exist and work as of
the PEOS update of 2015-03-11.

Tests to verify this slipped due to the very late patching
of PEOS on 2015-03-11.

HL7 Interface

This was originally intended as a HL7 interface into the underlying EMR
database. As OpenEMR requires an integration engine to speak HL7,
we are fully wrapping all interaction with OpenEMR ourselves.

This means that we have basically become an EMR system ourselves.
As EMR systems do not generally speak HL7 without an integration
engine, the HL7 interface as scoped by this sprint goal is now
out of scope for this release.

Release 2

Note: For all requests that send a JSON file as the POST body (ie. curl requests
with -d@XXX/XXX/XXX.json), the pid field may not be set correctly. Please manually
ensure that the pid is the same as the process id of the PEOS process you
wish to interact with. They default to pid = 0, which will not be correct
if you are not interacting with the first process you have created.

Process Creation

This creates a PEOS process given a specific model name and patient ID.

make run to start the python application.

Send a request to the API to create a process using the __test__.pml
model file:

curl -vX POST http://localhost:5000/api/peos/create -d @tests/requests/peos_create.json -H "Content-Type: application/json"

Should see the following output:

> POST /api/peos/create HTTP/1.1
> User-Agent: curl/7.37.1
> Host: 192.168.59.103:5000
> Accept: */*
> Content-Type: application/json
> Content-Length: 25
>
< HTTP/1.0 200 OK
< Content-Type: application/json
< Content-Length: 44
< Server: Werkzeug/0.10 Python/2.7.6
< Date: Wed, 08 Apr 2015 12:28:03 GMT
<
{
  "message": "__test__ has been created",
  "pid": 0
}

Process Management

make run to start the python application.

List process instances

Send a request to the API to list all created process.

curl -vX GET "http://localhost:5000/api/peos/list"

If a process has been created prior to this you should see output similar to this:

> GET /api/peos/list HTTP/1.1
> User-Agent: curl/7.37.1
> Host: 192.168.59.103:5000
> Accept: */*
> 
< HTTP/1.0 200 OK
< Content-Type: application/json
< Content-Length: 191
< Server: Werkzeug/0.10 Python/2.7.6
< Date: Wed, 08 Apr 2015 20:48:53 GMT
< 
{
  "processes": [
    {
      "model": "Clinical_Assessment", 
      "pid": "0"
    },
    {
      "model": "Dementia_Management", 
      "pid": 13
    }
  ]
}

Otherwise you will just receive an empty list for processes.

Get Status of Processes instance

Get the status of a process.

curl -vX GET http://localhost:5000/api/peos/status/{process_id}
Where {process_id} is the process ID number.

Sample output:

> GET /api/peos/status/0 HTTP/1.1
> User-Agent: curl/7.37.1
> Host: 192.168.59.103:5000
> Accept: */*
>
< HTTP/1.0 200 OK
< Content-Type: application/json
< Content-Length: 1076
< Server: Werkzeug/0.10 Python/2.7.6
< Date: Wed, 08 Apr 2015 21:44:08 GMT
<
{
  "actions": [
    {
      "details": [
        {
          "script": {}
        },
        {
          "req_resource": {
            "name": "test",
            "qualifier": "",
            "value": "\"\\${test}\""
          }
        },
        {
          "prov_resource": {
            "name": "b",
            "qualifier": "",
            "value": "\"\\${b}\""
          }
        },
        {
          "prov_resource": {
            "name": "True",
            "qualifier": "",
            "value": "\"\\${True}\""
          }
        }
      ],
      "name": "predicate",
      "state": "BLOCKED"
    },
    {
      "details": [
        {
          "script": {}
        },
        {
          "req_resource": {
            "name": "b",
            "qualifier": "",
            "value": "\"\\${b}\""
          }
        },
        {
          "req_resource": {
            "name": "True",
            "qualifier": "",
            "value": "\"\\${True}\""
          }
        }
      ],
      "name": "consequent",
      "state": "NONE"
    }
  ]
}
Process Deletion

This deletes a PEOS process given a specific process ID.

Send a request to the API to create a process using the steps from the process creation section, then send the following request:

curl -vX DELETE http://localhost:5000/api/peos/delete/{process_id}
Where {process_id} is the process ID number.

Should see the following output:

> DELETE /api/peos/delete/{process_id} HTTP/1.1
> User-Agent: curl/7.37.1
> Host: 192.168.59.103:5000
> Accept: */*
> 
< HTTP/1.0 200 OK
< Content-Type: application/json
< Content-Length: 34
< Server: Werkzeug/0.10 Python/2.7.6
< Date: Wed, 08 Apr 2015 21:08:35 GMT
< 
{
  "message": "Process deleted"
}
Patient Processes

This returns a list of processes associatied with a specific patient ID

Create a set of process for a patient using the steps from the process creation section, then send the following request:

curl -vX GET http://localhost:5000/api/patients/{process_id}/processes
Where {process_id} is the process ID number.

Should see the following output:

> GET /api/patients/<patient_id>/processes HTTP/1.1
> User-Agent: curl/7.37.1
> Host: 192.168.59.103:5000
> Accept: */*
> 
< HTTP/1.0 200 OK
< Content-Type: application/json
< Content-Length: 78
< Server: Werkzeug/0.10 Python/2.7.6
< Date: Wed, 08 Apr 2015 21:13:12 GMT
< 
{
  "processes": [
    0,
    1,
    ...,
  ]
}

Process Resource Binding

This binds a resource in a particular process to a path to a file of the same
name as the resource name. This is useful for PEOS 'requires/provides' checks.

make run to start the python application.

Send a request to the API to create a process using the test.pml
model file:

curl -vX POST http://localhost:5000/api/peos/bind/file -d @tests/requests/peos_bind.json -H "Content-Type: application/json"

Should see the following output:

> POST /api/peos/bind HTTP/1.1
> User-Agent: curl/7.37.1
> Host: 192.168.59.103:5000
> Accept: */*
> Content-Type: application/json
> Content-Length: 33
>
< HTTP/1.0 200 OK
< Content-Type: application/json
< Content-Length: 34
< Server: Werkzeug/0.10 Python/2.7.6
< Date: Wed, 08 Apr 2015 14:32:18 GMT
<
{
  "message": "Bound test in 0"
}

Resource Interface

make run to start the python application.

To get resource status you can GET the endpoint
/api/peos/status/<int:process_id>

curl -vX POST http://localhost:5000/api/peos/status/0 -H "Content-Type: application/json"

To get informations from the OpenEMR Database an ID can be bound to a resource
and this resource can then used with the TCL procedure database_select
This procedure takes a database query and fetches the result from openemr.
Many of our implemented TCL functions use this and parse data to decide whether
the requires or provides will pass.

File resources can alse be created which can be parsed for values in the form with the resource being binded to the file name:

key1: value1
key2: value2

These are parsed with the TCL function parse_dict_file

Other TCL functions that can be used in a provides or requires based on a resource are:
requests_privacy which accesses the OpenEMR database and searches notes on a patient for the keyword 'privacy'

status which accesses a file defined by path and returns the value pertaining to 'status'

You can access all OpenEMR patients that can use PEOS via the patient endpoint:

curl -X GET http://localhost:5000/api/patients -H "Content-Type: application/json"

This integrates with the OpenEMR database to access all patient records and these patients can then be used with PEOS.

Good API Design: Process Creation

Please see docs/API.md for the full API documentation.

Good API Design: Process Management

Please see docs/API.md for the full API documentation.

Docker Pull Command
Owner
ianconnolly
Source Repository

Comments (0)