API ReferenceapianalyticsPOST /v1/correlations/compute

POST /v1/correlations/compute

Service: analytics · operationId: (none)

Required scopes

(no scope declared — review service config)

Request body

{
  "type": "object",
  "properties": {
    "outcome_id_a": {
      "type": "string",
      "format": "uuid"
    },
    "outcome_id_b": {
      "type": "string",
      "format": "uuid"
    },
    "brand_id": {
      "type": "string",
      "minLength": 1
    },
    "method": {
      "type": "string",
      "enum": [
        "pearson",
        "spearman"
      ],
      "default": "pearson"
    },
    "subject_id": {
      "type": "string"
    }
  },
  "required": [
    "outcome_id_a",
    "outcome_id_b",
    "brand_id"
  ]
}

Responses

200 Correlation computed

{
  "type": "object",
  "properties": {
    "outcome_id_a": {
      "type": "string"
    },
    "outcome_id_b": {
      "type": "string"
    },
    "coefficient": {
      "type": "number"
    },
    "p_value": {
      "type": "number"
    },
    "sample_size": {
      "type": "number"
    },
    "method": {
      "type": "string",
      "enum": [
        "pearson",
        "spearman"
      ]
    },
    "strength": {
      "type": "string",
      "enum": [
        "strong",
        "moderate",
        "weak",
        "negligible"
      ]
    },
    "direction": {
      "type": "string",
      "enum": [
        "positive",
        "negative",
        "none"
      ]
    }
  },
  "required": [
    "outcome_id_a",
    "outcome_id_b",
    "coefficient",
    "p_value",
    "sample_size",
    "method",
    "strength",
    "direction"
  ]
}

404 Outcome not found

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

500 Internal error

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

Example

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