XML and HL7 in Domino

I have a new project starting in the next couple of weeks that uses technologies I am unfamiliar with. This project is a result of FDA regulations and the requirement to send them Medical Device data via HL7 formatted messages.

Our data for MDR is stored in a Notes Database. The FDA documentation recommened 3 methods of capturing this data. The susequent subission and acknowledgements will be handled by another team. I am strictly responsible for the generation of the HL7 message.

The FDA recommends 3 possibilites for the creation of the HL7 message. They are:

XSLT (eXtensible Stylesheet Language Transformation)

• XSLT uses XSL (eXtensible Stylesheet Language) and Xpath. Xpath is a query language for finding information in an XML document; path expressions are used to navigate XML documents.

• Create an XML file based on your database tables.

• Use XSLT to transform it to an XML - HL7 message.

• Validate it against the schema.

Inject Data Into Template

• Start with a “blank” instanceMapping.xml file by removing the data (not the meta-data) from the file. This will leave you with an XML-HL7 message with place holders for your data.

• Create a program that opens your blank instance.

• Run SQL statements against your database to retrieve data.

• Use XPath to figure out where in the instance the data should be inserted.

• Insert this data into your blank instance.

Create the Message From Scratch

• Programmatically create a new XML file to walk the message structure, query the background database, and create an XML instance.

• Create a program that opens your new XML file.

• Run SQL statements against your database to retrieve data.

• Use XPath to figure out where in the instance the data should be inserted.

• Insert your data into the instance.

I am very familiar with LotusScript and so that was my first avenue of investigation. I believe I could handle this by creating the HL7 message in code (the “Create the Message from Scratch” from above), but that doesn’t seem like the best course of action. I like #1, but I am unsure how to tackle this in Lotusscript (if it is even possible).

I did a lot of searching in these forums for xpath and I didn’t find a whole ton of information. Designer help doesn’t mention it at all.

I guess what I am after is whether #1 is even possible on 6.5.2? I also have the ability to use LEI to move the data out of Domino and into Oracle, which I could then use whatever technology I want to generate the HL7 message. I’m much more comfortable performing this within Domino, but I am searching for advice on the best method for doing this.

Has anyone else ever tackled this before? My thought process is that I would export the MDR data via XML, transform it using a predefined XSLT into a HL7-XML format. Not sure this is possible in LotusScript, but I am open to whatever options anyone else could recommend.

Thanks in advance.

Subject: XML and HL7 in Domino

well you can export notes data in XML format (see NotesDXLExporter) and then transform it using a stylesheet (see NotesXSLTTransformer class).

There might be a few things that are not implemented in transformer, but in general this approach should work.

As always trouble with XSLT is difficulty of debugging what you are going. So in this sense the old “build from scratch” using code is much more approachable. But codewise XSLT transform will probably be the most compact and economical solution. In fact you even do not need to dump it out in XML file - just pipe NotesXMLExporter output to NotesXSLTransformer input. you must have a few examples in help.

Subject: RE: XML and HL7 in Domino

Your first sentence was the way I was going to approach this initially. Export the domino form into XML and then transform it via a stylesheet.

I hear you about the build from scratch. It’s the way I always approach development in Lotus. I know lotusscript so well I can run circles around that piece, but my fear is that I am taking the brute force approach. I am more comfortable doing it this way, but I don’t see it as being elegant.

There are examples of piping in the help. I’ve read through them a few times, but I don’t have a frame of reference for the details yet having never approached a project like this before. I just really need to sit down and start hammering away at it.

Thanks for the guidance though. It will get me started.

Subject: RE: XML and HL7 in Domino

You can easily do the templating option by creating a form set to “Treat contents as other” “text/xml” and putting the appropriate fields into the appropriate message data locations and using a view form formula for recipient pull. Push would mean getting the document by URL and echoing the body to the recipient. A little less easy would be to store the template as a file (as suggested, with identifiable placekeeper text), opening the file as a NotesStream and reading the text into a string, then doing a simple Replace to insert the data.

Subject: RE: XML and HL7 in Domino

Stan,

First off thanks for responding. I’ve been visiting these forums for over 8 years now and I’ve seen your name pop up quite frequently in some of the more challenging posts here. I’m thankfull you took the time to weigh in on this.

This is interesting. On of my initial thought was to store the HL7 template as an attachment to a notes form within the database or locally on the server somewhere. I could then grab the template and input the data using NotesStream. This is the easiest alternative to some of the other more challenging aspects of this project. I think it’s the most straightforward and one I could easily accomplish with my current skillset.

I also had the thought of creating a notes form with all of the xml and fields I need embedded within it. The issue with this approach for me is that this needs to be a scheduled agent that runs nightly on all flagged MDR’s (flagged meaning the end user checks off a box on the form stating the FDA needs to be notified). My agent gathers all of the flagged MDR’s and creates a single HL7 - XML file with the details from each. The HL7 header stays the same and each MDR is wrapped in a tag. Would this method of opening the form via URL work in this context? I’ve worked plenty with opening forms, agents, etc via URL’s, but always in a web database with user input.

Sorry I left this piece out about the scheduled agent. I should have included all the pieces of the puzzle. Your first method would work just the same and it seems like that would be the easiest path to complete this task. Let me know if I am off the mark.

Subject: RE: XML and HL7 in Domino

Well, your agent could easily supply the header and closing tags using any “get the string” method, and you can grab each of the individual messages by getting the document by URL. It would be a two-pass thing – one pass to grab a list of UNIDs using standard script methods, then another pass to get each flagged document by URL. The form you’d use would just be a stub in that case rather than a valid XML document (no sense adding anything you need to delete in code later) and you can treat the form as text/plain (so there are no surprise validation failures if someone else later tries to use the “XML” without understanding that it’s just a stub). Looking at the HL7v3 spec, I thought the “fill in the template” approach would be the only really sane choice – there’s a lot of required boilerplate in the destination document (particularly the system-compliance numbers that seem to be attributes of just about every tag under the sun), and Lord knows there’s more than enough Domino-specific cruft in DXL, so XSLT, while doable, would be a pain in the butt by comparison.

Subject: RE: XML and HL7 in Domino

Thanks again Stan.

After reading your last message the approach I was taking was to generate the header using the “get the string” method from a template. Once I reached the tag I would start cycling through my MDR’s and adding the pertinent data.

I LOVE the approach of using a form instead of looking up the MDR and doing a find replace from a notesstream. My only question is this: I get the UNID of each flagged MDR. Then I cycle through them one by one to extract the form data (which includes the fields embedded in the xml).

When I start cycling through each document how do I get the document by URL? There’s no documentcontext in my case and because this agent would be scheduled I don’t see a method that would allow me to open the document in that manner. I can generate a URL that would open a document, I just don’t know where to go from there. That’s my only disconnect on this approach at the moment.

I completely agree with you. Fill in the template is looking like the sane choice here. The deeper I got into XSLT and DXL the more worried I became. For some reason I initially thought I was taking the easy way out by doing the “fill in the template” or the create from scratch when there could have been a better approach.

Subject: RE: XML and HL7 in Domino

Stan,

Nevermind, I got it figured out. I ended up using CreateObject(“MSXML2.ServerXMLHTTP”) to attach to the URL and then print out the results to a NotesStream. This solution is fantastic and very simple compared to the find/replace method (or the XSLT for that matter).

Thanks for all of your help, I really appreciate it.

Subject: RE: XML and HL7 in Domino

Hi JoelCan you please share your solution in more details. I need to send data from Lotus Notes database to another system and I am completely new to HL7. Do I need interface engine or is it possible directly from notes? I am very familiar with Lotus Script. Any details are greatly appreciated…