Producing Simplified C-CDA Data with BlueButton
BlueButton is a JavaScript library which consumes C-CDA XML data and produces a streamlined, JSON-encoded representation. The output of this library is very useful for doing work with healthcare information, removing much of the tedium and complexity normally encountered in handling C-CDA documents. Using a combination of a local JavaScript evaluation engine (Node.js), the BlueButton library, a simple script and the ease-of-use offered by the eiConsole, you can quickly get started mapping healthcare data to any format and send it to any system.
The are just a few steps necessary:
- Download and Install Node.js
- Download the BlueButton library
- Using the eiConsole, create and configure a new Route
- Add the “JavaScript Evaluation Processor” to your eiConsole library
- Configure a “script.js” in your Route’s folder
- Add and configure a “JavaScript Evaluation Processor” in your Route
- Add a “JSON Transformation Module” in your Route
- Start mapping!
1. Installing Node.js
Node.js is a JavaScript runtime that can be run locally to evaluate JavaScript and produce output. You can use other JavaScript runtimes as long as they can support BlueButton. To download Node.js, visit https://nodejs.org/ and follow the instructions for download and installation. After installing, you should be able to invoke Node from a terminal (“Command Prompt” in Windows, Terminal in OSX) via the “node” command:
node –version
2. Download BlueButton
You can download the BlueButton library at https://blue-button.github.io/bluebutton.js/
This library will be referenced via an absolute path, so put your copy of it (typically “bluebutton.js”) somewhere that can be easily located later.
3. Configure a New Route
Open the eiConsole and browse to an existing or new Working Directory where you’d like to work with the C-CDA format. In the Route File Management dialog, click the “Add New Route” button to add a Route, then double-click the added Route in the Route / Interface table to open it.
You can configure your Source (Listener, Processors) however you need to accept C-CDA documents, which are typically provided via FTP or via HTTP (SOAP or HTTP Post Listeners).
4. Add the “JavaScript Evaluation Processor”
You should be able to download the “JSEvaluationProcessor.jar” file here, or it can be found on the PilotFish Interface Exchange (PIE). Once downloaded, you’ll need to add it to your new Route.
Select the Route menu and choose “Define Module Classes,” then click the “Add Module Library” button.
Browse to the “JSEvaluationProcessor.jar” file. The eiConsole will ask you a few questions about placement of this library. If you choose “Yes” for the first option, it will place it in the eiConsole’s runtime/lib folder. If you choose “Yes” for the second option, it will place it in a “lib” folder specific to your Route. If you’ve chosen “No” for both of these options, it will go into the current Working Directory “lib” folder.
5. Configure an Invocation Script
To invoke BlueButton, as well as to send C-CDA data to it and retrieve the results, you’ll need a script. You can write your own or download the “script.js” file here. You’ll need to save this file locally to the Route you just added. If your Working Directory is a “eip-root” folder and your Route is named “C-CDA”, you can expect to find a “route.xml” file at “eip-root/Routes/C-CDA”. You should place the invocation script within that folder.
6. Configure the Processor
Now that you have a script to invoke, you’ll need to add a “JavaScript Evaluation Processor” to your Route. At a Listener that’s expected to receive C-CDA documents, click the “Processor Configuration” tab and then click “Add Processor”. You can find the Processor listed as “JavaScript Evaluator”. Add the Processor.
There are two configuration items you’ll need to provide values for:
- Command – The system-specific command to invoke to start the JavaScript runtime. This should be an absolute path to the location of the “Node.js” executable or script.
- Script File – This is the name of the invocation script you wrote in step #5.
For an OSX system, our “Command” value will be “/usr/local/bin/node” and the “Script File” will match the file name found here (“script.js”)
7. Configure a JSON Transformer
The added Processor should take transaction data, invoke BlueButton and pass the data to it. Whatever BlueButton produces should replace the transaction contents. Since BlueButton produces JSON, we’ll want to convert this to XML for general eiConsole use.
Add a Format to your Source Transform stage. “JSON to XML” is probably a suitable name as you shouldn’t require any other transformation steps.
Configure the Transformation Module by selecting the “JSON Transformer” from the drop-down.
8. Start Mapping!
You should now be able to switch to the eiConsole Testing Mode, pick up a sample C-CDA document and run it through your configured Stages. The output should now be XML, which you can treat like any other data or format in the Data Mapper.