Skip to content

Lincolnnus/Patient-Timeline-Node.js

Repository files navigation

GSOC 2013 Patient Timeline Viewer Using Node.js

This project is a Node.js implementation of the Patient Timeline Viewer


The whole system consists of three parts:

First part is a data warehouse implemented using project bindaas(http://imaging.cci.emory.edu/wiki/display/BDS/Introduction) developed by Emory University. The repository can be found here https://github.com/Lincolnnus/Timeline-Bindaas. Please edit the bindaas api urls in

routes/index.js .


Second part is the timeline server which is based on node.js and the express MVC framework. In this server, we used mongodb for user authentication. The database information can be found in

settings.js

To make an auto-increment user id field, another mongodb collection named counters should be created in your database before further configuration.

You need to start mongodb mongodto start mongo db mongo to start the mongo shell use ccda to select the corresponding database configured in settings.js db.counters.insert( { _id: "uid", seq: 0 } )


The node server is dependent on the following packages

"express": "3.3.3",
"express-partials":"*",
"ejs": "~0.7.1",
"jsdom":">=0.7.0",
"mongodb": ">= 0.9.9",
"mongojs": "*",
"connect-mongo": ">= 0.1.9",
"connect": ">=1.8.5",
"connect-flash":">=0.1.1",
"jsdom":"0.7.0",
"request":"2.25.0"

To install these packages, simply type

npm install

in your project directory, node package manager will automatically install these packages for you.

After installing the dependent packages, you should be able to run the node server by typing:

node app

And you should be accessible to the node server via http://localhost:3000. You can configure the port number and other enviroment information in

app.js

To adapt to the apache proxy server in Emory University, all the urls are prefixed with /timeline, for instance, the home page is http://localhost:3000/timeline instead of http://localhost:3000

One major function for the node server is to upload the ccda xml documents. You should be a valid registered user and logged in to the system in order to upload the ccda xml files.

When you're uploading the xml file, make sure that you have opened up the bindaas server and chosen the right database collection. The bindaas uploading API urls can be found in routes/index.js, please make sure they are all correct.

If you don't have the bindaas api ready, please comment out the following line in routes/index.js

uploadToBindaas(currentUser.uid,currentUser.xml); and use showTimeline(); in the views/index.ejs views/timeline.ejs instead of showTimelineAjax();//if you want to use ajax

The same for views/detail.ejs,views/timeline.ejsandviews/labs.ejs

Ensure that the public/uploads folder is readable/writable.


Another very important function for the node server is to get/post data from/to the data warehouse in bindaas via http request and the bindaas API.

To access the datas, another application interface has been created for the current logged in user.

/timeline/demographics.json To get the demographics of the current logged in user

/timeline/allergy.json To get the allergies of the current logged in user

/timeline/encounter.json

/timeline/immunization.json

/timeline/lab.json

/timeline/medication.json

/timeline/problem.json

/timeline/procedure.json

/timeline/vital.json

/timeline/timeline.json

Third Part is the web client, which is integrated as the express.js view in this case. However, The web client can also be seperated from the node server.

The web client data is retrieved via ajax through the above APIs. It is accessible via

/timeline/timeline

Once again, you need to ensure that the bindaas server is running and the corresponding database collection is selected. You may edit the

public/js/timeline.js

api key and the API urls in the

routes/index.js


To make asyncronize api calls and efficient data updating, we used ajax for commnications between the client and the node server.The codes can be found in

public/js/timeline.js

To make the data updating cleaner, we used a template engine named ejs(embeddedjs) for templating. The templetes can be found in

public/templates.

Besides the ajax timeline view, we also used a simple view which reads the public/js/data.js and then render the whole page directly in the

public/templates/*.ejs

For testing purposes, you may use the ccda files in the

public/uploads/ folder.


In general, to set up the system, you'll need to do the following works

  1. Start Mongodb

mongodto start mongo db mongo to start the mongo shell

  1. Use the database specified in

settings.js

  1. Insert a counters collection in the database
db.counters.insert( { _id: "uid", seq: 0 } )
  1. Setup the Bindaas Server
cd $bindaas_home/bin ./startup.sh
  1. Setup the Bindaas API(VERY IMPORTANT)

  2. Run the node server

node app

  1. Set write/read permission for

public/uploads

  1. Go to the browser and upload the CCDA xml file.

  2. If the bindaas api is not ready,comment out the following line in

routes/index.js

uploadToBindaas(currentUser.uid,currentUser.xml); and use showTimeline(); in the views/index.ejs views/timeline.ejs instead of showTimelineAjax();//if you want to use ajax

The same for views/detail.ejs,views/timeline.ejsandviews/labs.ejs

  1. The outcome would be similar to the

http://lincolnnus.github.io/Timeline-Bootstrapproject One demo version is available athttp://imaging.cci.emory.edu/timeline with user name: test, password: test.

About

GSOC 2013 Patient Timeline Using Node.js

Resources

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published