Thursday, January 16, 2014

jQuery Datepicker Issue: Month and Year dropdowns in IE have to click twice

While working on a legacy code base recently, I was facing an issue with the jQuery Datepicker. 

For some reason our customer's code is stuck with jquery-ui-1.8.13.custom.min.js. And the browsers mandated for the application is IE 9 with compatibility view with IE8 standards.

Issue

Load up a page with a Datepicker in it, with both the year and month dropdowns enabled. Click on one of the year/month dropdown lists, it appears and disappears. Click it again and it appears correctly.

After being clueless for few minutes, I realized some event is getting triggered right after the click event that is causing the dropdown list to collapse. Then I noticed this:

Reason

So the problem is jQuery Datepicker is binding two methods to the onchange and onclick events of the select. When I dug more and found this:

Hack

So I figured a quick hack is to get rid of the onclick method body in the plugin code itself. I could do that in the minified file (do it only if you know what you are doing!). Then a co-worker showed an even lower impact change, which is to remove the setTimeout() function body portion only – which, if doesn't break any of your existing functionality, is better.

On searching more I found that this is an issue with that version of the plugin tracked here but I am not sure which version has the fix.


Solution

Ideally I should override the onclick method using something like this. I am yet to try it because I have the "we-will-refactor-later" syndrome. 

Friday, January 10, 2014

How To Generate CCDA/CCD XML Documents for MU 2014

Most of the IT service providers in the healthcare space are busy taking steps towards getting Meaningful Use (MU 2014) certified. One of the key certification compliance criteria is the generation of various documents in XML format that adhere strictly to the CCDA or Consolidated Clinical Document Architecture. 

If you are new to these terminologies or the concepts then I recommend you go through these immensely helpful tutorials first:
  • The bible of all healthcare industry standards: HL7
  • Very nicely explained tutorials (videos) at: healthit.gov
  • Another one describing MU 2014 and CCDA (ppt) at: healthit.gov
So, you want to generate CCDA compliant document from your .net code.

But How? 

Well, there are 2 parts to the making of a CCDA document. 
  1. Prepare a .net type that mimics the XML. When serialized, this type will give us the XML that we want. Now, there are 3 ways to do this:
    • Hand-code the entire .net type(s). This requires in-depth analysis and understanding of the CCDA standard. Also considerable effort is required to develop and maintain the code when the standards change.
    • Download the schema XSDs as published by HL7 and then generate the .net type(s) out of it. This can be done by using tools like xsd.exe.
    • Use an API that already has such a .net object and exposes it to be used in the code. 
  2. Populate this .net type with the relevant data and serialize it to generate an XML out of it.
It is obvious that the API approach sounds the most cost effective and quick. In a later blog post we will evaluate a few APIs for this purpose.