Skip to main content
The TMT Platform exposes a set of HTTP Cloud Functions that query both Firestore and PostgreSQL to produce analytics data. These functions are used by dashboards and administrative interfaces to monitor sales performance, office activity, and platform health in real time. All indicator functions accept a JSON body with a top-level data key and respond with a data envelope.
// Request shape
{ "data": { "event_id": "abc123", "from": "2024-01-01", "to": "2024-12-31" } }

// Response shape
{ "message": "...", "status": 200, "data": { ... } }

Indicator categories

Sales Metrics

Track revenue totals, payment method distribution, ticket sell-through rates, and platform-wide statistics. Includes per-client sales breakdowns.

Office Metrics

Analyze ticket sales and revenue by office (taquilla), compare active vs inactive offices per event, and report on USB/offline device sales.

All indicator functions

FunctionData sourceWhat it measures
total_salesorders_transactions (PostgreSQL)Total revenue grouped by date, with optional event and date filters
total_sales_clientorders_transactions (PostgreSQL)Total revenue per client, grouped by date
money_distributionorders_payout (PostgreSQL)Revenue split across payment methods (custody accounts) for an event
number_tickets_vs_soldFirestore + orders (PostgreSQL)Allocated seat count vs sold ticket count with percentage
number_tickets_soldorders (PostgreSQL)Raw count of sold tickets with optional event and date filters
general_platform_dataFirestoreTotal counts of events, offices, collaborators, and clients across the platform
types_of_collaboratorsFirestoreCount of collaborators broken down by account type
sold_by_officeorders (PostgreSQL)Tickets sold and revenue per office/taquilla
offices_vs_offices_activeFirestoreTotal offices vs active offices assigned to a specific event
sold_by_usbsorders_transactions (PostgreSQL)Revenue from USB/offline devices, broken down by office and currency

Common filter parameters

Most indicator functions accept the same set of optional filters applied as SQL WHERE conditions against the PostgreSQL tables.
ParameterTypeDescription
event_idstringRestrict results to a single event
fromstring (YYYY-MM-DD)Include records from this date onward (date_created >= from)
tostring (YYYY-MM-DD)Include records up to and including this date (date_created <= to)
client_idstringUsed by total_sales_client to filter by client
All date comparisons cast the date_created timestamp column to DATE before comparing. Pass dates as YYYY-MM-DD strings.

Build docs developers (and LLMs) love