> ## Documentation Index
> Fetch the complete documentation index at: https://docs.causeloop.ai/llms.txt
> Use this file to discover all available pages before exploring further.

# Get Pattern Stats

> GET /patterns/stats
Aggregate stats: by_status counts, total_issue_count, avg_risk_score, most_active.
Powers the status segment labels (ALL/ACTIVE/EMERGING/MITIGATING/RESOLVED) + footer total.
Registered BEFORE /{pattern_id}.



## OpenAPI

````yaml /openapi.json get /v1/patterns/stats
openapi: 3.1.0
info:
  description: Causeloop Platform Backend
  title: Causeloop API
  version: 1.0.0
servers: []
security: []
paths:
  /v1/patterns/stats:
    get:
      tags:
        - patterns
      summary: Get Pattern Stats
      description: >-
        GET /patterns/stats

        Aggregate stats: by_status counts, total_issue_count, avg_risk_score,
        most_active.

        Powers the status segment labels
        (ALL/ACTIVE/EMERGING/MITIGATING/RESOLVED) + footer total.

        Registered BEFORE /{pattern_id}.
      operationId: get_pattern_stats_v1_patterns_stats_get
      parameters:
        - in: query
          name: q
          required: false
          schema:
            anyOf:
              - maxLength: 200
                type: string
              - type: 'null'
            title: Q
        - in: query
          name: domain
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Domain
        - in: query
          name: risk_min
          required: false
          schema:
            anyOf:
              - maximum: 100
                minimum: 0
                type: integer
              - type: 'null'
            title: Risk Min
        - in: query
          name: risk_max
          required: false
          schema:
            anyOf:
              - maximum: 100
                minimum: 0
                type: integer
              - type: 'null'
            title: Risk Max
      responses:
        '200':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/PatternStats'
          description: Successful Response
        '422':
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
          description: Validation Error
      security:
        - HTTPBearer: []
components:
  schemas:
    PatternStats:
      properties:
        avg_risk_score:
          title: Avg Risk Score
          type: number
        by_phase:
          additionalProperties:
            type: integer
          title: By Phase
          type: object
        by_status:
          additionalProperties:
            type: integer
          title: By Status
          type: object
        clustering_coverage_pct:
          title: Clustering Coverage Pct
          type: number
        computed_at:
          title: Computed At
          type: string
        high_risk_count:
          title: High Risk Count
          type: integer
        top_risk:
          items:
            additionalProperties: true
            type: object
          title: Top Risk
          type: array
        total:
          title: Total
          type: integer
        total_linked_issues:
          title: Total Linked Issues
          type: integer
      required:
        - total
        - by_status
        - by_phase
        - avg_risk_score
        - high_risk_count
        - total_linked_issues
        - clustering_coverage_pct
        - top_risk
        - computed_at
      title: PatternStats
      type: object
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          title: Detail
          type: array
      title: HTTPValidationError
      type: object
    ValidationError:
      properties:
        ctx:
          title: Context
          type: object
        input:
          title: Input
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          title: Location
          type: array
        msg:
          title: Message
          type: string
        type:
          title: Error Type
          type: string
      required:
        - loc
        - msg
        - type
      title: ValidationError
      type: object
  securitySchemes:
    HTTPBearer:
      scheme: bearer
      type: http

````