Model

Events

Events in Gigantic track user activities and system operations throughout the platform. They provide an audit trail of actions performed within models, projects, and organizations, and serve as the foundation for the notification system in the UI.

Purpose and Usage

Events are used for several key purposes:

  • Audit Trail: Track all user actions for compliance and historical reference
  • Notifications: Power the real-time notification system in the user interface
  • Activity Monitoring: Monitor user and system activity across the platform
  • Operational Insights: Provide insights into system usage and performance

Event Model Structure

The events are stored in MongoDB with the following structure:

FieldTypeDescription
idObjectIdUnique identifier for the event
userObjectId (ref: User)Reference to the user who triggered the event
projectObjectId (optional)Reference to the project context
organizationObjectId (optional)Reference to the organization context
modelObjectId (optional)Reference to the model context
sourceIdObjectIdIdentifier of the specific entity that triggered the event
actionEventActionType of action performed (sign, run, start, end, add, edit, delete)
sourceEventSourceOrigin of the event (Auth, Organization, Project, Model, Rule, Scan, Discover, Dataset, Report, Load, Pump, Entity, Field, Label)
infoStringAdditional information about the event
createdAtDateTimestamp when the event was created
updatedAtDateTimestamp when the event was last updated
readBy[ObjectId]List of users who have read/mark the event
metaMixedFlexible metadata storage for additional event details

Event Actions

Events can have the following actions:

  • sign - User has signed or approved something
  • run - A process or job has been executed
  • start - An operation has started
  • end - An operation has ended
  • add - Something has been added
  • edit - Something has been modified
  • delete - Something has been removed

Event Sources

Events can originate from the following sources:

  • Auth - Authentication-related events
  • Organization - Organization-level events
  • Project - Project-level events
  • Model - Model-level events
  • Rule - Rule execution events
  • Scan - Scan job events
  • Discover - Discovery process events
  • Dataset - Dataset-related events
  • Report - Report generation events
  • Load - Data loading events
  • Pump - Data pumping events
  • Entity - Entity-related events
  • Field - Field-related events
  • Label - Label-related events

Storage and Retention

Events are stored in a MongoDB collection named "events". Based on the code review, there doesn't appear to be an automatic TTL (Time To Live) mechanism configured for events, suggesting they are stored indefinitely until manually removed.

The client-side event store builds navigation links for different event types to direct users to the relevant sections of the application:

  • Scan/Discover events: Navigate to job details page
  • Dataset events: Navigate to datasets page (for add action) or job details page
  • Load/Pump events: Navigate to job details page
  • Rule events: Navigate to rule details page
  • Model events: Navigate to model page
  • Report events: Navigate to audit report page

Real-time Updates

Events are published in real-time using GraphQL subscriptions. The client-side event store subscribes to new events and updates the UI notification system accordingly.