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

# Get Patient Last Visit Histogram

> Get histogram data for days since last appointment.

Returns counts of patients in last-visit ranges.
When group_by is set, returns stacked histogram data with counts per group.



## OpenAPI

````yaml get /analytics/dashboards/patient-breakdown/patient-last-visit-histogram
openapi: 3.1.0
info:
  title: Decoda API
  description: External API documentation for the Decoda Health platform.
  version: '1.0'
servers: []
security: []
paths:
  /analytics/dashboards/patient-breakdown/patient-last-visit-histogram:
    get:
      tags:
        - provider
        - analytics
        - analytics
      summary: Get Patient Last Visit Histogram
      description: >-
        Get histogram data for days since last appointment.


        Returns counts of patients in last-visit ranges.

        When group_by is set, returns stacked histogram data with counts per
        group.
      operationId: >-
        get_patient_last_visit_histogram_analytics_dashboards_patient_breakdown_patient_last_visit_histogram_get
      parameters:
        - name: TENANT
          in: header
          required: true
          schema:
            type: string
            title: Tenant
          description: The tenant you are making this request on behalf of
        - name: API-KEY
          in: header
          required: true
          schema:
            type: string
            title: Api-Key
          description: Your api key
        - name: timezone
          in: query
          required: false
          schema:
            type: string
            default: UTC
            title: Timezone
        - name: patient_source
          in: query
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            title: Patient Source
        - name: location_ids
          in: query
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            title: Location Ids
        - name: days_since_last_appointment
          in: query
          required: false
          schema:
            anyOf:
              - type: integer
              - type: 'null'
            title: Days Since Last Appointment
        - name: patient_name
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Patient Name
        - name: patient_id
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Patient Id
        - name: last_appointment_service_ids
          in: query
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            title: Last Appointment Service Ids
        - name: last_appointment_provider_ids
          in: query
          required: false
          schema:
            anyOf:
              - items:
                  type: string
                type: array
              - type: 'null'
            title: Last Appointment Provider Ids
        - name: last_visit_days
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Last Visit Days
        - name: visit_span_days
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Visit Span Days
        - name: start_date
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: Start Date
        - name: end_date
          in: query
          required: false
          schema:
            anyOf:
              - type: string
              - type: 'null'
            title: End Date
        - name: group_by
          in: query
          required: false
          schema:
            anyOf:
              - enum:
                  - location
                  - patient_source
                  - provider
                type: string
              - type: 'null'
            title: Group By
      responses:
        '200':
          description: Successful Response
          content:
            application/json:
              schema:
                anyOf:
                  - type: array
                    items:
                      $ref: '#/components/schemas/HistogramItem'
                  - $ref: '#/components/schemas/GroupedHistogramResponse'
                title: >-
                  Response Get Patient Last Visit Histogram Analytics Dashboards
                  Patient Breakdown Patient Last Visit Histogram Get
        '422':
          description: Validation Error
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/HTTPValidationError'
components:
  schemas:
    HistogramItem:
      properties:
        key:
          type: string
          title: Key
        label:
          type: string
          title: Label
        count:
          type: integer
          title: Count
      type: object
      required:
        - key
        - label
        - count
      title: HistogramItem
      description: Represents a single histogram bucket.
    GroupedHistogramResponse:
      properties:
        groups:
          items:
            type: string
          type: array
          title: Groups
        items:
          items:
            $ref: '#/components/schemas/GroupedHistogramBucket'
          type: array
          title: Items
      type: object
      required:
        - groups
        - items
      title: GroupedHistogramResponse
      description: Histogram data grouped by a secondary dimension.
    HTTPValidationError:
      properties:
        detail:
          items:
            $ref: '#/components/schemas/ValidationError'
          type: array
          title: Detail
      type: object
      title: HTTPValidationError
    GroupedHistogramBucket:
      properties:
        key:
          type: string
          title: Key
        label:
          type: string
          title: Label
        counts:
          additionalProperties:
            type: integer
          type: object
          title: Counts
      type: object
      required:
        - key
        - label
        - counts
      title: GroupedHistogramBucket
      description: A histogram bucket with counts broken down by group.
    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

````