TAŇBA-OOH Әзірлеушілерге

City operational report - plays and screens, load, anomalies

GET /api/v1/stats/reports

https://app.tanba-ooh.kz/api/v1/stats/reports

Анықтамалықтың техникалық мәтіні ағылшын тілінде жазылған.

Scope read:stats. Own organisation; the authority sees the city. Answered from the hourly aggregates; days are Asia/Almaty days. series holds plays and active screens (structures with a play) per period, district and format; load the distribution of plays per screen per day; anomalies the screens to look at; reconciliation the plays an operator imported against the plays the players reported, per structure, approval and finished day.

Аутентификация

Authorization тақырыбындағы API кілті немесе консоль сеансы.

Рұқсат: read:stats

Параметрлер

АтауыОрныТүріМіндеттіСипаттамаМысал
fromсұрауstring (date)жоқFirst day (default 29 days back).2026-09-08
toсұрауstring (date)жоқLast day (default today).2026-10-06
grainсұрауstringжоқLength of one period: day, week or month. day, week, monthday

Жауаптар

200 The report sections.

application/json

АтауыТүріМіндеттіСипаттамаМысал
fromstring (date)иәFirst day of the report."2026-09-08"
tostring (date)иәLast day of the report."2026-10-06"
grainstringиәLength of one period in series: day, week or month."day"
seriesarray of objectиәPlays and active screens for each period, district and format.
series[].periodstring (date)иәFirst day of the period."2026-10-05"
series[].districtstringиәCode of the district."bostandyk"
series[].formatstringиәCode of the format."cityboard"
series[].playsintegerиәPlays in the period.48210
series[].screensintegerиәScreens with at least one play in the period.36
loadobjectиәHow plays per screen per day are distributed.
load.screen_daysintegerиәNumber of screen-days counted.1008
load.meanintegerиәMean plays per screen per day.1340
load.medianintegerиәMedian plays per screen per day.1325
load.p10integerиәPlays per screen per day that 10 % of screen-days stay under.980
load.p90integerиәPlays per screen per day that 90 % of screen-days stay under.1710
load.maxintegerиәMost plays on one screen in one day.2010
load.histogramarray of objectиәScreen-days by bands of plays.
load.histogram[].fromintegerиәLower edge of the band, in plays.1000
load.histogram[].tointegerиәUpper edge of the band, in plays.1500
load.histogram[].countintegerиәScreen-days in the band.412
anomaliesarray of objectиәThe screens to look at.
anomalies[].kindstringиәWhat was found. low_plays, silent, refusal_spike
anomalies[].structure_idstring (uuid)иәIdentifier of the structure."b7e4a2c9-0d1f-4a68-8e35-91c7f2d40b16"
anomalies[].codestringиәCode of the structure."ALM-0012"
anomalies[].addressstringиәStreet address of the structure."Al-Farabi Ave 77/7"
anomalies[].districtstringиәCode of the district."bostandyk"
anomalies[].observedintegerиәPlays observed on that day.120
anomalies[].baselineintegerиәPlays expected from the structure's own history.1300
anomalies[].daystringиәThe Asia/Almaty day concerned."2026-10-05"
reconciliationarray of objectиәImported plays against reported plays, for each structure, approval and finished day.
reconciliation[].daystring (date)иәThe Asia/Almaty day compared."2026-10-05"
reconciliation[].structurestringиәStructure code."ALM-0012"
reconciliation[].approval_numberstringиәNumber of the approval compared."TNB-2026-000123"
reconciliation[].imported_playsintegerиәPlays the operator imported for that day.2830
reconciliation[].reported_playsintegerиәPlays the players reported for that day.2841
reconciliation[].reconciled_rationumber | nullиәImported divided by reported; null while the players reported nothing.0.996

Мысал

{
  "from": "2026-09-08",
  "to": "2026-10-06",
  "grain": "day",
  "series": [
    {
      "period": "2026-10-05",
      "district": "bostandyk",
      "format": "cityboard",
      "plays": 48210,
      "screens": 36
    }
  ],
  "load": {
    "screen_days": 1008,
    "mean": 1340,
    "median": 1325,
    "p10": 980,
    "p90": 1710,
    "max": 2010,
    "histogram": [
      {
        "from": 1000,
        "to": 1500,
        "count": 412
      }
    ]
  },
  "anomalies": [
    {
      "kind": "low_plays",
      "structure_id": "b7e4a2c9-0d1f-4a68-8e35-91c7f2d40b16",
      "code": "ALM-0012",
      "address": "Al-Farabi Ave 77/7",
      "district": "bostandyk",
      "observed": 120,
      "baseline": 1300,
      "day": "2026-10-05"
    }
  ],
  "reconciliation": [
    {
      "day": "2026-10-05",
      "structure": "ALM-0012",
      "approval_number": "TNB-2026-000123",
      "imported_plays": 2830,
      "reported_plays": 2841,
      "reconciled_ratio": 0.996
    }
  ]
}

Қателер

Қателер problem құжаты (application/problem+json) түрінде, тұрақты code өрісімен келеді.

МәртебесіМағынасы
401No valid session or API key (unauthenticated, session_expired, invalid_api_key).
403The role or the key's scope does not allow this (forbidden, key_scope_denied, key_route_denied).
422Field errors (validation_failed).
defaultAn error as a problem document.

Код мысалдары

curl

curl 'https://app.tanba-ooh.kz/api/v1/stats/reports' \
  -H 'Authorization: Bearer YOUR_API_KEY'
Python
import requests

response = requests.get(
    "https://app.tanba-ooh.kz/api/v1/stats/reports",
    headers={
        "Authorization": "Bearer YOUR_API_KEY",
    },
)
print(response.status_code, response.text)
Go
package main

import (
	"fmt"
	"io"
	"net/http"
)

func main() {
	req, err := http.NewRequest("GET", "https://app.tanba-ooh.kz/api/v1/stats/reports", nil)
	if err != nil {
		panic(err)
	}
	req.Header.Set("Authorization", "Bearer YOUR_API_KEY")
	resp, err := http.DefaultClient.Do(req)
	if err != nil {
		panic(err)
	}
	defer resp.Body.Close()
	data, _ := io.ReadAll(resp.Body)
	fmt.Println(resp.Status, string(data))
}