Skip to content

docs: document the analytics endpoints - #8

Merged
PhilippTheServer merged 1 commit into
mainfrom
docs/analytics
Aug 26, 2026
Merged

PhilippTheServer merged 1 commit into
mainfrom
docs/analytics

Conversation

@PhilippTheServer

Copy link
Copy Markdown
Contributor

Closes #7 · documents OpenTaberna/fastapi#44

Four admin analytics endpoints landed in the API. Refreshing the OpenAPI snapshot made the
drift check fail with four undocumented paths — the check working as designed:

$ python3 tools/check_wiki.py
Checked 8 pages against 30 API paths.

4 problem(s):

  FAIL  API serves `/v1/admin/analytics/funnel`, but no wiki page mentions it
  FAIL  API serves `/v1/admin/analytics/products`, but no wiki page mentions it
  FAIL  API serves `/v1/admin/analytics/summary`, but no wiki page mentions it
  FAIL  API serves `/v1/admin/analytics/timeseries`, but no wiki page mentions it

What's documented

The four endpoints, plus the parts a reader cannot recover from the schema:

The metric definitions. What counts as gross revenue, refunded, net, AOV and units, and
what is never counted. These are choices rather than facts, and leaving them implicit in a
query is how two people read the same dashboard and come away with different numbers.

Why money is a list keyed by currency, and that a client must not add the entries
together.

Why days are cut in SHOP_TIMEZONE rather than UTC, with the setting added to the
configuration reference.

Why checkout is counted from payments rather than orders.status — status records
only where an order is now, so it cannot tell a cancelled checkout from one that never
happened.

What the numbers cannot tell you, stated plainly rather than left to inference: the
funnel is an order funnel and cannot see browsing shoppers, partial refunds are not
modelled, per-SKU return rate is an upper bound, and product revenue need not equal order
revenue.

Verification

$ python3 tools/check_wiki.py
Checked 8 pages against 30 API paths.
OK — every endpoint is documented, and every documented path exists.

$ python3 tools/check_wikijs.py
Checked 8 pages against http://localhost:3030.
OK — every page is served, listed in the sidebar, and no page asks for a login.

Snapshot regenerated from a live instance carrying the merged analytics service (30 paths,
up from 26).

The API gained four admin analytics endpoints (OpenTaberna/fastapi#44).
Refreshing openapi.snapshot.json made the drift check fail with four
undocumented paths, which is the check doing its job.

Documents them in the endpoint reference along with the metric definitions —
what counts as revenue and what does not — because those are choices rather
than facts and leaving them implicit in a query is how two readers come away
with different numbers.

Carries across the limits rather than letting a reader infer something
stronger: the funnel is an order funnel and cannot see browsing shoppers,
partial refunds are not modelled, per-SKU return rate is an upper bound because
returns are per order, and product revenue sums line values which need not
match order totals.

Also records why checkout is counted from payments rather than order status,
that money is grouped by currency and must not be summed, and adds
SHOP_TIMEZONE to the configuration reference.

Closes #7

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Claude-Session: https://claude.ai/code/session_01YY1ekLLeFLkAU2kvdQ8Ey4
@PhilippTheServer
PhilippTheServer merged commit d9c7bec into main Aug 26, 2026
2 checks passed
@PhilippTheServer
PhilippTheServer deleted the docs/analytics branch August 26, 2026 13:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Analytics endpoints are undocumented

1 participant