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

# Attribute a downstream patient or system outcome to a prior inference



## OpenAPI

````yaml /api-reference/openapi.yaml post /event/outcome
openapi: 3.0.4
info:
  title: MedLog API Specification
  description: >
    MedLog is a protocol for event-level logging of clinical AI. Any time an AI

    model is invoked to interact with a human, interface with another algorithm,

    or act independently, a MedLog record is created. This record consists of
    nine

    core fields: model, user, target, inputs, artifacts, outputs, outcomes,

    metadata, and feedback, providing a structured and consistent record of
    model

    activity. The MedLog protocol can catalyze the development of new databases
    and

    software to store and analyze MedLog records. Realizing this vision would
    enable

    continuous surveillance, auditing, and iterative improvement of medical AI –

    including, when needed, detailed traces for complex, agentic, or multi-stage

    workflows – laying the foundation for a new form of AI-centric digital

    epidemiology.


    Some useful links:

    - [MedLog repository](https://github.com/mims-harvard/medlog)
  contact:
    email: anoori@college.harvard.edu
  license:
    name: MIT
    url: https://mit-license.org/
  version: 0.0.1
servers:
  - description: SwaggerHub API Auto Mocking
    url: https://virtserver.swaggerhub.com/harvard-647/MedLog/0.0.1
  - url: https://medlog.swagger.io/api/v3
security:
  - ApiKeyAuth: []
tags:
  - name: Events
    description: Write-once event logging endpoints
paths:
  /event/outcome:
    post:
      tags:
        - Events
      summary: Attribute a downstream patient or system outcome to a prior inference
      operationId: postOutcome
      requestBody:
        required: true
        content:
          application/json:
            schema:
              $ref: '#/components/schemas/OutcomeEvent'
      responses:
        '201':
          description: Event accepted
        '400':
          description: Bad request. Invalid payload or missing fields.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '401':
          description: Unauthorized. Missing or invalid credentials.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
        '403':
          description: Forbidden. Insufficient permissions.
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/Error'
      security:
        - ApiKeyAuth: []
components:
  schemas:
    OutcomeEvent:
      allOf:
        - $ref: '#/components/schemas/BaseEvent'
        - type: object
          required:
            - outcome
          properties:
            outcome:
              $ref: '#/components/schemas/Outcome'
    Error:
      type: object
      required:
        - message
      properties:
        message:
          type: string
        code:
          type: string
        details:
          type: object
    BaseEvent:
      type: object
      required:
        - event_id
        - timestamp
        - medlog_version
        - system_metadata
      properties:
        event_id:
          type: string
          format: uuid
          description: Unique ID for this event
        run_id:
          type: string
          format: uuid
          description: Constant across all events in the same inference run
        parent_event_id:
          type: string
          format: uuid
          nullable: true
          description: ID of the event this one expands on (if any)
        timestamp:
          type: string
          format: date-time
        medlog_version:
          type: string
          example: '1.0'
        system_metadata:
          $ref: '#/components/schemas/SystemMetadata'
    Outcome:
      type: object
      required:
        - outcome_type
      properties:
        outcome_type:
          type: string
          enum:
            - validated
            - contradicted
            - partial
            - unknown
        occurred_at:
          type: string
          format: date-time
        description:
          type: string
        evidence_uri:
          type: string
          format: uri
    SystemMetadata:
      type: object
      properties:
        hostname:
          type: string
        app_name:
          type: string
        proc_id:
          type: string
        latency_ms:
          type: integer
          format: int32
  securitySchemes:
    ApiKeyAuth:
      type: apiKey
      in: header
      name: X-API-Key
      description: Provide a valid API key via the X-API-Key header.

````