openapi: 3.0.0
info:
  title: Export API
  version: '1.0'
  description: >-
    The Tidepool API is an HTTP REST API used by Tidepool clients use to
    communicate with the Tidepool Platform.


    For more information, see the [Getting Started](../docs/quick-start.md)
    section.
  termsOfService: https://developer.tidepool.org/terms-of-use/
  contact:
    name: Tidepool Api Support
    url: https://support.tidepool.org
    email: support@tidepool.org
  license:
    name: BSD-2-Clause
    url: https://github.com/tidepool-org/export/blob/master/LICENSE
  x-tidepool-service: https://github.com/tidepool-org/export
servers:
  - url: https://external.integration.tidepool.org
    description: integration
  - url: https://api.tidepool.org
    description: production
  - url: https://dev1.dev.tidepool.org
    description: dev1
  - url: https://qa1.development.tidepool.org
    description: qa1
  - url: https://qa2.development.tidepool.org
    description: qa2
tags:
  - name: Internal
    description: APIs intended for internal use by Tidepool.
  - name: Export
    description: Enable bulk export of diabetes data from user's Tidepool account.
paths:
  /export/{userId}:
    parameters:
      - $ref: '#/components/parameters/tidepooluserid'
    get:
      operationId: ExportUserData
      summary: Export user data
      description: >-
        Exports the diabetes data from user identified by `userId`, from
        `startDate` to `endDate`, in the requested `format`. Either a Tidepool
        session token, or a restricted token must be supplied.
      parameters:
        - $ref: '#/components/parameters/startdate.v1'
        - $ref: '#/components/parameters/enddate.v1'
        - $ref: '#/components/parameters/format.v1'
        - $ref: '#/components/parameters/glucoseunits.v1'
      responses:
        '200':
          description: User data exported in the requested `format`.
          headers:
            Content-Disposition:
              $ref: '#/components/headers/contentdisposition.v1'
          content:
            application/json:
              schema:
                $ref: '#/components/schemas/json.v1'
            application/vnd.openxmlformats-officedocument.spreadsheetml.sheet:
              schema:
                $ref: '#/components/schemas/excel.v1'
        '400':
          $ref: '#/components/responses/BadRequest'
        '401':
          $ref: '#/components/responses/Unauthorized'
        '403':
          $ref: '#/components/responses/Forbidden'
        '500':
          $ref: '#/components/responses/ServerError'
      security:
        - sessionToken: []
        - restrictedToken: []
      tags:
        - Export
        - Internal
components:
  securitySchemes:
    sessionToken:
      description: Tidepool Session Token
      type: apiKey
      name: X-Tidepool-Session-Token
      in: header
    restrictedToken:
      description: Tidepool Restricted Token
      type: apiKey
      name: restricted_token
      in: query
  responses:
    BadRequest:
      description: Bad Request
    Unauthorized:
      description: Unauthorized
    Forbidden:
      description: Forbidden
    ServerError:
      description: Server Error
  schemas:
    tidepooluserid:
      type: string
      title: Tidepool User ID
      pattern: >-
        ^([0-9a-f]{10}|[0-9a-f]{8}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{4}-[0-9a-f]{12})$
      description: >-
        String representation of a Tidepool User ID. Old style IDs are 10-digit
        strings consisting of only hexadeximcal digits. New style IDs are
        36-digit [UUID
        v4](https://en.wikipedia.org/wiki/Universally_unique_identifier#Version_4_(random))
      readOnly: true
      x-go-type: string
    datetime.v1:
      title: Date/Time
      description: >-
        [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) / [ISO
        8601](https://www.iso.org/iso-8601-date-and-time-format.html) timestamp
        _with_ timezone information
      type: string
      format: date-time
      example: '2017-02-06T02:37:46Z'
      x-go-type: string
    format.v1:
      title: Export Format
      type: string
      enum:
        - json
        - xlsx
      default: xlsx
      example: xlsx
    glucoseunits.v1:
      title: Export Glucose Units
      type: string
      enum:
        - mmol/L
        - mg/dL
      default: mmol/L
      example: mmol/L
    code.v1:
      title: Annotation Code
      description: >-
        Annotation codes that appear in Tidepool diabetes data records.

        The annotation codes are primarily intended for machine processing, but
        they are usually readable enough to make sense.

        These are by convention structured as series of strings separated by
        slashes (`/`), in order from more general to more specific.

        For example:

          * `wrong-device-time` or `time-change`, generic annotations.
          * `basal/unknown-duration` or `bg/out-of-range`, generic annotations around a particular theme.
          * `medtronic/basal/flat-rate`, a manufacturer-specific annotation.
          * `medtronic600/smbg/user-rejected-remote-bg`, a device-specific annotation.
      type: string
      minLength: 1
      pattern: ^[0-9a-z\-\_]+(/[0-9a-z\-\_]+(/[0-9a-z\-\_]+)?)?$
      enum:
        - animas/basal/flat-rate
        - animas/basal/marked-suspended-from-alarm
        - animas/bolus/extended-equal-split
        - animas/bolus/unknown-duration
        - animas/out-of-sequence
        - animas/status/fabricated-from-alarm
        - basal/auto
        - basal/intersects-incomplete-suspend
        - basal/mismatched-series
        - basal/unknown-duration
        - bg/out-of-range
        - carelink/basal/fabricated-from-schedule
        - carelink/basal/fabricated-from-suppressed
        - carelink/basal/off-schedule-rate
        - carelink/bolus/missing-square-component
        - carelink/wizard/long-search
        - final-basal/fabricated-from-schedule
        - insulet/basal/fabricated-from-schedule
        - insulet/bolus/split-extended
        - medtronic/basal/fabricated-from-schedule
        - medtronic/basal/flat-rate
        - medtronic/basal/one-second-gap
        - medtronic/basal/time-change
        - medtronic/status/fabricated-from-device-event
        - medtronic/wizard/carb-to-exchange-ratio-deconverted
        - medtronic600/smbg/bg-reading-received
        - medtronic600/smbg/bg-sent-for-calib
        - medtronic600/smbg/bg-si-fail-result-recd-frm-gst
        - medtronic600/smbg/bg-si-pass-result-recd-frm-gst
        - medtronic600/smbg/entered-as-bg-marker
        - medtronic600/smbg/entered-in-bg-entry
        - medtronic600/smbg/entered-in-bolus-wizard
        - medtronic600/smbg/entered-in-meal-wizard
        - medtronic600/smbg/entered-in-sensor-calib
        - medtronic600/smbg/remote-bg-acceptance-screen-timeout
        - medtronic600/smbg/user-accepted-remote-bg
        - medtronic600/smbg/user-rejected-remote-bg
        - medtronic600/smbg/user-rejected-sensor-calib
        - spring-forward
        - stats-how-calculated
        - stats-how-calculated-average-cbg
        - stats-how-calculated-average-smbg
        - stats-how-calculated-range-cbg
        - stats-how-calculated-range-smbg
        - stats-how-calculated-ratio
        - stats-insufficient-data
        - status/incomplete-tuple
        - tandem/basal/fabricated-from-new-day
        - tandem/basal/temp-without-rate-change
        - tandem/pumpSettingsOverride/estimated-duration
        - tandem/pumpSettingsOverride/fabricated-from-new-day
        - time-change
        - uncertain-timestamp
        - wizard/target-automated
        - wrong-device-time
      example: wrong-device-time
    bgoutofrange.v1:
      title: Blood Glucose Out of Range
      type: object
      properties:
        code:
          type: string
          enum:
            - bg/out-of-range
          example: bg/out-of-range
        value:
          type: string
          enum:
            - low
            - high
          example: low
        threshold:
          type: number
          example: 40
      required:
        - code
        - value
        - threshold
    annotation.v1:
      title: Annotation
      description: >-
        Annotation attached to the diabetes data record to provide additional
        information. Annotation is at minimum a `code` (string) that describes
        the annotation. It may also include additional properties that further
        describe the annotation. The maximum size is 4K bytes.
      type: object
      allOf:
        - type: object
          properties:
            code:
              $ref: '#/components/schemas/code.v1'
          required:
            - code
        - oneOf:
            - type: object
              properties:
                code:
                  $ref: '#/components/schemas/code.v1'
              required:
                - code
            - $ref: '#/components/schemas/bgoutofrange.v1'
    annotationarray.v1:
      title: Annotation Array
      description: An array of annotations.
      type: array
      uniqueItems: true
      minItems: 0
      maxItems: 100
      items:
        $ref: '#/components/schemas/annotation.v1'
    datasetid.v1:
      title: Data Set ID
      type: string
      pattern: ^(upid_[0-9a-f]{12}|upid_[0-9a-f]{32}|[0-9a-f]{32})$
      minLength: 17
      maxLength: 37
      example: ce8cc5f7595575945f91fc6710db6fef
      x-tags:
        - Data
    association-type.v1:
      title: Association Type
      description: >-
        The type of the association. If type is `blob`, `datum`, or `image`,
        then `id` must also be specified. If type is `url`, then url must also
        be specified.
      type: string
      enum:
        - blob
        - datum
        - image
        - url
      example: blob
      x-go-type: string
    reason.v1:
      title: Association Reason
      description: The reason for the association.
      type: string
      minLength: 1
      maxLength: 1000
    association-id.v1:
      title: Association ID
      description: >-
        The ID of the associated Tidepool resource if type is blob, datum, or
        image.
      type: string
    url.v1:
      title: URL
      description: URL
      type: string
      format: uri
    blob.v1:
      title: Association (blob)
      type: object
      properties:
        type:
          $ref: '#/components/schemas/association-type.v1'
        reason:
          $ref: '#/components/schemas/reason.v1'
        id:
          $ref: '#/components/schemas/association-id.v1'
        url:
          $ref: '#/components/schemas/url.v1'
      required:
        - type
        - id
    datum.v1:
      title: Association (datum)
      type: object
      properties:
        type:
          $ref: '#/components/schemas/association-type.v1'
        reason:
          $ref: '#/components/schemas/reason.v1'
        id:
          $ref: '#/components/schemas/association-id.v1'
        url:
          $ref: '#/components/schemas/url.v1'
      required:
        - type
        - id
    image.v1:
      title: Association (image)
      type: object
      properties:
        type:
          $ref: '#/components/schemas/association-type.v1'
        reason:
          $ref: '#/components/schemas/reason.v1'
        id:
          $ref: '#/components/schemas/association-id.v1'
        url:
          $ref: '#/components/schemas/url.v1'
      required:
        - type
        - id
    url-association.v1:
      title: Association (url)
      type: object
      properties:
        type:
          $ref: '#/components/schemas/association-type.v1'
        reason:
          $ref: '#/components/schemas/reason.v1'
        id:
          $ref: '#/components/schemas/association-id.v1'
        url:
          $ref: '#/components/schemas/url.v1'
      required:
        - type
        - id
        - url
    association.v1:
      title: Association
      description: Associate this resource with another Tidepool resource ID.
      type: object
      oneOf:
        - $ref: '#/components/schemas/blob.v1'
        - $ref: '#/components/schemas/datum.v1'
        - $ref: '#/components/schemas/image.v1'
        - $ref: '#/components/schemas/url-association.v1'
      required:
        - type
    associationarray.v1:
      title: Association Array
      description: An array of associations for the resource.
      type: array
      items:
        $ref: '#/components/schemas/association.v1'
    clockdriftoffset.v1:
      title: Clock Drift Offset
      description: Clock drift offset, expressed as milliseconds.
      type: integer
      format: int64
      minimum: -86400000
      maximum: 86400000
      example: 0
      x-tags:
        - Data
    conversionoffset.v1:
      title: Conversion Offset
      description: Conversion offset, expressed as milliseconds.
      type: integer
      format: int64
      example: 0
      x-tags:
        - Data
    semanticversion.v1:
      title: Semantic Version Number
      description: >-
        [Semantic Version Number 2.0.0](http://semver.org/). Regex from their
        [site](https://semver.org/#is-there-a-suggested-regular-expression-regex-to-check-a-semver-string).
      type: string
      minLength: 5
      pattern: >-
        ^(0|[1-9]\d*)\.(0|[1-9]\d*)\.(0|[1-9]\d*)(?:-((?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*)(?:\.(?:0|[1-9]\d*|\d*[a-zA-Z-][0-9a-zA-Z-]*))*))?(?:\+([0-9a-zA-Z-]+(?:\.[0-9a-zA-Z-]+)*))?$
      example: 2.36.1
    reversedomainname.v1:
      title: Reverse Domain Name
      description: >-
        Name in the [reverse domain name
        notation](https://en.wikipedia.org/wiki/Reverse_domain_name_notation).
      type: string
      pattern: >-
        ^[a-zA-Z0-9](|[a-zA-Z0-9-]{0,61}[a-zA-Z0-9])(\.[a-zA-Z0-9](|[a-zA-Z0-9-]{0,61}[a-zA-Z0-9]))+$
      example: org.tidepool.uploader
    deduplicatordescriptor.v1:
      title: Deduplicator Descriptor
      type: object
      properties:
        hash:
          type: string
          minLength: 1
        version:
          $ref: '#/components/schemas/semanticversion.v1'
        name:
          $ref: '#/components/schemas/reversedomainname.v1'
      required:
        - name
        - version
      x-tags:
        - Data
    deviceid.v1:
      title: Device ID
      description: >-
        Globally unique to device and repeatable with each upload, e.g. device
        make and model with serial number
      type: string
      minLength: 1
      example: MMT-1711:12345678
      x-tags:
        - Data
    datetimenotz.v1:
      title: Date/Time without Timezone
      description: >-
        [RFC 3339](https://www.ietf.org/rfc/rfc3339.txt) / [ISO
        8601](https://www.iso.org/iso-8601-date-and-time-format.html) timestamp
        _without_ timezone information
      type: string
      pattern: ^\d{4}-\d{2}-\d{2}T\d{2}:\d{2}:\d{2}$
      example: '2017-02-06T02:37:46'
      x-go-type: string
    jsonpatch.v1:
      title: JSONPatch
      oneOf:
        - properties:
            op:
              type: string
              description: The operation to perform.
              enum:
                - add
                - replace
                - test
            path:
              type: string
              description: A JSON Pointer path.
            value:
              description: The value to add, replace or test.
          required:
            - op
            - path
            - value
        - properties:
            op:
              type: string
              description: The operation to perform.
              enum:
                - remove
            path:
              type: string
              description: A JSON Pointer path.
          required:
            - op
            - path
        - properties:
            op:
              type: string
              description: The operation to perform.
              enum:
                - move
                - copy
            from:
              description: A JSON Pointer path pointing to the location to move/copy from.
              type: string
            path:
              type: string
              description: A JSON Pointer path.
          required:
            - op
            - from
            - path
      type: object
      description: >-
        Only have this here because Stoplight doesn't seem to like using the
        JSONSchema directly as a ref from http://json.schemastore.org/json-patch
    eventhistory.v1:
      title: Event History [Proposed]
      description: Revision history of the event
      type: array
      items:
        type: object
        properties:
          time:
            $ref: '#/components/schemas/datetime.v1'
          changes:
            $ref: '#/components/schemas/jsonpatch.v1'
        required:
          - time
          - changes
      x-tags:
        - Data
    origin-id.v1:
      title: Origin ID
      description: >-
        Any external identifier uniquely identifying the resource at the origin
        source.
      type: string
      minLength: 1
      maxLength: 100
    name.v1:
      title: Origin Name
      description: A human-readable name for the origin source.
      type: string
      minLength: 1
      maxLength: 100
    payload.v1:
      title: Payload
      description: >-
        Grab bag field for data that isn't yet part of the data model. The
        maximum size is 4K bytes.
      type: object
      additionalProperties: true
    origin-type.v1:
      title: Origin Type
      description: The type of the origin source.
      type: string
      enum:
        - application
        - device
        - manual
        - service
      example: device
    version.v1:
      title: Origin Version
      description: The version of the origin source at the time the resources was obtained.
      type: string
      minLength: 1
      maxLength: 100
    origin.v1:
      title: Origin
      description: External origin information for the source of the resource.
      type: object
      properties:
        id:
          $ref: '#/components/schemas/origin-id.v1'
        name:
          $ref: '#/components/schemas/name.v1'
        payload:
          $ref: '#/components/schemas/payload.v1'
        time:
          $ref: '#/components/schemas/datetime.v1'
        type:
          $ref: '#/components/schemas/origin-type.v1'
        version:
          $ref: '#/components/schemas/version.v1'
      required:
        - id
        - name
        - time
        - type
        - version
    longitude.v1:
      title: Longitude
      description: >-
        The prime meridian, which passes near the Royal Observatory, Greenwich,
        England, is defined as 0° longitude by convention. Positive longitudes
        are east of the prime meridian, and negative ones are west.
      type: object
      properties:
        units:
          type: string
          enum:
            - degrees
          example: degrees
        value:
          type: number
          format: double
          minimum: -180
          maximum: 180
          example: -122.1625595
      required:
        - units
        - value
    latitude.v1:
      title: Latitude
      description: >-
        Latitude is an angle which ranges from -90° at the South pole to 0° at
        the Equator to 90° at the North pole.
      type: object
      properties:
        units:
          type: string
          enum:
            - degrees
          example: degrees
        value:
          type: number
          format: double
          minimum: -90
          maximum: 90
          example: 37.4454404
      required:
        - units
        - value
    meters.v1:
      title: Accuracy (meters)
      description: Accuracy of a measurement, expressed as meters.
      type: object
      properties:
        value:
          type: number
          format: double
          minimum: 0
          maximum: 1000
          example: 42
        units:
          type: string
          enum:
            - meters
          example: meters
      required:
        - units
    accuracy-feet.v1:
      title: Accuracy (feet)
      description: Accuracy of a measurement, expressed in `feet`.
      type: object
      properties:
        value:
          type: number
          format: double
          minimum: 0
          maximum: 3280
          example: 42
        units:
          type: string
          enum:
            - feet
          example: feet
      required:
        - units
    accuracy.v1:
      title: Accuracy
      description: Accuracy of a measurement
      type: object
      oneOf:
        - $ref: '#/components/schemas/meters.v1'
        - $ref: '#/components/schemas/accuracy-feet.v1'
    floor.v1:
      title: Floor
      type: integer
      format: int32
      minimum: -1000
      maximum: 1000
    elevation-meters.v1:
      title: Elevation (meters)
      type: object
      properties:
        units:
          type: string
          enum:
            - meters
          example: meters
        value:
          type: number
          format: double
          minimum: 0
          maximum: 10000
          example: 42
      required:
        - units
        - value
    elevation-feet.v1:
      title: Elevation (feet)
      type: object
      properties:
        units:
          type: string
          enum:
            - feet
          example: feet
        value:
          type: number
          format: double
          minimum: 0
          maximum: 32808
          example: 42
      required:
        - units
        - value
    elevation.v1:
      title: Elevation
      description: Elevation, expressed as `meters` or `feet`.
      type: object
      oneOf:
        - $ref: '#/components/schemas/elevation-meters.v1'
        - $ref: '#/components/schemas/elevation-feet.v1'
      required:
        - units
        - value
    gps.v1:
      title: GPS
      description: GPS coordinates and related information.
      type: object
      properties:
        origin:
          $ref: '#/components/schemas/origin.v1'
        longitude:
          $ref: '#/components/schemas/longitude.v1'
        latitude:
          $ref: '#/components/schemas/latitude.v1'
        horizontalAccuracy:
          $ref: '#/components/schemas/accuracy.v1'
        verticalAccuracy:
          $ref: '#/components/schemas/accuracy.v1'
        floor:
          $ref: '#/components/schemas/floor.v1'
        elevation:
          $ref: '#/components/schemas/elevation.v1'
      required:
        - longitude
        - latitude
    location.v1:
      title: Location
      type: object
      description: >-
        Location information associated with the resource. One or both of `name`
        and `gps` must be specified.
      properties:
        name:
          type: string
          description: A name for the location.
          minLength: 1
          maxLength: 100
        gps:
          $ref: '#/components/schemas/gps.v1'
    note.v1:
      title: Note
      description: A note associated with the resource.
      type: string
      minLength: 1
      maxLength: 1000
    notearray.v1:
      title: Note Array
      description: An array of 1 to 100 notes.
      type: array
      minItems: 1
      maxItems: 100
      items:
        $ref: '#/components/schemas/note.v1'
    tag.v1:
      title: Tag
      description: A tag associated with the resource.
      type: string
      minLength: 1
      maxLength: 100
    tagarray.v1:
      title: Tag Array
      description: An array of tags.
      type: array
      items:
        $ref: '#/components/schemas/tag.v1'
    timezonename.v1:
      title: Time Zone
      description: >-
        A string timezone name from the [IANA timezone
        database](https://www.iana.org/time-zones)
      type: string
      example: Europe/London
      x-tags:
        - Data
    timezoneoffset.v1:
      title: Time Zone offset
      description: >-
        Time zone offset, expressed as positive or negative number of minutes
        from UTC.
      type: integer
      format: int32
      minimum: -10080
      maximum: 10080
      example: -420
      x-tags:
        - Data
    datatype.v1:
      title: Tidepool Data Type
      description: Data type
      type: string
      enum:
        - alert
        - basal
        - bloodKetone
        - bolus
        - cbg
        - cgmSettings
        - controllerSettings
        - controllerStatus
        - deviceEvent
        - deviceStatus
        - dosingDecision
        - food
        - insulin
        - physicalActivity
        - pumpSettings
        - pumpStatus
        - reportedState
        - smbg
        - upload
        - water
        - wizard
      example: upload
      x-tags:
        - Data
    uploadid.v1:
      title: Upload ID
      description: >-
        An upload identifier; this field should be the uploadId of the
        corresponding upload record
      type: string
      pattern: ^([0-9a-f]{32}|upid_[0-9a-f]{12})$
      minLength: 17
      maxLength: 32
      example: 0d92d5c1c22117a18f3620b9e24d3c06
      x-tags:
        - Data
    base.v1:
      title: Base
      description: An abstract base data type for all Tidepool diabetes data objects.
      type: object
      properties:
        annotations:
          $ref: '#/components/schemas/annotationarray.v1'
        archivedTime:
          allOf:
            - $ref: '#/components/schemas/datetime.v1'
          readOnly: true
        archivedDatasetId:
          $ref: '#/components/schemas/datasetid.v1'
        associations:
          $ref: '#/components/schemas/associationarray.v1'
        clockDriftOffset:
          $ref: '#/components/schemas/clockdriftoffset.v1'
        conversionOffset:
          $ref: '#/components/schemas/conversionoffset.v1'
        createdTime:
          $ref: '#/components/schemas/datetime.v1'
        createdUserId:
          $ref: '#/components/schemas/tidepooluserid'
        deduplicator:
          $ref: '#/components/schemas/deduplicatordescriptor.v1'
        deletedTime:
          $ref: '#/components/schemas/datetime.v1'
        deletedUserId:
          $ref: '#/components/schemas/tidepooluserid'
        deviceId:
          $ref: '#/components/schemas/deviceid.v1'
        deviceTime:
          $ref: '#/components/schemas/datetimenotz.v1'
        guid:
          type: string
          description: >-
            A string ID. Added to each event during data processing in the
            Tidepool Uploader or upon ingestion by the platform data ingestion
            service.
          deprecated: true
        history:
          $ref: '#/components/schemas/eventhistory.v1'
        id:
          $ref: '#/components/schemas/datasetid.v1'
        location:
          $ref: '#/components/schemas/location.v1'
        modifiedTime:
          $ref: '#/components/schemas/datetime.v1'
        modifiedUserId:
          $ref: '#/components/schemas/tidepooluserid'
        notes:
          $ref: '#/components/schemas/notearray.v1'
        origin:
          $ref: '#/components/schemas/origin.v1'
        payload:
          $ref: '#/components/schemas/payload.v1'
        source:
          type: string
          enum:
            - carelink
        tags:
          $ref: '#/components/schemas/tagarray.v1'
        time:
          $ref: '#/components/schemas/datetime.v1'
        timezone:
          $ref: '#/components/schemas/timezonename.v1'
        timezoneOffset:
          $ref: '#/components/schemas/timezoneoffset.v1'
        type:
          $ref: '#/components/schemas/datatype.v1'
        uploadId:
          $ref: '#/components/schemas/uploadid.v1'
      required:
        - id
        - type
        - time
      x-tags:
        - Data
    alert.v1:
      title: Alert
      allOf:
        - $ref: '#/components/schemas/base.v1'
        - type: object
          description: Alert presented to user
          properties:
            type:
              type: string
              enum:
                - alert
            name:
              type: string
              minLength: 1
              maxLength: 100
            priority:
              type: string
              enum:
                - critical
                - normal
                - timeSensitive
            trigger:
              type: string
              enum:
                - delayed
                - immediate
                - repeating
            triggerDelay:
              type: integer
              format: int32
              minimum: 0
              maximum: 86400
            sound:
              type: string
              enum:
                - name
                - silence
                - vibrate
            soundName:
              type: string
              minLength: 1
              maxLength: 100
            issuedTime:
              $ref: '#/components/schemas/datetime.v1'
            acknowledgedTime:
              $ref: '#/components/schemas/datetime.v1'
            retractedTime:
              $ref: '#/components/schemas/datetime.v1'
          required:
            - name
            - issuedTime
      x-tags:
        - Data
    deliverytype.v1:
      title: Delivery Type
      description: >-
        This defines the basal delivery type, used to differentiate between
        automated, scheduled, suspended and temporary basal types.
      type: string
      enum:
        - automated
        - scheduled
        - suspend
        - temp
      x-tags:
        - Data
    duration.v1:
      title: Insulin Delivery Duration
      description: An integer value representing a duration of time in milliseconds.
      type: integer
      format: int64
      minimum: 0
      maximum: 604800000
    expectedduration.v1:
      title: Expected Insulin Delivery Duration
      description: >-
        An integer value representing an original programmed duration of time in
        milliseconds, copied from the duration field on ingestion when a
        following event has resulted in truncation of the original programmed
        duration.


        `expectedDuration` cannot be less than the value of `duration`
      type: integer
      format: int64
      minimum: 0
      maximum: 604800000
    compound.v1:
      title: Insulin Compound
      type: object
      properties:
        amount:
          type: number
          format: double
          minimum: 0
      required:
        - amount
      x-tags:
        - Data
    compoundarray.v1:
      title: Insulin Compound Array
      type: array
      items:
        $ref: '#/components/schemas/compound.v1'
      maxItems: 100
      minItems: 1
      x-tags:
        - Data
    concentration.v1:
      title: Insulin Concentration
      type: object
      properties:
        value:
          type: number
          format: double
          minimum: 0
          maximum: 10000
        units:
          type: string
          enum:
            - Units/mL
      required:
        - units
        - value
      x-tags:
        - Data
    simple.v1:
      title: Insulin Simple
      type: object
      required:
        - actingType
      properties:
        actingType:
          type: string
          enum:
            - intermediate
            - long
            - rapid
            - short
        brand:
          type: string
          minLength: 1
          maxLength: 100
        concentration:
          $ref: '#/components/schemas/concentration.v1'
      x-tags:
        - Data
    formulation.v1:
      title: Insulin Formulation
      type: object
      oneOf:
        - properties:
            compounds:
              $ref: '#/components/schemas/compoundarray.v1'
            name:
              type: string
              minLength: 1
              maxLength: 100
        - properties:
            simple:
              $ref: '#/components/schemas/simple.v1'
            name:
              type: string
              minLength: 1
              maxLength: 100
      x-tags:
        - Data
    deliveryrate.v1:
      title: Insulin Delivery Rate
      description: >-
        A floating point number >= 0 representing the amount of insulin
        delivered in units per hour.
      type: number
      format: double
      minimum: 0
      maximum: 100
    schedulename.v1:
      title: Insulin Delivery Schedule Name
      description: The name of the basal schedule.
      type: string
      minLength: 1
      maxLength: 1000
    scheduled.v1:
      title: Basal Suppressed Scheduled
      type: object
      properties:
        type:
          type: string
          enum:
            - basal
        deliveryType:
          type: string
          enum:
            - scheduled
        rate:
          $ref: '#/components/schemas/deliveryrate.v1'
        insulinFormulation:
          $ref: '#/components/schemas/formulation.v1'
        scheduleName:
          $ref: '#/components/schemas/schedulename.v1'
        annotations:
          $ref: '#/components/schemas/annotationarray.v1'
      x-tags:
        - Data
    automated.v1:
      title: Basal Automated
      description: An automated basal delivery event.
      allOf:
        - $ref: '#/components/schemas/base.v1'
        - type: object
          properties:
            deliveryType:
              $ref: '#/components/schemas/deliverytype.v1'
        - type: object
          properties:
            type:
              type: string
              enum:
                - basal
            deliveryType:
              type: string
              enum:
                - automated
            duration:
              $ref: '#/components/schemas/duration.v1'
            expectedDuration:
              $ref: '#/components/schemas/expectedduration.v1'
            insulinFormulation:
              $ref: '#/components/schemas/formulation.v1'
            rate:
              $ref: '#/components/schemas/deliveryrate.v1'
            scheduleName:
              $ref: '#/components/schemas/schedulename.v1'
            suppressed:
              $ref: '#/components/schemas/scheduled.v1'
          required:
            - deliveryType
            - duration
            - rate
      x-tags:
        - Data
    scheduled.v1-2:
      title: Basal Scheduled
      description: A scheduled basal delivery event.
      allOf:
        - $ref: '#/components/schemas/base.v1'
        - type: object
          properties:
            deliveryType:
              $ref: '#/components/schemas/deliverytype.v1'
        - type: object
          properties:
            type:
              type: string
              enum:
                - basal
            deliveryType:
              type: string
              enum:
                - scheduled
            duration:
              $ref: '#/components/schemas/duration.v1'
            expectedDuration:
              $ref: '#/components/schemas/expectedduration.v1'
            insulinFormulation:
              $ref: '#/components/schemas/formulation.v1'
            rate:
              $ref: '#/components/schemas/deliveryrate.v1'
            scheduleName:
              $ref: '#/components/schemas/schedulename.v1'
      x-tags:
        - Data
    automated.v1-2:
      title: Basal Suppressed Automated
      type: object
      properties:
        type:
          type: string
          enum:
            - basal
        deliveryType:
          type: string
          enum:
            - automated
        suppressed:
          $ref: '#/components/schemas/scheduled.v1'
        scheduleName:
          $ref: '#/components/schemas/schedulename.v1'
        rate:
          $ref: '#/components/schemas/deliveryrate.v1'
        insulinFormulation:
          $ref: '#/components/schemas/formulation.v1'
        annotations:
          $ref: '#/components/schemas/annotationarray.v1'
      x-tags:
        - Data
    percentage.v1:
      title: Insulin Delivery Percentage
      description: >-
        Floating point value representing a percentage, where 1.0 represents
        100%.
      type: number
      format: float
      minimum: 0
      maximum: 10
    temporary.v1:
      title: Basal Suppressed Temporary
      type: object
      properties:
        type:
          type: string
          enum:
            - basal
        deliveryType:
          type: string
          enum:
            - temporary
        suppressed:
          oneOf:
            - $ref: '#/components/schemas/automated.v1-2'
            - $ref: '#/components/schemas/scheduled.v1'
        rate:
          $ref: '#/components/schemas/deliveryrate.v1'
        percent:
          $ref: '#/components/schemas/percentage.v1'
        insulinFormulation:
          $ref: '#/components/schemas/formulation.v1'
        annotations:
          $ref: '#/components/schemas/annotationarray.v1'
      x-tags:
        - Data
    suspend.v1:
      title: Basal Suspend
      allOf:
        - $ref: '#/components/schemas/base.v1'
        - type: object
          description: A basal suspend event
          properties:
            deliveryType:
              $ref: '#/components/schemas/deliverytype.v1'
        - type: object
          properties:
            type:
              type: string
              enum:
                - basal
            deliveryType:
              type: string
              enum:
                - suspend
            duration:
              $ref: '#/components/schemas/duration.v1'
            expectedDuration:
              $ref: '#/components/schemas/expectedduration.v1'
            suppressed:
              oneOf:
                - $ref: '#/components/schemas/automated.v1-2'
                - $ref: '#/components/schemas/scheduled.v1'
                - $ref: '#/components/schemas/temporary.v1'
      x-tags:
        - Data
    temporary.v1-2:
      title: Basal Temporary
      allOf:
        - $ref: '#/components/schemas/base.v1'
        - type: object
          description: A temporary basal delivery event
          properties:
            deliveryType:
              $ref: '#/components/schemas/deliverytype.v1'
        - type: object
          properties:
            type:
              type: string
              enum:
                - basal
            deliveryType:
              type: string
              enum:
                - temp
            duration:
              $ref: '#/components/schemas/duration.v1'
            expectedDuration:
              $ref: '#/components/schemas/expectedduration.v1'
            insulinFormulation:
              $ref: '#/components/schemas/formulation.v1'
            percent:
              $ref: '#/components/schemas/percentage.v1'
            rate:
              $ref: '#/components/schemas/deliveryrate.v1'
            suppressed:
              oneOf:
                - $ref: '#/components/schemas/automated.v1-2'
                - $ref: '#/components/schemas/scheduled.v1'
      x-tags:
        - Data
    trend.v1:
      title: Glucose Trend
      description: >-
        Trends are annotated in terms of `slow`, `moderate` and `rapid`, since
        different manufacturers use different arrow glyphs.
      type: string
      enum:
        - constant
        - slowFall
        - slowRise
        - moderateFall
        - moderateRise
        - rapidFall
        - rapidRise
      x-tags:
        - Data
    rateunits.v1:
      title: Glucose Rate Units (mg/dL/minute)
      type: string
      enum:
        - mmol/L/minute
        - mg/dL/minute
      example: mg/dL/minute
      x-tags:
        - Data
    trendrate.v1:
      title: Glucose Trend Rate
      type: number
      format: double
      minimum: -100
      maximum: 100
      x-tags:
        - Data
    sampleinterval.v1:
      title: Glucose Sample Interval
      type: number
      format: int32
      minimum: 0
      maximum: 86400000
      x-tags:
        - Data
    backfilled.v1:
      title: Glucose Backfilled
      type: boolean
      x-tags:
        - Data
    unitsmgdl.v1:
      title: Blood Unit (mg/dL)
      type: string
      enum:
        - mg/dL
        - mg/dl
      example: mg/dL
      x-tags:
        - Data
    valuemgdl.v1:
      title: Blood Value (mg/dL)
      description: An integer value representing a `mg/dL` value.
      type: integer
      format: int32
      minimum: 0
      maximum: 1000
      example: 105
      x-tags:
        - Data
    glucosemgdl.v1:
      title: Blood Glucose (mg/dL)
      description: Blood glucose value, in `mg/dL`
      type: object
      properties:
        units:
          $ref: '#/components/schemas/unitsmgdl.v1'
        value:
          $ref: '#/components/schemas/valuemgdl.v1'
      required:
        - units
        - value
      x-tags:
        - Data
    unitsmmol.v1:
      title: Blood Unit (mmol/L)
      type: string
      enum:
        - mmol/L
        - mmol/l
      example: mmol/L
      x-tags:
        - Data
    valuemmol.v1:
      title: Blood Value (mmol/L)
      description: A floating point value representing a `mmol/L` value.
      type: number
      format: float
      minimum: 0
      example: 5.5
      x-tags:
        - Data
    glucosemmol.v1:
      title: Blood Glucose (mmol/L)
      description: Blood glucose value, in `mmol/L`
      type: object
      properties:
        units:
          $ref: '#/components/schemas/unitsmmol.v1'
        value:
          $ref: '#/components/schemas/valuemmol.v1'
      required:
        - units
        - value
      x-tags:
        - Data
    glucose.v1:
      title: Blood Glucose
      description: Blood glucose value, in `mg/dL` or `mmol/L`
      oneOf:
        - $ref: '#/components/schemas/glucosemgdl.v1'
        - $ref: '#/components/schemas/glucosemmol.v1'
      x-tags:
        - Data
    continuousglucose.v1:
      title: Continuous Glucose
      allOf:
        - $ref: '#/components/schemas/base.v1'
        - type: object
          description: A continuous glucose measurement
          properties:
            type:
              type: string
              enum:
                - cbg
            trend:
              $ref: '#/components/schemas/trend.v1'
            trendRateUnits:
              $ref: '#/components/schemas/rateunits.v1'
            trendRate:
              $ref: '#/components/schemas/trendrate.v1'
            sampleInterval:
              $ref: '#/components/schemas/sampleinterval.v1'
            backfilled:
              $ref: '#/components/schemas/backfilled.v1'
          required:
            - type
        - $ref: '#/components/schemas/glucose.v1'
      x-tags:
        - Data
    subtype.v1:
      title: Self Monitored Glucose Sub Type
      type: string
      enum:
        - linked
        - manual
        - scanned
      example: scanned
    selfmonitoredglucose.v1:
      title: Self Monitored Glucose
      allOf:
        - $ref: '#/components/schemas/base.v1'
        - type: object
          description: A self-monitored glucose measurement
          properties:
            type:
              type: string
              enum:
                - smbg
            subType:
              $ref: '#/components/schemas/subtype.v1'
          required:
            - type
        - $ref: '#/components/schemas/glucose.v1'
      x-tags:
        - Data
    ketone.v1:
      title: Blood Ketone
      description: A blood ketone measurement event, always in `mmol/L`
      allOf:
        - $ref: '#/components/schemas/base.v1'
        - type: object
          properties:
            type:
              type: string
              enum:
                - bloodKetone
            units:
              $ref: '#/components/schemas/unitsmmol.v1'
            value:
              $ref: '#/components/schemas/valuemmol.v1'
          required:
            - units
            - value
            - type
      x-tags:
        - Data
    subtype.v1-2:
      title: Bolus Subtype
      type: string
      enum:
        - automated
        - dual/square
        - normal
        - square
    deliverycontext.v1:
      title: Bolus Delivery Context
      type: string
      enum:
        - algorithm
        - device
        - oneButton
        - remote
        - watch
        - undetermined
    bolus.v1:
      title: Bolus
      allOf:
        - $ref: '#/components/schemas/base.v1'
        - type: object
          description: An abstract base data type for different types of bolus data
          properties:
            type:
              type: string
              enum:
                - bolus
            subType:
              $ref: '#/components/schemas/subtype.v1-2'
            insulinFormulation:
              $ref: '#/components/schemas/formulation.v1'
            deliveryContext:
              $ref: '#/components/schemas/deliverycontext.v1'
      required:
        - type
        - subType
      x-tags:
        - Data
      x-internal: false
    automated.v1-3:
      title: Bolus Automated
      allOf:
        - $ref: '#/components/schemas/bolus.v1'
        - type: object
          description: An automated bolus event
          properties:
            expectedNormal:
              type: number
              format: float
              minimum: 0
              maximum: 100
              description: >-
                Floating point value rounded to the appropriate significant
                figures for the device's precision.
            normal:
              type: number
              format: float
              minimum: 0
              maximum: 100
              description: >-
                Floating point value rounded to the appropriate significant
                figures for the device's precision.
            subType:
              type: string
              enum:
                - automated
          required:
            - normal
            - subType
      x-tags:
        - Data
    combination.v1:
      title: Bolus Combination
      allOf:
        - $ref: '#/components/schemas/bolus.v1'
        - type: object
          description: A combination bolus event
          properties:
            duration:
              type: integer
              format: int64
              minimum: 0
              maximum: 86400000
              description: Integer value representing milliseconds
            expectedDuration:
              type: integer
              format: int64
              minimum: 0
              maximum: 86400000
              description: Integer value representing milliseconds
            expectedExtended:
              type: number
              format: float
              minimum: 0
              maximum: 100
              description: >-
                Floating point value rounded to the appropriate significant
                figures for the device's precision.
            expectedNormal:
              type: number
              format: float
              minimum: 0
              maximum: 100
              description: >-
                Floating point value rounded to the appropriate significant
                figures for the device's precision.
            extended:
              type: number
              format: float
              minimum: 0
              maximum: 100
              description: >-
                Floating point value rounded to the appropriate significant
                figures for the device's precision.
            normal:
              type: number
              format: float
              minimum: 0
              maximum: 100
              description: >-
                Floating point value rounded to the appropriate significant
                figures for the device's precision.
            subType:
              type: string
              enum:
                - dual/square
          required:
            - duration
            - extended
            - normal
            - subType
      x-tags:
        - Data
    extended.v1:
      title: Bolus Extended
      allOf:
        - $ref: '#/components/schemas/bolus.v1'
        - type: object
          description: An extended bolus event
          properties:
            duration:
              type: integer
              format: int64
              minimum: 0
              maximum: 86400000
              description: Integer value representing milliseconds
            expectedDuration:
              type: integer
              format: int64
              minimum: 0
              maximum: 86400000
              description: Integer value representing milliseconds
            expectedExtended:
              type: number
              format: float
              minimum: 0
              maximum: 100
              description: >-
                Floating point value rounded to the appropriate significant
                figures for the device's precision.
            extended:
              type: number
              format: float
              minimum: 0
              maximum: 100
              description: >-
                Floating point value rounded to the appropriate significant
                figures for the device's precision.
            subType:
              type: string
              enum:
                - square
          required:
            - duration
            - extended
            - subType
      x-tags:
        - Data
    normal.v1:
      title: Bolus Normal
      allOf:
        - $ref: '#/components/schemas/bolus.v1'
        - type: object
          description: A normal bolus event
          properties:
            expectedNormal:
              type: number
              format: float
              minimum: 0
              maximum: 100
              description: >-
                Floating point value rounded to the appropriate significant
                figures for the device's precision.
            normal:
              type: number
              format: float
              minimum: 0
              maximum: 100
              description: >-
                Floating point value rounded to the appropriate significant
                figures for the device's precision.
            subType:
              type: string
              enum:
                - normal
          required:
            - normal
            - subType
      x-tags:
        - Data
    value.v1:
      title: Blood Value (in mg/dL or mmol/L units)
      oneOf:
        - $ref: '#/components/schemas/valuemgdl.v1'
        - $ref: '#/components/schemas/valuemmol.v1'
      x-tags:
        - Data
    targetmgdl.v1:
      title: Blood Glucose Target Value (mg/dL)
      description: Blood glucose target values, in `mg/dL`
      type: object
      properties:
        high:
          type: number
          minimum: 0
          maximum: 1000
          description: |-
            An integer encoding the upper bound of a PWD's blood glucose target.

            The minimum value should be >= `low` or `target`, whichever present
        low:
          type: number
          minimum: 0
          maximum: 1000
          description: An integer encoding the lower bound of a PWD's blood glucose target.
        range:
          type: number
          minimum: 0
          maximum: 1000
          description: >-
            An integer encoding the allowed deviation above or below the PWD's
            target blood glucose.


            Maximum should be min(`target`, 1000 - `target`) such that
            `target`-`range` >= 0 and `target`+`range` <= 1000
        target:
          type: number
          minimum: 0
          maximum: 1000
          description: >-
            An integer encoding the PWD's target blood glucose as a single
            value.
      example:
        high: 180
        low: 80
      x-tags:
        - Data
    targetmmol.v1:
      title: Blood Glucose Target Value (mmol/L)
      description: Blood glucose target values, in `mmol/L`
      type: object
      properties:
        high:
          type: number
          description: |-
            An integer encoding the upper bound of a PWD's blood glucose target.

            The minimum value should be >= `low` or `target`, whichever present
          minimum: 0
          maximum: 55
        low:
          type: number
          minimum: 0
          maximum: 55
          description: An integer encoding the lower bound of a PWD's blood glucose target.
        range:
          type: number
          minimum: 0
          maximum: 55
          description: >-
            An integer encoding the allowed deviation above or below the PWD's
            target blood glucose.


            Maximum should be min(`target`, 1000 - `target`) such that
            `target`-`range` >= 0 and `target`+`range` <= 1000
        target:
          type: number
          minimum: 0
          maximum: 55
          description: >-
            An integer encoding the PWD's target blood glucose as a single
            value.
      x-tags:
        - Data
    target.v1:
      title: Blood Glucose Target
      oneOf:
        - $ref: '#/components/schemas/targetmgdl.v1'
        - $ref: '#/components/schemas/targetmmol.v1'
      x-tags:
        - Data
    recommended.v1:
      title: Insulin Recommended
      description: >-
        An object encoding the amount of insulin calculated as a recommended
        dose to "cover" the `bgInput` and `carbInput`, possibly taking into
        account the `insulinOnBoard`.
      type: object
      properties:
        net:
          type: number
          description: >-
            A floating point value representing units of insulin.


            Floating point value rounded to the appropriate significant figures
            for the device's precision.
          format: float
          minimum: -100
          maximum: 100
        correction:
          type: number
          description: >-
            A floating point value representing units of insulin.


            Floating point value rounded to the appropriate significant figures
            for the device's precision.
          format: float
          minimum: -100
          maximum: 100
        carb:
          type: number
          description: >-
            A floating point value representing units of insulin.


            Floating point value rounded to the appropriate significant figures
            for the device's precision.
          format: float
          minimum: 0
          maximum: 100
      x-tags:
        - Data
    units.v1:
      title: Carbohydrate Units
      type: string
      enum:
        - grams
        - exchanges
      example: grams
    calculator.v1:
      title: Bolus Calculator
      allOf:
        - $ref: '#/components/schemas/base.v1'
        - type: object
          description: A bolus calculator event
          properties:
            bgInput:
              $ref: '#/components/schemas/value.v1'
            bgTarget:
              $ref: '#/components/schemas/target.v1'
            bolus:
              description: The bolus event resulting from this wizard event.
            carbInput:
              type: integer
              format: int32
              description: >-
                An integer encoding the PWD's carbohydrate input into the bolus
                calculator.
              minimum: 0
              maximum: 1000
            insulinCarbRatio:
              type: number
              description: >-
                An integer encoding the grams of carbohydrate "covered" by one
                unit of insulin for the PWD.
              format: double
              minimum: 0
              maximum: 250
            insulinOnBoard:
              type: number
              description: A floating point value representing units of insulin.
              format: float
              minimum: 0
              maximum: 250
            insulinSensitivity:
              $ref: '#/components/schemas/value.v1'
            recommended:
              $ref: '#/components/schemas/recommended.v1'
            type:
              type: string
              enum:
                - wizard
            units:
              type: string
            carbUnits:
              $ref: '#/components/schemas/units.v1'
      required:
        - type
      x-tags:
        - Data
    cgmsettings.v1:
      title: CGM Settings
      allOf:
        - $ref: '#/components/schemas/base.v1'
        - type: object
          description: Continuous Glucose Monitor settings
          properties:
            firmwareVersion:
              type: string
              maxLength: 100
              minLength: 1
              example: '1.2'
            hardwareVersion:
              type: string
              maxLength: 100
              minLength: 1
              example: 2.3r45
            highAlerts:
              type: object
              properties:
                enabled:
                  type: boolean
                level:
                  $ref: '#/components/schemas/value.v1'
                snooze:
                  type: integer
                  minimum: 0
                  maximum: 86400000
                  description: Integer value representing milliseconds
              required:
                - enabled
                - level
                - snooze
            lowAlerts:
              type: object
              properties:
                enabled:
                  type: boolean
                level:
                  $ref: '#/components/schemas/value.v1'
                snooze:
                  type: integer
                  minimum: 0
                  maximum: 86400000
                  description: Integer value representing milliseconds
              required:
                - enabled
                - level
                - snooze
            manufacturers:
              type: array
              maxLength: 10
              minLength: 1
              example:
                - Acme
              items:
                type: string
                maxLength: 100
                minLength: 1
            model:
              type: string
              maxLength: 100
              minLength: 1
              example: Turbo CGM III
            name:
              type: string
              maxLength: 100
              minLength: 1
              example: My CGM
            outOfRangeAlerts:
              type: object
              properties:
                enabled:
                  type: boolean
                snooze:
                  type: number
                  description: Integer value representing milliseconds
                  format: double
                  minimum: 0
                  maximum: 86400000
              required:
                - enabled
                - snooze
            rateOfChangeAlert:
              type: object
              properties:
                fallRate:
                  type: object
                  properties:
                    enabled:
                      type: boolean
                    rate:
                      oneOf:
                        - description: Integer value representing a `mg/dL` value.
                          format: double
                          minimum: -10
                          maximum: 0
                          exclusiveMaximum: true
                          multipleOf: 1
                        - description: Floating point value representing a `mmol/L` value.
                          format: double
                          minimum: -0.55
                          maximum: 0
                          exclusiveMaximum: true
                      type: number
                riseRate:
                  type: object
                  properties:
                    enabled:
                      type: boolean
                    rate:
                      oneOf:
                        - description: Integer value representing a `mg/dL` value.
                          format: double
                          exclusiveMinimum: true
                          minimum: 0
                          maximum: 10
                          multipleOf: 1
                        - description: Floating point value representing a `mmol/L` value.
                          format: double
                          exclusiveMinimum: true
                          minimum: 0
                          maximum: 0.55
                      type: number
              required:
                - fallRate
                - riseRate
            serialNumber:
              type: string
              maxLength: 100
              minLength: 1
              example: '1234567890'
            softwareVersion:
              type: string
              maxLength: 100
              minLength: 1
              example: 3.4.5
            transmitterId:
              type: string
              example: G8X568
            type:
              type: string
              enum:
                - cgmSettings
            units:
              type: string
              enum:
                - mg/dL
                - mmol/L
      required:
        - type
      x-tags:
        - Data
    device.v1:
      title: Controller Settings Device
      allOf:
        - type: object
          description: The device for the controller settings.
          properties:
            firmwareVersion:
              type: string
              maxLength: 100
              minLength: 1
              example: '1.2'
            hardwareVersion:
              type: string
              maxLength: 100
              minLength: 1
              example: 2.3r45
            manufacturers:
              type: array
              items:
                type: string
                maxLength: 100
                minLength: 1
              maxLength: 10
              minLength: 1
              example:
                - Acme
            model:
              type: string
              maxLength: 100
              minLength: 1
              example: Super Controller
            name:
              type: string
              maxLength: 100
              minLength: 1
              example: My Controller
            serialNumber:
              type: string
              maxLength: 100
              minLength: 1
              example: '1234567890'
            softwareVersion:
              type: string
              maxLength: 100
              minLength: 1
              example: 3.4.5
      x-tags:
        - Data
    notifications.v1:
      title: Controller Settings Notifications
      allOf:
        - type: object
          description: The notifications for the controller settings.
          properties:
            authorization:
              type: string
              enum:
                - authorized
                - denied
                - ephemeral
                - notDetermined
                - provisional
            alert:
              type: boolean
            criticalAlert:
              type: boolean
            badge:
              type: boolean
            sound:
              type: boolean
            announcement:
              type: boolean
            notificationCenter:
              type: boolean
            lockScreen:
              type: boolean
            alertStyle:
              type: string
              enum:
                - alert
                - banner
                - none
      x-tags:
        - Data
    controllersettings.v1:
      title: Controller Settings
      allOf:
        - $ref: '#/components/schemas/base.v1'
        - type: object
          description: Controller settings
          properties:
            type:
              type: string
              enum:
                - controllerSettings
            device:
              $ref: '#/components/schemas/device.v1'
            notifications:
              $ref: '#/components/schemas/notifications.v1'
      x-tags:
        - Data
    controllerstatus.v1:
      title: Controller Status
      allOf:
        - $ref: '#/components/schemas/base.v1'
        - type: object
          description: Controller status
          properties:
            type:
              type: string
              enum:
                - controllerStatus
            battery:
              type: object
              properties:
                time:
                  type: string
                  format: date-time
                state:
                  type: string
                  enum:
                    - charging
                    - full
                    - unplugged
                remaining:
                  type: number
                  format: double
                  minimum: 0
                  maximum: 1
                  example: 0.75
                units:
                  type: string
                  enum:
                    - percent
          required:
            - battery
    subtype.v1-3:
      title: Device Event Sub Type
      type: string
      enum:
        - alarm
        - calibration
        - prime
        - pumpSettingsOverride
        - reservoirChange
        - sensorEvent
        - settingsChange
        - status
        - timeChange
        - transmitterEvent
    event.v1:
      title: Device Event
      description: An abstract base data type for all device events.
      allOf:
        - $ref: '#/components/schemas/base.v1'
        - type: object
          properties:
            type:
              type: string
              enum:
                - deviceEvent
            subType:
              $ref: '#/components/schemas/subtype.v1-3'
      required:
        - subType
        - type
      x-tags:
        - Data
    alarm.v1:
      title: Device Alarm
      allOf:
        - $ref: '#/components/schemas/event.v1'
        - type: object
          description: An alert from a diabetes device
          properties:
            subType:
              type: string
              enum:
                - alarm
            alarmType:
              type: string
              enum:
                - auto_off
                - low_insulin
                - low_power
                - no_delivery
                - no_insulin
                - no_power
                - occlusion
                - other
                - over_limit
              description: >-
                String value encoding the type of alarm, with `other` as the
                catch-all/default category.
            status:
              type: string
              description: >-
                The `id` of the status event logically connected with this
                event.
          required:
            - subType
            - alarmType
      x-tags:
        - Data
    calibration.v1:
      title: Device Calibration
      allOf:
        - $ref: '#/components/schemas/event.v1'
        - type: object
          description: A blood glucose device calibration event
          properties:
            subType:
              type: string
              enum:
                - calibration
          required:
            - subType
        - $ref: '#/components/schemas/glucose.v1'
      x-tags:
        - Data
    deliverystatus.v1:
      title: Device Delivery Status
      description: An insulin pump's insulin delivery status.
      allOf:
        - $ref: '#/components/schemas/event.v1'
        - type: object
          properties:
            duration:
              type: integer
              format: int64
              minimum: 0
            expectedDuration:
              type: integer
              format: int64
              minimum: 0
            reason:
              type: object
              properties:
                suspended:
                  type: string
                  enum:
                    - automatic
                    - manual
                resumed:
                  type: string
                  enum:
                    - automatic
                    - manual
            status:
              type: string
              enum:
                - resumed
                - suspended
            subType:
              type: string
              enum:
                - status
          required:
            - status
            - subType
      x-tags:
        - Data
    primecannula.v1:
      title: Cannula Prime Event
      description: A cannula prime event.
      allOf:
        - $ref: '#/components/schemas/event.v1'
        - type: object
          properties:
            primeTarget:
              type: string
              enum:
                - cannula
            subType:
              type: string
              enum:
                - prime
            volume:
              type: number
              format: float
              minimum: 0
              maximum: 10
      required:
        - primeTarget
        - subType
        - volume
      x-tags:
        - Data
    primetubing.v1:
      title: Tubing Prime Event
      description: A tubing prime event.
      allOf:
        - $ref: '#/components/schemas/event.v1'
        - type: object
          properties:
            primeTarget:
              type: string
              enum:
                - tubing
            subType:
              type: string
              enum:
                - prime
            volume:
              type: number
              format: float
              minimum: 0
              maximum: 100
      required:
        - primeTarget
        - subType
        - volume
      x-tags:
        - Data
    prime.v1:
      title: Device Prime Event
      description: An insulin pump prime event.
      oneOf:
        - $ref: '#/components/schemas/primecannula.v1'
        - $ref: '#/components/schemas/primetubing.v1'
      required:
        - primeTarget
        - subType
      x-tags:
        - Data
    units.v1-2:
      title: Blood Unit (mg/dL or mmol/L)
      oneOf:
        - $ref: '#/components/schemas/unitsmgdl.v1'
        - $ref: '#/components/schemas/unitsmmol.v1'
      x-tags:
        - Data
    pumpsettingsoverride.v1:
      title: Device Pump Settings Override Event
      allOf:
        - $ref: '#/components/schemas/event.v1'
        - type: object
          description: An insulin pump settings override event.
          properties:
            subType:
              type: string
              enum:
                - pumpSettingsOverride
            overrideType:
              type: string
              enum:
                - custom
                - physicalActivity
                - preprandial
                - preset
                - sleep
              example: preset
            overridePreset:
              type: string
              minLength: 1
              maxLength: 100
              example: Running
            method:
              type: string
              enum:
                - automatic
                - manual
              example: manual
            duration:
              type: number
              format: float
              minimum: 0
              maximum: 604800000
              example: 2700000
            expectedDuration:
              type: number
              format: float
              minimum: 0
              maximum: 604800000
              example: 7200000
            bgTarget:
              $ref: '#/components/schemas/target.v1'
              example:
                high: 160
                low: 150
            basalRateScaleFactor:
              type: number
              format: float
              minimum: 0.1
              maximum: 10
              example: 0.8
            carbRatioScaleFactor:
              type: number
              format: float
              minimum: 0.1
              maximum: 10
              example: 1.25
            insulinSensitivityScaleFactor:
              type: number
              format: float
              minimum: 0.1
              maximum: 10
              example: 1.25
            units:
              type: object
              properties:
                bg:
                  $ref: '#/components/schemas/units.v1-2'
          required:
            - subType
            - overrideType
      x-tags:
        - Data
    reservoirchange.v1:
      title: Device Reservoir Change
      description: An insulin pump reservoir change.
      allOf:
        - $ref: '#/components/schemas/event.v1'
        - type: object
          properties:
            subType:
              type: string
              enum:
                - reservoirChange
            status:
              type: string
              description: >-
                The `id` of the `status` event logically connected with this
                event.
          required:
            - subType
      x-tags:
        - Data
    sensor.v1:
      title: DeviceSensorEvent [Proposed]
      description: A device sensor event.
      allOf:
        - $ref: '#/components/schemas/event.v1'
        - type: object
          properties:
            subType:
              type: string
              enum:
                - sensorEvent
            eventType:
              type: string
              enum:
                - expired
                - start
                - stop
      x-tags:
        - Data
    settingschange.v1:
      title: Device Settings Change [Proposed]
      description: An insulin pump settings change.
      allOf:
        - $ref: '#/components/schemas/event.v1'
        - type: object
          properties:
            basalSchedule:
              type: object
              properties:
                from:
                  type: string
                to:
                  type: string
              required:
                - to
            bgTarget:
              type: object
              properties:
                from:
                  type: string
                to:
                  type: string
              required:
                - to
            carbRatio:
              type: object
              properties:
                from:
                  type: string
                to:
                  type: string
              required:
                - to
            insulinSensitivityFactor:
              type: object
              properties:
                from:
                  type: string
                to:
                  type: string
              required:
                - to
            subType:
              type: string
              enum:
                - settingsChange
          required:
            - subType
      x-tags:
        - Data
    timechangeinfo.v1:
      title: Time Change Info
      type: object
      properties:
        timeZoneName:
          $ref: '#/components/schemas/timezonename.v1'
        time:
          $ref: '#/components/schemas/datetimenotz.v1'
      x-tags:
        - Data
    timechange.v1:
      title: Device Time Change
      description: A device time change.
      allOf:
        - $ref: '#/components/schemas/event.v1'
        - oneOf:
            - description: A `timeChange` event
              type: object
              properties:
                subType:
                  type: string
                  enum:
                    - timeChange
                method:
                  type: string
                  enum:
                    - automatic
                    - manual
                from:
                  $ref: '#/components/schemas/timechangeinfo.v1'
                to:
                  $ref: '#/components/schemas/timechangeinfo.v1'
              required:
                - subType
                - method
                - to
            - description: Legacy `timeChange` event
              type: object
              properties:
                subType:
                  type: string
                  enum:
                    - timeChange
                change:
                  properties:
                    agent:
                      type: string
                      enum:
                        - automatic
                        - manual
                    from:
                      $ref: '#/components/schemas/datetimenotz.v1'
                    to:
                      $ref: '#/components/schemas/datetimenotz.v1'
                  required:
                    - agent
                    - from
                    - to
                  oneOf:
                    - type: string
                    - type: object
              required:
                - subType
      x-tags:
        - Data
    transmitter.v1:
      title: DeviceTransmitterEvent [Proposed]
      allOf:
        - $ref: '#/components/schemas/event.v1'
        - type: object
          description: A transmitter event
          properties:
            subType:
              type: string
              enum:
                - transmitterEvent
            eventType:
              type: string
              enum:
                - expired
                - start
                - stop
      x-tags:
        - Data
    calories.v1:
      title: Energy (calories)
      type: object
      properties:
        units:
          type: string
          enum:
            - calories
        value:
          type: number
          format: float
          minimum: 0
          maximum: 10000000
      required:
        - units
        - value
    kilocalories.v1:
      title: Energy (kilocalories)
      type: object
      properties:
        units:
          type: string
          enum:
            - kilocalories
        value:
          type: number
          format: float
          minimum: 0
          maximum: 10000
      required:
        - units
        - value
    joules.v1:
      title: Energy (joules)
      type: object
      properties:
        units:
          type: string
          enum:
            - joules
        value:
          type: number
          format: float
          minimum: 0
          maximum: 41858000
      required:
        - units
        - value
    kilojoules.v1:
      title: Energy (kilojoules)
      type: object
      properties:
        units:
          type: string
          enum:
            - kilojoules
        value:
          type: number
          format: float
          minimum: 0
          maximum: 41858
      required:
        - units
        - value
    energy.v1:
      title: Energy
      type: object
      oneOf:
        - $ref: '#/components/schemas/calories.v1'
        - $ref: '#/components/schemas/kilocalories.v1'
        - $ref: '#/components/schemas/joules.v1'
        - $ref: '#/components/schemas/kilojoules.v1'
    nutrition.v1:
      title: Nutrition
      type: object
      properties:
        absorptionDuration:
          type: integer
          format: int32
          minimum: 0
          maximum: 86400
          description: >-
            The duration it takes to fully digest/absorb the nutrients, in
            `seconds`
        carbohydrate:
          type: object
          properties:
            dietaryFiber:
              type: number
              format: float
              minimum: 0
              maximum: 1000
            net:
              type: number
              format: float
              minimum: 0
              maximum: 1000
            sugars:
              type: number
              format: float
              minimum: 0
              maximum: 1000
            total:
              type: number
              format: float
              minimum: 0
              maximum: 1000
            units:
              type: string
              enum:
                - grams
          required:
            - net
            - units
        energy:
          $ref: '#/components/schemas/energy.v1'
        fat:
          type: object
          properties:
            total:
              type: number
              format: float
              minimum: 0
              maximum: 1000
            units:
              type: string
              enum:
                - grams
          required:
            - total
            - units
        protein:
          type: object
          properties:
            total:
              type: number
              format: float
              minimum: 0
              maximum: 1000
            units:
              type: string
              enum:
                - grams
          required:
            - total
            - units
      example:
        absorptionDuration: 10800
        carbohydrate:
          net: 25
          units: grams
    bloodglucose.v1:
      title: Blood Glucose for Dosing Decision
      description: A simple blood glucose for a dosing decision.
      type: object
      properties:
        time:
          type: string
          format: date-time
        value:
          $ref: '#/components/schemas/value.v1'
      required:
        - value
      x-tags:
        - Data
    start.v1:
      title: Start Time
      description: Start time as millisecond offset from midnight
      type: object
      properties:
        start:
          type: number
          minimum: 0
          maximum: 86400000
      required:
        - start
      x-tags:
        - Data
    targetstart.v1:
      title: Blood Glucose Target Start
      description: ''
      allOf:
        - $ref: '#/components/schemas/target.v1'
        - $ref: '#/components/schemas/start.v1'
      x-tags:
        - Data
    issue.v1:
      title: Issue for Dosing Decision
      description: An issue for a dosing decision.
      type: object
      properties:
        id:
          type: string
          minLength: 1
          maxLength: 100
        metadata:
          type: object
          additionalProperties: true
      required:
        - id
      example:
        id: unknown
        metadata:
          extra: information
      x-tags:
        - Data
    dosingdecision.v1:
      title: Dosing Decision
      description: A dosing decision
      allOf:
        - $ref: '#/components/schemas/base.v1'
        - type: object
          properties:
            type:
              type: string
              enum:
                - dosingDecision
            reason:
              type: string
              minLength: 1
              maxLength: 100
              example: bolus
            originalFood:
              type: object
              properties:
                time:
                  type: string
                  format: date-time
                nutrition:
                  $ref: '#/components/schemas/nutrition.v1'
              required:
                - nutrition
            food:
              type: object
              properties:
                time:
                  type: string
                  format: date-time
                nutrition:
                  $ref: '#/components/schemas/nutrition.v1'
              required:
                - nutrition
            smbg:
              $ref: '#/components/schemas/bloodglucose.v1'
            carbsOnBoard:
              type: object
              properties:
                time:
                  type: string
                  format: date-time
                amount:
                  type: number
                  format: double
                  minimum: 0
                  maximum: 1000
                  example: 18
              required:
                - amount
            insulinOnBoard:
              type: object
              properties:
                time:
                  type: string
                  format: date-time
                amount:
                  type: number
                  format: double
                  minimum: -1000
                  maximum: 1000
                  example: 0.75
              required:
                - amount
            bgTargetSchedule:
              type: array
              items:
                $ref: '#/components/schemas/targetstart.v1'
            bgHistorical:
              type: array
              items:
                $ref: '#/components/schemas/bloodglucose.v1'
            bgForecast:
              type: array
              items:
                $ref: '#/components/schemas/bloodglucose.v1'
            recommendedBasal:
              type: object
              properties:
                rate:
                  type: number
                  format: double
                  minimum: 0
                  maximum: 100
                  example: 1.25
                duration:
                  type: number
                  format: int32
                  minimum: 0
                  maximum: 86400000
                  example: 180000
              required:
                - rate
            recommendedBolus:
              type: object
              properties:
                amount:
                  type: number
                  format: double
                  minimum: 0
                  maximum: 1000
                  example: 2.5
              required:
                - amount
            requestedBolus:
              type: object
              properties:
                amount:
                  type: number
                  format: double
                  minimum: 0
                  maximum: 1000
                  example: 2
              required:
                - amount
            warnings:
              type: array
              items:
                $ref: '#/components/schemas/issue.v1'
            errors:
              type: array
              items:
                $ref: '#/components/schemas/issue.v1'
            scheduleTimeZoneOffset:
              type: number
              format: int32
              minimum: -10080
              maximum: 10080
              example: -480
            units:
              type: object
              properties:
                bg:
                  $ref: '#/components/schemas/units.v1-2'
                carb:
                  type: string
                  enum:
                    - exchanges
                    - grams
                  example: grams
                insulin:
                  type: string
                  enum:
                    - Units
              required:
                - bg
                - carb
                - insulin
          required:
            - reason
            - units
      x-tags:
        - Data
    amount.v1:
      title: Amount
      type: object
      properties:
        units:
          type: string
        value:
          type: number
          format: double
      required:
        - units
        - value
      x-tags:
        - Data
    ingredient.v1:
      title: Ingredient
      description: A nutritional ingredient
      type: object
      properties:
        nutrition:
          $ref: '#/components/schemas/nutrition.v1'
        name:
          type: string
          minLength: 1
          maxLength: 100
        code:
          type: string
          minLength: 1
          maxLength: 100
        brand:
          type: string
          minLength: 1
          maxLength: 100
        amount:
          $ref: '#/components/schemas/amount.v1'
      x-tags:
        - Data
    ingredientarray.v1:
      title: Ingredient Array
      description: An array of ingredients
      type: array
      items:
        $ref: '#/components/schemas/ingredient.v1'
      maxItems: 100
      minItems: 1
      x-tags:
        - Data
    food.v1:
      title: Food
      allOf:
        - $ref: '#/components/schemas/base.v1'
        - type: object
          description: Food consumption
          properties:
            amount:
              $ref: '#/components/schemas/amount.v1'
            brand:
              type: string
              minLength: 1
              maxLength: 100
            code:
              type: string
              minLength: 1
              maxLength: 100
            ingredients:
              $ref: '#/components/schemas/ingredientarray.v1'
            meal:
              type: string
              enum:
                - breakfast
                - lunch
                - dinner
                - snack
                - other
            mealOther:
              type: string
              minLength: 1
              maxLength: 100
            name:
              type: string
              minLength: 1
              maxLength: 100
            nutrition:
              $ref: '#/components/schemas/nutrition.v1'
            type:
              type: string
              enum:
                - food
      required:
        - type
        - brand
        - code
        - meal
        - name
      x-tags:
        - Data
    dose.v1:
      title: Insulin Dose
      description: An object representing an Insulin Dose
      type: object
      properties:
        units:
          type: string
          enum:
            - Units
        total:
          type: number
          format: float
          minimum: 0
          maximum: 250
        food:
          type: number
          format: float
          minimum: 0
          maximum: 250
        correction:
          type: number
          format: float
          minimum: -250
          maximum: 250
        active:
          type: number
          format: float
          minimum: 0
          maximum: 250
      required:
        - total
        - units
      x-tags:
        - Data
    insulin.v1:
      title: Insulin
      description: An Insulin delivery event. Could be automated or manual.
      allOf:
        - $ref: '#/components/schemas/base.v1'
        - type: object
          properties:
            dose:
              $ref: '#/components/schemas/dose.v1'
            formulation:
              $ref: '#/components/schemas/formulation.v1'
            site:
              type: string
              minLength: 0
              maxLength: 100
            type:
              type: string
              enum:
                - insulin
      required:
        - type
      x-tags:
        - Data
    activitytype.v1:
      title: Physical Activity Type
      type: string
      enum:
        - americanFootball
        - archery
        - australianFootball
        - badminton
        - barre
        - baseball
        - basketball
        - bowling
        - boxing
        - climbing
        - coreTraining
        - cricket
        - crossCountrySkiing
        - crossTraining
        - curling
        - cycling
        - dance
        - danceInspiredTraining
        - downhillSkiing
        - elliptical
        - equestrianSports
        - fencing
        - fishing
        - flexibility
        - functionalStrengthTraining
        - golf
        - gymnastics
        - handball
        - handCycling
        - highIntensityIntervalTraining
        - hiking
        - hockey
        - hunting
        - jumpRope
        - kickboxing
        - lacrosse
        - martialArts
        - mindAndBody
        - mixedCardio
        - mixedMetabolicCardioTraining
        - other
        - paddleSports
        - pilates
        - play
        - preparationAndRecovery
        - racquetball
        - rowing
        - rugby
        - running
        - sailing
        - skatingSports
        - snowboarding
        - snowSports
        - soccer
        - softball
        - squash
        - stairClimbing
        - stairs
        - stepTraining
        - surfingSports
        - swimming
        - tableTennis
        - taiChi
        - tennis
        - trackAndField
        - traditionalStrengthTraining
        - volleyball
        - walking
        - waterFitness
        - waterPolo
        - waterSports
        - wheelchairRunPace
        - wheelchairWalkPace
        - wrestling
        - yoga
      example: curling
    otheractivitytype.v1:
      title: Other Activity Type
      description: This is only applicable if the `activityType` is `other`
      type: string
      minLength: 1
      maxLength: 100
      example: skydiving
    activity-name.v1:
      title: Activity Name
      type: string
      minLength: 1
      maxLength: 100
      example: Hiking the John Muir Trail
    reportedintensity.v1:
      title: Reported Intensity
      type: string
      enum:
        - high
        - low
        - medium
      example: medium
    aggregate.v1:
      title: Aggregate
      description: Set to `true` if this is an aggregate activity.
      type: boolean
      example: false
    distance-meters.v1:
      title: Distance (meters)
      type: object
      properties:
        units:
          type: string
          enum:
            - meters
          example: meters
        value:
          type: number
          format: float
          minimum: 0
          maximum: 160934.4
          example: 42
      required:
        - units
        - value
    kilometers.v1:
      title: Distance (kilometers)
      type: object
      properties:
        units:
          type: string
          enum:
            - kilometers
          example: kilometers
        value:
          type: number
          format: float
          minimum: 0
          maximum: 160.9344
          example: 42
      required:
        - units
        - value
    distance-feet.v1:
      title: Distance (feet)
      type: object
      properties:
        units:
          type: string
          enum:
            - feet
          example: feet
        value:
          type: number
          format: float
          minimum: 0
          maximum: 528000
          example: 42
      required:
        - units
        - value
    yards.v1:
      title: Distance (yards)
      type: object
      properties:
        units:
          type: string
          enum:
            - yards
          example: yards
        value:
          type: number
          format: float
          minimum: 0
          maximum: 176000
          example: 42
      required:
        - units
        - value
    miles.v1:
      title: Distance (miles)
      type: object
      properties:
        units:
          type: string
          enum:
            - miles
          example: miles
        value:
          type: number
          format: float
          minimum: 0
          maximum: 100
          example: 42
      required:
        - units
        - value
    distance.v1:
      title: Distance
      description: >-
        Distance, expressed as `meters`, `kilometers`, `feet`, `yards`, or
        `miles`.
      oneOf:
        - $ref: '#/components/schemas/distance-meters.v1'
        - $ref: '#/components/schemas/kilometers.v1'
        - $ref: '#/components/schemas/distance-feet.v1'
        - $ref: '#/components/schemas/yards.v1'
        - $ref: '#/components/schemas/miles.v1'
    hours.v1:
      title: Duration (hours)
      type: object
      properties:
        units:
          type: string
          enum:
            - hours
          example: hours
        value:
          type: number
          format: float
          minimum: 0
          maximum: 168
          example: 42
      required:
        - units
        - value
    minutes.v1:
      title: Duration (minutes)
      type: object
      properties:
        units:
          type: string
          enum:
            - minutes
          example: minutes
        value:
          type: number
          format: float
          minimum: 0
          maximum: 10080
          example: 42
      required:
        - units
        - value
    seconds.v1:
      title: Duration (seconds)
      type: object
      properties:
        units:
          type: string
          enum:
            - seconds
          example: seconds
        value:
          type: number
          format: float
          minimum: 0
          maximum: 604800
          example: 42
      required:
        - units
        - value
    duration.v1-2:
      title: Duration
      description: Duration, expressed as `hours`, `minutes` or `seconds`.
      type: object
      oneOf:
        - $ref: '#/components/schemas/hours.v1'
        - $ref: '#/components/schemas/minutes.v1'
        - $ref: '#/components/schemas/seconds.v1'
    flights.v1:
      title: Flights
      type: object
      properties:
        count:
          type: integer
          format: int32
          minimum: 0
          maximum: 10000
          example: 42
      required:
        - count
    laps.v1:
      title: Laps
      type: object
      properties:
        count:
          type: integer
          format: int32
          minimum: 0
          maximum: 10000
          example: 5
        distance:
          $ref: '#/components/schemas/distance.v1'
      required:
        - count
        - distance
    steps.v1:
      title: Steps
      type: object
      properties:
        count:
          type: integer
          format: int32
          minimum: 0
          maximum: 100000
          example: 42
      required:
        - count
    physical.v1:
      title: Physical Activity
      allOf:
        - $ref: '#/components/schemas/base.v1'
        - type: object
          description: Logging of physical activity
          properties:
            type:
              type: string
              enum:
                - physicalActivity
            activityType:
              $ref: '#/components/schemas/activitytype.v1'
            activityTypeOther:
              $ref: '#/components/schemas/otheractivitytype.v1'
            name:
              $ref: '#/components/schemas/activity-name.v1'
            reportedIntensity:
              $ref: '#/components/schemas/reportedintensity.v1'
            aggregate:
              $ref: '#/components/schemas/aggregate.v1'
            distance:
              $ref: '#/components/schemas/distance.v1'
            duration:
              $ref: '#/components/schemas/duration.v1-2'
            elevationChange:
              oneOf:
                - $ref: '#/components/schemas/distance-feet.v1'
                - $ref: '#/components/schemas/distance-meters.v1'
            energy:
              $ref: '#/components/schemas/energy.v1'
            flight:
              $ref: '#/components/schemas/flights.v1'
            lap:
              $ref: '#/components/schemas/laps.v1'
            step:
              $ref: '#/components/schemas/steps.v1'
          required:
            - type
            - activityType
            - name
            - reportedIntensity
      x-tags:
        - Data
    days.v1:
      title: Days
      type: array
      uniqueItems: true
      minItems: 1
      maxItems: 7
      items:
        type: string
        enum:
          - Sunday
          - Monday
          - Tuesday
          - Wednesday
          - Thursday
          - Friday
          - Saturday
    midnightoffset.v1:
      title: Midnight Offset
      type: number
      format: integer
      minimum: 0
      maximum: 86400
    overridepreset.v1:
      title: Pump Settings Override Preset
      allOf:
        - type: object
          description: An insulin pump settings override preset.
          properties:
            abbreviation:
              type: string
              maxLength: 100
              minLength: 1
              example: 🏃‍♀️
            duration:
              type: number
              format: float
              minimum: 0
              maximum: 604800000
              example: 7200
            bgTarget:
              $ref: '#/components/schemas/target.v1'
              example:
                high: 160
                low: 150
            basalRateScaleFactor:
              type: number
              format: float
              minimum: 0.1
              maximum: 10
              example: 0.8
            carbRatioScaleFactor:
              type: number
              format: float
              minimum: 0.1
              maximum: 10
              example: 1.25
            insulinSensitivityScaleFactor:
              type: number
              format: float
              minimum: 0.1
              maximum: 10
              example: 1.25
      x-tags:
        - Data
    pumpsettings.v1:
      title: Pump Settings
      description: >-
        Insulin pump settings


        TODO: Find a way for the following to be either/or and add properties of
        all of the above (for now, set to type: object):

        - basalSchedule/basalSchedules

        - bgTarget/bgTargets

        - carbRatio/carbRatios

        - insulinSensitivity/insulinSensitivities

        - add properties of all of the above
      allOf:
        - $ref: '#/components/schemas/base.v1'
        - type: object
          properties:
            type:
              type: string
              enum:
                - pumpSettings
            activeSchedule:
              type: string
              description: >-
                A string value encoding the name of the PWD's active basal
                schedule.
            basalSchedule:
              type: object
            basalSchedules:
              type: object
              description: >-
                A set of key-value pairs encoding the PWD's programmed basal
                schedules, where each key is a basal schedule name and each
                value is an array of basal schedule segment objects.
            bgTarget:
              $ref: '#/components/schemas/target.v1'
            bgTargets:
              type: object
            bolus:
              type: object
              properties:
                amountMaximum:
                  type: object
                calculator:
                  type: object
                  properties:
                    enabled:
                      type: boolean
                    insulin:
                      oneOf:
                        - description: Duration in `hours`
                          properties:
                            duration:
                              type: number
                              format: float
                              minimum: 0
                              maximum: 10
                            units:
                              type: string
                              enum:
                                - hours
                          required:
                            - duration
                            - units
                        - description: Duration in `minutes`
                          properties:
                            duration:
                              type: number
                              format: float
                              minimum: 0
                              maximum: 600
                            units:
                              type: string
                              enum:
                                - minutes
                          required:
                            - duration
                            - units
                        - description: Duration in `seconds`
                          properties:
                            duration:
                              type: number
                              format: float
                              minimum: 0
                              maximum: 36000
                            units:
                              type: string
                              enum:
                                - seconds
                          required:
                            - duration
                            - units
                      type: object
                  required:
                    - enabled
                extended:
                  type: object
            carbRatio:
              type: number
              format: double
              minimum: 0
              maximum: 250
              description: >-
                An integer encoding the grams of carbohydrate "covered" by one
                unit of insulin for the PWD.
            carbRatios:
              type: object
              description: >-
                A set of key-value pairs encoding the PWD's programmed carb
                ratio schedules, where each key is a schedule name and each
                value is an array of carb ratio segment objects.
            display:
              type: object
              properties:
                bloodGlucose:
                  type: object
                  properties:
                    units:
                      type: string
                      enum:
                        - mg/dL
                        - mmol/L
                  required:
                    - units
            firmwareVersion:
              type: string
              minLength: 1
              maxLength: 100
              example: '1.2'
            hardwareVersion:
              type: string
              minLength: 1
              maxLength: 100
              example: 2.3r45
            insulinFormulation:
              $ref: '#/components/schemas/formulation.v1'
            insulinSensitivity:
              type: object
            insulinSensitivities:
              type: object
            manufacturers:
              type: array
              uniqueItems: true
              minItems: 0
              maxItems: 10
              example:
                - Acme
              items:
                type: string
                minLength: 1
                maxLength: 100
            model:
              type: string
              minLength: 1
              maxLength: 100
              example: Pump A Lot
            name:
              type: string
              description: The name of the pump, if known.
              minLength: 1
              maxLength: 100
              example: My Pump
            serialNumber:
              type: string
              description: The serial number of the pump, if known.
              minLength: 1
              maxLength: 100
            sleepSchedules:
              type: array
              minItems: 0
              maxItems: 10
              items:
                type: object
                oneOf:
                  - properties:
                      enabled:
                        type: boolean
                        enum:
                          - true
                      days:
                        $ref: '#/components/schemas/days.v1'
                      start:
                        $ref: '#/components/schemas/midnightoffset.v1'
                        description: >-
                          Start time in seconds, offset from midnight (e.g. 11pm
                          is 82800)
                      end:
                        $ref: '#/components/schemas/midnightoffset.v1'
                        description: >-
                          end time in seconds, offset from midnight (e.g. 7am is
                          25200)
                    required:
                      - enabled
                      - start
                      - end
                      - days
                  - properties:
                      enabled:
                        type: boolean
                        enum:
                          - false
                      days:
                        $ref: '#/components/schemas/days.v1'
                      start:
                        $ref: '#/components/schemas/midnightoffset.v1'
                        description: >-
                          Start time in seconds, offset from midnight (e.g. 11pm
                          is 82800)
                      end:
                        $ref: '#/components/schemas/midnightoffset.v1'
                        description: >-
                          end time in seconds, offset from midnight (e.g. 7am is
                          25200)
                    required:
                      - enabled
            softwareVersion:
              type: string
              description: The software version of the pump, if known.
              minLength: 1
              maxLength: 100
              example: 3.4.5
            units:
              type: object
              properties:
                bg:
                  type: string
                  enum:
                    - mmol/L
                    - mmol/l
                    - mg/dL
                    - mg/dl
                  description: >-
                    A string value encoding the blood glucose units exposed in
                    the user interface on this insulin pump.
                carb:
                  type: string
                  enum:
                    - exchanges
                    - grams
                  description: >-
                    A string value encoding the (universal) units for
                    carbohydrate input as grams.
              required:
                - bg
                - carb
            dosingEnabled:
              type: boolean
            bgTargetPreMealTarget:
              type: object
              properties:
                low:
                  type: number
                  minimum: 0
                  maximum: 1000
                high:
                  type: number
                  minimum: 0
                  maximum: 1000
              required:
                - low
                - high
            bgSafetyLimit:
              type: number
              format: double
              minimum: 0
              maximum: 1000
              example: 75
            insulinModel:
              type: object
              properties:
                modelType:
                  type: string
                  enum:
                    - rapidAdult
                    - rapidChild
                    - fiasp
                    - walsh
                    - other
                modelTypeOther:
                  type: string
                  maxLength: 100
                  minLength: 1
                actionDelay:
                  type: number
                  format: integer
                  minimum: 0
                  maximum: 86400
                actionDuration:
                  type: number
                  format: integer
                  minimum: 0
                  maximum: 86400
                actionPeakOffset:
                  type: number
                  format: integer
                  minimum: 0
                  maximum: 86400
            overridePresets:
              type: object
              additionalProperties:
                $ref: '#/components/schemas/overridepreset.v1'
      x-tags:
        - Data
    pumpstatus.v1:
      title: Pump Status
      allOf:
        - $ref: '#/components/schemas/base.v1'
        - type: object
          description: Insulin pump status
          properties:
            type:
              type: string
              enum:
                - pumpStatus
            basalDelivery:
              type: object
              properties:
                state:
                  type: string
                  enum:
                    - cancelingTemporary
                    - initiatingTemporary
                    - resuming
                    - scheduled
                    - suspended
                    - suspending
                    - temporary
                  example: temporary
                time:
                  type: string
                  format: date-time
                dose:
                  type: object
                  properties:
                    startTime:
                      type: string
                      format: date-time
                    endTime:
                      type: string
                      format: date-time
                    rate:
                      type: number
                      format: double
                      minimum: 0
                      maximum: 100
                      example: 1.25
                    amountDelivered:
                      type: number
                      format: double
                      minimum: 0
                      maximum: 1000
                      example: 0
                  required:
                    - rate
              required:
                - state
            battery:
              type: object
              properties:
                time:
                  type: string
                  format: date-time
                state:
                  type: string
                  enum:
                    - charging
                    - full
                    - unplugged
                remaining:
                  type: number
                  format: double
                  minimum: 0
                  maximum: 1
                  example: 0.75
                units:
                  type: string
                  enum:
                    - percent
            bolusDelivery:
              type: object
              properties:
                state:
                  type: string
                  enum:
                    - canceling
                    - delivering
                    - initiating
                    - none
                  example: delivering
                dose:
                  type: object
                  properties:
                    startTime:
                      type: string
                      format: date-time
                    amount:
                      type: number
                      format: double
                      minimum: 0
                      maximum: 1000
                      example: 4.5
                    amountDelivered:
                      type: number
                      format: double
                      minimum: 0
                      maximum: 1000
                      example: 1.75
                  required:
                    - amount
              required:
                - state
            deliveryIndeterminant:
              type: boolean
              example: false
            reservoir:
              type: object
              properties:
                time:
                  type: string
                  format: date-time
                remaining:
                  type: number
                  format: double
                  minimum: 0
                  maximum: 10000
                  example: 68
                units:
                  type: string
                  enum:
                    - Units
              required:
                - remaining
                - units
      x-tags:
        - Data
    severity.v1:
      title: Severity
      type: integer
      format: int32
      minimum: 0
      maximum: 10
      example: 5
      x-tags:
        - Data
    state.v1:
      title: State
      type: string
      enum:
        - alcohol
        - cycle
        - hyperglycemiaSymptoms
        - hypoglycemiaSymptoms
        - illness
        - other
        - stress
      example: alcohol
      x-tags:
        - Data
    otherstate.v1:
      title: Other State
      description: Should only be present if `state` is `other`
      type: string
      minLength: 1
      maxLength: 100
      example: buzzed
      x-tags:
        - Data
    states.v1:
      title: States
      type: array
      uniqueItems: true
      minItems: 1
      maxItems: 100
      items:
        type: object
        additionalProperties: false
        properties:
          severity:
            $ref: '#/components/schemas/severity.v1'
          state:
            $ref: '#/components/schemas/state.v1'
          stateOther:
            $ref: '#/components/schemas/otherstate.v1'
        required:
          - state
      x-tags:
        - Data
    reportedstate.v1:
      title: Reported State
      allOf:
        - $ref: '#/components/schemas/base.v1'
        - type: object
          description: Reported states that can have an impact on blood glucose
          properties:
            type:
              type: string
              enum:
                - reportedState
            states:
              $ref: '#/components/schemas/states.v1'
      required:
        - states
      x-tags:
        - Data
    settings.v1:
      title: Settings
      allOf:
        - $ref: '#/components/schemas/base.v1'
        - type: object
          description: Global Settings Object
          properties:
            name:
              type: string
              minLength: 1
              maxLength: 1000
            loopAppVersion:
              type: string
              minLength: 1
              maxLength: 1000
      x-tags:
        - Data
    devicemanufacturers.v1:
      title: Device Manufacturers
      description: >-
        An array of string tags indicating the manufacturer(s) of the device.


        In order to avoid confusion resulting from referring to a single
        manufacturer with more than one name—for example, using both 'Minimed'
        and 'Medtronic' interchangeably—we restrict the set of strings used to
        refer to manufacturers to the set listed above and enforce *exact*
        string matches (including casing).


        `deviceManufacturers` is an array of one or more string "tags" because
        there are devices resulting from a collaboration between more than one
        manufacturer, such as the Tandem G4 insulin pump with CGM integration (a
        collaboration between `Tandem` and `Dexcom`).
      type: array
      items:
        type: string
      example:
        - DeviceCo
      x-tags:
        - Data
    devicemodelname.v1:
      title: Device Model Name
      description: >-
        A string identifying the model of the device.


        The `deviceModel` is a non-empty string that encodes the model of
        device.

        We endeavor to match each manufacturer's standard for how they represent
        model name in terms of casing, whether parts of the name are represented
        as one word or two, etc.
      type: string
      minLength: 1
      example: Devicey McDeviceface
      x-tags:
        - Data
    deviceserialnumber.v1:
      title: Device Serial Number
      description: >-
        A string encoding the device's serial number.


        The `deviceSerialNumber` is a string that encodes the serial number of
        the device.

        Note that even if a manufacturer only uses digits in its serial numbers,
        the SN should be stored as a string regardless.


        Uniquely of string fields in the Tidepool device data models,
        `deviceSerialNumber` *may* be an empty string.

        This is essentially a compromise: having the device serial number is
        extremely important (especially for e.g., clinical studies) but in 2016
        we came across our first case where we *cannot* recover the serial
        number of the device that generated the data: Dexcom G5 data uploaded to
        Tidepool through Apple iOS's HealthKit integration.
      type: string
      minLength: 1
      example: B97B6D59
      x-tags:
        - Data
    devicetag.v1:
      title: Device Tag
      description: Tag indicating the function(s) of a particular device.
      type: string
      maxLength: 100
      enum:
        - bgm
        - cgm
        - insulin-pump
        - fgm
        - pen
        - manual
      x-tags:
        - Data
    devicetags.v1:
      title: Device Tags
      description: >-
        An array of string tags indicating the function(s) of the device.


        The `deviceTags` array should be fairly self-explanatory as an array of
        tags indicating the function(s) of a particular device.

        For example, the Insulet OmniPod insulin delivery system has the tags
        `bgm` and `insulin-pump` since the PDM is both an insulin pump
        controller and includes a built-in blood glucose monitor.
      type: array
      minItems: 1
      items:
        $ref: '#/components/schemas/devicetag.v1'
      x-tags:
        - Data
    uploaddevice.v1:
      title: Upload Device
      description: The device used to provide diabetes data
      type: object
      properties:
        deviceManufacturers:
          $ref: '#/components/schemas/devicemanufacturers.v1'
        deviceModel:
          $ref: '#/components/schemas/devicemodelname.v1'
        deviceSerialNumber:
          $ref: '#/components/schemas/deviceserialnumber.v1'
        deviceTags:
          $ref: '#/components/schemas/devicetags.v1'
      additionalProperties: false
      default: {}
      x-tags:
        - Data
    platform.v1:
      title: Client Software Platform
      description: The software platform on which the client software was run.
      type: string
      example: macOS 10.15.4
      x-tags:
        - Data
    metadata.v1:
      title: Metadata
      type: object
      additionalProperties: true
      x-tags:
        - Data
    clientsoftware.v1:
      title: Client Software
      description: The client software that provided diabetes data.
      type: object
      properties:
        name:
          $ref: '#/components/schemas/reversedomainname.v1'
        version:
          $ref: '#/components/schemas/semanticversion.v1'
        platform:
          $ref: '#/components/schemas/platform.v1'
        private:
          $ref: '#/components/schemas/metadata.v1'
      required:
        - name
        - version
      x-tags:
        - Data
    computertime.v1:
      title: Computer Time
      description: >-
        An ISO 8601 formatted timestamp without any timezone offset information.


        The `computerTime` field encodes the *local* time at upload with no
        timezone offset information since we are storing `timezone` separately.

        We store this field in order to be able to audit and/or detect the
        correspondence between the user's browser time and the timezone they
        selected at the time of upload.

        If the user selected the timezone that was actually in effect for their
        browser at the time of upload, then applying the stored `timezone` to
        the UTC Zulu `time` field will match `computerTime`.

        If, on the other hand, the user selected a *different* timezone from
        that effective in their browser at the time of upload, applying the
        `timezone` to `time` will *not* match `computerTime`.


        There are some use cases when it is perfectly justified to select a
        timezone that does *not* reflect the browser's current timezone.

        For example, some insulin pump users do not change the time on their
        devices when traveling for short periods of time across many timezones,
        but when uploading a device a user should always choose the timezone
        that aligns with the most recent data on the device and thus that will
        *not* match the local browser timezone.
      type: string
      format: time
      x-tags:
        - Data
    datasettype.v1:
      title: Data Set Type
      type: string
      enum:
        - continuous
        - normal
      example: continuous
      x-tags:
        - Data
    timeprocessing.v1:
      title: Time Processing
      description: >-
        A string indicating what variety of processing was used to create the
        `time` and related fields such as `timezoneOffset` on data in this
        upload.


        For data auditing purposes, we store a string encoding the type of
        algorithm used to generate the `time`, `timezoneOffset`, and other
        related fields from the local `deviceTime`. At present, there are only
        three options for this value:

        - `none` for data sources that already include a UTC-anchored `time`
        value. At present, the *only* data source for which this is true is
        Dexcom G5 or Dexcom G6 data coming through Apple's iOS HealthKit
        integration.

        - `across-the-board-timezone` for devices (all BGMs, for example) that
        cannot have their `deviceTime` values ["bootstrapped" to a UTC `time`
        value](http://developer.tidepool.io/uploader/docs/BootstrappingToUTC.html);
        in such cases, we apply a single user-selected timezone to every
        `deviceTime` "across the board" to generate the `time` value.

        - `utc-bootstrapping` for devices (most insulin pumps and CGMs) where we
        use a combination of the user-selected timezone at time of upload, the
        most recent timestamp on device, and the history of display time changes
        on the device to infer the correct `time` value for each record.
      type: string
      enum:
        - none
        - across-the-board-timezone
        - utc-bootstrapping
      example: utc-bootstrapping
      x-tags:
        - Data
    upload.v1:
      title: Upload
      allOf:
        - $ref: '#/components/schemas/base.v1'
        - $ref: '#/components/schemas/uploaddevice.v1'
        - type: object
          description: >-
            Metadata about an upload of diabetes device data to the Tidepool
            platform.
          properties:
            type:
              type: string
              enum:
                - upload
            byUser:
              $ref: '#/components/schemas/tidepooluserid'
            client:
              $ref: '#/components/schemas/clientsoftware.v1'
            computerTime:
              $ref: '#/components/schemas/computertime.v1'
            dataSetType:
              $ref: '#/components/schemas/datasettype.v1'
            timeProcessing:
              $ref: '#/components/schemas/timeprocessing.v1'
            version:
              $ref: '#/components/schemas/semanticversion.v1'
      x-tags:
        - Data
    gallons.v1:
      title: Water Amount, in Gallons
      allOf:
        - $ref: '#/components/schemas/amount.v1'
        - type: object
          properties:
            units:
              type: string
              enum:
                - gallons
            value:
              type: number
              format: double
              minimum: 0
              maximum: 10
      x-tags:
        - Data
    ounces.v1:
      title: Water Amount, in Ounces
      allOf:
        - $ref: '#/components/schemas/amount.v1'
        - type: object
          properties:
            units:
              type: string
              enum:
                - ounces
            value:
              type: number
              format: double
              minimum: 0
              maximum: 1280
      x-tags:
        - Data
    liters.v1:
      title: Water Amount, in Liters
      allOf:
        - $ref: '#/components/schemas/amount.v1'
        - type: object
          properties:
            units:
              type: string
              enum:
                - liters
            value:
              type: number
              format: double
              minimum: 0
              maximum: 37.854118
      x-tags:
        - Data
    milliliters.v1:
      title: Water Amount, in Milliliters
      allOf:
        - $ref: '#/components/schemas/amount.v1'
        - type: object
          properties:
            units:
              type: string
              enum:
                - milliliters
            value:
              type: number
              format: double
              minimum: 0
              maximum: 37854.118
      x-tags:
        - Data
    water.v1:
      title: Water Consumption
      description: Water consumption
      allOf:
        - $ref: '#/components/schemas/base.v1'
        - type: object
          properties:
            type:
              type: string
              enum:
                - water
            amount:
              oneOf:
                - $ref: '#/components/schemas/gallons.v1'
                - $ref: '#/components/schemas/ounces.v1'
                - $ref: '#/components/schemas/liters.v1'
                - $ref: '#/components/schemas/milliliters.v1'
          required:
            - type
            - amount
      x-tags:
        - Data
    data.v1:
      title: Tidepool Diabetes Data
      description: >-
        This is a composite data type that represents all possible Tidepool
        diabetes data objects.
      oneOf:
        - $ref: '#/components/schemas/alert.v1'
        - $ref: '#/components/schemas/automated.v1'
        - $ref: '#/components/schemas/scheduled.v1-2'
        - $ref: '#/components/schemas/suspend.v1'
        - $ref: '#/components/schemas/temporary.v1-2'
        - $ref: '#/components/schemas/continuousglucose.v1'
        - $ref: '#/components/schemas/selfmonitoredglucose.v1'
        - $ref: '#/components/schemas/ketone.v1'
        - $ref: '#/components/schemas/automated.v1-3'
        - $ref: '#/components/schemas/combination.v1'
        - $ref: '#/components/schemas/extended.v1'
        - $ref: '#/components/schemas/normal.v1'
        - $ref: '#/components/schemas/calculator.v1'
        - $ref: '#/components/schemas/cgmsettings.v1'
        - $ref: '#/components/schemas/controllersettings.v1'
        - $ref: '#/components/schemas/controllerstatus.v1'
        - $ref: '#/components/schemas/alarm.v1'
        - $ref: '#/components/schemas/calibration.v1'
        - $ref: '#/components/schemas/deliverystatus.v1'
        - $ref: '#/components/schemas/prime.v1'
        - $ref: '#/components/schemas/pumpsettingsoverride.v1'
        - $ref: '#/components/schemas/reservoirchange.v1'
        - $ref: '#/components/schemas/sensor.v1'
        - $ref: '#/components/schemas/settingschange.v1'
        - $ref: '#/components/schemas/timechange.v1'
        - $ref: '#/components/schemas/transmitter.v1'
        - $ref: '#/components/schemas/dosingdecision.v1'
        - $ref: '#/components/schemas/food.v1'
        - $ref: '#/components/schemas/insulin.v1'
        - $ref: '#/components/schemas/physical.v1'
        - $ref: '#/components/schemas/pumpsettings.v1'
        - $ref: '#/components/schemas/pumpstatus.v1'
        - $ref: '#/components/schemas/reportedstate.v1'
        - $ref: '#/components/schemas/settings.v1'
        - $ref: '#/components/schemas/upload.v1'
        - $ref: '#/components/schemas/water.v1'
      x-tags:
        - Data
    dataarray.v1:
      title: Tidepool Diabetes Data Array
      description: Diabetes Data Array
      type: array
      minItems: 1
      items:
        $ref: '#/components/schemas/data.v1'
      x-tags:
        - Data
    json.v1:
      title: Export as JSON
      description: Exported data in JSON format
      allOf:
        - $ref: '#/components/schemas/dataarray.v1'
    excel.v1:
      title: Export as Excel
      description: Exported data in Microsoft Excel spreadsheet
      type: string
      format: binary
  parameters:
    tidepooluserid:
      description: Tidepool User ID
      name: userId
      in: path
      required: true
      schema:
        $ref: '#/components/schemas/tidepooluserid'
    startdate.v1:
      description: Start date for the export data
      name: startDate
      in: query
      schema:
        $ref: '#/components/schemas/datetime.v1'
    enddate.v1:
      description: End date for the exported data
      name: endDate
      in: query
      schema:
        $ref: '#/components/schemas/datetime.v1'
    format.v1:
      description: Export format
      name: format
      in: query
      schema:
        $ref: '#/components/schemas/format.v1'
    glucoseunits.v1:
      description: Glucose units of the exported data
      name: bgUnits
      in: query
      schema:
        $ref: '#/components/schemas/glucoseunits.v1'
  headers:
    contentdisposition.v1:
      description: >-
        Tells the browser to show a `Save As` dialog box to save the exported
        file locally.
      required: true
      schema:
        type: string
        default: attachment; filename="TidepoolExport.{format}"
      example: attachment; filename="TidepoolExport.json"
