Files
zarinpal-analytics-backend/CONTEXT.md

2.6 KiB

Domain Glossary

Merchant

A business represented in the source data. A merchant owns terminals, payment sessions, and merchant users. In the MVP, detailed data is visible only within that merchant's authenticated boundary.

Merchant User

A person/account permitted to authenticate as one merchant. The hackathon seed creates an initial demo user for each merchant; a merchant and a merchant user are not the same concept.

Terminal

A merchant-owned payment endpoint identified by the source terminal key.

Payment Session

One payment journey identified by the source session key. A session belongs to one merchant and terminal and can contain one or more payment attempts.

Payment Attempt

One try within a payment session, distinguished by its try sequence. This is the grain of a source CSV row and must not be confused with a unique payment session.

Opaque Payer Token

The nullable payer_card_key source value. It is an unverified, merchant-scoped token used only for internal approximate repeat-payer analytics. It is not a card number or verified person identifier.

Import Run

One traceable attempt to ingest a specific source archive/schema using a specific importer revision. It records outcome, counts, validation evidence, and provenance.

Calendar Date

One civil date enriched with Gregorian and Jalali calendar attributes, Persian month/season, weekday, and reporting attributes.

Reporting Period

An approved time window used for metrics: Tehran-local day, week, Jalali month, or Persian season.

Analytical Metric

A deterministic numerical measure with a definition, source fields, filters, period, unit, missing-data behavior, and drill-down path.

Analytics Projection

A rebuildable, versioned analytics result derived from normalized PostgreSQL facts and cached in Redis for one merchant/cohort revision. It is not independent business truth.

Analytics Revision

A monotonically increasing PostgreSQL merchant or cohort version changed when a related payment fact is inserted. Redis cache keys include the revisions they represent; a mismatch causes request-triggered section jobs to calculate new keys while older keys expire through TTL.

Analytics Section

One independently calculable and deliverable dashboard part. The MVP section ids are overview, payment_performance, fees, and peer_comparison. All four start on first dashboard access and become visible independently through authenticated SSE events.

Peer Cohort

An approved group of other merchants used for anonymized comparison. The active merchant is excluded, and a benchmark is suppressed unless at least 10 peers and 1,000 peer sessions contribute.