Skip to content

becush/himss_interoperability_showcase_2021

 
 

Repository files navigation

Sepsis Detection Demo

1. Purpose

TO-DO

2. Architecture

2.1. Sepsis Detection Runtime processes:

  1. sepsisdetection parent process

    sepsisdetection svg
  2. highmediummitigation Subprocess:

    highmediummitigation svg

2.2. Reference Architecture

reference architecture actual
  1. An external client POSTs a FHIR R4 bundle (with a Patient, Location and multiple Observation resources ) to the RESTful API of the HAPI FHIR JPA server.

  2. HAPI FHIR JPA Server persists (using Hiberate) to its PostgreSQL database. FHIR resources are stored as gzip blobs in the following table of the HAPI FHIR database schema: public.hfj_res_ver .

  3. Debezium detects the additional records to the public.hfj_res_ver table and puts them in motion by sending the raw GZIP blobs to a kafka topic: fhir.public.hfj_res_ver

  4. Messages in the fhir.public.hfj_res_ver topic can now be viewed via monitoring tools such as KafDrop. The sepsisdetection_rhpam application is also a consumer on that topic. During consumption of a Patient resource, the following occurs:

    1. Given a patiend ID, the RESTful API of the HAPI FHIR server is queried for a list of all Observation resources for the Patient in a given time period. This list of Observation resources is used as the payload of an HTTP POST request to the sepsisdetection-ml function. The function responds with an indication of whether sepsis is likely or not.

    2. A FHIR R4 RiskAssessment resource (which includes the data indicating likelyhood of sepsis) is posted to the FHIR Server via its RESTful APIs.

    3. The RH-PAM process-engine embedded in the sepsisdetection-RHPAM application is invoked and a sepsis-detection business process is started. These business process and corresponding human tasks can be monitored via tools such as RH-PAMs dashbuilder component.

  5. The sepsisdetection-ui application interacts with the RESTful KIE-Server APIs of sepsisdetection-rhpam and renders a user interface that allows for management of the sepsis-detection business process and corresponding human tasks.

  6. The sepsisdetection-ui pulls in an IFrame from HealthFlow.

3. Deploy to OpenShift

Ansible is included to deploy this application to OpenShift in a repeatable manner.

3.1. Pre-reqs:

  1. OpenShift Container Platform version 4.7.* or more recent. Resource requirements needed by the app (doesn’t include resource requirements of Openshift to support itself) is as follows:

    1. RAM: 6 GB

    2. CPU: 8

    3. Storage: 10 PVCs of type RWO (no RWX requirement) and each of size 5 GiB

  2. cluster-admin credentials to this OpenShift cluster are needed

  3. Corresponding oc utility installed locally

    All versions of this utility are available at either of the following:

  4. ansible installed locally

    ie: dnf install ansible

  5. git installed locally

3.2. Procedure:

  1. Using the oc utility that corresponds to the version of OpenShift that you will deploy to, log into the cluster:

    $ oc login <OCP API Server url> -u <cluster-admin userId> -p <passwd>
  2. Clone the source code of this project:

    $ git clone https://github.com/redhat-naps-da/himss_interoperability_showcase_2021
  3. Change to the ansible directory of this project:

    $ cd ansible
  4. Deploy to OpenShift:

    $ ansible-playbook playbooks/install.yml
    1. Deployment should complete in about 15 minutes.

    2. Notice the creation of a new OCP namespace where the application resides: user1-sepsisdetection

    3. At the completion of the installation, expect to see messages similar to the following:

      ...
      
      
      PLAY RECAP *******************************************************************************************************************************************************************************************************
      localhost                  :  ok=137  changed=77   unreachable=0    failed=0    skipped=14   rescued=0    ignored=0
  5. Optional: Uninstall from OpenShift:

    $ ansible-playbook playbooks/uninstall.yml

4. User Interfaces

demo routes

As seen in the list of routes created in the user1_sepsisdetection namespace, the demo provides the following user interfaces and APIs:

4.1. Dashbuilder

dashbuilder tasks

4.2. Hapi FHIR Server

hapi fhir home

4.3. Kafdrop

kafdrop home
kafdrop message

4.4. Sepsisdetection-rhpam

This service consists of the RH-PAM process_engine embedded in SpringBoot.

  1. This service consumes messages from Red Hat AMQ Streams

  2. This service also exposes the following RESTful APIs:

    1. KIE-Server REST APIs:

      1. Swagger documentation is available in json format as per the following:

        $ curl -v -u "kieserver:kieserver" https://$(oc get route sepsisdetection-rhpam -n user1-sepsisdetection --template='{{ .spec.host }}')/rest/swagger.json | jq .
        1. swagger-ui:

          Point your browser to the output of the following:

          $ SEPSISDETECTION_RHPAM_URL=https://$(oc get route sepsisdetection-rhpam -n user1-sepsisdetection --template='{{ .spec.host }}')
          
          $ echo -en "\n$SEPSISDETECTION_RHPAM_URL/rest/api-docs/?url=$SEPSISDETECTION_RHPAM_URL/rest/swagger.json\n"
          swagger ui
    2. FHIR Enabled REST APIs:

      Augments the RH-PAM KIE-Server with additional APIs that allow for handling FHIR related process and task variables

4.5. Sepsisdetection-UI

sepsisui home

5. Demo Scenario

5.1. POST Patient to HAPI FHIR Server

The application includes a HAPI FHIR Server that exposes RESTful endpoints.

The demo scenario starts by submitting an HTTP POST with a FHIR bundle (which includes a FHIR R4 Patient) to the HAPI FHIR Server.

  1. Set FHIR_SERVER_URL env var:

    1. If testing environment deployed to OpenShift:

      FHIR_SERVER_URL=https://$(oc get route fhir-server -n user1-sepsisdetection --template='{{ .spec.host }}')
    2. If testing environment deployed locally:

      FHIR_SERVER_URL=http://localhost:8080
  2. POST Observation to FHIR server

    $ curl -X POST \
           -H "Content-Type:application/fhir+json" \
           $FHIR_SERVER_URL/fhir \
           -d "@sepsisdetection-rhpam/src/test/resources/fhir/ObservationPatientBundle.json"

5.2. View and Administer SepsisDetection Human Tasks

  1. Point your browser to the output of the following command:

    $ echo -en "\nhttps://$(oc get route sepsisdetection-ui -n user1-sepsisdetection --template='{{ .spec.host }}' )\n"
    sepsisui singleprocess
  2. Click Show/Hide Workflow:

    sepsisui risk assessment
  3. Click the My Tasks tab:

    sepsisui singletask

6. my.healthflow.io notes

HealthFlow was initially supposed to have been deployed on the kubeframe as part of the demo, but they couldn’t get it containerized in time, so it was relegated to being displayed in that iFrame. There’s a container image out there for it, but it’s monolithic and bulky, and we kind of shelved helping them with it for the time being. It’s based on a project called Meteor, and includes an embedded FHIR server with database instance, as well as some other stuff. Pretty heavy duty.

Example URL:

7. Test

The sepsisdetection-rhpam deployment is enabled with the kie_server as well as various endpoints that can consume FHIR payloads.

7.1. SepsisDetection RHPAM

  1. Set SEPSISDETECTION_RHPAM_URL env var:

    1. If testing environment deployed locally:

      SEPSISDETECTION_RHPAM_URL=http://localhost:9080
    2. If testing environment deployed to OpenShift:

      SEPSISDETECTION_RHPAM_URL=https://$(oc get route sepsisdetection-rhpam -n user1-sepsisdetection --template='{{ .spec.host }}')
  2. Health Check Report

    $ curl -u "kieserver:kieserver" -H 'Accept:application/json' $SEPSISDETECTION_RHPAM_URL/rest/server/healthcheck?report=true
  3. View raw swagger json

    $ curl -v -u "kieserver:kieserver" $SEPSISDETECTION_RHPAM_URL/rest/swagger.json | jq .
  4. View swagger-ui:

    Point your browser to the output of the following:

    $ echo -en "\n$SEPSISDETECTION_RHPAM_URL/rest/api-docs/?url=$SEPSISDETECTION_RHPAM_URL/rest/swagger.json\n"
    swagger ui
  5. List KIE Containers

    $ curl -u "kieserver:kieserver" -X GET $SEPSISDETECTION_RHPAM_URL/rest/server/containers
  6. List process definitions in JSON representation:

    $ curl -u "kieserver:kieserver" -X GET -H 'Accept:application/json' $SEPSISDETECTION_RHPAM_URL/rest/server/containers/sepsisdetection-kjar/processes/
  7. List cases in JSON representation:

    $ curl -u "kieserver:kieserver" -X GET -H 'Accept:application/json' $SEPSISDETECTION_RHPAM_URL/rest/server/queries/cases/

8. Local containerized environment

This project includes a docker-compose config file that allows for deployment of the application as containers in your local environment.

  1. Start application pod with all linux containers:

    $ docker-compose -f etc/docker-compose.yaml up -d
    Note
    If underlying linux container system in use in your local environment is podman, then follow this set-up guide.
  2. The following diagram depicts the containers instantiated as part of this pod:

    docker compose architecture
  3. Post Debezium configs to kafka_connect container:

    $ curl -X POST \
            -H "Accept:application/json" -H "Content-Type:application/json" \
            localhost:8083/connectors/ \
            -d "@etc/hapi-fhir/debezium-fhir-server-pgsql.json"
    Note
    This step is not needed when running the solution in OpenShift. It’s only needed when running the solution in a local containerized environmennt (ie: docker-compose)
  4. Stop application pod with all linux containers:

    $ docker-compose -f etc/docker-compose.yaml down

9. Development

  1. Build and install kjar project:

    $ cd sepsisdetection-kjar
    
    $ mvn clean install -DskipTests
  2. Build KIE-Server executable from this project:

    $ cd sepsisdetection-rhpam
    
    $ mvn clean package
  3. Build and Start app

    $ mvn clean package -DskipTests && \
             java -Dorg.kie.server.repo=../etc/sepsisdetection-rhpam/runtime_configs \
                  -jar target/sepsisdetection-rhpam-0.0.1.jar &> /tmp/sepsisdetection-rhpam.log &
  4. Optional: Create a kie-container in kie-server (kie-container should already be registered as per contents of etc/rhpam/sepsisdetection-rhpam.xml )

    $ export KJAR_VERSION=1.0.0
    $ export KIE_SERVER_CONTAINER_NAME=sepsisdetection-rhpam
    
    $ sed "s/{KIE_SERVER_CONTAINER_NAME}/$KIE_SERVER_CONTAINER_NAME/g" etc/rhpam/kie_container.json \
         | sed "s/{KJAR_VERSION}/$KJAR_VERSION/g" \
         > /tmp/kie_container.json && \
         curl -u "kieserver:kieserver" -X PUT -H 'Content-type:application/json' localhost:9080/rest/server/containers/$KIE_SERVER_CONTAINER_NAME-$KJAR_VERSION -d '@/tmp/kie_container.json'

11. Bug list

  1. Decide what to do about integrating with Healthflow.io . Maybe create a simulator

  2. Persisting list of Observations as part of process instance variables caused problems when retrieving those pInstance variables and marshalling to json (so as to be rendered in sepsisdetection-ui ).

12. Operator notes

12.2. Development

12.2.1. Base Operator

  1. Modify Makefile (as needed)

  2. Build image and deploy to quay:

    $ make docker-build docker-push
  3. Deploy operator in OpenShift cluster:

    $ make deploy
    
    cd config/manager && /u01/labs/mw/redhat-naps-da/himss_interoperability_showcase_2021/ansible/bin/kustomize edit set image controller=quay.io/redhat_naps_da/sepsisdetection-operator:0.0.2
    /u01/labs/mw/redhat-naps-da/himss_interoperability_showcase_2021/ansible/bin/kustomize build config/default | kubectl apply -f -
    I0831 13:00:25.259384   30895 request.go:668] Waited for 1.075752563s due to client-side throttling, not priority and fairness, request: GET:https://api.cluster-3983.3983.sandbox362.opentlc.com:6443/apis/security.internal.openshift.io/v1?timeout=32s
    namespace/ansible-system created
    customresourcedefinition.apiextensions.k8s.io/himss2021s.cache.redhat.com created
    serviceaccount/ansible-controller-manager created
    role.rbac.authorization.k8s.io/ansible-leader-election-role created
    clusterrole.rbac.authorization.k8s.io/ansible-manager-role created
    clusterrole.rbac.authorization.k8s.io/ansible-metrics-reader created
    clusterrole.rbac.authorization.k8s.io/ansible-proxy-role created
    rolebinding.rbac.authorization.k8s.io/ansible-leader-election-rolebinding created
    clusterrolebinding.rbac.authorization.k8s.io/ansible-manager-rolebinding created
    clusterrolebinding.rbac.authorization.k8s.io/ansible-proxy-rolebinding created
    configmap/ansible-manager-config created
    service/ansible-controller-manager-metrics-service created
    deployment.apps/ansible-controller-manager created
  4. Install HIMSS2021 resource

    $ oc apply -f config/samples/cache_v1alpha1_himss2021.yaml
  5. Acquire needed configs for use in RHPDS:

    $ mkdir rhpds
    $ bin/kustomize build config/default > rhpds/sepsisdetection-operator-all-configs.yml
    $ cp config/samples/cache_v1alpha1_himss2021.yaml rhpds

12.2.2. OLM

  1. list status of existing OLM on RHPDS cluster

    $  operator-sdk olm status --olm-namespace openshift-operator-lifecycle-manager
  2. uninstall existing OLM on RHPDS cluster

    $  operator-sdk olm uninstall --version 0.17.0
  3. install latest OLM in olm namespace

    $ operator-sdk olm install
  1. Demo Onboarding request into RHPDS

  2. agnosticd pull request

About

No description, website, or topics provided.

Resources

Stars

0 stars

Watchers

0 watching

Forks

Releases

No releases published

Packages

 
 
 

Contributors

Languages

  • Python 32.8%
  • TypeScript 24.5%
  • Java 22.6%
  • PLpgSQL 8.1%
  • HTML 5.7%
  • Makefile 2.2%
  • Other 4.1%