Repository navigation
fix(dashboards): use date for charted time fields so time-series render - #67
Merged
Merged
Conversation
…nder
Time-series charts (and "last N months/days" KPIs) silently rendered
"No rows" on several dashboards even though the data existed.
Root cause (platform): the analytics dataset executor binds dashboard date
tokens (`{12_months_ago}`, `{90_days_ago}`, `{today}`, …) as ISO date
**strings** ("2025-06-18"). A `Field.date` column stores ISO text, so
`col >= '2025-06-18'` matches; a `Field.datetime` column stores an **integer
epoch** (1780012800000), and in SQLite an INTEGER always sorts before any
TEXT, so `epoch >= 'YYYY-MM-DD'` is ALWAYS FALSE → empty chart. (The
un-filtered cube returns the rows, which is why the data looked present.)
Confirmed by diffing the working evidence KPI (`expires_on` = date → text)
against the broken assessments chart (`assessed_at` = datetime → epoch).
Template fix: change the charted/date-token-filtered timestamp fields from
`datetime` to `date` (day granularity is all these reports need, and the
column then stores ISO text the analytics layer can compare):
- compliance `compliance_assessment.assessed_at` → assessments-by-month
- todo `todo_task.completed_at` → throughput-by-week
- expense `expense_report.reimbursed_at` → spend-by-month
- content `content_piece.published_at` → published-by-month
- content `content_publication.published_at` → ROI dashboard (90d)
Deliberately NOT changed: `helpdesk_ticket.resolved_at` stays `datetime`
because SLA-resolution timing needs sub-day precision — its
"Resolutions by Day" chart stays empty until the platform binds epoch for
datetime columns. Documented the whole gotcha in AGENTS.md.
Verified: fresh boot stores all five as ISO text (typeof = text); the
compliance assessments-by-month chart renders a line (y-axis populated)
where it previously showed "No rows"; chart SQL count 0 → 4.
Co-Authored-By: Claude Opus 4.8 <noreply@anthropic.com>
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Add this suggestion to a batch that can be applied as a single commit.This suggestion is invalid because no changes were made to the code.Suggestions cannot be applied while the pull request is closed.Suggestions cannot be applied while viewing a subset of changes.Only one suggestion per line can be applied in a batch.Add this suggestion to a batch that can be applied as a single commit.Applying suggestions on deleted lines is not supported.You must change the existing code in this line in order to create a valid suggestion.Outdated suggestions cannot be applied.This suggestion has been applied or marked resolved.Suggestions cannot be applied from pending reviews.Suggestions cannot be applied on multi-line comments.Suggestions cannot be applied while the pull request is queued to merge.Suggestion cannot be applied right now. Please check back later.
Several dashboards' time-series charts and "last N months/days" KPIs silently rendered "No rows" even though the data existed.
Root cause (platform-level)
The analytics dataset executor binds dashboard date tokens (
{12_months_ago},{90_days_ago},{today}, …) as ISO date strings ("2025-06-18").Field.datecolumn stores ISO text →col >= '2025-06-18'matches. ✅Field.datetimecolumn stores an integer epoch (1780012800000). In SQLite an INTEGER always sorts before any TEXT, soepoch >= 'YYYY-MM-DD'is always false → empty result. ❌The un-filtered cube returns the rows (which is why the data looked present). Confirmed by diffing the working evidence KPI (
expires_on=date→ text storage) against the broken assessments chart (assessed_at=datetime→ epoch storage), and by direct SQLite queries:Template fix
Change the charted / date-token-filtered timestamp fields from
datetime→date(day granularity is all these reports need; the column then stores ISO text the analytics layer compares correctly):compliance_assessment.assessed_attodo_task.completed_atexpense_report.reimbursed_atcontent_piece.published_atcontent_publication.published_atDeliberately not changed:
helpdesk_ticket.resolved_atstaysdatetime— SLA-resolution timing needs sub-day precision (flows compare it, breach logic uses it). Its "Resolutions by Day" chart stays empty until the platform binds epoch for datetime columns. The full gotcha is documented inAGENTS.mdfor future template authors.Verification
typeof = text).status IN (...) AND assessed_at >= '2025-06-18') goes 0 → 4 rows.🤖 Generated with Claude Code