blue-button / bluebutton.js

The Blue Button JavaScript Library
blue-button.github.io/bluebutton.js
Other
152 stars 102 forks source link

JSON to CCDA (or C32) dump? #82

Closed kachok closed 10 years ago

kachok commented 10 years ago

I have code for dumping current bluebutton.js JSON back into CCDA (rough version for node.js only).

Any desire from others to have this functionality as part of bluebutton.js?

robdodson commented 10 years ago

I'd be interested in seeing it. Maybe you could open a pull request so we could review and comment?

kachok commented 10 years ago

Will try, it's a ball of mud (ejs templates+node.js only) so not sure what to do to make it browser compatible.

robdodson commented 10 years ago

ah I see. do you want to link to the branch in this thread instead?

kachok commented 10 years ago

our code is in private repo, we are opensourcing it in december But I'm refactoring bluebutton.js stuff now, so will try to have something to share earlier

Forked it here https://github.com/amida-tech/bluebutton.js will start pushing updates and ask community if I can merge them into original repo

sankarravi commented 10 years ago

@kachok @blacktm This would be a super valuable feature for us (ElationEMR). We're going to be using BB.js for C32/CCDA import in production soon, and I'm working on CCDA export next week. Building them based on BB JSON sounds nice, and I should have a good amount of time to allocate to the project next week.

@kachok Do you want to merge master into your work and open a pull request as a starting point? I'll be doing this stuff in Node too, but it sounds like EJS at least nominally support browser-side usage, so I can also look into how to make that work.

kachok commented 10 years ago

@sankarravi @blacktm we are back on improving bb.js for our product at @amida-tech so trying to figure out how to merge everything back at the moment

sankarravi commented 10 years ago

Awesome! @blacktm and I were talking on #94 about how to keep generation browser compatible, and we decided the best path is to require ejs on the browser + to request the template via XHR, but if you get it merged and working from node (which at this point probably just means copying the code into the new geneators/ccda.js and moving the tests into the spec/ folder somewhere, rather than literally merging), I can take over the browser piece.

sankarravi commented 10 years ago

@kachok If you're not already working on this and have other BB.js projects in mind, feel free to skip. I'm going to merge your EJS stuff into the new Generators framework today. I'll make a pull request for it on the elationemr branch (https://github.com/elationemr/bluebutton.js) and move the pull request here when it's ready

kachok commented 10 years ago

@sankarravi sounds like a plan (e.g. you go ahead). Also EJS approach is heavy weight, proper way would be to generate XML element by element. Didn't do it for lack of time last year.

sankarravi commented 10 years ago

I think time is against me there too :). Hand-generating XML sounds rough, especially given how complicated the CCDA schema is. I'm going to start with the EJS approach, and then hopefully if more people get value out of using BB.js to generate CCDAs, we can work as a community to improve the process and the amount of data we include.

sankarravi commented 10 years ago

@blacktm @jmandel Some bad news... So the Meaningful Use standards (or at least the testing body that our team uses) use the Testing Transport Tool (http://transport-testing.nist.gov/ttt/) to validate CCDAs, and any CCDA an EMR generates has to have 0 errors to pass MU Stage 2. That tool is backed by Model Driven Health Tools and literally the only files that I've seen pass it with 0 errors are... also generated by MDHT!

The EMERGE and HL7 sample XML from https://github.com/chb/sample_ccdas both have errors (EMERGE Patient_0 has just a couple; HL7 has many). So do the samples at http://wiki.siframework.org/Companion+Guide+to+Consolidated+CDA+for+MU2.

I just can't imagine building a string template based system that passes this test, and we obviously need to pass the test for our doctors' sake. I got pretty far along that approach, and I'll commit what I have in case anyone wants to make the tradeoff of lighter-weight code (no Java install required) for a less strict CCDA.

Beyond that, I plan to build a Java project that uses BB JSON as an API to MDHT. It'll be harder to keep the API completely in sync with BB JSON if they're separate projects since we still have an unstable API, but hopefully it will still leave people better off than the status quo.

(flagged Josh just because it seemed like an issue he's interested in from other discussions)

sankarravi commented 10 years ago

Ok maybe I was too pessimistic yesterday... I took one of the sample files that passes the TTT and managed to parse it through BB.js and throw it back through the BB.js generator and still have it pass. So I'm going to keep working on this :)

owenfi commented 10 years ago

sankarravi commented 10 years ago

Ok, I've got a pull request here: https://github.com/blue-button/bluebutton.js/pull/103- Would like at least one other person to look it over before we decide to merge

sankarravi commented 10 years ago

Latest stuff at: https://github.com/blue-button/bluebutton.js/pull/104. This has gone through a decent amount of MU-related testing on our end, so it should be capable of generating some pretty real CCDAs.

sankarravi commented 10 years ago

Now in master!