Containers as Assets

Using RKVST to Represent Containers

Represent Containers Using RKVST

RKVST Assets can be used to track the status, contents, location, and other key attributes of containers over time. This can also be done for containers within containers. For example, you may wish to track bags inside boxes that are inside a shipping container being transported on a train.

Create a Container Asset

Creating an Asset to represent a container is the same as creating any other asset. For more detail on this process, please see our RKVST Overview guide. For this example, we will create a simple asset that we will call Shipping Container. Note that with RKVST, we could also record more complex attributes such as size of the container, weight, location, or any other important details. For now, we will create a minimal Asset that includes the name and type.

Create the Shipping Container

Note: To use the YAML Runner you will need to install the rkvst-archivist python package.

Click here for installation instructions.

---
steps:
  - step:
      action: ASSETS_CREATE_IF_NOT_EXISTS
      description: Create a shipping container asset.
      asset_label: Shipping Container 
    selector: 
      - attributes: 
        - arc_display_name
    behaviours: 
      - RecordEvidence
    proof_mechanism: SIMPLE_HASH
    attributes: 
      arc_display_name: Shipping Container
      arc_display_type: Shipping Container
    confirm: true
{
    "behaviours": ["RecordEvidence"],
    "proof_mechanism": "SIMPLE_HASH",
    "attributes": {
        "arc_display_name": "Shipping Container",
        "arc_display_type": "Shipping Container",
    }
}

Associate an Item or Container with Another Container

Now that we have created a Shipping Container Asset, we can create an Asset to represent an item or container within the Shipping Container. To do this, we will create another Asset and add a custom Asset Attribute that links it to our Shipping Container. For example, let’s create an Asset to represent a box that is being transported within the Shipping Container.

Note: For this example, we used the custom attribute within_container, but you could use any key to associate the Assets that does not contain the reserved ‘arc_’ prefix.
Create the Box
Add an Extended Attribute

Note: To use the YAML Runner you will need to install the rkvst-archivist python package.

Click here for installation instructions.

---
steps:
  - step:
      action: ASSETS_CREATE_IF_NOT_EXISTS
      description: Create a box asset and associate with Shipping Container.
      asset_label: Box 
    selector: 
      - attributes: 
        - arc_display_name
    behaviours: 
      - RecordEvidence
    proof_mechanism: SIMPLE_HASH
    attributes: 
      arc_display_name: Box
      arc_display_type: Box
      within_container: Shipping Container
    confirm: true
{
    "behaviours": ["RecordEvidence"],
    "proof_mechanism": "SIMPLE_HASH",
    "attributes": {
        "arc_display_name": "Box",
        "arc_display_type": "Box",
        "within_container": "Shipping Container",
    }
}

It is now recorded that there is a Box within the container Shipping Container. We repeat this process to create another Asset and record what was inside the Box.

List All Assets Asssociated with a Container

To retrieve all Assets associated with a container, you can run a query with a filter that will identify which Assets have the attribute within_container set to the desired value. To list all Assets inside of Shipping Container:

Go to the Audit/Filter page and filter the Assets and Events within your tenancy.

Filter Assets and Events

Note: To use the YAML Runner you will need to install the rkvst-archivist python package.

Click here for installation instructions.

---
steps:
  - step:
      action: ASSETS_LIST
      description: List all assets within Shipping Container.
      print_response: true
    attrs:
      within_container: Shipping Container

See instructions for creating your BEARER_TOKEN_FILE here.

curl -g -v -X GET \
     -H "@$BEARER_TOKEN_FILE" \
     "https://app.rkvst.io/archivist/v2/assets?attributes.within_container=Shipping%20Container"

Edit this page on GitHub