docs(report): align Advanced SQL section with the implemented queries#44
Merged
aykhan019 merged 1 commit intoMay 31, 2026
Conversation
Section 5 printed SQL that no longer matched the live API, which is a risk for a graded report where the source is inspected during the demo. Rewrite Q1-Q6 to mirror apps/api/src/modules/analytics/analytics.service.ts: - Q1 top artists: DENSE_RANK (not RANK), no 30-day window, no role='primary' filter, HAVING COUNT(*) > 1; drop the pct_of_plays/distinct_tracks columns. - Q2 heatmap: drop the 90-day window the code never applied; add the tracks.hidden_at join. - Q3 hidden gems: global "never played by anyone" anti-join (LEFT JOIN ... WHERE lh.id IS NULL), artist via albums.primary_artist_id, configurable minPlaylistCount, random sampling; drop the per-user/preview-only framing. - Q4 discover: single top-track cohort (not all played tracks), cooccurrence_count, NOT EXISTS exclusion, random sampling. - Q5 trending: two-CTE recent/prior growth-ratio with a threshold, not a single-scan COUNT(*) FILTER delta. - Q6: replace the fabricated "curated picks" RANK query (no such SQL exists) with the real Jaccard similar-playlists query behind the "More like this" rail. Also fix the "Five representative queries" count (six), the Figure 9 "seed track" caption, the Figure 11 "(Query 6)" reference, the row-count "13 application tables" label (six are catalog tables), and the "deterministic seed scripts" wording.
|
@fateh-mammadli is attempting to deploy a commit to the Aykhan's projects Team on Vercel. A member of the Team first needs to authorize it. |
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.
Why
The final report's Section 5 (Advanced SQL Queries — the 3%-weighted criterion) printed SQL that diverged from the live API in
apps/api/src/modules/analytics/analytics.service.ts. Because graders inspect the source during Demo Day, the report and the code need to agree.What changed
Rewrote Q1–Q6 to be transcriptions of the queries that actually run:
RANK(), 30-day window,role='primary',pct_of_playsDENSE_RANK(), all-time, no role filter,HAVING COUNT(*)>1tracks.hidden_atfilterWHERE lh.id IS NULLanti-join,minPlaylistCount, random samplingcooccurrence_count,NOT EXISTS, random samplingCOUNT(*) FILTERdeltaRANK()query that did not existsimilarPlaylistsquery behind "More like this"Also corrected:
Docs-only change;
final-report/**is prettier-ignored so formatting is unaffected.