Skip to end of metadata
Go to start of metadata

You are viewing an old version of this page. View the current version.

Compare with Current View Page History

« Previous Version 2 Current »

Use Case: Session Data Retrieval

Problem

As an analyst, I want to know which users have completed a session of a particular Scenario so that I can issue credit to the users relating to the associated learning module in my system-of-record.

Solution

I will use a GraphQL client to retrieve Scenario Session data from the Scope GraphQL API which is not otherwise available in the Scope CMS user interface.

Procedure

  1. The GraphiQL client application is installed and configured to communicate with the Scope GraphQL API (see “Exploring the Graph”)

  2. The following query is executed:

    query {
      node(id: "INSERT_ID_OF_SCENARIO") {
        ... on Scenario {
          sessions {
            nodes {
              id
              state
              user {
                id
                name
              }
            }
          }
        }
      }
    }
  3. The JSON response is reformatted to CSV (using any relevant tool) for merge with system-of-record data and/or reporting.

Finding Events by event and value types

This query can be used to find Scenario Session Events of one or many given types (eventTypes argument):

  • CALL_CONNECT

  • CALL_DISCONNECT

  • CHECKLIST_ITEM_COMPLETE

  • CONTINUE_SESSION

  • CREATE_SESSION

  • END_SESSION

  • ENTER_SESSION

  • EXIT_SESSION

  • FINISH_SESSION

  • SCREENSHOT_CAPTURED

  • VIEW_STEP

  • QUIZ_COMPLETE

  • QUIZ_ITEM_COMPLETE

Also, when querying for Events of the type CHECKLIST_ITEM_COMPLETE, a valueTypes argument can be passed in to specify one or many of the following:

  • PHOTO

  • NUMBER

  • BARCODE

  • YES_NO_OPTION

  • BOOLEAN

  • TEXT

  • QUIZ_MULTIPLE_CHOICE_2D

  • QUIZ_MULTIPLE_CHOICE_3D

  • MULTI_OPTION

  • MULTI_OPTION_3D

  • MULTI_SELECT

  • MULTI_SELECT_3D

  • QUIZ_MULTI_SELECT_2D

  • QUIZ_MULTI_SELECT_3D

For instance, when querying for recent Events capturing a photo upload in a checklist item step:

Variables

{
  "first": 10,
  "eventTypes": ["CHECKLIST_ITEM_COMPLETE"],
  "valueTypes": ["PHOTO"],
  "orderBy": {
    "attribute": "startedAt",
    "direction": "DESC"
  }
}

Query

query FetchRecentPhotoChecklistItemCompleteEvents(
  $first: Int,
  $eventTypes: [ScenarioSessionEventTypeEnum!],
  $valueTypes: [ScenarioStepItemTypeEnum!],
  $orderBy: SortOrderInputObject
  ) {
  scenarioSessionEvents(
    first: $first
    orderBy: $orderBy
    eventTypes: $eventTypes,
    valueTypes: $valueTypes
  ) {
  nodes {
      id
      value
      photo {
        fileUrl
      }
    }
  }
}

User and Session arguments to refine the query

In order to narrow down the results in the above sample query to a given User, a User id or username can be passed in.

Also a scenarioSessionId can be used as a filter:

Variables

{
  "first": 10,
  "eventTypes": ["CHECKLIST_ITEM_COMPLETE"],
  "valueTypes": ["PHOTO"],
  "username": "jane.doe",
  "scenarioSessionId": "sR9216ls6ww3Jp9cr4l5hpRiD8XyoEPgvT9PO--6cQC_SjkS9gitsWjSuYw1wTAf",
  "orderBy": {
    "attribute": "startedAt",
    "direction": "DESC"
  }
}

Query

query FetchRecentPhotoChecklistItemCompleteEvents(
  $first: Int,
  $eventTypes: [ScenarioSessionEventTypeEnum!],
  $valueTypes: [ScenarioStepItemTypeEnum!],
  $orderBy: SortOrderInputObject,
  $scenarioSessionId: ID
  $username: String
  ) {
  scenarioSessionEvents(
    first: $first
    orderBy: $orderBy
    eventTypes: $eventTypes,
    valueTypes: $valueTypes,
    scenarioSessionId: $scenarioSessionId,
    user: { username: $username }
  ) {
  nodes {
      id
      value
      photo {
        fileUrl
      }
    }
  }
}

  • No labels