Criteria Editor

Definition

The Criteria Editor is used to construct string-value using Carlang expressions.

Carlang

Carlang is an excel-like function language. With Carlang, you are able to retrieve HL7/XML/JSON/DataSet values from a specified task/field. Currently, there are some functions available:

@ConvertDateTime(“DATE_TIME_TO_CONVERT”, “SOURCE_FORMAT”, “DESTINATION_FORMAT”)

This function is used to convert a date value from any executed task in the scenario suite. The function has 3 parameters.

  • DATE_TIME_TO_CONVERT: The date the user wish to convert.
  • SOURCE_FORMAT: The format of the date before the conversion. (Can use the “HL7” and “FHIR” constant or any format from the DateTime c# .net documentation)
  • DESTINATION_FORMAT: The target format of the date after the conversion. (Can use the HL7 an “FHIR” constant or any format from the DateTime c# .net documentation)

EX: @ConvertDateTime(“20200428011122-0500”, “HL7”, “FHIR”) 🠖 2020-04-28T01:11:22-05:00
@ConvertDateTime(“2021-04-20”, “yyyy-MM-dd”, “MM-dd-yyyy”) 🠖 04-20-2021

@DataSet(“TASK_PATH”[9],”COLUMN”,”ROW”,”TABLE”)

This function is used to retrieve a value from an SQL Query result-set. The function has 4 parameters:

  • TASK_PATH: (Optional) The task containing the source SQL Query result-set. If not specified, the current task will be used.
    • [9]: (Optional) Use this parameter to specify which iteration of the specified task from which to get data.
  • COLUMN: The name/index of the column in the result-set containing the data.
  • ROW: (Optional) The row index in the result-set containing the data.
  • TABLE: (Optional) The name/index of the table in the result-set containing the data.

@EncodeBase64(“VALUE_TO_CONVERT”)

This function is used to encode a raw value to a base64 value from any executed task in the scenario suite. The function has 1 parameter.

  • STRING_TO_CONVERT: The value the user wish to convert.

@HL7(“TASK_PATH”[R9],”HL7_FIELD”)

This function is used to retrieve an HL7 field value from any executed task in the scenario suite. The function has 2 parameters.

  • TASK_PATH: The task containing the source HL7 message. If not specified, the current task will be used.
    • [R]: (Optional) Use this parameter to get the value from the task’s result message (ACK).
    • [9]: (Optional) Use this parameter to get the value from the task’s ninth message (if your task have many messages). Message index is a 1-based index.
  • HL7_FIELD: The HL7 Field to retrieve value from. Ex: PID.3.1, PID[2].3.1.

Hl7 Field syntax is SEGMENT_NAME[SEGMENT_REPETITION].FIELD_POSITION[FIELD_REPETITION].COMPONENT_POSITION.SUB_COMPONENT_POSITION

@JSON(“TASK_PATH”,”JSON_PATH”)

This function is used to retrieve a JSON-Path value from any executed task in the scenario suite. The function has 2 parameters.

  • TASK_PATH: The task containing the source JSON resource. If not specified, the current task will be used.
  • JSON_PATH: The JSON-Path to retrieve value from: Ex: ‘$.name[*].family’.

@XML(“TASK_PATH”[R],”X_PATH”)

This function is used to retrieve an X-Path value from any executed task in the scenario suite. The function has 2 parameters.

  • TASK_PATH: The task containing the source XML message. If not specified, the current task will be used.
    • [R]: (Optional) Use this parameter to get the value from the task’s result message (ACK).
  • X_PATH: The X-Path to retrieve value from: Ex: ClinicalDocument/typeId/@extension.

@Value(“TASK_PATH”[R])

This function is used to retrieve a string value from any executed task in the scenario suite. The function has 1 parameter.

  • TASK_PATH: The task containing the source value. If not specified, the current task will be used.
    • [R]: (Optional) Use this parameter to get the value from the task’s result value.

Configuration

HL7 v2.x Field

  • Click on the ‘Browse…’ button to select the Task containing the value or leave it empty to use the current task.
  • Check the ‘Get field from ACK’ if you which to get the value from the ACK message instead of the HL7 message sent/received.
  • If more than one message is present and you wish to compare against a specific message, you can set the index. If an index is not specified then all messages are matched 1-on-1 for validation. The first message of the source Task will be compared to the first message of the compared Task, the second with the second, etc.
  • Specify which element you wish to validate by setting the Segment, Field, Component and Sub-Component as needed.
  • By default, the first instance found of a Segment or Field will be used for the validation. If needed, you can specify which repetition to use by setting the Seg # and/or Field #.

XML Field

  • Click on the ‘Browse…’ button to select the Task containing the value or leave it empty to use the current task.
  • Select the X-Path to be used.

JSON Field

  • Click on the ‘Browse…’ button to select the Task containing the value or leave it empty to use the current task.
  • Select the JSON-Path to be used.

 DataSet Field

  • Click on the ‘Browse… button’ to select the Task containing the value or leave it empty to use the current task.
  • (Optional) Select the task iteration.
  • Select the column name.
  • (Optional) select the row index.
  • (Optional) Select the table from the result-set (if the SQL Query contains more than one SELECT).

When finished, click on insert to add it to the criteria. You can then insert another Field Value or text. When you are done editing, click on Apply to close the editor and apply the changes.

Advanced Criteria Example

To check that PID.2 and PID.4 of a sending task named “Send Task 1”, have been properly merged and separated by a dash in the Z01.1 field of the current task:

  1. Create the following validation: Z01.1 is = _
  2. Set the criteria to: @HL7(“/ScenarioName/ActionName/Send Task 1″,”PID.2”)-@HL7(“/ScenarioName/ActionName/Send Task 1″,”PID.4″)

So, if PID.2 is “ABC” and PID.4 is “123”, then the runtime validation would be: Z01.1 is = ABC-123