Persons Dashboard
A final table/view of wide, enriched person data ready for dashboards. Rebuild as necessary.
Create persons_dashboard
Section titled “Create persons_dashboard”This is a DuckDB Pivot.
CREATE OR REPLACE TABLE persons_dashboard ASPIVOT ( SELECT p.id AS person_id, p.status, p.created_at, p.updated_at, pt.tag_type, pt.tag_value FROM persons p LEFT JOIN person_tags pt ON p.id = pt.person_id)ON tag_typeUSING max(tag_value)GROUP BY person_id, status, created_at, updated_at;