Applications - Events
  • 22 Dec 2023
  • 2 Minutes to read
  • Dark
    Light

Applications - Events

  • Dark
    Light

Article summary

The Application Events endpoint returns records of changes that have occurred related to the given application.

Application Event Object

Field

Example

Definition

application_id
string

"di71rG94"

The ID of the requested application.

event_id
string

"tHAV32G"

The unique ID of the given event record.

type
string

"application_replay"

The type of event. See below for supported application event types.

message
string

"test_user@cogniac.co replayed 10 subject-media from subject cat in application di71rG94. 45 consensus subject-media skipped."

A brief message describing the event.

event_data
string

"{"user_id": "test_user@cogniac.co", "replayed": 10, "skipped": 45, "limit": 10.0, "validation_only": false, "force_feedback": true, "subject_uid": "cat", "replay_order": "random", "probability_upper": 1.0, "probability_lower": 0.0}"

Raw data for the event as a JSON-encoded string.

created_at
unix timestamp

1234567890

The timestamp of the event.

Application Event Types

The following application event types are tracked and returned:

application_config_change - An application has been created, updated, or deleted.

model_trained - A new model was trained for this application.

model_released - A new, best-performing model has been released for this application.

application_replay - A user has replayed media through this application.

application_feedback_purged - A user has purged the pending feedback requests for this application.

Retrieving Application Events

The application events endpoint accepts various query filters:

Argument

Example

Description

start
unix timestamp

1234567890

(optional)
 Earliest timestamp of events to query; defaults to 0.

end
unix timestamp

1234567890

(optional)
 Latest timestamp of events to query; defaults to current timestamp.

event_types
array

["application_config_change", "application_model_released"]

(optional)
 List of event types to query, defaults to None (returns all events).

limit
integer

10

(optional)
 Max number of events to return per page; defaults to no limit.

GET /1/applications/{app_id}/events
Host: https://api.cogniac.io

Example: Retrieve Application Events

curl -X GET https://api.cogniac.io/1/applications/di71rG94/events?limit=10&reverse=true \
-H "Authorization: Bearer abcdefg.hijklmnop.qrstuvwxyz" \
import requests
import json
my_headers = {"Authorization":"Bearer abcdefg.hijklmnop.qrstuvwxyz"}

resp = requests.get("https://api.cogniac.io/1/applications/di71rG94/events?limit=10&reverse=true",
                     headers=my_headers)

if resp.status_code == 200:
    formatted_json = json.dumps(resp.json(), indent=2)
    print(formatted_json)
else:
    print(f"Error: {resp.status_code}")
    print(resp.content)
{
    "data": [
        {
            "application_id": "di71rG94",
            "created_at": 1514933657.972397,
            "event_data": "...",
            "event_id": "ey3y05ES",
            "message": "other_user@cogniac.co\nchanged active from true to false",
            "type": "application_config_change"
        },
        {
            "application_id": "di71rG94",
            "created_at": 1514929197.486502,
            "event_data": "{\"user_id\": \"test_user@cogniac.co\", \"replayed\": 10, \"skipped\": 45, \"limit\": 10.0, \"validation_only\": false, \"force_feedback\": true, \"subject_uid\": \"cat\", \"replay_order\": \"random\", \"probability_upper\": 1.0, \"probability_lower\": 0.0}",
            "event_id": "88Oh2jGn",
            "message": "test_user@cogniac.co replayed 10 subject-media from subject cat in application di71rG94. 45 consensus subject-media skipped.",
            "type": "application_replay"
        },
        {
            "application_id": "di71rG94",
            "created_at": 1514927486.350218,
            "event_data": "{\"model_uri\": \"s3://cogniac-models/InitialModel_di71rG94_Gnno00.tgz\", \"model_id\": \"InitialModel_di71rG94_Gnno00.tgz\", \"timestamp\": 1514927486.1633, \"validation_data_size\": 0, \"app_id\": \"di71rG94\", \"validation_media_focus_size\": 0, \"output_subjects\": [\"cat\"], \"type\": \"detection_fullframe\", \"release_metrics\": \"best_F1\"}",
            "event_id": "xlYTLS4B",
            "message": "model_id InitialModel_di71rG94_Gnno00.tgz, validation_media_focus_size 0",
            "type": "model_release"
        },
        {
            "application_id": "di71rG94",
            "created_at": 1514927479.842088,
            "event_data": "...",
            "event_id": "WaOXPMRX",
            "message": "test_user@cogniac.co\nchanged active from false to true",
            "type": "application_config_change"
        },
    ...
  ]
}


Was this article helpful?