Sidebar

How can I conceptualize the process of programming scripts in QIE?

0 votes
530 views
asked Aug 19, 2016 by gary-t-8719 (14,860 points)
I am new to programming and often don't know where to start when writing a custom script. How can I conceptualize the programming process?

1 Answer

+1 vote

The main object that we are dealing with in QIE is a Message. The message can be of many different types (HL7, XML, CSV, et cetera) but from a programming perspective it basically boils down to string or textual data.

One way of thinking about the message is as a Hawaiian Haystack meal. A Hawaiian haystack is a dish composed of a rice base and several toppings. It is prepared by topping rice with toppings such as chicken, chicken gravy, diced pineapple, diced tomatoes, Chinese noodles, cheese, and celery. Traditionally, each topping is prepared in its own dish and presented buffet-style, then added on top of the rice as desired source: WikiPedia. The message in QIE is like the Hawaiian haystack already prepared and put together comprised of clinic, doctor, patient, and medical information. 

Writing scripts in QIE is a process of dismantling the message to get to an individual item like the patients mrn, a particular allergy or the patients responsible provider and manipulating, reformatting or rearranging the data into a new message to send it to another entity.

1. So the first step in writing a script is to identify what you have in your message or a given variable. Only by seeing or identifying what you have, will you know how to dismantle that piece of information to manipulate it. Here are a few ways to identify the data you have.

   a. Load a sample message in the Source Node --> Sample Messages and then use the test window to step through your mapping functions. In the testing window the upper pane will show what was in the Message Object before the given mapping or step and the lower pane will show what is in the Message Object after the given mapping or step.

   b. Write your variable(s) out to a Channel Cache, Message Cache or Log (debug, info, warning, or error) variable and then view the contents in the test window Caches or Test Log menu options.

        var patientMRN = source.getNode('PID-3');
 
        messageCache.setValue('patientMRN', patientMRN);
        qie.debug('patientMRN: ' + patientMRN);
        qie.info('patientMRN: ' + patientMRN);
        qie.warning('patientMRN: ' + patientMRN);
        qie.error('patientMRN: ' + patientMRN);
 
        var LOC = source.getNode('MSH-3');
        channelCache.setValue('locationOfCare', LOC);
 
 
2. Continue to dismantle your message or variable to get at a smaller portion or piece of data. This can be done by using the Source and Message Object functions found in the Standard, Code Wizard or  StringUtils functions.
 
   Standard and Code Wizard functions:
 
 
 
String Utils Functions:
 
 
3. Once the data has been manipulated, reformatted or rearranged it can be put back into the Message Object using the Standard or Code Wizard Message functions.
 
        message.addChild('nodePath', 'childNode', 'value*', index*);
 
        message.setNode('nodePath', 'value', instance*, forceNode*);
 
        message.removeAllNodes('nodePath');
 
 
answered Aug 19, 2016 by gary-t-8719 (14,860 points)
...