Overview

Rule Groups are containers that organize multiple moderation rules for specific contexts within your application. They enable you to apply different moderation strategies to different types of content, ensuring appropriate and contextual moderation across your platform.

Why Rule Groups?

Different areas of your application require different moderation approaches:

Profile Images

May require stricter rules for inappropriate content, ensuring professional appearance

Forum Posts

May focus on hate speech, spam, and maintaining constructive discussions

Product Reviews

May emphasize authenticity, preventing fake reviews and promotional content

Private Messages

May have more lenient rules while still preventing harassment

Creating Rule Groups

Basic Setup

  1. Navigate to your site in the dashboard
  2. Click on “Rule Groups”
  3. Create your first rule group
  4. Give it a descriptive name (e.g., “Profile Images”, “Forum Posts”)
  5. Optionally set it as the default group

Rule Group Properties

PropertyDescriptionExample
NameDescriptive identifier”User Profile Images”
DescriptionPurpose and context”Moderation rules for user avatar uploads”
Is DefaultAuto-applies to content without specified grouptrue / false
Site IDAssociated siteAutomatically set

Working with Rules

Adding Rules to Groups

Each rule group can contain multiple rules that work together:
// Example rule structure within a group
{
  "rule_group_id": "rg_123",
  "rules": [
    {
      "name": "Inappropriate Content Filter",
      "template": "nsfw_content",
      "is_active": true,
      "confidence_threshold": 0.85
    },
    {
      "name": "Face Detection Required",
      "template": "face_detection",
      "is_active": true,
      "evaluation_type": "requirement"
    }
  ]
}

Rule Templates

Pixel Patrol provides pre-configured rule templates that you can use or customize:

Advanced Parameters

Some rule templates support advanced parameters that must be provided during media submission:

Gender-Based Moderation Example

Rule configuration with advanced parameters:
{
  "type": "object",
  "required": ["gender"],
  "properties": {
    "gender": {
      "type": "string",
      "description": "User's stated gender (e.g., male, female, non-binary)"
    }
  }
}
API submission with required metadata:
{
  "api_key": "site_xxxxxxxxxxxxxxxxxxxx",
  "content_url": "https://example.com/image.jpg",
  "rule_group_id": "rg_profile_images",
  "metadata": {
    "gender": "male",
    "user_id": "user_123",
    "context": "profile_photo"
  }
}

Using Rule Groups in API Calls

Specifying a Rule Group

When submitting content for moderation, specify which rule group to use:
const result = await pixelPatrol.submitMedia({
  content_url: imageUrl,
  rule_group_id: 'rg_profile_images', // Specific rule group
  app_media_id: `profile-${userId}`,
  metadata: {
    context: 'profile_photo',
    user_id: userId
  }
});

Default Rule Group

If no rule group is specified, the default rule group for the site will be used:
// Uses default rule group
const result = await pixelPatrol.submitMedia({
  content_url: imageUrl,
  app_media_id: `content-${contentId}`
});

Best Practices

Organization Strategies

  1. Context-Based Groups: Create groups based on where content appears
    • User Profiles
    • Public Posts
    • Private Messages
    • Comments
  2. Risk-Based Groups: Organize by risk level
    • High Risk (public facing)
    • Medium Risk (authenticated users)
    • Low Risk (trusted users)
  3. Media Type Groups: Separate by content type
    • Images
    • Videos
    • Text Content

Configuration Tips

{
  "name": "Profile Images",
  "rules": [
    { "template": "nsfw_content", "threshold": 0.90 },
    { "template": "face_detection", "required": true },
    { "template": "violence", "threshold": 0.85 }
  ]
}

Performance Considerations

  • Rule Order: Rules are evaluated in parallel for performance
  • Caching: Rule group configurations are cached for fast access
  • Limits: Consider your plan’s moderation limits when designing rule groups

Management Features

Copying Rule Groups

Quickly duplicate successful configurations:
  1. Click the copy button on any rule group
  2. Modify the name and rules as needed
  3. Save the new group

Updating Rules

Rules can be updated without affecting ongoing moderations:
  • Changes apply to new submissions only
  • Historical moderation results remain unchanged
  • Test changes with sample content first

Deleting Groups

You cannot delete the last rule group for a site. Ensure at least one group remains active.

Integration Examples

E-commerce Platform

// Product images
await submitMedia({
  content_url: productImageUrl,
  rule_group_id: 'rg_product_images',
  metadata: {
    category: 'electronics',
    seller_id: sellerId
  }
});

// Customer reviews
await submitMedia({
  body: reviewText,
  rule_group_id: 'rg_customer_reviews',
  metadata: {
    product_id: productId,
    rating: 5
  }
});

Social Media Application

// User avatars
await submitMedia({
  content_url: avatarUrl,
  rule_group_id: 'rg_user_avatars',
  metadata: {
    gender: userGender,
    age_group: 'adult'
  }
});

// Post content
await submitMedia({
  content_url: postImageUrl,
  body: postText,
  rule_group_id: 'rg_public_posts',
  metadata: {
    visibility: 'public',
    hashtags: ['travel', 'photography']
  }
});

Monitoring & Analytics

Track rule group performance:
  • Approval rates per rule group
  • Most triggered rules within each group
  • Processing time by group complexity
  • False positive rates for tuning