Article
· Jul 7, 2023 2m read

Using IRIS Populate Utility To Populate Data

Hi Developers, I'm currently doing a demo about building a front end UI doing data analytics and setup a performance test with large data objects, therefore using "Populate Utility" could help me auto generate some sample data that I can play with.

Within this post I would like to share my experience of using Populate Utility, including using POPSPEC Parameter.

1. At the beginning, I have created 2 persistent classes to support Populate Utility( Extends (%Persistent, %Populate)): popPatient which aim to populate patients' information, popSign to simulate the collected data from a heart rate sensor on the patient.    

2.1 To make this demo close to real life circumstances, I would like to add the range of values of variables for some properties by using MAXVAL and MINVAL. For example you cant expect patients' age as 1000 years old.

Do the same as heart rate BPM

2.2 If we need to use a custom auto-generation method, this time we need to use POPSPEC to define the generated values,for example We have pre-defined classes that can be referenced directly and generate US phone numbers, but in my case I want to generate a format that meets the Australian phone number . I also want to record the time of the collected heartrates, and create a list to put all the values I want to generate in this list. All above need to use POPSPEC to customise the generation of data from a user defined method.

In this case, I have written two simple classMethods to predefine the phone number format and pickup current timestamp as heartrate collect time. Then Add the POPSPEC parameter to related property

 

3. Execute Method and start populate Data

You can simply enter the following command into Terminal to populate the data, replacing number with the number of values that need to be populated.

"do ##class(Demo.popPatient).Populate( number  )"

"do ##class(Demo.popSign).Populate( number )"

 

Or you can put those two command defined in a classMethod like this, then execute "do ##class(Demo.RunPopulate). StartPop ('times for patient', times for signs') 

 

4.Here is an example for generating 10 patients and 50 collected HeartRate signs

 

Hope this simple explore could help you, Happy Coding !

Discussion (6)2
Log in or sign up to continue