How to manage Conduit piping

From 42Q
Jump to navigation Jump to search

Introduction

The purpose of this document is to teach the user how to use the pipe parameter operation in a Conduit request as well as how to set up the command’s parameters.

Conduit can be thought of as an executor of distinct Operations. Each operation is a command or a macro encapsulating some behavior into a named entity. Many operations are designed to directly manipulate the device history record (DHR) of a serial number, but ultimately an operation can exhibit nearly any behavior deemed useful and/or relevant to production manufacturing. Each operation has a number of prompts or parameters required in order to execute successfully, that number ranging from zero (no parameters at all) to a dozen or more.

Conduit’s primary design methodology has been to create a large number of relatively simple, well-defined operations specific to a single action. By composing multiple operations into a single request, clients can perform complicated tasks using these relatively simple building blocks.

By default, Conduit supports blocks or sets of operations in a single request. Performing lots of “work” is as simple as sending as many operations as required to adjust (append to) the unit’s history accordingly. However, in some cases, users may want to allow some level of interoperability between the discrete operations. More concretely, base the inputs of operation N using information obtained by executing operation N - 1. Since each operation is its own miniature “program” or function users need a way to facilitate feeding or sharing data from one operation into another operation.

The previously mentioned is achieved by using Pipe operations, more specifically PipeParameter.

Before outlining the actual usage of PipeParameter, there is one thing to keep in mind: PipeParameter is really just a way to avoid making multiple, small requests to Conduit. Anything you can do with Piping could be mimicked in a client application by asking Conduit to execute a single operation, take the results of that operation and then construct a follow-up call with the extracted fields. This is obviously cumbersome and likely very inefficient, but that is all in terms of the PipeParameter operation. We’re linking or gluing a composed set of operations together so we can reduce round trips to Conduit and the need for implementing complicated client logic.

 

 

 

 

Pipe Parameter

PipeParameter provides a mechanism to bypass the typical prompting requirements of a Conduit operation. Meaning that it enables clients to feed/push/pipe data from some source field into a destination field on a subsequent, non-pipe operation. Pipe Parameter only interacts with NON-PIPE operations. This means sequential PipeParameter calls act as if the adjacent PipeParameter calls aren’t present. The from_field (data) source for a PipeParameter call is the last NON-PIPE operation executed before the PipeParameter call and the destination to_field is on the first NON-PIPE operation following the PipeParameter call. PipeParameter itself has 3 parameters driving its execution: Source, From Field and To Field.
 

Figure 1: Three Parameters Of PipeParameter

HTMCP Three Parameters Of PipeParameter.png

 

 

Source

The source field indicates the PipeParameter operation where to look for the piece of information identified by the from_field parameter. At this time the possible values for source are: Data (data), Data Pointer (data_ptr), Input Parameter (input_parameter) and Scanned Unit (scanned_unit).

 

  • Data (data)

The default source when not provided. Using source data means the Pipe Parameter call will seek out the specified from_field in the execution results of the last NON-PIPE operation executed before this call. Note that not all operations produce meaningful data, and there is not currently a published schema of the data every operation produces (if any is produced at all).

 

  • Data Pointer (data_ptr)

It is identical to data but the from_field is specified using the JSON Pointer syntax.

 

  • Input Parameter (input_parameter)

Take the from_field input parameter of the previously executed NON-PIPE operation and push that value into the to_field of the closest NON-PIPE operation.

 

  • Scanned Unit (scanned_unit)

The from_field, specified using JSON pointer syntax, is taken from the snapshot of unit information Conduit gathers while scanning the transaction unit supplied during the Conduit request. At the moment we have not published a formal list of fields available in the scanned unit snapshot but quite a bit of data is gathered during the process of scanning the transaction unit.
 

From Field

Within the specified source, identify the value associated with the from_field name.

 

To Field

Populate the to_field name with the value extracted from source-> from_field as if the client had explicitly populated that value when constructing the call in the request.

 

Macros

The macro mechanism in Conduit and the command register allow administrators to encapsulate custom behaviors into a single named entity. This includes removing optional fields not relevant for that use case and overriding prompts to better fit the specific manufacturing domain. Many “built-in” macros take advantage of piping, including:
StartDefectReprocessing
RESCAN
 

Example Cases

How to create a Macro and a Operation

To create a new Macro and new operations follow the steps below:

  1. Select the Macro button. A new window will appear under the Macro button.

 

Figure 2: Macro Button
HTMCP Macro Button.png

 

  1. Enter the Macro Name.
  2. Enter the Description.
  3. Enter the Operation.
  4. If users need to add more operations they have to select the Add Operation button.

 

Figure 3: Operation Button

HTMCP Operation Button.png

 

  1. Enter the values from the command name.
  2. Select the Save button to save the Macro.

 

How to use CommandName and AddComment

The easiest way to understand using Pipe Parameter is by example. We’ll start with a few simple cases, and then move on to more exotic and/or tedious applications.
A macro consists of one or more Operations, and each operation consists of a CommandName which has one or more fields that will be filled with their corresponding value.

In order to describe an instance of a Conduit Operation we will use the following syntax:
 
Command: CommanName
Values: <field_name1: value> <field_name2: value2> <field_nameN: valueN>

 

To do so follow the steps below:

  1. Create a new Macro.
  2. Enter the Macro Name.
  3. Enter the Description.
  4. Enter the command Add Attribute in the Operation field.
  5. Enter the Attribute Name value.
  6. Enter the Attribute Value value.
  7. Create a new operation.
  8. Enter the command Pipe Parameter in the Operation field.
  9. Enter the Parameter Source value.
  10. Enter the From Field value.
  11. Enter the To Field value.
  12. Create a new operation.
  13. Enter the command Add Comment in the Operation field.
  14. Enter the Comment Text value.

 

Figure 4: CommandName and AddComment Example

HTMCP CommandName and AddComment Example.png

 

The structure below represents the macro from the image above.

Command: CommandName
Values: <attr_name: Command name> <attr:value: add attribute command>

Operation: PipeParameter
Values: <source: input_parameter> <from_field: attribute value> <to_field: comment_text>

Operation: AddComment
Values: <comment_text: This is some text>

Note: Conduit command is actually a JSON object with at least a field called name and any other parameters provided, so the actual AddComment command above could be modeled as:
{“name”: “AddComment”, “comment_text”: “This is some text”}
 

 

How to use Source: data

The simplest possible pipe parameter scenario. AddMeasurementKey produces a data field called measurement_key which we Pipe to the comment_text field on the AddComment operation.

 

To do so follow the steps below:

  1. Create a new Macro.
  2. Enter the Macro Name.
  3. Enter the Description.
  4. Enter the command Pipe Parameter in the Operation field.
  5. Enter the Parameter Source value.
  6. Enter the From Field value.
  7. Enter the To Field value.
  8. Create a new operation.
  9. Enter the command Add Comment in the Operation field.
  10. Enter the Comment Text value.

 

Figure 5: Source data Example

HTMCP Source data Example.png

 

The structure below represents the macro from the image above.

Command: PipeParameter
Values: <from_field: measurement_key> <to_field: comment_text>

Command: AddComment
Value: <comment_text: This is some text>

 

 

How to use Source: scanned_unit

The ScannedUnit produced during the scanning process has a large dataset, including an active list of unremoved attributes. Here we make use of JSON pointer syntax to access the attr_data field of the first element of the attributes array under the unit_elements root element.

 

To do so follow the steps below:

  1. Create a new Macro.
  2. Enter the Macro Name.
  3. Enter the Description.
  4. Enter the command Scan Unit in the Operation field.
  5. Enter the Unit Serial Number value.
  6. Enter the Part Number value.
  7. Enter the Quantity value.
  8. Enter the Revision value.
  9. Create a new operation.
  10. Enter the command Pipe Parameter in the Operation field.
  11. Enter the Parameter Source value.
  12. Enter the From Field value.
  13. Enter the To Field value.
  14. Create a new operation.
  15. Enter the command Add Comment in the Operation field.
  16. Enter the Comment Text value.

 

Figure 6: Source scanned_unit Example

HTMCP Source scanned unit Example.png

 

The structure below represents the macro from the image above.

Command: PipeParameter
Values: <from_field: /unit_elements/attributes/0/attr_data> <source: scanned_unit> <to_field: comment_text>

Command: AddComment
Values: <comment_text: Comment example>

 

 

How to use Source: input_parameter

Sometimes we want to pass the same value provided to one operation to a later operation in the transaction instead of prompting for a piece of data twice.  Here we piped the defect_code input parameter from the first RecordDefect call to the ref_designator field of the 2nd RecordDefect call.

 

To do so follow the steps below:

  1. Create a new Macro.
  2. Enter the Macro Name.
  3. Enter the Description.
  4. Enter the command Record Defect in the Operation field.
  5. Enter the Defect Code value.
  6. Enter the Defect Quantity value.
  7. Create a new operation.
  8. Enter the command Pipe Parameter in the Operation field.
  9. Enter the Parameter Source value.
  10. Enter the From Field value.
  11. Enter the To Field value.
  12. Create a new operation.
  13. Enter the command Record Defect in the Operation field.
  14. Enter the Defect Code value.
  15. Enter the Defect Quantity value.

 

Figure 7: Input Parameter Example

HTMCP Input Parameter Example.png

 

The structure below represents the macro from the image above.

Command: RecordDefect
Values: <defect_code: 0101> <ref_designator: N/A>

Command: PipeParameter
Values: <from_field: defect_code> <source: input_parameter> <to_field: ref_designator>

Command: RecordDefect
Values: <defect_code: 0102>

 

 

How to use Source: data_ptr

The JSON pointer version of the previous NON-PIPE operation results. The plain data source version tries very hard to identify the from_field, including iterating through various elements.  The data_ptr version allows you to explicitly identify the from_field if that is necessary. As you can see, the plain data source version is more approachable in most cases as the data_ptr usage requires explicit knowledge of the data results produced by the operation.

 

To do so follow the steps below:

  1. Create a new Macro.
  2. Enter the Macro Name.
  3. Enter the Description.
  4. Enter the command Scan Unit in the Operation field.
  5. Enter the Add Measurement Key value.
  6. Create a new operation.
  7. Enter the command Pipe Parameter in the Operation field.
  8. Enter the Parameter Source value.
  9. Enter the From Field value.
  10. Enter the To Field value.
  11. Create a new operation.
  12. Enter the command Add Comment in the Operation field.
  13. Enter the Comment Text value.

 

Figure 8: Source data_ptr Example

HTMCP Source data ptr Example.png

 

The structure below represents the macro from the image above.

Command: AddMeasurementKey

Command: PipeParameter
Values: <from_field: /0/data/measurement_key> <source: data_ptr> <to_field: comment_text>

Command: AddComment
Values: <comment_text: This is some text>

 

 

How to use ‘Piggy-Back’ Input Parameter

Sometimes we may want to propagate the results of an operation or operations executed earlier in a set of commands to operations much later in the transaction.  As soon as we need to bridge across multiple NON-PIPE operations we need to get creative.  Each operation has a known list of field names relevant to its execution as defined in the client-command-registry.  This means that any fields on that operation outside this list are effectively ignored. 

That means, we can pipe fields unrelated to an operation to a field name that operation doesn’t care about, then after executing that intermediate operation we can pipe that unrelated field further down the list of calls.  This allows us to percolate meaningful data from an earlier call all the way to the last operation in a transaction.

Note: Piggyback is an example of a ‘to_field’ that won’t collide with any field name the intermediate operation(s) might consume during execution.

 

To do so follow the steps below:

  1. Create a new Macro.
  2. Enter the Macro Name.
  3. Enter the Description.
  4. Enter the command Read Flex Field in the Operation field.
  5. Enter the Reference Table value.
  6. Enter the Reference Field value.
  7. Enter the Reference Value value.
  8. Create a new operation.
  9. Enter the command Pipe Parameter in the Operation field.
  10. Enter the Parameter Source value.
  11. Enter the From Field value.
  12. Enter the To Field value.
  13. Create a new operation.
  14. Enter the command Read Flex Field in the Operation field.
  15. Enter the Reference Table value.
  16. Enter the Reference Field value.
  17. Enter the Reference Value value.
  18. Create a new operation.
  19. Enter the command Pipe Parameter in the Operation field.
  20. Enter the Parameter Source value.
  21. Enter the From Field value.
  22. Enter the To Field value.
  23. Create a new operation.
  24. Enter the command Pipe Parameter in the Operation field.
  25. Enter the Parameter Source value.
  26. Enter the From Field value.
  27. Enter the To Field value.
  28. Create a new operation.
  29. Enter the command Add Attribute in the Operation field.
  30. Enter the Parameter Source value.
  31. Enter the From Field value.
  32. Enter the To Field value.
  33. Create a new operation.
  34. Enter the command Add Attribute in the Operation field.
  35. Enter the Attribute Name value.
  36. Enter the Attribute Value value.

 

Figure 9: ‘Piggy-Back’ Input Parameter Example

HTMCP ‘Piggy-Back’ Input Parameter Example.png

 

The structure below represents the macro from the image above.

Command: ReadFlexField
Values: <flex_field: board_label_name> <reference_field: part_number> <reference_table: part> <reference_value: ~CDIAGPART001~>

Command: PipeParameter
Values: <from_field: flex_value> <to_field: piggyback>
                                                                                 
Command: ReadFlexField
Values: <flex_field: board_algorithm> <reference_field: part_number> <reference_table: part> <reference_value: ~CDIAGPART001~>

Command: PipeParameter
Values: <from_field: piggyback> <source: input_parameter> <to_field: attr_name>                   

Command: PipeParameter
Values: <from_field: flex_value> <to_field: attr_data>

Command: AddAttribute
Values: <attribute_name: attr_name> <attribute_value: attr_data>

 

 

How to use Replace Tree Component

Find a tree component attached somewhere in the scanned unit’s component hierarchy and replace that component.

 

To do so follow the steps below:

  1. Create a new Macro.
  2. Enter the Macro Name.
  3. Enter the Description.
  4. Enter the command Pipe Parameter in the Operation field.
  5. Enter the Parameter Source value.
  6. Enter the From Field value.
  7. Enter the To Field value.
  8. Create a new operation.
  9. Enter the command Find Unit Tree Component in the Operation field.
  10. Enter the Unit Serial Number value.
  11. Enter the Component id value.
  12. Enter the Component Part Number value.
  13. Enter the Reference Designator value.
  14. Enter the Not Found Error Message value.
  15. Create a new operation.
  16. Enter the Parameter Source value.
  17. Enter the From Field value.
  18. Enter the To Field value.
  19. Create a new operation.
  20. Enter the Parameter Source value.
  21. Enter the From Field value.
  22. Enter the To Field value.
  23. Create a new operation.
  24. Enter the Replace Unit Component value.
  25. Enter the Unit Serial Number value.
  26. Enter the Old Component id value.
  27. Enter the Component id value.

 

Figure 10: Replace Tree Component Example

HTMCP Replace Tree Component Example.png

 

The structure below represents the macro from the image above.

Command: PipeParameter
Values: <from_field: /serial_number> <source: scanned_unit> <to_field: unit_serial_number>
                                                                                                                                                                                         
Command: FindUnitTreeComponent
Values: <not_found_error_message: Unable to identify component to remove>

Command: PipeParameter
Values: <from_field: parent_serial_number> <source: data> <to_field: unit_serial_number>
                                                                                                                                                                                                                
Command: PipeParameter
Values: <from_field: component_id> <source: input_parameter> <to_field: old_component_id>

Command: ReplaceUnitComponent
Values: <unit_serial_number: unit_serial_number> <old_component_id: old_component_id> <component_id: component_id>

 

 

How to render, store and record media

It is possible to render and store labels and record that information in a media file which will have an alias and a description.

 

To do so follow the steps below:

  1. Create a new Macro.
  2. Enter the Macro Name.
  3. Enter the Description.
  4. Enter the command Render Label in the Operation field.
  5. Enter the Unit Serial Number value.
  6. Enter the Label Name value.
  7. Create a new operation.
  8. Enter the command Pipe Parameter in the Operation field.
  9. Enter the Parameter Source value.
  10. Enter the From Field value.
  11. Enter the To Field value.
  12. Create a new operation.
  13. Enter the command Pipe Parameter in the Operation field.
  14. Enter the Parameter Source value.
  15. Enter the From Field value.
  16. Enter the To Field value.
  17. Create a new operation.
  18. Enter the command Pipe Parameter in the Operation field.
  19. Enter the Parameter Source value.
  20. Enter the From Field value.
  21. Enter the To Field value.
  22. Create a new operation.
  23. Enter the command Store Media in the Operation field.
  24. Enter the Original Filename value.
  25. Enter the Media Content value.
  26. Enter the Media Payload File value.
  27. Enter the Mime Type value.
  28. Enter the Media Tag value.
  29. Enter the Storage Level value.
  30. Enter the Media Description value.
  31. Enter the Media Alias value.
  32. Create a new operation.
  33. Enter the command Pipe Parameter in the Operation field.
  34. Enter the Parameter Source value.
  35. Enter the From Field value.
  36. Enter the To Field value.
  37. Create a new operation.
  38. Enter the command Record Media in the Operation field.
  39. Enter the Media Identifier(s) value.

 

 

Figure 11: Render, Store And Record Media Example

HTMCP Render, Store And Record Media Example.png

 

The structure below represents the macro from the image above.

Command: RenderLabel
Values: <label_name: le_24x_test_dup_allowed> <test_print: 0>

Command: PipeParameter
Values: <from_field: rendered_file> <source: data> <to_field: payload_file>
                            
Command: PipeParameter
Values: <from_field: content_type> <source: data> <to_field: mime_type>


Command: PipeParameter
Values: <from_field: original_filename> <source: data> <to_field: original_filename>                                                                                                                                                                                              
Command: StoreMedia
Values: <media_alias: Weir Hardness Certificate Testing> <media_description: Rendered Label> <media_tag: CPI> <storage_level: site>
          
Command: PipeParameter
Values: <from_field: identifier> <source: data> <to_field: media_identifier>
                     
Command: RecordMedia
Values: <media_identifiers: media_identifier>