dataset-common.ts

Overview

The dataset-common.ts file defines enumerations that are used across the dataset module or related components within the application. Its primary purpose is to provide a centralized, type-safe way to manage constants related to log tabs and processing types, improving code maintainability and reducing the risk of errors from using string literals directly.

This file contains two key enumerations:

By exporting these enums, the file enables consistent usage throughout the system wherever these concepts are relevant.


Enumerations

1. LogTabs

Description:
Defines the two possible log tabs that the UI or processing components may reference when displaying or managing logs related to datasets or files.

Members:

Member

Value

Description

FILE_LOGS

'fileLogs'

Represents logs related to files.

DATASET_LOGS

'datasetLogs'

Represents logs related to datasets.

Usage Example:

import { LogTabs } from './dataset-common';

// Example: Switching between log tabs in a UI component
function showLogTab(tab: LogTabs) {
  if (tab === LogTabs.FILE_LOGS) {
    console.log("Displaying file logs");
  } else if (tab === LogTabs.DATASET_LOGS) {
    console.log("Displaying dataset logs");
  }
}

showLogTab(LogTabs.DATASET_LOGS);

2. processingType

Description:
Enumerates the types of processing workflows or engines available for dataset handling within the system.

Members:

Member

Value

Description

knowledgeGraph

'knowledgeGraph'

Indicates processing via a knowledge graph approach.

raptor

'raptor'

Indicates processing via the Raptor engine or method.

Usage Example:

import { processingType } from './dataset-common';

function startProcessing(type: processingType) {
  switch(type) {
    case processingType.knowledgeGraph:
      console.log("Starting knowledge graph processing pipeline.");
      break;
    case processingType.raptor:
      console.log("Starting Raptor processing pipeline.");
      break;
  }
}

startProcessing(processingType.raptor);

Implementation Details


Interaction with Other Parts of the System


Mermaid Diagram

classDiagram
    class LogTabs {
        <<enumeration>>
        +FILE_LOGS: string = 'fileLogs'
        +DATASET_LOGS: string = 'datasetLogs'
    }

    class processingType {
        <<enumeration>>
        +knowledgeGraph: string = 'knowledgeGraph'
        +raptor: string = 'raptor'
    }

Summary

dataset-common.ts is a small but critical utility file that defines centralized enums for log tabs and processing types used across dataset-related modules in the application. It promotes consistency, reduces errors, and improves code clarity when handling log views and dataset processing workflows.