{
  "$schema": "https://json-schema.org/draft/2020-12/schema",
  "$id": "https://artifacts.apis.io/prismareviews/json-schema/prismareviews-stats-schema.json",
  "title": "Stats",
  "description": "Review statistics for a period, by when reviews were written. A reply counts once it is published.",
  "x-generated": "2026-11-02",
  "x-method": "derived",
  "x-generator": "derive-json-schema.py",
  "x-source": "openapi/prismareviews-openapi.json#/components/schemas/Stats",
  "type": "object",
  "required": [
    "since",
    "until",
    "location_id",
    "platform",
    "reviews",
    "average_rating",
    "ratings",
    "replied",
    "reply_rate",
    "median_reply_hours",
    "unreplied_negative",
    "by_month"
  ],
  "properties": {
    "since": {
      "type": "string",
      "description": "Start of the period (included).",
      "format": "date-time"
    },
    "until": {
      "type": "string",
      "description": "End of the period (not included).",
      "format": "date-time"
    },
    "location_id": {
      "type": [
        "string",
        "null"
      ],
      "description": "The location filter, if any."
    },
    "platform": {
      "type": [
        "string",
        "null"
      ],
      "description": "The platform filter, if any."
    },
    "reviews": {
      "type": "integer",
      "description": "Reviews written in the period."
    },
    "average_rating": {
      "type": [
        "number",
        "null"
      ],
      "description": "Average of the 1–5 ratings, 2 decimals. `null` without rated reviews."
    },
    "ratings": {
      "type": "object",
      "description": "Reviews per star, `1` to `5`.",
      "additionalProperties": {
        "type": "integer"
      }
    },
    "replied": {
      "type": "integer",
      "description": "Reviews with a published reply."
    },
    "reply_rate": {
      "type": [
        "number",
        "null"
      ],
      "description": "`replied / reviews`, 0 to 1. `null` without reviews."
    },
    "median_reply_hours": {
      "type": [
        "number",
        "null"
      ],
      "description": "Median time from review to reply, in hours, 1 decimal."
    },
    "unreplied_negative": {
      "type": "integer",
      "description": "Reviews of 1 or 2 stars without a published reply."
    },
    "by_month": {
      "type": "array",
      "description": "One entry per calendar month (UTC) with reviews, oldest first.",
      "items": {
        "type": "object",
        "required": [
          "month",
          "reviews",
          "average_rating",
          "replied"
        ],
        "properties": {
          "month": {
            "type": "string",
            "description": "`YYYY-MM`."
          },
          "reviews": {
            "type": "integer"
          },
          "average_rating": {
            "type": [
              "number",
              "null"
            ]
          },
          "replied": {
            "type": "integer"
          }
        }
      }
    }
  }
}