Skip to content

Mask & Prune

The Mask & Prune feature in our platform offers a simplified and flexible way to transform data before sending it to the Fitness Engine. With Mask & Prune, you can efficiently manage sensitive or unnecessary information, ensuring that only relevant data is used to generate Fitness Signals.

Mask

The Mask functionality allows you to conceal specific fields without permanently deleting them from the data. This is particularly useful for safeguarding sensitive information that you do not want to expose to the Fitness Engine. By configuring the "mask" array within the Fitness Sensors, you can easily define which fields or objects to mask.

Configuration

The "mask" value comprises two components: a Separator and a Path

  • Separator: The first character serves as the delimiter for the remaining values. Posible values are: $, ., #, _
  • Path: Represents the target field's path that needs to be masked. Whether it's a simple field or a nested object, you have the flexibility to apply masking as needed.
mask:
  - .<mapping-for-value>
  - .<mapping>.<for>.<value2> # Nested mapping

Example

Lets configure a Fitness Sensor that pulls information from different users and we want to mask the location and area id of the user.

kind: FitnessSensor
apiVersion: fitness.orcasio.com/v1alpha3
metadata:
  name: user-api-cron
  namespace: sample
spec:
  sensor: sensor://fitness.orcasio.net/http
  source: sample-api
  enabled: false
  trigger:
    name: cron
    cron:
      schedule: "0/15 * * * * *"
  data:
    host: https://sample.net
    verb: GET
    pathPrefix: api
    mask:
      - .location
      - .area.id
    endpoints:
      - name: "user-info"
        queryPath: "users"

Lets say that the data it pulls from the api is the following:

{
  "username": "jsmith@sample.com",
  "name": "John Smith",
  "location": "USA",
  "area": {
    "id": 123456789,
    "name": "IT"
  }
}

The end result after masking the data will be somethink like this:

{
  "username": "jsmith@sample.com",
  "name": "John Smith",
  "location": "**A*S",
  "area": {
    "id": "*2**5**9*",
    "name": "IT"
  }
}

Prune

The Prune feature, on the other hand, enables you to remove entire fields or objects from the data collected by the FitnessSensor. This comes in handy when certain data elements are not necessary for generating Fitness Signals or when you want to reduce the data size sent to the Fitness Engine. Like Mask, you can configure the "prune" array within the Fitness Sensors to specify which fields or objects to remove.

Configuration

The "prune" value also consists of a Separator and a Path, allowing you to precisely target the data elements to be pruned.

  • Separator: The first character serves as the delimiter for the remaining values. Posible values are: $, ., #, _
  • Path: Represents the target field's path that needs to be pruned. Whether it's a simple field or a nested object, you have the flexibility to apply masking as needed.
prune:
  - .<mapping-for-value>
  - .<mapping>.<for>.<value2> # Nested mapping

Example

Lets configure a Fitness Sensor that pulls information from different users and we want to prune the location and area id of the user.

kind: FitnessSensor
apiVersion: fitness.orcasio.com/v1alpha3
metadata:
  name: user-api-cron
  namespace: sample
spec:
  sensor: sensor://fitness.orcasio.net/http
  source: sample-api
  enabled: false
  trigger:
    name: cron
    cron:
      schedule: "0/15 * * * * *"
  data:
    host: https://sample.net
    verb: GET
    pathPrefix: api
    prune:
      - .location
      - .area.id
    endpoints:
      - name: "user-info"
        queryPath: "users"

Lets say that the data it pulls from the api is the following:

{
  "username": "jsmith@sample.com",
  "name": "John Smith",
  "location": "USA",
  "area": {
    "id": 123456789,
    "name": "IT"
  }
}

The end result after pruning the data will be:

{
  "username": "jsmith@sample.com",
  "name": "John Smith",
  "area": {
    "name": "IT"
  }
}