Skip to content

List Dataset Node

Overview

The List Dataset node publishes the list of available datasets from the connected Firebase configuration. It automatically sends messages when the flow starts and whenever the dataset list changes, making it ideal for dynamic UI components, dashboard displays, and dataset selection workflows.

Key Features

  • Auto-emit on startup: Sends dataset list when flow starts
  • Real-time updates: Emits when datasets change in Firebase
  • Manual trigger: Can be triggered via input message
  • Tag statistics: Includes image counts per tag
  • Dropdown options: Provides formatted options for UI selectors
  • Connection monitoring: Visual status indicators for Firebase connection
  • Sorted output: Datasets alphabetically sorted by name

Use Cases

  • Populate dropdown menus for dataset selection
  • Display dashboard statistics of available datasets
  • Monitor dataset updates in real-time
  • Trigger workflows when new datasets are added
  • Generate reports on dataset inventory

Configuration

Properties

Output Field

  • Type: Message property path
  • Default: payload
  • Required: Yes
  • Description: Where the dataset array will be stored in the message

Firebase Config

  • Type: Node reference (firebase-config)
  • Required: Yes
  • Description: Reference to firebase-config node for authentication

Input

Manual Trigger

Send any message to manually request the current dataset list:

javascript
msg.payload = true;  // Or any value
return msg;

Behavior:

  • Only works if Firebase is connected
  • Emits dataset list with reason: "manual"
  • Useful for refresh buttons or periodic polling

Output

Message Structure

javascript
{
  payload: [
    {
      name: "Product Inspection",
      id: "prod-inspect-v2",
      tags: {
        "OK": 1523,
        "DEFECT": 387,
        "ROTA": 149
      }
    },
    {
      name: "Quality Control",
      id: "qc-dataset-001",
      tags: {
        "PASS": 2000,
        "FAIL": 150
      }
    }
  ],
  reason: "startup",          // "startup", "update", "manual", "reset", "error"
  datasetsCount: 2,
  timestamp: "2024-01-15T10:30:00.000Z",
  options: [
    {
      label: "Product Inspection",
      value: "prod-inspect-v2"
    },
    {
      label: "Quality Control",
      value: "qc-dataset-001"
    }
  ]
}

Output Fields

payload (Array)

Array of dataset objects, each containing:

  • name: Human-readable dataset name
  • id: Unique dataset identifier
  • tags: Object mapping tag names to image counts

reason (String)

Why the message was sent:

  • "startup": Flow started or node deployed
  • "update": Dataset list changed in Firebase
  • "manual": Triggered by input message
  • "reset": Firebase reconnected
  • "error": Error occurred

datasetsCount (Number)

Total number of datasets in the list

timestamp (String)

ISO 8601 timestamp of when message was sent

options (Array)

Formatted for dropdown/select UI components:

  • label: Display name
  • value: Dataset ID for selection

Example Output

javascript
// Empty datasets
{
  payload: [],
  reason: "startup",
  datasetsCount: 0,
  timestamp: "2024-01-15T10:00:00.000Z",
  options: []
}

// Multiple datasets with tags
{
  payload: [
    {
      name: "Defect Detection",
      id: "defects-2024",
      tags: {
        "scratch": 450,
        "dent": 230,
        "crack": 120,
        "OK": 3200
      }
    }
  ],
  reason: "update",
  datasetsCount: 1,
  timestamp: "2024-01-15T10:05:00.000Z",
  options: [
    {
      label: "Defect Detection",
      value: "defects-2024"
    }
  ]
}

Node Status

Status Indicators

FillShapeTextMeaning
YellowDotconnecting (attempt N)Firebase connecting
GreenDotconnectedFirebase connected
GreenDotloaded: N dataset(s)Datasets loaded
GreenDotupdated: N dataset(s)Datasets updated
YellowRingwaiting for firebaseWaiting for connection
RedRingconnection errorFirebase error
RedRingmissing firebase-configConfig not set
RedRinginvalid output fieldOutput path error

Usage Examples

Example 1: Populate Dropdown

[Inject: On Start] → [List Dataset] → [UI Dropdown]

UI Dropdown config:

javascript
// In dashboard dropdown node
msg.options = msg.options; // Use the options array
return msg;

Result: Dropdown populated with dataset names

Example 2: Dataset Statistics Dashboard

javascript
// Function node after List Dataset
const stats = msg.payload.map(ds => ({
  name: ds.name,
  totalImages: Object.values(ds.tags).reduce((sum, count) => sum + count, 0),
  tags: Object.keys(ds.tags).length
}));

msg.payload = stats;
return msg;

// Output:
// [
//   { name: "Dataset A", totalImages: 5000, tags: 5 },
//   { name: "Dataset B", totalImages: 3000, tags: 3 }
// ]

Example 3: Monitor New Datasets

javascript
// Function node: Track changes
const previous = context.get("previousCount") || 0;
const current = msg.datasetsCount;

if (current > previous) {
  msg.payload = `${current - previous} new dataset(s) added`;
  context.set("previousCount", current);
  return msg;  // Alert about new datasets
}

context.set("previousCount", current);
return null;  // No change

Example 4: Filter by Tag

javascript
// Function node: Find datasets with specific tag
const requiredTag = "DEFECT";

msg.payload = msg.payload.filter(dataset =>
  dataset.tags && requiredTag in dataset.tags
);

return msg;

Example 5: Create Dataset Summary

javascript
// Function node: Generate summary
const summary = {
  totalDatasets: msg.datasetsCount,
  timestamp: msg.timestamp,
  datasets: msg.payload.map(ds => {
    const totalImages = Object.values(ds.tags).reduce((sum, c) => sum + c, 0);
    const tagList = Object.keys(ds.tags).join(", ");

    return {
      name: ds.name,
      id: ds.id,
      totalImages: totalImages,
      tags: tagList,
      avgImagesPerTag: (totalImages / Object.keys(ds.tags).length).toFixed(0)
    };
  })
};

msg.payload = summary;
return msg;

Example 6: Conditional Workflow

[List Dataset] → [Switch: Check Count]
                   ├→ [Count > 0] → [Process Datasets]
                   └→ [Count = 0] → [Alert: No Datasets]

Switch node rules:

  • Rule 1: msg.datasetsCount > 0 → Output 1
  • Rule 2: msg.datasetsCount == 0 → Output 2

Integration Patterns

Pattern 1: Dynamic Dataset Selection

[List Dataset] → [UI Dropdown] → [User Selection] → [From Dataset]

Usage: User selects dataset, then loads images from it

Pattern 2: Periodic Monitoring

[Inject: Every 5min] → [List Dataset] → [Function: Check Changes] → [Alert]

Usage: Monitor for dataset additions/updates

Pattern 3: Multi-Output Dashboard

[List Dataset] ─┬→ [Chart: Dataset Counts]
                ├→ [Table: Dataset Details]
                └→ [Gauge: Total Images]

Usage: Multiple dashboard widgets from one source

Pattern 4: Conditional Processing

[List Dataset] → [Function: Filter] → [Dataset Upload]

Usage: Upload only to datasets matching criteria

Auto-Emit Behavior

On Startup

  • Node automatically emits dataset list when deployed
  • Reason: "startup"
  • Happens after Firebase connection established

On Firebase Updates

  • Emits when datasets change in Firebase
  • Reason: "update"
  • Real-time synchronization

On Firebase Reconnect

  • Emits after reconnection
  • Reason: "reset"
  • Ensures fresh data after connection loss

Error Handling

Missing Firebase Config

Error: "Missing firebase-config reference"

Cause: Firebase Config property not set

Solution: Configure Firebase Config dropdown in node settings

Connection Errors

Status: Red ring - "connection error"

Cause: Firebase authentication failed or network issue

Solution:

  1. Check Firebase config credentials
  2. Verify network connectivity
  3. Check Firebase console for issues

Invalid Output Field

Error: "Failed to set output field"

Cause: Output field path is invalid

Solution: Use valid message property path (e.g., payload, datasets, data.list)

Performance Considerations

Memory Usage

  • Minimal: Only stores dataset metadata
  • No image data loaded
  • Scales well with hundreds of datasets

Network Usage

  • Initial load: Downloads dataset list from Firebase
  • Updates: Only changed datasets synced
  • Lightweight: Metadata only

Frequency

  • Startup: Once per deployment
  • Updates: Only when datasets change
  • Manual: On-demand via input

Best Practices

  1. Use for UI selection: Ideal for dropdowns and selectors
  2. Cache results: Store in context if needed repeatedly
  3. Monitor changes: Use reason field to handle different triggers
  4. Filter appropriately: Process only relevant datasets
  5. Handle empty lists: Check datasetsCount before processing
  6. Use options array: Pre-formatted for UI components

Troubleshooting

No datasets emitted

Possible causes:

  • Firebase not connected
  • No datasets in Firebase project
  • Firebase config incorrect

Solutions:

  • Check firebase-config node status
  • Verify Firebase console has datasets
  • Review Firebase credentials

Datasets not updating

Possible causes:

  • Real-time listener not active
  • Firebase connection dropped

Solutions:

  • Check node status for connection state
  • Send manual trigger to force update
  • Redeploy flow

Wrong output format

Possible causes:

  • Output field misconfigured
  • Expecting different structure

Solutions:

  • Verify output field path
  • Use function node to transform if needed
  • Check msg.payload structure

See Also