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

# Get Aggregated Scorecard

> Returns aggregated metric scores at the requested scope level.



## OpenAPI

````yaml /openapi/em-data-readiness-v2.yaml post /api/data-readiness/metrics/scorecard
openapi: 3.1.0
info:
  title: EM Data Readiness Service
  description: Data Readiness Service API for managing workflows, metrics, and data quality
  version: 4.3.0-dev1
servers: []
security:
  - BearerAuth: []
tags:
  - name: Health
    description: Service health monitoring. Check service status and version information.
  - name: Root
    description: Root endpoint providing service information and navigation links.
  - name: Configuration
    description: Service configuration endpoints. View current configuration values.
  - name: Workflows
    description: >-
      Workflow configuration and execution management. Create, configure, and
      run data quality workflows including definitions, configurations, runs,
      and tasks.
  - name: Data Assets
    description: >-
      Data catalog entity management. Manage databases, schemas, and tables
      metadata.
  - name: Metrics
    description: >-
      Data quality metrics and scorecards. Calculate scores, view trends, and
      analyze dimensions.
  - name: Violations
    description: >-
      Data quality violation management. View, acknowledge, and remediate
      detected violations.
  - name: Glossary
    description: >-
      Business glossary management. Create, verify, and organize business terms
      and definitions.
paths:
  /api/data-readiness/metrics/scorecard:
    post:
      tags:
        - Metrics
      summary: Get Aggregated Scorecard
      description: Returns aggregated metric scores at the requested scope level.
      operationId: get_metrics_scorecard
      requestBody:
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/ScorecardRequest'
        required: true
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ScorecardResponse'
        '400':
          description: Bad Request - Invalid parameters
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
        '500':
          description: Internal Server Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/ErrorResponse'
      security:
        - BearerAuth: []
components:
  schemas:
    ScorecardRequest:
      properties:
        asset_fqn:
          anyOf:
            - type: string
            - type: 'null'
          title: Asset Fqn
          description: >-
            Fully qualified name to scope the scorecard (e.g.
            service.database.schema.table)
        assessment_type:
          anyOf:
            - $ref: '#/components/schemas/AssessmentType'
            - type: 'null'
          description: Filter by assessment type
        as_of:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: As Of
          description: Point-in-time snapshot cutoff (ISO 8601)
        workflow_run_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Workflow Run Id
          description: Filter to a specific workflow run
        weight_overrides:
          anyOf:
            - additionalProperties:
                anyOf:
                  - type: number
                  - type: string
                    pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
              propertyNames:
                format: uuid
              type: object
            - type: 'null'
          title: Weight Overrides
          description: Mapping of dimension UUIDs to custom weights
      additionalProperties: false
      type: object
      title: ScorecardRequest
      description: Request body for the scorecard endpoint.
    ScorecardResponse:
      properties:
        overall_score:
          anyOf:
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Overall Score
          description: Weighted overall score across all dimensions
          examples:
            - '0.82'
        scope:
          type: string
          title: Scope
          description: Scope level of the scorecard
          examples:
            - service
            - database
            - schema
            - table
        entity:
          $ref: '#/components/schemas/EntityIdentifier'
          description: Entity identifier for the scope
        as_of:
          anyOf:
            - type: string
              format: date-time
            - type: 'null'
          title: As Of
          description: Point-in-time snapshot cutoff (ISO 8601)
          examples:
            - '2024-01-15T10:30:00Z'
        workflow_run_id:
          anyOf:
            - type: string
              format: uuid
            - type: 'null'
          title: Workflow Run Id
          description: Workflow run ID if filtering to a specific run
          examples:
            - 550e8400-e29b-41d4-a716-446655440023
        dimensions:
          items:
            $ref: '#/components/schemas/DimensionScore'
          type: array
          title: Dimensions
          description: Scores for each dimension
      type: object
      required:
        - overall_score
        - scope
        - entity
        - dimensions
      title: ScorecardResponse
      description: Aggregated scores at the requested scope.
    ErrorResponse:
      properties:
        error:
          $ref: '#/components/schemas/ErrorInfo'
          description: >-
            Error information object containing code, message, and optional
            details
        request_id:
          anyOf:
            - type: string
            - type: 'null'
          title: Request Id
          description: Request ID for debugging and support
          examples:
            - req_abc123xyz
      type: object
      required:
        - error
      title: ErrorResponse
      description: >-
        Standard error response model for API errors.


        Matches the structure returned by _handle_service_error in
        workflows/routes.py.

        The actual API response format is:

        {
            "error": {
                "code": "ERROR_CODE",
                "message": "Error message",
                "details": {...}
            },
            "request_id": "optional-request-id"
        }
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    AssessmentType:
      type: string
      enum:
        - metadata
        - data_quality
      title: AssessmentType
      description: Type of assessment a dimension belongs to.
    EntityIdentifier:
      properties:
        service:
          anyOf:
            - type: string
            - type: 'null'
          title: Service
          description: Service name
          examples:
            - production_db
        database_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Database Name
          description: Database name filter
          examples:
            - analytics
        schema_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Schema Name
          description: Schema name filter
          examples:
            - public
        table_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Table Name
          description: Table name filter
          examples:
            - customers
      type: object
      title: EntityIdentifier
      description: Identifies the scope entity for a scorecard or trend.
    DimensionScore:
      properties:
        dimension_id:
          type: string
          format: uuid
          title: Dimension Id
          description: Unique identifier of the dimension
          examples:
            - 550e8400-e29b-41d4-a716-446655440021
        name:
          type: string
          title: Name
          description: Dimension name
          examples:
            - completeness
        display_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Display Name
          description: Human-readable display name
          examples:
            - Completeness
        fqn:
          type: string
          title: Fqn
          description: Fully qualified name of the dimension
          examples:
            - dimensions.completeness
        assessment_type:
          type: string
          title: Assessment Type
          description: 'Type of assessment: ''metadata'' or ''data_quality'''
          examples:
            - metadata
        weight:
          type: string
          pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
          title: Weight
          description: Relative weight in overall score calculation
          examples:
            - '0.25'
        purpose:
          anyOf:
            - type: string
            - type: 'null'
          title: Purpose
          description: Purpose of the dimension
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Description of the dimension
        numerator:
          type: integer
          title: Numerator
          description: Aggregated numerator across metrics
          examples:
            - 170
        denominator:
          type: integer
          title: Denominator
          description: Aggregated denominator across metrics
          examples:
            - 200
        score:
          anyOf:
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Score
          description: Weighted dimension score
          examples:
            - '0.85'
        metrics:
          items:
            $ref: '#/components/schemas/MetricScore'
          type: array
          title: Metrics
          description: Individual metric scores within this dimension
      type: object
      required:
        - dimension_id
        - name
        - fqn
        - assessment_type
        - weight
        - numerator
        - denominator
        - score
        - metrics
      title: DimensionScore
      description: Score for a dimension, aggregated from its metrics.
    ErrorInfo:
      properties:
        code:
          type: string
          title: Code
          description: >-
            Error code identifier (e.g., 'WORKFLOW_NOT_FOUND',
            'VALIDATION_ERROR')
          examples:
            - WORKFLOW_NOT_FOUND
        message:
          type: string
          title: Message
          description: Human-readable error message
          examples:
            - >-
              Workflow configuration with id
              '123e4567-e89b-12d3-a456-426614174000' not found
        details:
          anyOf:
            - additionalProperties: true
              type: object
            - type: 'null'
          title: Details
          description: >-
            Additional error details as a dictionary (flexible structure for
            business logic errors)
          examples:
            - workflow_id: 123e4567-e89b-12d3-a456-426614174000
      type: object
      required:
        - code
        - message
      title: ErrorInfo
      description: >-
        Nested error information object.


        Note: This model uses an untyped dict for `details` to match the
        flexible error

        structure used throughout the service layer (see WorkflowServiceError
        and similar).

        This is distinct from ErrorDetail, which is used for structured
        validation errors.
    ValidationError:
      properties:
        loc:
          items:
            anyOf:
              - type: string
              - type: integer
          type: array
          title: Location
        msg:
          type: string
          title: Message
        type:
          type: string
          title: Error Type
      type: object
      required:
        - loc
        - msg
        - type
      title: ValidationError
    MetricScore:
      properties:
        metric_definition_id:
          type: string
          format: uuid
          title: Metric Definition Id
          description: Unique identifier of the metric definition
          examples:
            - 550e8400-e29b-41d4-a716-446655440020
        name:
          type: string
          title: Name
          description: Metric name
          examples:
            - has_description
        display_name:
          anyOf:
            - type: string
            - type: 'null'
          title: Display Name
          description: Human-readable display name
          examples:
            - Has Description
        fqn:
          type: string
          title: Fqn
          description: Fully qualified name of the metric
          examples:
            - metrics.completeness.has_description
        unit:
          anyOf:
            - type: string
            - type: 'null'
          title: Unit
          description: Unit of measurement
          examples:
            - percent
        purpose:
          anyOf:
            - type: string
            - type: 'null'
          title: Purpose
          description: Purpose of the metric
        description:
          anyOf:
            - type: string
            - type: 'null'
          title: Description
          description: Description of the metric
        numerator:
          type: integer
          title: Numerator
          description: Count of assets meeting the metric criteria
          examples:
            - 85
        denominator:
          type: integer
          title: Denominator
          description: Total count of assets evaluated
          examples:
            - 100
        score:
          anyOf:
            - type: string
              pattern: ^(?!^[-+.]*$)[+-]?0*\d*\.?\d*$
            - type: 'null'
          title: Score
          description: Calculated score (numerator/denominator)
          examples:
            - '0.85'
        asset_count:
          type: integer
          title: Asset Count
          description: Number of assets evaluated
          examples:
            - 100
      type: object
      required:
        - metric_definition_id
        - name
        - fqn
        - numerator
        - denominator
        - score
        - asset_count
      title: MetricScore
      description: Score for a single metric across assets at the requested scope.
  securitySchemes:
    BearerAuth:
      type: http
      scheme: bearer
      bearerFormat: JWT
      description: >-
        JWT Bearer token authentication. Include the token in the Authorization
        header as: `Authorization: Bearer <token>`. The JWT must contain valid
        client_id, and project_id claims for tenant isolation and SDK routing.

````