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

# Compare Documents using PDSQI-9

> Compares two documents against each other on eight documentation quality domains of PDSQI-9 (Provider Documentation Summarization Quality Instrument).
The citations domain is dropped because most documents do not cite sources. The PDSQI-9 naming is kept.
The two documents must come from the same `sourceContext`.

The API shows both documents to a language model twice, with the order of the documents swapped.
A domain has a winner only when both orderings agree. This mitigates the position bias of the language model.

This operation uses a language model. It uses credits.




## OpenAPI

````yaml /api-reference/auto-generated-openapi.yml post /tools/evaluations/text/documents/pairwise/pdsqi9
openapi: 3.0.0
info:
  title: Corti API
  version: 2.0.0
servers:
  - url: https://api.{environment}.corti.app/v2/
    variables:
      environment:
        default: eu
        enum:
          - us
          - eu
security:
  - AuthorizationHeader:
      - bearer
tags:
  - name: Interactions
  - name: Recordings
  - name: Transcripts
  - name: Facts
  - name: Codes
  - name: FHIR
  - name: Languages
  - name: Guided Documents
  - name: Guided Templates
  - name: Guided Sections
  - name: Documents (Classic)
  - name: Templates (Classic)
  - name: Evaluations
paths:
  /tools/evaluations/text/documents/pairwise/pdsqi9:
    post:
      tags:
        - Evaluations
      summary: Compare Documents using PDSQI-9
      description: >
        Compares two documents against each other on eight documentation quality
        domains of PDSQI-9 (Provider Documentation Summarization Quality
        Instrument).

        The citations domain is dropped because most documents do not cite
        sources. The PDSQI-9 naming is kept.

        The two documents must come from the same `sourceContext`.


        The API shows both documents to a language model twice, with the order
        of the documents swapped.

        A domain has a winner only when both orderings agree. This mitigates the
        position bias of the language model.


        This operation uses a language model. It uses credits.
      operationId: evaluations_documents_pairwise_pdsqi9
      parameters:
        - $ref: '#/components/parameters/Tenant-Name'
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/EvaluationPairwisePdsqi9Request'
            example:
              documentA:
                subjective: The patient woke with left arm weakness.
                objective: Left arm strength 4/5. No facial asymmetry.
              documentB:
                subjective: >-
                  The patient woke unable to move the left arm and reports the
                  weakness started this morning.
                objective: Left arm strength 4/5. No facial asymmetry.
              sourceContext:
                type: text
                text: I woke up this morning and couldn't move my left arm.
      responses:
        '200':
          description: The winner of each PDSQI-9 domain (excluding citations).
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/EvaluationPairwisePdsqi9Response'
              example:
                winners:
                  accurate: a
                  thorough: tie
                  useful: a
                  organized: tie
                  comprehensible: a
                  succinct: b
                  synthesized: tie
                  stigmatizing: tie
                evaluationConfigHash: >-
                  sha256:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
                usageInfo:
                  creditsConsumed: 0.06
        '400':
          $ref: '#/components/responses/BadRequest'
        '403':
          $ref: '#/components/responses/EvaluationForbidden'
        '429':
          $ref: '#/components/responses/EvaluationTooManyRequests'
        '500':
          $ref: '#/components/responses/EvaluationInternalError'
        '502':
          $ref: '#/components/responses/EvaluationBadGateway'
components:
  parameters:
    Tenant-Name:
      name: Tenant-Name
      in: header
      description: >-
        Identifies a distinct entity within Corti's multi-tenant system. Ensures
        correct routing and authentication of the request.
      required: true
      example: base
      schema:
        type: string
        description: >-
          Identifies a distinct entity within Corti's multi-tenant system.
          Ensures correct routing and authentication of the request.
        example: base
  schemas:
    EvaluationPairwisePdsqi9Request:
      type: object
      description: >
        The two documents to compare.

        Both documents must come from the same `sourceContext`.

        The `winners` in the response use `a` for `documentA` and `b` for
        `documentB`.
      required:
        - documentA
        - documentB
        - sourceContext
      properties:
        documentA:
          $ref: '#/components/schemas/EvaluationDocument'
        documentB:
          $ref: '#/components/schemas/EvaluationDocument'
        sourceContext:
          $ref: '#/components/schemas/EvaluationPairwiseSourceContext'
    EvaluationPairwisePdsqi9Response:
      type: object
      required:
        - winners
        - evaluationConfigHash
        - usageInfo
      properties:
        winners:
          $ref: '#/components/schemas/EvaluationPairwiseWinners'
        evaluationConfigHash:
          type: string
          description: >
            A SHA-256 hash of the evaluation configuration: the language model,
            the prompt and the model parameters.

            The hash does not include the content of the request.

            Compare winners only when they have the same hash.
          example: >-
            sha256:9f86d081884c7d659a2feaa0c55ad015a3bf4f1b2b0b822cd15d6c15b0f00a08
        usageInfo:
          $ref: '#/components/schemas/CommonUsageInfo'
    EvaluationDocument:
      type: object
      description: >
        A document. Each key is a section ID. Each value is the text of that
        section.

        Section IDs must not be empty.


        The API processes the sections in the order of the request.

        The spans and claims in the response are in the order of the sections in
        the request, and then in the order in the text.
      minProperties: 1
      additionalProperties:
        type: string
      example:
        subjective: Patient reports right knee pain for two weeks.
        plan: Follow-up in one week.
    EvaluationPairwiseSourceContext:
      description: >
        The source that both documents came from. A transcript or a text string.

        The API does not split the source context into sentences. It passes the
        source context to the language model as-is.
      oneOf:
        - $ref: '#/components/schemas/CommonTranscriptContext'
        - $ref: '#/components/schemas/CommonTextContext'
      discriminator:
        propertyName: type
        mapping:
          transcript: '#/components/schemas/CommonTranscriptContext'
          text: '#/components/schemas/CommonTextContext'
    EvaluationPairwiseWinners:
      type: object
      description: >
        One verdict per PDSQI-9 documentation quality domain, resolved over both
        orderings.

        The citations domain of the PDSQI-9 instrument is dropped because most
        documents do not cite sources.

        The domains:

        - `accurate`: The document is true and does not contain incorrect
        information.

        - `thorough`: The document is complete and records all issues of
        importance.

        - `useful`: The information is relevant to the target reader, at the
        right level of detail.

        - `organized`: The document is well-structured so that the reader can
        follow the information.

        - `comprehensible`: The language is clear, plain and familiar to the
        target reader.

        - `succinct`: The document captures each statement in the fewest words,
        without redundancy.

        - `synthesized`: The document reflects understanding of the scenario.

        - `stigmatizing`: The document avoids stigmatizing language.
      required:
        - accurate
        - thorough
        - useful
        - organized
        - comprehensible
        - succinct
        - synthesized
        - stigmatizing
      properties:
        accurate:
          $ref: '#/components/schemas/EvaluationPairwiseVerdict'
        thorough:
          $ref: '#/components/schemas/EvaluationPairwiseVerdict'
        useful:
          $ref: '#/components/schemas/EvaluationPairwiseVerdict'
        organized:
          $ref: '#/components/schemas/EvaluationPairwiseVerdict'
        comprehensible:
          $ref: '#/components/schemas/EvaluationPairwiseVerdict'
        succinct:
          $ref: '#/components/schemas/EvaluationPairwiseVerdict'
        synthesized:
          $ref: '#/components/schemas/EvaluationPairwiseVerdict'
        stigmatizing:
          $ref: '#/components/schemas/EvaluationPairwiseVerdict'
    CommonUsageInfo:
      type: object
      description: Credits consumed for this request.
      required:
        - creditsConsumed
      properties:
        creditsConsumed:
          type: number
    ErrorResponse:
      type: object
      required:
        - requestid
        - status
        - type
        - detail
      properties:
        requestid:
          type: string
        status:
          type: integer
        type:
          type: string
        detail:
          type: string
        validationErrors:
          type: array
          items:
            type: object
            additionalProperties:
              type: string
    CommonTranscriptContext:
      type: object
      required:
        - type
        - transcript
      description: A transcript provided as input context to the model.
      properties:
        type:
          type: string
          enum:
            - transcript
        transcript:
          $ref: '#/components/schemas/GuidedDocumentTranscriptMinimal'
    CommonTextContext:
      type: object
      title: Text
      required:
        - type
        - text
      properties:
        type:
          type: string
          enum:
            - text
          description: |
            The type of context, always "text" in this context.
        text:
          type: string
          description: |
            A text string to be used as input to the model.
          minLength: 1
    EvaluationPairwiseVerdict:
      type: string
      description: >
        The winner of one PDSQI-9 domain, resolved over both orderings.

        - `a`: `documentA` is better. Both orderings name `documentA`.

        - `b`: `documentB` is better. Both orderings name `documentB`.

        - `tie`: The domain has no winner. Both orderings say the documents are
        of equal quality, or one ordering names a winner and the other names a
        tie.

        - `contradiction`: The orderings name opposite documents. The model
        flipped with the order of the documents.
      enum:
        - a
        - b
        - tie
        - contradiction
    GuidedDocumentTranscriptMinimal:
      type: object
      required:
        - transcripts
      description: >
        Minimal transcript shape accepted as input context. Decoupled from the
        transcript resource: only `transcripts` is required, and within each
        segment only `text` is required.
      properties:
        metadata:
          $ref: '#/components/schemas/GuidedDocumentTranscriptMetadataMinimal'
        transcripts:
          type: array
          minItems: 1
          items:
            $ref: '#/components/schemas/GuidedDocumentTranscriptSegmentMinimal'
    GuidedDocumentTranscriptMetadataMinimal:
      type: object
      description: Optional transcript-level metadata. All fields optional.
      properties:
        participantsRoles:
          type: array
          items:
            $ref: '#/components/schemas/TranscriptsParticipant'
          nullable: true
    GuidedDocumentTranscriptSegmentMinimal:
      type: object
      required:
        - text
      description: Minimal transcript segment. Only `text` is required.
      properties:
        channel:
          type: integer
          description: The channel associated with this phrase/utterance.
        participant:
          type: integer
          description: The identifier of the participant.
        speakerId:
          type: integer
          description: Id to tag an identified speaker.
        text:
          type: string
          description: The spoken phrase or utterance.
          minLength: 1
        start:
          type: integer
          description: Start time in milliseconds for phrase/utterance.
        end:
          type: integer
          description: End time in milliseconds for phrase/utterance.
    TranscriptsParticipant:
      type: object
      required:
        - channel
        - role
      properties:
        channel:
          type: integer
          minimum: 0
          description: The audio channel to associate with a participant role.
        role:
          type: string
          description: >-
            Free-form label for the participant role (e.g., 'doctor', 'patient',
            'Attending Physician'). Must not be empty or whitespace-only after
            trimming, must not contain control characters, and must not exceed
            100 characters or 10 words.
  responses:
    BadRequest:
      description: Bad Request
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    EvaluationForbidden:
      description: The access token does not have the scope for evaluations.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    EvaluationTooManyRequests:
      description: >-
        The API has too many evaluation requests. Wait. Then send the request
        again.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    EvaluationInternalError:
      description: Internal Server Error
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
    EvaluationBadGateway:
      description: The API could not complete the evaluation.
      content:
        application/json:
          schema:
            $ref: '#/components/schemas/ErrorResponse'
  securitySchemes:
    AuthorizationHeader:
      type: http
      description: Input your token
      scheme: bearer

````

This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.