· Feb 7 5m read

IRIS quick query service idea sharing

Hello, friends who are developing IRIS. I recently participated in the InterSystems Developer Tools Contest. This time, I made a tool based on the idea described in an article I published earlier as a template for quick query of messages. Currently, you only need to establish entity classes in IRIS, Then record the message corresponding to the entity class in the specified lookup table, and all the key fields generated in the message can be inverted indexed (the concept in ElasticSearch), which is convenient for quick query. The following is the design idea of my program.


In China, as an integrated platform manufacturer, most of the things that hospitals do when they jointly debug with other systems are not to develop code but to check messages. Let me first demonstrate the IRIS message checking method I am currently using

Example 1:

You need to see [个人信息注册服务]

I just need to enter [个人信息注册服务] in the box and press Enter



Click View Message to display the contents of the message, as shown in the figure:



Click [View Process] to display the IRIS message visualization page, as shown in the figure



Example 2:

You need to query which services are called by the patient whose ID is [2874621] on the integrated platform

I just need to select [Patient ID] from the drop-down list, then enter [2874621],  Enter:

This is how we can intuitively query the specified message from the perspective of user needs. IRIS also has this function - message viewer. How is it used? First, we need to know which Production components are used in this message. Second, we need to understand the structure of the entity class used in this message. For example, to check this person's message, I need to enter request. Body. PatientID="2874621" and select the message class. If I need to check multiple services, I also need to select multiple message classes... This article is not about how to use the message viewer. You may as well know it. 

Program analysis and design ideas

    Use of the original message viewer

We first use the [Message Viewer] provided by IRIS to check the personal information registration service with the patient ID of [2874621], as shown in the figure:


    Select the time and enter the conditions shown in the figure to retrieve. The steps seem quite simple, but there are two prerequisites. First, I need to know which message class corresponds to each service. Second, I know which field corresponds to the patient ID in this message class, and this field cannot be in the loop (it seems to say three conditions~haha). How to deal with it is in front of us


    SQL  analysis

Use the [Display Query] function provided by IRIS (see my other article on how to turn it on ),As shown in the figure



Find a place to format it


You can see three points from this SQL

1The table of IRIS message records isEns.MessageHeader

2IRIS saves messages by creating a table for the entity itself, such as the above example:【BKIP_PatientInfo_MSG.PatientInfoRegister

3head.MessageBodyId = BKIP_PatientInfo_MSG.PatientInfoRegister.%ID

Through these three items, we can get the information of the following figure

          If we process SQL in the way shown in the above figure, and then reflect it on the page for users to choose; The patient ID is also selected or entered by the user; This is really an intuitive solution. However, efficiency. When the user selects the time, the above message viewer first finds two IDs so that the query can find between these two primary key IDs, which increases efficiency. We can certainly use it. So is it necessary? If we remove it, we must slow down? This is one of them. Second, if the patient ID is in the loop, even in the loop... the message viewer seems to have no way (of course, please accept my knee if there is a boss who can solve it).

    Problems to be solved

  1. Comparison table, service and message comparison table
  2. How to query fields in the loop as keywords

The first problem is the solution. Create a new table to maintain the relationship between the service and the message class. The second problem is that we need to look at the table Ens.MessageHeader:



I don’t seem to see anything...

You can see this picture

The red box in the figure is the same. At the same time, we enter the message visualization, as shown in the figure

Can we say that the session ID is the message representing the service? We want to check the message of the specified person of the specified service, which can be understood as checking the session ID, that is, the session ID. Let’s change our thinking. If I traverse the patient ID in the loop and store it in a table, I have sessionID, patient ID, and service name for the data in this row. When I want to check the personal information registration service with the patient ID of [2874621] and get the sessionID, I directly jump to the visual tracking. If I change the patient ID into the doctor’s order ID, the same is true for other key fields. Is the problem solved?

Program design (idea)

Create a new index table field as SessionID, service name, attribute name, attribute value and creation time, as shown in the figure



    Then, each time the service is called, take out the attribute name, attribute value and SessionID we need and store them in this table, as shown in the figure

When we query on the page, we only need to write the SQL as shown in the figure. The ellipsis represents the condition after and

The following REST interface and front-end page are here [omitted]. You can refer to the ideas provided in my other article to write and provide the Restful interface

( )


In general, our idea is that we should reduce the original data volume and maintain the original problem of multiple loops in multiple rows of data in a single table. In this way, the original multi-table joint query is changed into a single-table query. This speed is not fast to fly? At present, we only share ideas. I believe that we must have our own way of program design. I will not show too much for the time being. See here, please give me a compliment!!


      Of course, there are still many things that need to be optimized for the tool to make it more convenient, but at present I use it as a demo tool. If the project has a good response, I would like to continue to optimize it. If you think it is good, please vote for me:

Discussion (1)1
Log in or sign up to continue