Generate Test Messages

This tutorial shows you how to create test messages using Caristix software.

Generate Test Messages: when to use this tutorial

During interface coding or validation, you often need a set of sample messages.  But there are times when the source or destination system hasn’t been deployed or upgraded, and it’s impossible to obtain real-world sample messages from the vendor. In these cases, the solution would be to create the messages yourself.

But the problem is that manually building a large set of sample messages (>50) is time-consuming and resource-intensive for busy teams. Sometimes you simply can’t build 50+ sample messages manually.

This tutorial explains how to generate a large amount of messages (>100,000) easily and quickly.

Overview

The process is straightforward.  First, create a suite with two tasks.  The first task will include all the configuration information needed to populate a message template from data sources. It will send the message to the second task.  This second task will take the message and save it to a file.  To generate multiple messages, those tasks just need to run multiple times. This tutorial will create 100 messages for you.

Here is a step-by-step explanation.

You can also download the test suite and use it to walk through this tutorial.

Step #1:  Create a suite

  1. Create a test suite:

    For the purposes of this tutorial, name the suite Caristix Test Tutorial

  2. Create a scenario:

    Name the scenario How To

  3. Add an action:

    Name the action Generate messages

  4. Create a “Send HL7 Message” task:

    Call this new task Generate A01 messages

  5. Create a “Receive HL7 Message” task:

    Call it Receive generated messages

 

Step #2:  Configure Message Generation Parameters

In this step, you’ll configure the message template and the data sources to populate the template.

  1. Configure the Generate A01 messages task

    • Select the Generate A01 messages task
    • Select the Configuration tab
    • Configure an outbound connection where host is 127.0.0.1 and port is 6661.  Set timeout to 30 seconds. 
    • Select it as the Outbound connection
  2. Get a message template

    • If you have a single message, paste it in the message zone.  This becomes the message template.  Generated messages will be based on this message.

    – OR –

    • Click the Generate message from Profile… button
    • Select the HL7 v2.6 conformance profile from the profile library.  You will generate HL7 v2.6 messages using this profile.
    • Select the ADT-A01 trigger event. You’ll be creating admit messages.
    • Click OK
  3. Configure fields

    Now you’re going to set up variables for several fields such as the date and time of the message, patient name, patient date of birth, etc. These fields need to be linked to a data source so that during execution, the fields are populated with different data, so you get different messages.  Data sources can be Excel files, text files, databases or built-in data generators.

    • MSH.7 – Date/Time of Message
      For this field, configure a variable using a date time generator.  The MSH.7 field value will be replaced with a variable ${CurrentDateTime}.  During execution, this variable will be replaced with the current date and time.
      • Move the mouse over the MSH.7 field
      • Right-click the field and select Set Variable for MSH.7
        The variable window opens
      • Click Add…
        A new row is added to set a new variable
      • Rename to ${CurrentDateTime}
      • Set TYPE to String
      • Under Configuration, set Type to Date Time
      • Under Based on, select  Now
      • Select Date format: yyyyMMddHHmmss
      • Click OK
    • MSH.10 – Message Control ID
      Now configure the MSH.10 field value, so it is replaced with a variable ${MsgControlID}. At run time, this variable will be replaced with a generated number.
      • Move the mouse over the MSH.10 field
      • Right-click the field and select Set Variable for MSH.10
        The variable window opens
      • Click Add…
        A new row is added to set a new variable
      • Rename to ${MsgControlID}
      • Set TYPE property to String
      • In Configuration, set Type to Numeric
      • Select Generate sequential list so the numbers you generate increment for every message generated.
      • Set Between 10000000 and 99999999 so generated numbers will start from 10000000 to 99999999
      • Select Decimals: 0
      • Select Increment by: 1
      • Select Start new list
      • Click OK
    • EVN.2 – Recorded Date/Time
      For EVN.2, we will reuse a variable we configured previously.  At run time, field value will be replaced with the ${CurrentDateTime} variable.  Retrieve it from the variable list:
      • Move the mouse over the EVN.2 field
      • Right-click the field and select Set Variable for EVN.2
        The variable window opens
      • Select the ${CurrentDateTime} variable
      • Click OK
    • PID.2 – Patient ID
      Using the same technique, create a new variable for PID.2. This time, the variable will generate numerics leaded with a string and 0s to make sure the new field values are 8 characters long
      • Move the mouse over the PID.2 field
      • Right-click the field and select Set Variable for PID.2
        The variable window opens
      • Click Add…
        A new row is added to set a new variable
      • Set NAME property to ${PatientID}
      • Set TYPE property to String
      • In Configuration, set Type to Numeric
      • Select Generate random value
      • Set Between 1 and 999999
      • Select Decimals: 0
      • Select Increment by: 1
      • Set Generator formatting: ID{0:D6} so the number generated is prefixed with “ID” and “0” up to 6 digits long number
      • Click OK
    • PID.5.1 – Patient Family Name
      PID.5.1 will be populated with names stored in an Excel file. The file is provided with the product. Start by configuring the ${PatientLastName} variable:
      • Move the mouse over the PID.5.1 field
      • Right-click the field and select Set Variable for PID.5.1
        The variable window opens
      • Click Add…
        A new row is added to set a new variable
      • Set NAME property to ${PatientLastName}
      • Set TYPE property to String
      • In Configuration, set Type to Excel File
      • Select Generate sequential list so Excel file content is selected from top to bottom
      • Set File: C:ProgramDataCaristixCommonSamplesExcelPatientProfile.xlsx
      • Set Worksheet: Demographics1
      • Set Column: B
      • Set Start new list so it starts with the top row of the Excel file at each execution
      • Click OK
    • PID.5.2 – Patient Given Name
      Do the same thing for PID5.2 as we did for PID.5.1. PID.5.2 will be populated with first names stored in an Excel file.  Using the same Excel file and worksheet will make sure the given name selected is on the same row as the last name selected in PID.5.1.  Now we’ll configure the ${PatientGivenName} variable.
      • Move the mouse over the PID.5.2 field
      • Right-click the field and select Set Variable for PID.5.2
        The variable window opens
      • Click Add…
        A new row is added to set a new variable
      • Set NAME property to ${PatientGivenName}
      • Set TYPE property to String
      • In Configuration, set Type to Excel File
      • Select Generate sequential list so Excel file content is selected from top to bottom
      • Set File: C:\ProgramData\Caristix\Common\Samples\Excel\PatientProfile.xlsx
      • Set Worksheet: Demographics1
      • Set Column: A
      • Set Start new list so it starts with the Excel file top row at each execution
      • Click OK
    • PID.7 – Patient Date of Birth
      The PID.7 field value will be replaced with a variable ${DOB}. At run time, this variable will be replaced/assigned with a generated date. Now we’ll configure the variable.
      • Move the mouse over the PID.7 field
      • Right-click the field and select Set Variable for PID.7
        The variable window opens
      • Click Add…
        A new row is added to set a new variable
      • Set NAME property to ${DOB}
      • Set TYPE property to String
      • In Configuration, set Type to Date Time
      • Select Generate random values so a random date is generated
      • Set Based on: A specific date
      • Set the date to: 1914-01-01
      • Set In range between 0 and 1200 Month so the generated date will be between 1914-01-01 and 2014-01-01 (1200-month range)
      • Set Date format: yyyyMMdd
      • Click OK
    • PID.8 – Patient Gender
      For the PID.8 field, we will use a new generator. The value will be pulled via a variable ${Gender} using the code set from a conformance profile.  At run time, the code from 0001 – Administrative Sex will set the variable.  This is useful when you want to generate messages from a specification or profile.
      • Move the mouse over the PID.8 field
      • Right-click the field and select Set Variable for PID.8
        The variable window opens
      • Click Add…
        A new row is added to set a new variable
      • Set NAME property to ${Gender}
      • Set TYPE property to String
      • In Configuration, set Type to Table
      • Select Generate random values so a random code is picked from the profile
      • Set Table Type: User Defined Tables
      • Set Table: 0001 – Administrative Sex
        Click Edit Table… to view/update the table content.  Any profile from the library can be used.  To select a profile, change the reference profile in the Options
      • Click OK
    • PID.11 – Patient Address
      For PID.11 field, we will use one variable to populate several components. Actually, we will create a variable combining several generators.
      • Move the mouse over the PID.11.1 field
      • Right-click the field and select Set Variable for PID.11.1
        The variable window opens
      • Click Add…
        A new row is added to set a new variable
      • Set NAME property to ${PatientAddress}
      • Set TYPE property to String
      • In Configuration, set Type to Excel File
      • Select Generate sequential list
      • Set File: C:ProgramDataCaristixCommonSamplesExcelPatientProfile.xlsx
      • Set Worksheet: Demographics1
      • Set Column: D
      • Set Start new list

      Now, we have a street number from the Excel file. The street name is still missing so instead of leaving this dialog, we’ll continue and add another generator to add a street name to the variable.

      • Click Advanced Mode
        A new section appears listing the generators.
      • Click Add
        A new generator is created. Let’s configure this one too.
      • In Configuration, set Type to Excel File
      • Select Generate sequential list
      • Set File: C:\ProgramData\Caristix\Common\Samples\Excel\PatientProfile.xlsx
      • Set Worksheet: Demographics1
      • Set Column: E
      • Set Start new list

      Now, we’re done with PID.11.1. Let’s continue with another generator for PID.11.3 (city).

      • Click Add in the generator bar
        A new generator is created.
      • In Configuration, set Type to Excel File
      • Select Generate sequential list
      • Set File: C:\ProgramData\Caristix\Common\Samples\Excel\PatientProfile.xlsx
      • Set Worksheet: Demographics1
      • Set Column: G
      • Set Start new list
      • Let’s do the same for PID.11.5 (zip code)
      • Click Add in the generator bar
        A new generator is created.
      • In Configuration, set Type to Excel File
      • Select Generate sequential list
      • Set File: C:\ProgramData\Caristix\Common\Samples\Excel\PatientProfile.xlsx
      • Set Worksheet: Demographics1
      • Set Column: I
      • Set Start new list

      The last step is to format the data generated and add component delimiters

      • Under Generator formatting, add the spaces and delimiters:{0} {1}^^{2}^^{3}^USA^P
      • Click OK

Step #3:  Execute

  1. Configure the Receive generated messages task

    • Select the Receive generated messages task
    • Select the Configuration tab
    • Configure an inbound connection where host is 0.0.0.0 and port is 6661.  Set timeout to 30 seconds. 
    • Select it as the Inbound connection
    • Check the Save inbound message to file check box
    • Set File path to C:${CxScenarioSuiteName}.hl7
    • Check the Append checkbox so messages are added to the file.
  2. Set the scenario to execute 100 times so 100 messages are generated.

    • Select the Generate messages action in the suite tree
    • Select the Configuration tab
    • Set Execute: 100 time(s)
  3. Execute and generate messages

    • Right-click the Generate messages action
    • Select Run

 A file (C:Caristix Test Tutorial – Generate Message.hl7) is created with 100 messages in it.

Download the test suite and use it to walk through this tutorial.

Enjoy!