Introduction

Before you begin, we recommend perusing the DeepAffex Developer Guide so that you have a basic understanding of NuraLogix's DeepAffex technologies and terminologies. Please be sure to read the first two chapters - Introduction and Getting Started.

The Web Measurement Service is designed for a simple use-case, explained in the scenario described below.

Scenario overview and concepts

The user visits your website hosting a single-page application (called "app" hereafter).

In the field, the app (which you develop) will manage:

  • user authentication
  • user consent
  • collecting subject's profile information and
  • collecting answers to subject's medical history questionnaire
  • obtaining a token and a refresh token from the DeepAffex API

Then, the app will redirect the user to WMS with the profile information that is necessary to take a measurement. On WMS, the user will complete a measurement and then WMS will redirect the user back to the app with the results of the measurement.

Information will be passed from the app to WMS through a specially crafted URL (the "call-in" URL). Since this URL will contain personal information, it will be encrypted so that only a specially configured WMS will be able to read the information. Additionally, for the app to link the measurements results to the user's profile, a unique Partner ID will also be passed along with the user profile details to WMS.

The measurement results will be passed back via a preconfigured "callback" URL.

Measurement Flow

The details of the measurement flow described above are captured in the following diagram.

sequenceDiagram
    autonumber
    participant TPAPI as Third-party Cloud
    participant APP as Third-party app
    participant WMS as Web Measurement Service
    participant DFX as DeepAffex API

    APP->>+TPAPI: Request short-lived DFX_AUTH_TOKEN
    TPAPI->>+DFX: Request short-lived DFX_AUTH_TOKEN
    DFX-->>-TPAPI: Issue short-lived DFX_AUTH_TOKEN & DFX_REFRESH_TOKEN
    TPAPI-->>-APP: Return short-lived DFX_AUTH_TOKEN & DFX_REFRESH_TOKEN

    Note over APP: PROFILE_DATA { "identifier": [PartnerID], "height": 175, "weight": 75, ... }
    APP->>APP: Generate SESSION_ID
    APP->>APP: Encrypt PROFILE_DATA with public key and construct WMS URL

    Note over APP,WMS: WMS_URL: https://awe.na-east.nuralogix.ai/c/[CONFIG_ID]/[PROFILE_DATA]/[DFX_AUTH_TOKEN]/[DFX_REFRESH_TOKEN]/[SESSION_ID]
    APP->>WMS: Call WMS at WMS_URL
    WMS->>WMS: Decrypt PROFILE_DATA with private key
    WMS->>DFX: Forward DFX_AUTH_TOKEN & DFX_REFRESH_TOKEN

    loop Until measurement is successful
        WMS->>DFX: Create Measurement
        DFX-->>WMS: Return MeasurementID
        WMS->>DFX: Subscribe Results
        activate DFX
        loop Until all payloads are sent
            WMS-)DFX: Add Data
            DFX--)WMS: Send Results
        end
        deactivate DFX
    end

    WMS-->>APP: Send MeasurementID and Results back through CALLBACK_URL (SESSION_ID in Results)
    Note over WMS,APP: https://thirdparty.com/example/measurementComplete?ai.nuralogix.nura.results=<<base64encoded>>

(Click here to open a larger version of this diagram in a new window)