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:
LogTabs: Represents the different types of log views or tabs that can be displayed.processingType: Represents the different types of processing methods or pipelines applicable to datasets.
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 |
|---|---|---|
|
| Represents logs related to files. |
|
| 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 |
|---|---|---|
|
| Indicates processing via a knowledge graph approach. |
|
| 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
The file uses TypeScript
enumto define fixed sets of string constants.The enums are exported to be imported and used throughout the application, ensuring consistent reference values.
Using string enums (as opposed to numeric enums) makes debugging and logging more readable.
Interaction with Other Parts of the System
UI Components:
TheLogTabsenum is likely used by UI components that render different log views or tabs, enabling them to switch and check the active tab in a type-safe manner.Processing Modules:
TheprocessingTypeenum is used by dataset processing modules or pipeline orchestrators to select and execute the appropriate processing engine or method, such as knowledge graph-based processing or the Raptor engine.Logging and Monitoring:
Both enums can be used in logging, monitoring, or analytics to classify and filter logs or processing runs.Configuration & Routing:
These enums might also interact with configuration files or routing mechanisms to control workflow behavior based on selected log tabs or processing types.
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.