Filter By Observations

Filter content by observation(s) in your Graphlit project.

As content is processed through the configured workflow, Graphlit observes entities such as labels, categories, persons or organizations in the text of your documents, the transcripts of your audio or video files, or even within images.

We call these observations of observables (i.e. observed entities).

You can filter for content which has observed one or more entities, such as a specific person and label and organization. These queries leverage the knowledge graph to find connections between these observed entities and across your content.

Filter By Category

In this example, we will query for the observed categories in the knowledge graph, which contain the word Phone.

Query Categories

Query:

query QueryCategories($filter: CategoryFilter!) {
  categories(filter: $filter) {
    results {
      id
      name
    }
  }
}

Variables:

{
  "filter": {
    "name": "Phone",
    "offset": 0,
    "limit": 100
  }
}

Response:

{
  "results": [
    {
      "id": "a3edf984-9e28-4629-b1e4-c0d35c8e4f8a",
      "name": "Phone Number"
    }
  ]
}

Then, by specifying the observations field in the GraphQL content filter object, you can filter your content by this category. (You can provide one or more observations in the array.)

For the observation, you will specify the observableType field as CATEGORY and the observable reference, which takes the ID of the category above.

In the observations field of the GraphQL response, you will find a list of occurrences, which specific the type and location where the category was found.

In this case, it was found multiple times, across multiple pages, of this document. Each occurrence contains a confidence score (between 0.0 and 1.0) of how confident the AI was in observing this entity.

Query Contents

Query:

query QueryContents($filter: ContentFilter!) {
  contents(filter: $filter) {
    results {
      id
      name
      creationDate
      state
      owner {
        id
      }
      originalDate
      finishedDate
      workflowDuration
      uri
      text
      type
      fileType
      mimeType
      fileName
      fileSize
      masterUri
      mezzanineUri
      transcriptUri
      observations {
        id
        observableType
        observable {
          id
          name
        }
        occurrences {
          occurrenceType
          confidence
          startTime
          endTime
          pageIndex
          boundingBox {
            left
            top
            width
            height
          }
        }
      }
    }
  }
}

Variables:

{
  "filter": {
    "observations": [
      {
        "observableType": "CATEGORY",
        "observable": {
          "id": "a3edf984-9e28-4629-b1e4-c0d35c8e4f8a"
        }
      }
    ],
    "queryType": "SIMPLE",
    "searchType": "VECTOR",
    "offset": 0,
    "limit": 100
  }
}

Response:

{
  "results": [
    {
      "type": "FILE",
      "originalDate": "2015-12-03T20:01:00Z",
      "mimeType": "application/vnd.openxmlformats-officedocument.wordprocessingml.document",
      "fileType": "DOCUMENT",
      "fileName": "Test Credit Card Account Numbers.docx",
      "fileSize": 20506,
      "masterUri": "https://graphlit20230804f85c04ec.blob.core.windows.net/files/f80b07d9-540c-490a-9c10-04c8b28f11bd/Test%20Credit%20Card%20Account%20Numbers.docx",
      "mezzanineUri": "https://graphlit20230804f85c04ec.blob.core.windows.net/files/f80b07d9-540c-490a-9c10-04c8b28f11bd/Mezzanine/Test%20Credit%20Card%20Account%20Numbers.json",
      "observations": [
        {
          "observableType": "CATEGORY",
          "observable": {
            "name": "Phone Number",
            "id": "a3edf984-9e28-4629-b1e4-c0d35c8e4f8a"
          },
          "occurrences": [
            {
              "occurrenceType": "TEXT",
              "confidence": 0.8,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.8,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.8,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.8,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.8,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.8,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.8,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.8,
              "pageIndex": 0
            }
          ],
          "id": "0702f4f0-eaa5-4c2b-912f-54920832dadd"
        },
        {
          "observableType": "CATEGORY",
          "observable": {
            "name": "Credit Card Number",
            "id": "c8857e63-eb66-4b70-a495-e51822a669df"
          },
          "occurrences": [
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            }
          ],
          "id": "dfc5271e-af65-4f50-97de-8b96c83dd8b4"
        },
        {
          "observableType": "CATEGORY",
          "observable": {
            "name": "EU Debit Card Number",
            "id": "dfaa31ad-f1e1-4a18-9b12-d17c22575dd1"
          },
          "occurrences": [
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            },
            {
              "occurrenceType": "TEXT",
              "confidence": 0.85,
              "pageIndex": 0
            }
          ],
          "id": "06e75569-bd66-4b51-8678-a27c09694c69"
        }
      ],
      "uri": "redacted",
      "id": "f80b07d9-540c-490a-9c10-04c8b28f11bd",
      "name": "Test Credit Card Account Numbers",
      "state": "FINISHED",
      "creationDate": "2023-08-04T03:36:21Z",
      "finishedDate": "2023-08-04T03:36:36Z",
      "workflowDuration": "PT14.6647643S",
      "owner": {
        "id": "ad8154c6-bd6c-4782-a689-d1cd4ffb0693"
      }
    }
  ]
}

Last updated