# Pattern Detection in InfoCenter

## Overview
The InfoCenter's pattern detection features visualize AI-detected patterns from analyzed pages, including listing templates, search mechanisms, and pagination.

## Reliability Status Flow
1. **DRAFT**: Initial analysis created by Scout
2. **PENDING_CONFIRMATION**: Sent to AI for verification
3. **CONFIRMED**: AI verified the analysis
4. **REJECTED**: AI found issues with the analysis

## Pattern Types

### Listing Templates
Identifies repeating item structures like product cards, reviews, blog posts, etc.

**10 Supported Types**:
- PRODUCT_LISTING, CART_ITEM_LISTING, ORDER_LISTING, REVIEW_LISTING
- BLOG_POST_LISTING, FAQ_LISTING, STORE_LISTING, BOOKING_LISTING
- MEDIA_LISTING, NOTIFICATION_LISTING

**Components**:
- Each template has: item selector, slots, actions, structure metadata
- Slots define data extraction (title, price, image, etc.)
- Actions define user interactions (add to cart, view details, etc.)

### Search Mechanisms
Detects how users can search on the page.

**2 Methods**:
- **FORM_SUBMIT**: Form with input field and submit button
- **URL_PATTERN**: URL-based search with query parameters

### Pagination Mechanisms
Identifies how users navigate through multiple pages.

**4 Types**:
- **NUMBERED_PAGES**: Clickable page numbers (1, 2, 3...)
- **NEXT_PREV**: Next/Previous buttons only
- **LOAD_MORE**: "Load More" button to append content
- **INFINITE_SCROLL**: Automatic loading on scroll

## UI Components

### Pattern Detection Summary Card
Shows overview statistics:
- Pages with Patterns
- Total Listing Templates
- Pages with Search

### Patterns Tab
Dedicated view showing all analyses with detected patterns, organized by page.

### Template Cards & Modal
- **Card**: Summary with slot preview (max 5 visible)
- **Modal**: Full details with paginated slots and actions tables

### Pattern Cards
- **SearchMechanismCard**: Displays search selectors
- **PaginationMechanismCard**: Displays pagination selectors

## Data Structure
All pattern data stored in JSONB columns in `page_analysis` table:
- `listing_templates`: Array of ListingTemplate objects
- `search_mechanism`: SearchMechanism object
- `pagination_mechanism`: PaginationMechanism object

## Implementation Details
See `packages/domain/src/types/PatternTypes.ts` for TypeScript interfaces.
