Skip to content

Add Database Reco Counts report client support - #3146

Merged
adamtheturtle merged 3 commits into
mainfrom
adamtheturtle/unblocked-open-issues
Aug 14, 2026
Merged

Add Database Reco Counts report client support#3146
adamtheturtle merged 3 commits into
mainfrom
adamtheturtle/unblocked-open-issues

Conversation

@adamtheturtle

@adamtheturtle adamtheturtle commented Aug 14, 2026

Copy link
Copy Markdown
Member

Closes #3133.

Adds client support for the Database Reco Counts report — the last VWS endpoint with no vws-python equivalent.

What is added

  • VWS and AsyncVWS take an optional database_id. The report endpoint is the first to need it, and it is not derivable from the server keys. Calling the report method without it raises DatabaseIdNotSetError.
  • request_database_reco_counts_report(year=..., month=...) returns a RecoCountsReportRequest with the transaction ID and the presigned URL. The wire format is a YYYY-mm string, but the arguments are two ints, so a malformed month is unrepresentable and the call site reads well next to datetime attributes.
  • download_reco_counts_report(presigned_url=...) fetches the report. It is unsigned, is not against base_vws_url, and does not go through make_request. A 404 raises RecoCountsReportNotReadyError; any other non-200 raises RecoCountsReportDownloadError, as an expired URL would give.
  • wait_for_reco_counts_report(presigned_url=...) polls until the report is ready, raising RecoCountsReportTimeoutError on timeout.
  • RecoCountsReport parses the CSV into RecoCount items and keeps raw_csv, since Vuforia does not document the format and it could gain columns. Unknown columns are ignored.

Tests

Both clients are exercised against vws-python-mock for a successful report, a download before the report is ready, a wait which times out, a rejected month (out of range and out of the accepted window), a mismatched database ID, a missing database ID and a failed download. Parsing is tested for empty, populated and extra-column CSVs.

Per the notes on the issue, the tests do not depend on the shape of the presigned URL and do not assert on non-empty report bodies, since the mock's reports are header-only until VWS-Python/vws-python-mock#3356 lands.

Docs

A "Recognition counts" example in the documentation, an API reference entry via the existing automodule directives, and a news fragment.

🤖 Generated with Claude Code


Note

Low Risk
Additive API surface with broad test coverage; download uses a separate unsigned URL path but does not change existing target-management behavior.

Overview
Adds client support for Vuforia’s Database Reco Counts report: per-target recognition counts for the current or previous month.

VWS and AsyncVWS now accept an optional database_id (required only for this feature). New methods mirror the async/sync split elsewhere: request_database_reco_counts_report(year, month) kicks off background generation and returns a presigned URL; download_reco_counts_report fetches the CSV via unsigned GET (not make_request); wait_for_reco_counts_report polls until ready. Shared logic lives in _reco_counts.py.

Models and errors: RecoCountsReportRequest, RecoCount, and RecoCountsReport (CSV parsing with raw_csv preserved; extra columns ignored). New exceptions include DatabaseIdNotSetError, RecoCountsReportNotReadyError (404), RecoCountsReportDownloadError, and RecoCountsReportTimeoutError.

Docs gain a “Recognition counts” example; tests and mock fixtures wire database_id / VWS_DATABASE_ID.

Reviewed by Cursor Bugbot for commit 613d8d5. Bugbot is set up for automated code reviews on this repo. Configure here.

Add ``request_database_reco_counts_report``,
``download_reco_counts_report`` and ``wait_for_reco_counts_report`` to
``VWS`` and ``AsyncVWS``, along with an optional ``database_id``
constructor argument which the report endpoint needs.

The download is not signed, is not against ``base_vws_url``, and 404s
until the report is generated, so it does not go through
``make_request``.

Closes #3133

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
The month was a ``YYYY-mm`` string, which let callers pass a value that
could not be a month at all. Taking two ints makes a malformed month
unrepresentable, and reads better next to ``datetime`` attributes.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
Vuforia accepts only the current month and the previous month, so a
month out of the 1-12 range is now rejected by the type rather than by
the server.

A month taken from a ``datetime`` needs wrapping in ``calendar.Month``,
because ``datetime.month`` is a plain ``int`` and ``beartype`` rejects
it otherwise.

Co-Authored-By: Claude Opus 5 (1M context) <noreply@anthropic.com>
@adamtheturtle
adamtheturtle merged commit cb8a5fb into main Aug 14, 2026
14 checks passed
@adamtheturtle
adamtheturtle deleted the adamtheturtle/unblocked-open-issues branch August 14, 2026 13:16
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.

Add Database Reco Counts report client support

1 participant