asyncapi: 3.0.0
info:
  title: Analytics Platform - Analytics Events
  version: 0.0.1
  description: |
    This AsyncAPI document describes analytics and tracking events related to the Analytics Platform application.
    These events are primarily used to analyze the use and development of the Analytics Platform.
    Essentially, certain log information from the Apache Superset analysis tool is used for this purpose. 
  contact:
    name: Team-PPD-Business-Objects
    email: team-businessobjects@d-velop.de

servers:
  dap_cdp:
    host: cdp.prod.dap.d-velop.cloud
    protocol: https
    description: Server endpoint for publishing analytics events to the d.velop Analytics Platform (DAP)

channels:
  analytics:
    description: Channel used for emitting analytics events, such as application subscription updates
    messages:
      ChartCreated: 
          $ref: '#/components/messages/ChartCreated'
      ChartDataLoaded:
          $ref: '#/components/messages/ChartDataLoaded'
      ChartUpdated:
          $ref: '#/components/messages/ChartUpdated'
      ChartDeleted:
          $ref: '#/components/messages/ChartDeleted'
      DashboardCreated:
          $ref: '#/components/messages/DashboardCreated'
      DashboardViewed:
          $ref: '#/components/messages/DashboardViewed'
      DashboardUpdated:
          $ref: '#/components/messages/DashboardUpdated'
      DashboardDeleted:
          $ref: '#/components/messages/DashboardDeleted'
      ChartFavorited:
          $ref: '#/components/messages/ChartFavorited'
      ChartUnfavorited:
          $ref: '#/components/messages/ChartUnfavorited'
      DashboardFavorited:
          $ref: '#/components/messages/DashboardFavorited'
      DashboardUnfavorited:
          $ref: '#/components/messages/DashboardUnfavorited'
      DatasetDeleted:
          $ref: '#/components/messages/DatasetDeleted'
      DatasetCreated:
          $ref: '#/components/messages/DatasetCreated'
      SavedQueryCreated:
          $ref: '#/components/messages/SavedQueryCreated'
      SqlLabQueryExecutionSucceeded:
          $ref: '#/components/messages/SqlLabQueryExecutionSucceeded'
      SqlLabQueryExecutionFailed:
          $ref: '#/components/messages/SqlLabQueryExecutionFailed'
    servers:
      - $ref: '#/servers/dap_cdp'

operations:
  sendChartCreated:
    action: send
    channel:
      $ref: '#/channels/analytics'
    messages:
      - $ref: '#/channels/analytics/messages/ChartCreated'
    description: |
      Publishes a `ChartCreated` event to the analytics channel, indicating that a user has created a chart in Superset.
  sendChartDataLoaded:
    action: send
    channel:
      $ref: '#/channels/analytics'
    messages:
      - $ref: '#/channels/analytics/messages/ChartDataLoaded'
    description: |
      Publishes a `ChartDataLoaded` event to the analytics channel, indicating that the data for a chart has been loaded.
  sendChartUpdated:
    action: send
    channel:
      $ref: '#/channels/analytics'
    messages:
      - $ref: '#/channels/analytics/messages/ChartUpdated'
    description: |
      Publishes a `ChartUpdated` event to the analytics channel, indicating that a user has updated a chart in Superset.
  sendChartDeleted:
    action: send
    channel:
      $ref: '#/channels/analytics'
    messages:
      - $ref: '#/channels/analytics/messages/ChartDeleted'
    description: |
      Publishes a `ChartDeleted` event to the analytics channel, indicating that a user has deleted a chart in Superset.
  sendDashboardCreated:
    action: send
    channel:
      $ref: '#/channels/analytics'
    messages:
      - $ref: '#/channels/analytics/messages/DashboardCreated'
    description: |
      Publishes a `DashboardCreated` event to the analytics channel, indicating that a user has created a dashboard in Superset.
  sendDashboardViewed:
    action: send
    channel:
      $ref: '#/channels/analytics'
    messages:
      - $ref: '#/channels/analytics/messages/DashboardViewed'
    description: |
      Publishes a `DashboardViewed` event to the analytics channel, indicating that a user has viewed a dashboard in Superset.
  sendDashboardUpdated:
    action: send
    channel:
      $ref: '#/channels/analytics'
    messages:
      - $ref: '#/channels/analytics/messages/DashboardUpdated'
    description: |
      Publishes a `DashboardUpdated` event to the analytics channel, indicating that a user has updated a dashboard in Superset.
  sendDashboardDeleted:
    action: send
    channel:
      $ref: '#/channels/analytics'
    messages:
      - $ref: '#/channels/analytics/messages/DashboardDeleted'
    description: |
      Publishes a `DashboardDeleted` event to the analytics channel, indicating that a user has deleted a dashboard in Superset.
  sendChartFavorited:
    action: send
    channel:
      $ref: '#/channels/analytics'
    messages:
      - $ref: '#/channels/analytics/messages/ChartFavorited'
    description: |
      Publishes a `ChartFavorited` event to the analytics channel, indicating that a user has favorited a chart in Superset.
  sendChartUnfavorited:
    action: send
    channel:
      $ref: '#/channels/analytics'
    messages:
      - $ref: '#/channels/analytics/messages/ChartUnfavorited'
    description: |
      Publishes a `ChartUnfavorited` event to the analytics channel, indicating that a user has unfavorited a chart in Superset.
  sendDashboardFavorited:
    action: send
    channel:
      $ref: '#/channels/analytics'
    messages:
      - $ref: '#/channels/analytics/messages/DashboardFavorited'
    description: |
      Publishes a `DashboardFavorited` event to the analytics channel, indicating that a user has favorited a dashboard in Superset.
  sendDashboardUnfavorited:
    action: send
    channel:
      $ref: '#/channels/analytics'
    messages:
      - $ref: '#/channels/analytics/messages/DashboardUnfavorited'
    description: |
      Publishes a `DashboardUnfavorited` event to the analytics channel, indicating that a user has unfavorited a dashboard in Superset.
  sendDatasetDeleted:
    action: send
    channel:
      $ref: '#/channels/analytics'
    messages:
      - $ref: '#/channels/analytics/messages/DatasetDeleted'
    description: |
      Publishes a `DatasetDeleted` event to the analytics channel, indicating that a user has deleted a dataset in Superset.
  sendDatasetCreated:
    action: send
    channel:
      $ref: '#/channels/analytics'
    messages:
      - $ref: '#/channels/analytics/messages/DatasetCreated'
    description: |
      Publishes a `DatasetCreated` event to the analytics channel, indicating that a user has created a dataset in Superset.
  sendSavedQueryCreated:
    action: send
    channel:
      $ref: '#/channels/analytics'
    messages:
      - $ref: '#/channels/analytics/messages/SavedQueryCreated'
    description: |
      Publishes a `SavedQueryCreated` event to the analytics channel, indicating that a user has created a saved query in Superset.
  sendSqlLabQueryExecutionSucceeded:
    action: send
    channel:
      $ref: '#/channels/analytics'
    messages:
      - $ref: '#/channels/analytics/messages/SqlLabQueryExecutionSucceeded'
    description: |
      Publishes a `SqlLabQueryExecutionSucceeded` event to the analytics channel, indicating that a user has successfully executed a SQL Lab query in Superset.
  sendSqlLabQueryExecutionFailed:
    action: send
    channel:
      $ref: '#/channels/analytics'
    messages:
      - $ref: '#/channels/analytics/messages/SqlLabQueryExecutionFailed'
    description: |
      Publishes a `SqlLabQueryExecutionFailed` event to the analytics channel, indicating that a user has failed to execute a SQL Lab query in Superset.

components:
  messages:
    ChartCreated:
      name: ChartCreated
      title: Chart Created Event
      summary: Indicates that a user has created a chart in Superset
      contentType: application/json
      payload:
        $ref: '#/components/schemas/ChartCreatedPayload'
    ChartDataLoaded:
      name: ChartDataLoaded
      title: Chart Data Loaded Event
      summary: Indicates that the data for a chart has been loaded
      contentType: application/json
      payload:
        $ref: '#/components/schemas/ChartDataLoadedPayload'
    ChartUpdated:
      name: ChartUpdated
      title: Chart Updated Event
      summary: Indicates that a user has updated a chart in Superset
      contentType: application/json
      payload:
        $ref: '#/components/schemas/ChartUpdatedPayload'
    ChartDeleted:
      name: ChartDeleted
      title: Chart Deleted Event
      summary: Indicates that a user has deleted a chart in Superset
      contentType: application/json
      payload:
        $ref: '#/components/schemas/ChartDeletedPayload'
    DashboardCreated:
      name: DashboardCreated
      title: Dashboard Created Event
      summary: Indicates that a user has created a dashboard in Superset
      contentType: application/json
      payload:
        $ref: '#/components/schemas/DashboardCreatedPayload'
    DashboardViewed:
      name: DashboardViewed
      title: Dashboard Viewed Event
      summary: Indicates that a user has viewed a dashboard in Superset
      contentType: application/json
      payload:
        $ref: '#/components/schemas/DashboardViewedPayload'
    DashboardUpdated:
      name: DashboardUpdated
      title: Dashboard Updated Event
      summary: Indicates that a user has updated a dashboard in Superset
      contentType: application/json
      payload:
        $ref: '#/components/schemas/DashboardUpdatedPayload'
    DashboardDeleted:
      name: DashboardDeleted
      title: Dashboard Deleted Event
      summary: Indicates that a user has deleted a dashboard in Superset
      contentType: application/json
      payload:
        $ref: '#/components/schemas/DashboardDeletedPayload'
    ChartFavorited:
      name: ChartFavorited
      title: Chart Favorited Event
      summary: Indicates that a user has favorited a chart in Superset
      contentType: application/json
      payload:
        $ref: '#/components/schemas/ChartFavoritedPayload'
    ChartUnfavorited:
      name: ChartUnfavorited
      title: Chart Unfavorited Event
      summary: Indicates that a user has unfavorited a chart in Superset
      contentType: application/json
      payload:
        $ref: '#/components/schemas/ChartUnfavoritedPayload'
    DashboardFavorited:
      name: DashboardFavorited
      title: Dashboard Favorited Event
      summary: Indicates that a user has favorited a dashboard in Superset
      contentType: application/json
      payload:
        $ref: '#/components/schemas/DashboardFavoritedPayload'
    DashboardUnfavorited:
      name: DashboardUnfavorited
      title: Dashboard Unfavorited Event
      summary: Indicates that a user has unfavorited a dashboard in Superset
      contentType: application/json
      payload:
        $ref: '#/components/schemas/DashboardUnfavoritedPayload'
    DatasetDeleted:
      name: DatasetDeleted
      title: Dataset Deleted Event
      summary: Indicates that a user has deleted a dataset in Superset
      contentType: application/json
      payload:
        $ref: '#/components/schemas/DatasetDeletedPayload'
    DatasetCreated:
      name: DatasetCreated
      title: Dataset Created Event
      summary: Indicates that a user has created a dataset in Superset
      contentType: application/json
      payload:
        $ref: '#/components/schemas/DatasetCreatedPayload'
    SavedQueryCreated:
      name: SavedQueryCreated
      title: Saved Query Created Event
      summary: Indicates that a user has created a saved query in Superset
      contentType: application/json
      payload:
        $ref: '#/components/schemas/SavedQueryCreatedPayload'
    SqlLabQueryExecutionSucceeded:
      name: SqlLabQueryExecutionSucceeded
      title: SQL Lab Query Execution Succeeded Event
      summary: Indicates that a user has successfully executed a SQL Lab query in Superset
      contentType: application/json
      payload:
        $ref: '#/components/schemas/SqlLabQueryExecutionSucceededPayload'
    SqlLabQueryExecutionFailed:
      name: SqlLabQueryExecutionFailed
      title: SQL Lab Query Execution Failed Event
      summary: Indicates that a user has failed to execute a SQL Lab query in Superset
      contentType: application/json
      payload:
        $ref: '#/components/schemas/SqlLabQueryExecutionFailedPayload'
    

  schemas:
    ChartCreatedPayload:
      allOf:
        - $ref: 'https://eventcatalog.event-catalog.int.otc.fts.d-3.de/schemas/analytics-track.yaml#/TrackEvent'
        - type: object
          title: Specific event properties
          properties:
            event:
              const: "ChartCreated"
    ChartDataLoadedPayload:
      allOf:
        - $ref: 'https://eventcatalog.event-catalog.int.otc.fts.d-3.de/schemas/analytics-track.yaml#/TrackEvent'
        - type: object
          title: Specific event properties
          properties:
            event:
              const: "ChartDataLoaded"
            properties:
              type: object
              properties: 
                chartId:
                  type: integer
                  format: int64
                  description: Unique identifier of the chart in Superset.
                  example: 42
                vizType:
                  type: string
                  description: Type of visualization (e.g., bar, line, pie) used in the chart.
                  example: "table"
                dashboardId:
                  type: integer
                  format: int64
                  description: Unique identifier of the dashboard in Superset.
                  example: 7
    ChartUpdatedPayload:
      allOf:
        - $ref: 'https://eventcatalog.event-catalog.int.otc.fts.d-3.de/schemas/analytics-track.yaml#/TrackEvent'
        - type: object
          title: Specific event properties
          properties:
            event:
              const: "ChartUpdated"
            properties:
              type: object
              properties:
                chartId:
                  type: integer
                  format: int64
                  description: Unique identifier of the chart in Superset.
                  example: 42
    ChartDeletedPayload:
      allOf:
        - $ref: 'https://eventcatalog.event-catalog.int.otc.fts.d-3.de/schemas/analytics-track.yaml#/TrackEvent'
        - type: object
          title: Specific event properties
          properties:
            event:
              const: "ChartDeleted"
            properties:
              type: object
              properties: 
                chartId:
                  type: integer
                  format: int64
                  description: Unique identifier of the chart in Superset.
                  example: 42
    DashboardCreatedPayload:
      allOf:
        - $ref: 'https://eventcatalog.event-catalog.int.otc.fts.d-3.de/schemas/analytics-track.yaml#/TrackEvent'
        - type: object
          title: Specific event properties
          properties:
            event:
              const: "DashboardCreated"
            properties:
              type: object
              properties:
                dashboardId:
                  type: integer
                  format: int64
                  description: Unique identifier of the dashboard in Superset.
                  example: 7
    DashboardViewedPayload:
      allOf:
        - $ref: 'https://eventcatalog.event-catalog.int.otc.fts.d-3.de/schemas/analytics-track.yaml#/TrackEvent'
        - type: object
          title: Specific event properties
          properties:
            event:
              const: "DashboardViewed"
            properties:
              type: object
              properties:
                dashboardId:
                  type: integer
                  format: int64
                  description: Unique identifier of the dashboard in Superset.
                  example: 7
    DashboardUpdatedPayload:
      allOf:
        - $ref: 'https://eventcatalog.event-catalog.int.otc.fts.d-3.de/schemas/analytics-track.yaml#/TrackEvent'
        - type: object
          title: Specific event properties
          properties:
            event:
              const: "DashboardUpdated"
            properties:
              type: object
              properties:
                dashboardId:
                  type: integer
                  format: int64
                  description: Unique identifier of the dashboard in Superset.
                  example: 7
    DashboardDeletedPayload:
      allOf:
        - $ref: 'https://eventcatalog.event-catalog.int.otc.fts.d-3.de/schemas/analytics-track.yaml#/TrackEvent'
        - type: object
          title: Specific event properties
          properties:
            event:
              const: "DashboardDeleted"
            properties:
              type: object
              properties:
                dashboardId:
                  type: integer
                  format: int64
                  description: Unique identifier of the dashboard in Superset.
                  example: 7
    ChartFavoritedPayload:
      allOf:
        - $ref: 'https://eventcatalog.event-catalog.int.otc.fts.d-3.de/schemas/analytics-track.yaml#/TrackEvent'
        - type: object
          title: Specific event properties
          properties:
            event:
              const: "ChartFavorited"
            properties:
              type: object
              properties:
                chartId:
                  type: integer
                  format: int64
                  description: Unique identifier of the chart in Superset.
                  example: 333
    ChartUnfavoritedPayload:
      allOf:
        - $ref: 'https://eventcatalog.event-catalog.int.otc.fts.d-3.de/schemas/analytics-track.yaml#/TrackEvent'
        - type: object
          title: Specific event properties
          properties:
            event:
              const: "ChartUnfavorited"
            properties:
              type: object
              properties:
                chartId:
                  type: integer
                  format: int64
                  description: Unique identifier of the chart in Superset.
                  example: 42
    DashboardFavoritedPayload:
      allOf:
        - $ref: 'https://eventcatalog.event-catalog.int.otc.fts.d-3.de/schemas/analytics-track.yaml#/TrackEvent'
        - type: object
          title: Specific event properties
          properties:
            event:
              const: "DashboardFavorited"
            properties:
              type: object
              properties:
                dashboardId:
                  type: integer
                  format: int64
                  description: Unique identifier of the dashboard in Superset.
                  example: 7
    DashboardUnfavoritedPayload:
      allOf:
        - $ref: 'https://eventcatalog.event-catalog.int.otc.fts.d-3.de/schemas/analytics-track.yaml#/TrackEvent'
        - type: object
          title: Specific event properties
          properties:
            event:
              const: "DashboardUnfavorited"
            properties:
              type: object
              properties:
                dashboardId:
                  type: integer
                  format: int64
                  description: Unique identifier of the dashboard in Superset.
                  example: 7
    DatasetDeletedPayload:
      allOf:
        - $ref: 'https://eventcatalog.event-catalog.int.otc.fts.d-3.de/schemas/analytics-track.yaml#/TrackEvent'
        - type: object
          title: Specific event properties
          properties:
            event:
              const: "DatasetDeleted"
    DatasetCreatedPayload:
      allOf:
        - $ref: 'https://eventcatalog.event-catalog.int.otc.fts.d-3.de/schemas/analytics-track.yaml#/TrackEvent'
        - type: object
          title: Specific event properties
          properties:
            event:
              const: "DatasetCreated"
    SavedQueryCreatedPayload:
      allOf:
        - $ref: 'https://eventcatalog.event-catalog.int.otc.fts.d-3.de/schemas/analytics-track.yaml#/TrackEvent'
        - type: object
          title: Specific event properties
          properties:
            event:
              const: "SavedQueryCreated"
    SqlLabQueryExecutionSucceededPayload:
      allOf:
        - $ref: 'https://eventcatalog.event-catalog.int.otc.fts.d-3.de/schemas/analytics-track.yaml#/TrackEvent'
        - type: object
          title: Specific event properties
          properties:
            event:
              const: "SqlLabQueryExecutionSucceeded"
            properties:
              type: object
              properties:
                dashboardId:
                  type: integer
                  format: int64
                  description: Unique identifier of the dashboard in Superset.
                  example: 12
    SqlLabQueryExecutionFailedPayload:
      allOf:
        - $ref: 'https://eventcatalog.event-catalog.int.otc.fts.d-3.de/schemas/analytics-track.yaml#/TrackEvent'
        - type: object
          title: Specific event properties
          properties:
            event:
              const: "SqlLabQueryExecutionFailed"