API ReferenceapianalyticsPOST /cohort/changepoint

POST /cohort/changepoint

Service: analytics · operationId: (none)

Required scopes

(no scope declared — review service config)

Request body

{
  "type": "object",
  "properties": {
    "values": {
      "type": "array",
      "items": {
        "type": "number"
      }
    },
    "min_segment_size": {
      "type": "integer",
      "default": 3
    },
    "alpha": {
      "type": "number",
      "default": 0.05
    }
  },
  "required": [
    "values"
  ]
}

Responses

200 Changepoint detection completed

{
  "type": "object",
  "properties": {
    "method": {
      "type": "string",
      "enum": [
        "welch_t_test"
      ]
    },
    "sample_size": {
      "type": "integer"
    },
    "alpha": {
      "type": "number"
    },
    "min_segment_size": {
      "type": "integer"
    },
    "changepoints": {
      "type": "array",
      "items": {
        "type": "object",
        "properties": {
          "index": {
            "type": "integer"
          },
          "statistic": {
            "type": "number"
          },
          "p_value": {
            "type": "number"
          },
          "before_mean": {
            "type": "number"
          },
          "after_mean": {
            "type": "number"
          },
          "significant": {
            "type": "boolean"
          }
        },
        "required": [
          "index",
          "statistic",
          "p_value",
          "before_mean",
          "after_mean",
          "significant"
        ]
      }
    },
    "best_changepoint": {
      "type": [
        "object",
        "null"
      ],
      "properties": {
        "index": {
          "type": "integer"
        },
        "statistic": {
          "type": "number"
        },
        "p_value": {
          "type": "number"
        },
        "before_mean": {
          "type": "number"
        },
        "after_mean": {
          "type": "number"
        },
        "significant": {
          "type": "boolean"
        }
      },
      "required": [
        "index",
        "statistic",
        "p_value",
        "before_mean",
        "after_mean",
        "significant"
      ]
    }
  },
  "required": [
    "method",
    "sample_size",
    "alpha",
    "min_segment_size",
    "changepoints",
    "best_changepoint"
  ]
}

400 Invalid request

{
  "type": "object",
  "properties": {
    "error": {
      "type": "string"
    },
    "message": {
      "type": "string"
    }
  },
  "required": [
    "error",
    "message"
  ]
}

Example

curl -X POST https://analytics.platform.loop.health/cohort/changepoint \
  -H "Authorization: Bearer $ACCESS_TOKEN" \
  -H "Content-Type: application/json" \
  -d '{ ... }'