Jeffrey Drumm · Jan 11, 2018 go to post

Are the identifiers you are trying to compare always at the same position in each field, i.e. 3rd repetition? If yes, you should be able to use HL7.{PID:3(3).1}=HL7.{MRG:1(3).1} to compare them.

Jeffrey Drumm · Jan 8, 2018 go to post

Are you sure that:

The host is running HealthShare 2016.2 or later?

The web server for HS/Caché is actually running on port 80? 57772 is the default for "stock" installations.

Jeffrey Drumm · Jan 1, 2018 go to post

Ah, very good. Looks like I was on the right track; thanks for the confirmation!

Jeffrey Drumm · Jan 1, 2018 go to post

Thank you so much for the detailed response, Eduard.

Upon further reflection, though, I'm not sure this is exactly the solution I'm looking for. There may be multiple "sidelined" messages that are eligible for update from a single response; consider the situation where lab orders may be created in an external system for delivery to a Lab system, but the patient is registered in the Lab via a separate interface that is driven by a request made of the registration system by Ensemble. All orders for a given patient encounter would need to be held until the registration is received, but only one event will trigger the release (and enrichment) of all orders for that encounter.

Assuming tokens are unique across all deferred responses, I'll need to create a token management system that supports a one-to-many relationship between the "public" token sent to/received from the external system and the "private" tokens that identify deferred messages eligible for update from a given deferred response. If a single token can satisfy the response requirement for multiple messages, though, that may not be necessary. If that capability is mentioned in the documentation, I haven't come across it yet.

Jeffrey Drumm · Dec 30, 2017 go to post

Thank you, Eduard. As mentioned in my response to Robert, I need to understand the criteria that matches the response to the request given that they may be returned out of order. I'll take a look at the link you've provided.

Jeffrey Drumm · Dec 30, 2017 go to post

Thank you, Robert. This sounds promising and I will look into it.

Most importantly, I need to understand the criteria upon which the response is matched to the request (and therefore the message that triggered the request), since there's no guarantee that the responses will return in the same order the requests are made.

Jeffrey Drumm · Dec 28, 2017 go to post

In Studio's Tools menu, select Options, Environment, Documentation and Proxy. Check "Templates and add-ins will use Proxy server for <hostname>." Enter the address (including 'https://' if you're using SSL/TLS) and port number for your standalone web server. Click Apply.

You may have to re-authenticate each time you select a template, but at least you'll be able to get to them (and I'm sure there's a way around that too).

Jeffrey Drumm · Dec 22, 2017 go to post

Yes I did, just to see what would happen ... none of my properties are of numeric type, sadly

Jeffrey Drumm · Dec 22, 2017 go to post

Hmm. If " is is escaped as \", and the value consists of a single " (or ends with ") then it appears as \"" in the JSON output. A simple $REPLACE becomes a slightly less simple $REPLACE(json, ":""""", ":null""") , with fingers crossed that the output from %ToJSON isn't prettified in the future...

Certainly not the end of the world, but I'm a bit concerned that it's the start of a trip down the rabbit hole wink

Jeffrey Drumm · Dec 21, 2017 go to post

Thank you, Eduard.

My need is relatively unsophisticated, at least in my mind :)

I'm modeling  a JSON request payload for a web service as a Persistent class  ("Patient") that will be used as the message body for an Ensemble Request (of type Ens.Request). The Patient object will be populated from HL7v2 or possibly other sources via a DTL, and the target HTTP operation will serialize the message body to JSON for submission to an external web service.

Your suggestions have given me 98% of what I need ... but I'd like to represent unpopulated values as null rather than "" and/or simply omit keys with null values from the resulting JSON. There are format options for some of the %ZEN.Auxiliary.altJSONProvider methods, but none seem to provide that sort of control (and I swear I saw one or both of my desires addressed in one of the DC threads on JSON serialization but can't find it again).

substituting null for "" is a relatively simple $REPLACE operation; scraping out un-valued keys is perhaps a bit more complicated.

Thanks for clarifying the current status of the new JSON methods. I'm hoping any current issues get resolved soon.

Jeffrey Drumm · Dec 21, 2017 go to post

Thanks, Eduard.

So the functionality that a number of posters demonstrated here, where %ToJSON() (or $toJSON()) seemed to have been rolled into Persistent and Registered objects at some point was subsequently removed? This thread is very confusing ...

Jeffrey Drumm · Dec 20, 2017 go to post

So did this ever happen? I'm on 2017.2 and the only output I get is <SYNTAX>. I'll post some code if needed, but it's a straightforward persistent object that I'm using as the payload for an Ensemble Ens.Request object.

Jeffrey Drumm · Nov 23, 2017 go to post

For checking the progress of deletion of older messages, just bring up the message viewer and set the Sort Order to Oldest First and the Time Format to Complete. Each time you click the Search button, you should see progressively "newer" messages as the older ones are purged.

Jeffrey Drumm · Nov 16, 2017 go to post

So, putting it all together ...

NOTE: This is NOT production-ready code. There's no error handling or input validation. You get to add that stuff yourself :)

Class User.HL7.Operation.Email extends Ens.BusinessOperation {

 

Parameter ADAPTER = "EnsLib.EMail.OutboundAdapter";

 

Property Adapter As EnsLib.EMail.OutboundAdapter;

 

Parameter INVOCATION = "Queue";

 

Method SimpleMessage(pInput As EnsLib.HL7.Message, Output pOutput As Ens.Response) As %Status

{

    Set email=##class(%Net.MailMessage).%New()

    Set addr = pInput.GetValueAt("PID:13.4")

    Do email.To.Insert(addr)

    Set email.Subject="The subject of your message"

    Do email.TextData.Write("This is the body of your message.")

    Set tSc=..Adapter.SendMail(email)

    //send an empty response message after message is sent

    Set pOutput=##class(Ens.Response).%New()

    Quit $$$OK

}

 

XData MessageMap {

    <MapItem MessageType="EnsLib.HL7.Message">

        <Method>SimpleMessage</Method>

    </MapItem>

}

 

}

Jeffrey Drumm · Nov 16, 2017 go to post

Scrubbed my existing Eclipse installation and re-installed Oxygen, then the Atelier plugin. So far, so good.

Jeffrey Drumm · Nov 8, 2017 go to post

You specify the schema to use in the "Message Schema Category" field of the of the inbound Business Service's configuration.

Jeffrey Drumm · Nov 5, 2017 go to post

Do you need to route the message based on criteria supplied in HL7 field values? Is any transformation required?

If the answer to both of those questions is "no," then you really don't need a router ... you can specify the operation(s) in the target config name field for the business service that receives the messages.

If you need to route, though, you'll want to disable BuildMap segment mapping error validation in the routing rule. That's enabled when using 1 as the validation selection. Try "d-m-z" instead, assuming you still want to validate that the messages have a DocType assigned.

Note that you won't be able to (easily) specify routing criteria based on fields in segments starting with the first segment that doesn't match the schema, or (again, easily) work with those segments in DTLs.

If flexibility and maintainability are a requirement, I'd recommend you go ahead and create a custom schema.

Jeffrey Drumm · Oct 25, 2017 go to post

Thanks for this, Evgeny. It doesn't look like i'll be driving down tonight given the weather here in Maine, so I'll be participating via live stream!

Jeffrey Drumm · Oct 25, 2017 go to post

There's a pretty good description of what needs to be done in the overview here. It describes, and offers examples of,  methods for composing and sending an email in a Business Operation based on this adapter. The primary decisions you'll need to make are whether it will be a simple text-based email vs. a multi-part message, what type of message object will trigger it, and the method to call for delivery when that message type is received.

Jeffrey Drumm · Oct 20, 2017 go to post

For your testing purposes, are you looking to simply examine the output of the transformation or do you need to have the message continue to its destination?

You can select messages by Header ID or Body ID for transformation via the Ensemble / Interoperate / HL7 v2.x / HL7 v2.x Message Viewer facility and examine the transformed output in HTML-ized form.

Alternately, you can execute the DTL in the terminal against a message object you've opened by Body ID and write the output to a file for viewing in an external application:

ISYSDEV>set imsg=##class(EnsLib.HL7.Message).%OpenId(1668896)
ISYSDEV>set sc=##class(RegADT.ADTtoCMSDtl).Transform(imsg,.omsg)
ISYSDEV>do omsg.OutputToFile("/home/jdrumm/tmp/zzzfile.hl7")

This doesn't have the effect of releasing anything from the queue; the messages are all still there waiting to be processed by the BP.

Jeffrey Drumm · Aug 23, 2017 go to post

Yes, unfortunately testing DTLs that use context variables is ... challenging. sad

Jeffrey Drumm · Aug 23, 2017 go to post

So, assuming you've defined the context variables on the Context tab of the BPL, they're visible/accessible as objects with DTL called from the BPL, just like variables you define within the DTL. You can treat them just like any other variable of the defined Type:

 

Given the example from the screenshot, you can reference cvisCurrMessage as context.cvisCurrMessage within the DTL and use any methods or properties associated with its class. context.cvisCurrMessage.GetValueAt("MSH:10"), for example, returns the value of the MSH:10 field of the HL7 message referenced by context.cvisCurrMessage.

The one thing you have to be very careful about is synchronous vs. asynchronous calls to operations. You can't be guaranteed that the response object will be populated in a timely fashion when invoking the operation asynchronously, and sometimes even synchronously if you're using the BPL <call> object. You'll want to invoke the operation via the process.SendRequestSync() method in a <code> object to keep things sequenced properly.

Does that help? (if yes, please mark this response as your answer :D)

Jeffrey Drumm · Aug 22, 2017 go to post

I need to spend more time thinking about what you're trying to accomplish, but this comment specifically caught my eye:

As far as I know it is not possible to use the context of a process as input for a data transformation. If I am wrong i'd like to know.

Context variables defined within the process are available to DTLs invoked within the BPL. And you can of course use context variables to reference objects and pass them to DTLs as source or target objects. Not sure that this is what you were getting at, though.

Jeffrey Drumm · Aug 4, 2017 go to post

Thanks for the suggestions. It looks like there's a guest parking right at One Broadway, with entrance on Third.

Jeffrey Drumm · Aug 3, 2017 go to post

Hi Evgeny,

I'll most likely be driving to Cambridge, from Maine. Will parking be available at 1 Broadway (or 1 Memorial), or should I look at options outside of Cambridge and take the T to Kendall Square?

Thanks

Jeffrey Drumm · Aug 2, 2017 go to post

Hi Scott,

What metadata are you referring to? Document properties such as Title, Author, Subject, Keywords, etc. or are you looking to actually extract patient data from formatted page elements?

It doesn't look like HealthShare has any built-in PDF parsing features, but there may be something developed by the community (if there is, I'm not aware of it, though). If it's the properties I mentioned above, though, they're normally stored near the end of the file and it's conceivable that you could scrape them out with COS. To do it right, though, I think you'd want to call an external utility to fetch it. The pdfinfo utility in xpdf does that pretty efficiently:

jdrumm@oobuntoo:/mnt/hgfs/DDownloads/Intersystems$ pdfinfo Sample.pdf 
Title:          Sample
Subject:        Just another pdf
Keywords:       test metadata cache fetching
Author:         Jeff Drumm
Creator:        PDFCreator Version 1.7.3
Producer:       GPL Ghostscript 9.10
CreationDate:   Wed Aug  2 07:32:38 2017

If you're looking to get data stored as formatted page elements, though, that's an entirely different challenge.

Jeffrey Drumm · Jul 28, 2017 go to post

If you're actually installing/configuring SSL for your customers, why not simply redirect HTTP to HTTPS on the external web server?

Jeffrey Drumm · Jul 27, 2017 go to post

The problem is that your syntax doesn't really describe  a property; it's shorthand that works in the routing rule and DTL editors.

Try, instead, set context.X = request.GetValueAt("MSH:9.2").

EDIT: Looking at the log you included, it appears as though you are using the correct syntax at some point. Is context.X defined as a %String in the BPL context variable definitions?

Jeffrey Drumm · Jul 27, 2017 go to post

Ugh, and this is why I should do a page refresh before posting a comment/answer ... laugh

I was pretty sure it was an issue with the web application definition, but didn't think to remove the dispatch class when I tested ...