dashboards-and-reports

Maintains dashboard endpoints, leaderboards, and BC01/BC02/BC03 revenue reports in a FastAPI backend.

1|Updated May 23, 2026
One-click install
npx skills add https://github.com/palfish-t-i-u/palfish-t-i-u-h-th-ng-ver-2 --skill dashboards-and-reports-palfish-t-i-u
Or copy as Structured Prompt for Agent
Please help me install this Agent Skill.
Skill: dashboards-and-reports
Source: https://github.com/palfish-t-i-u/palfish-t-i-u-h-th-ng-ver-2/tree/main/.claude/skills/dashboards-and-reports
Command: npx skills add https://github.com/palfish-t-i-u/palfish-t-i-u-h-th-ng-ver-2 --skill dashboards-and-reports-palfish-t-i-u

SYSTEM DOCUMENTATION & REQUIREMENTS

What problem does it solve? It guides developers through the PalFish GMV Manager's dashboard and reporting layer, where two distinct dashboard views and three report types share overlapping endpoints, exchange-rate logic, and team-scope rules that are easy to break without context. ## Core Features & Use Cases - Dashboard endpoint mapping: Distinguishes the Bảng thông tin gamification leaderboard (DashboardTab) from Dashboard Sale M6 (Module6Tab) and their respective endpoints in dashboard_routes.py. - Report generation logic: Documents BC01/BC02 pivot reports in revenue_routes.py and BC03 daily/monthly merge logic across crm_sales_data, so_doanh_thu, and don_hang in report_routes.py. - Scope and rate enforcement: Explains enforce_report_scope() sub-team filtering and the three-step exchange-rate lookup order with the 3700 VND fallback. - Use Case: When the monthly leaderboard shows stale data, use this Skill to trace the BXH query through so_doanh_thu, the 50k-row cap, and team enrichment from nhan_su_sale. ## Quick Start Ask the AI to explain why the BC03 monthly report returns a 503 error on a fresh Supabase instance and how to fix it.

Frequently Asked Questions about dashboards-and-reports

High-intent search queries and answers about installing and using this skill.

FAQPage Schema
How do I debug a leaderboard showing stale or wrong data?

Trace the BXH query path: top-today uses the payment_lines RPC get_top_sales on paid lines, while top-month reads so_doanh_thu filtered by ngay_tien_ve. Check whether fetch_rows_capped silently truncated results at 50,000 rows, since the truncation flag is not returned in API responses.

Why does the BC03 report return a 503 error on a new Supabase instance?

The bc03_month_settings and bc03_kpi_rows tables are not in the numbered migration sequence. Run docs/supabase_schema_patch_bc03_monthly.sql manually in the Supabase SQL Editor, and run docs/sql/notifications_exchange_rates.sql separately for the exchange_rates table.

How does exchange-rate lookup work in dashboard endpoints?

dashboard_routes._load_exchange_rate() checks bc03_month_settings for the target month first, then the exchange_rates table via get_rate_for_date(), then falls back to the hard-coded DEFAULT_EXCHANGE_RATE of 3700. Note that revenue_routes.get_rate_for_date() skips the first step.

Why do KPI cards show zeros while the chart shows data in Dashboard Sale?

The M6 summary endpoint uses only record_type='summary' rows from crm_sales_data for KPI numbers, while the chart uses record_type='daily' rows. If one record type was synced but not the other, one view populates and the other stays empty.

When should I not use this Skill for report work?

Do not use it for BC01/BC02 pivot logic, which lives in revenue_routes.py and belongs to the so-doanh-thu-revenue skill, nor for CRM sync mechanics or RBAC permission rules, which are covered by the crm-sync and rbac-and-auth-accounts skills respectively.