Many web applications can be greatly enhanced by the ability to contextually launch (open a specific patient or exam) a clinical client. The industry has generally adopted URL-based integration to launch clients such as image viewers, dictation applications, etc. HarbingerJS lets Bridge applications launch a a client with clinical context, currently primarily targeted for image viewers. An example is demonstrated in part 7 of the Rails tutorial.


HarbingerJS is included in the Rails Extensions gem. The gem provides both the HarbingerJS library to the asset rails pipeline as well as a Rails helper method to handle passing serverside information into the JavaScript library.

Warning: You must perform the HarbingerJS setup to use this code!

Additionally you'll need to include some specific JavaScript files in your asset pipeline to use these features. An example excerpt of an application.js:

//= require harbinger-js/core
//= require harbinger-js/integration.js


The simplest way create a context integration in your application is through the integration library in HarbingerJS. The primary method for doing this is $.harbingerjs.integration.view. It takes 3 parameters:

  1. The integration definition (JS object) - This is defined in the data model, stored the external system of the client being launched. It will always be in JSON. To launch a PACS client, you can get the integration definition with the radExam.imageViewer method.
  2. The exam (JS object) - This is built for you by the radExam.integrationJson method.
  3. An optional display function (defaults to opening a hidden iframe) - You can supply your own function here, or you can use one of the predefined ones (passing "iframe" or "window"). "iframe" opens the study in a hidden iframe. "window" opens a new browser window with the URL defined in the integration definition.

There are two approaches to use this to launch an image viewer: both are functionally equivalent, but vary in JavaScript style.


Storing a radExam in the variable exam, you can launch a URL integration for the image viewer in a new window:

<%= button_to_function("Launch","$.harbingerjs.integration.view(#{exam.imageViewer},#{exam.integrationJson});") %>


If you prefer to keep JavaScript isolated from mark up, you can add additional elements that contain the metadata required to launch a client.


.data { display: none; }

ERB Markup:

<div class="launch-group">
  <div class="data">
    <div class="integration-definition"><%= exam.imageViewer %></div>
    <div class="exam-object"><%= exam.integrationJson %></div>
  <button class="btn">Launch</button>


$(".launch-group button").bind("click", function(e) {
  var data = $(this).siblings(".data");
  var integration = $.parseJSON(data.find(".integration-definition").html());
  var exam = $.parseJSON(data.find(".exam-object").html());

Both examples above use the iframe method, but you can override this by specifying a function as the third argument to the view function (or the name of one of the built in functions: "iframe", "window"). That function will be passed the URL generated by the exam and integration definition. Here is the source for the "window" function as an example of how to build your own:

function(url) {; }