Mirth Community

Mirth Community (http://www.mirthcorp.com/community/forums/index.php)
-   Support (http://www.mirthcorp.com/community/forums/forumdisplay.php?f=6)
-   -   Message Generator Plugin - Can it create new messages? (http://www.mirthcorp.com/community/forums/showthread.php?t=216742)

ChrisYetter-MEDSEEK 12-09-2016 05:49 PM

Message Generator Plugin - Can it create new messages?
 
I work for a company that has a paid Mirth Connect license.

I've installed the Message Generator plugin and it's working properly, but I'm unable to get it to create new HL7 v2 messages.

I went back and watched the Mirth Dev Q&A for when the plugin was released, but it doesn't seem like the plugin was designed to do what I'd like it to do.

Before I move on to another solution, am I missing something? Is there a way to create a channel that uses this plugin to create new HL7 v2 messages that can be sent outbound via TCP/IP MLLP to a downstream system to populate it with sample data?

Thanks!

kirbykn2 12-13-2016 11:58 AM

Not that I am aware of, but this sounds like a great feature request!

As you probably are aware, you could use the plugin to generate the message, copy the message, and then paste it into the appropriate channel. You could also generate a bunch of different message types, and save them to a flat file and send it from there at a later time.

appsbyaaron 12-14-2016 05:27 AM

I've looked for years to try and find a bulk HL7 message generator for testing. I can't find one. I actually started writing my own software a couple of times to do it but it's daunting and I don't have the time to finish the project.

If anyone knows of something that works it would be really helpful!!

PS: I made one for vaccine HL7 messages a couple years ago but it was never circulated outside of the environment I was in at the time. To create something to generate ANY HL7 message with all it's variations is completely overwhelming to me.

narupley 12-14-2016 06:54 AM

Indeed, we do have that on our roadmap!

In the meantime, you can technically do it in a JavaScript Reader. The generator unfortunately isn't yet built/refactored for dynamic classloaders, so you'll have to do a sort of workaround.

Take everything from extensions/generator/lib and place it inside your custom-lib folder (optionally inside a subfolder like custom-lib/gen-lib if you wish for organization purposes). Then also put client-lib/swingx-core-1.6.2.jar in there.

Next, you need to include those libraries on the overall server classpath, so edit mirth.properties, set "server.includecustomlib" to true, and restart MC.

Then you'll want to launch the Administrator again, and open up the generator dialog. Set whatever properties you want:

http://i.imgur.com/cfcSnQh.png

You can customize how many fields/components/subcomponents to include and what to generate for them to a great detail, even supply regular expressions for them:

http://i.imgur.com/NhxIk0K.png

Once your done, hit Export and save the XML file somewhere. Put it somewhere on the server running MC so that a channel can access it.

Then in a JavaScript Reader you can do this:

Code:

var generator = $gc('generator');
if (generator == null) {
        var xstream = new com.thoughtworks.xstream.XStream();
        var properties = xstream.fromXML(FileUtil.read('/path/to/properties.xml'));
        generator = new com.mirth.generator.model.Generator();
        generator.setGeneratorProperties(properties);
        $gc('generator', generator);
}

generator.generate(generator.getGeneratorProperties().getSelectedDataType());
var list = new java.util.ArrayList();
while (generator.hasNext()) {
        list.add(generator.next());
}

return list;

And there you go! Now your channel will automatically generate random fake messages to your generator specifications:

Code:

MSH|^~\&|||||19380702222617||ADT^A04|MSG0000000006|P|2.5
EVN|A04|19400318171515||U
PID|1||949107234~949107234||ORTIS^GEORGE^R|HUTCHINSON^JAMES^Q||A|GADDIS^VIOLET^N|||||||||822778712
PV1|1|C||U||||||||||||||||||||||||xx
PR1|1||||19330318220223||+28.
IN1|1||xxTESTxx|||MERLETTE^ERIC^Y||||||||||MONDRAGON^ANTONIO^Z~SMUIN^ANDREW^Q||||||||||||||||xx||-||||||||||||||||||xxTESTxx

MSH|^~\&|||||19810102141835||ADT^A04|MSG0000000007|P|2.5
EVN|A04|19810512224407||||19890604234531
PID|1||276922612||WEISSBERG^RICHARD^V|MCCUAN^LOYD^D~DOKER^ASHLEY^D||M|SOHNS^STEPHEN^L
PV1|1|C|||||||||||||||||||||||19550414||||||||||19050401||||||xx
PR1|1||||19481007234542|||||||||2
IN1|1||xxTESTxx|||BRULE^LISA^N||||||||||OLEA^MICHAEL^D||||Y|||||||||||||||||||.0

MSH|^~\&|||||19940513212643||ADT^A04|MSG0000000008|P|2.5
EVN|A04|19441105134222
PID|1||674106993||ROCHESTER^PATRICIA^C|NOCKET^RONALD^V~EDDY^ROBERT^W||U|SLONAKER^VICTORIA^D||||||||||488-75-0000||||||||||||||19360412153338
PV1|1|C||||||||||xx||||||||xxTESTxx|||xx
PR1|1||||19460529221236
IN1|1||xxTESTxx|||RODRIGUEZ^SARAH^T||||||||||SCHULTHEIS^NELLIE^V~WILLILAMS^SYDNEY^F||||N

...


narupley 12-14-2016 06:56 AM

Quote:

Originally Posted by appsbyaaron (Post 257900)
I've looked for years to try and find a bulk HL7 message generator for testing. I can't find one. I actually started writing my own software a couple of times to do it but it's daunting and I don't have the time to finish the project.

If anyone knows of something that works it would be really helpful!!

PS: I made one for vaccine HL7 messages a couple years ago but it was never circulated outside of the environment I was in at the time. To create something to generate ANY HL7 message with all it's variations is completely overwhelming to me.

It is indeed overwhelming and quite complicated. We have such a solution available as a commercial extension in case you weren't aware:

https://www.nextgen.com/Interoperabi...sage-generator

siddharth 12-14-2016 07:42 AM

I did a project once which would generate random ADT A04s, with MSH,PID,PV1,NK1, GT1 and IN1 segment. Completely different from one another.

If you want to simulate such a thing you need few static arrays, size 10 for good effect like first Name, last name, street1,street2,city,Provider last name, first name etc.

Then, you need Math.random() method that you can run over the indexes of each of these arrays and substitute in an HL7 message. For other thing like MRN, Policy ID, Date Of Birth you can generate randomly.

Hope it helps!

appsbyaaron 12-14-2016 09:12 AM

Quote:

Originally Posted by narupley (Post 257904)
It is indeed overwhelming and quite complicated. We have such a solution available as a commercial extension in case you weren't aware:

https://www.nextgen.com/Interoperabi...sage-generator

Yes. I use this for creating template messages for quick drag and drop in my transformers. But with it you can't generate a file with 1999 unique messages. Or act as a server and send 1999 messages into mirth. But the plugin does work beautifully.

appsbyaaron 12-14-2016 09:19 AM

1 Attachment(s)
Here is a screenshot of the my last attempt in Java. Just for funzies.

narupley 12-14-2016 09:37 AM

FYI the generator actually does have the ability to generate X amount of unique messages and spit them out to disk somewhere, but right now those options aren't enabled in the UI. Technically speaking they can be set manually in the properties XML. But anyway these are definitely things that we want to improve and are on our roadmap.

akathol 04-19-2019 02:28 PM

3 Attachment(s)
Hi Nick, I know this is an old, old thread, but I was attempting to set this up on our instance as it would be very helpful.

Attached is the channel (3.7.1) that I'm using. I can see the getSelectedDataType(), but I'm getting an error when the generator.generate() method runs.

catch error output:
Code:

JavaException: org.apache.commons.lang.SerializationException: java.lang.ClassNotFoundException: com.mirth.generator.model.GeneratorProperties
I followed the steps to add the generator to a custom-lib folder as well as the swingx jar (which I pulled from mirth connect fisheye since I didn't know where it lived on our appliance).

I'm not sure how the class cannot be found when I can specifically run the methods to get the getSelectedDataType from it, but not the generate method using it.

Alternatively, is there news of if this action is possible using an alternative method (you mentioned it was on the roadmap to update the message generator to allow this type of functionality).


All times are GMT -8. The time now is 03:57 PM.

Powered by vBulletin® Version 3.8.7
Copyright ©2000 - 2019, vBulletin Solutions, Inc.
Mirth Corporation