Skip to content
Draft
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
17 changes: 17 additions & 0 deletions db_schema/migrations/19_spotify_graphql_raw.sql
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
-- Migration 19: Create table for raw Spotify GraphQL data
-- Stores raw JSON payloads from the spotify_graphql pipeline
CREATE TABLE IF NOT EXISTS spotifyGraphQLRaw (
id BIGINT UNSIGNED NOT NULL AUTO_INCREMENT,
account_id INTEGER NOT NULL,
show_uri VARCHAR(255) NOT NULL,
episode_uri VARCHAR(255) NULL,
endpoint VARCHAR(100) NOT NULL,
data JSON NOT NULL,
retrieved_at DATETIME NOT NULL,
PRIMARY KEY (id),
INDEX idx_graphql_raw_account_endpoint (account_id, endpoint),
INDEX idx_graphql_raw_account_show (account_id, show_uri),
INDEX idx_graphql_raw_account_episode (account_id, episode_uri)
);

INSERT INTO migrations (migration_id, migration_name) VALUES (19, 'spotify graphql raw');
29 changes: 29 additions & 0 deletions fixtures/spotifyGraphqlEpisodeAudienceSizeAllTime.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
{
"provider": "spotify",
"version": 1,
"retrieved": "2026-03-14T10:00:00.000Z",
"meta": {
"show": "spotify:show:0tJRC0UsObPCWLmmzmOkIs",
"endpoint": "episodeAudienceSizeAllTime",
"episode": "spotify:episode:7tCwxfSBukfYDYvHD8QbK7"
},
"range": {
"start": "2026-03-07",
"end": "2026-03-14"
},
"data": {
"episodeByUri": {
"episodeAudienceSizeAllTime": {
"analyticsValue": {
"analyticsValue": {
"__typename": "SingleValueLong",
"value": 8
}
},
"endDate": "",
"startDate": ""
},
"uri": "spotify:episode:7tCwxfSBukfYDYvHD8QbK7"
}
}
}
33 changes: 33 additions & 0 deletions fixtures/spotifyGraphqlEpisodeConsumptionAllTime.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,33 @@
{
"provider": "spotify",
"version": 1,
"retrieved": "2026-03-14T10:00:00.000Z",
"meta": {
"show": "spotify:show:0tJRC0UsObPCWLmmzmOkIs",
"endpoint": "episodeConsumptionAllTime",
"episode": "spotify:episode:7tCwxfSBukfYDYvHD8QbK7"
},
"range": {
"start": "2026-03-07",
"end": "2026-03-14"
},
"data": {
"episodeByUri": {
"episodeConsumptionAllTime": {
"analyticsValue": {
"analyticsValue": {
"__typename": "ConsumptionValue",
"backgroundMsPlayed": 0,
"foregroundConsumptionHours": 0.0,
"foregroundConsumptionPercent": 0.0,
"foregroundMsPlayed": 0,
"totalConsumptionHours": 3.62
}
},
"endDate": "",
"startDate": ""
},
"uri": "spotify:episode:7tCwxfSBukfYDYvHD8QbK7"
}
}
}
35 changes: 35 additions & 0 deletions fixtures/spotifyGraphqlEpisodeMetadata.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,35 @@
{
"provider": "spotify",
"version": 1,
"retrieved": "2026-03-14T10:00:00.000Z",
"meta": {
"show": "spotify:show:0tJRC0UsObPCWLmmzmOkIs",
"endpoint": "episodeMetadata",
"episode": "spotify:episode:7tCwxfSBukfYDYvHD8QbK7"
},
"range": {
"start": "2026-03-07",
"end": "2026-03-14"
},
"data": {
"episodeByUri": {
"contentType": "EPISODE_CONTENT_TYPE_AUDIO",
"coverArt": {
"large": {
"url": "https://example.com/large.jpg"
},
"small": {
"url": "https://example.com/small.jpg"
}
},
"publishedOn": {
"seconds": 1773381600
},
"thumbnail": {
"images": []
},
"title": "Ep. 139: Example Episode",
"uri": "spotify:episode:7tCwxfSBukfYDYvHD8QbK7"
}
}
}
57 changes: 57 additions & 0 deletions fixtures/spotifyGraphqlEpisodePerformanceAllTime.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
{
"provider": "spotify",
"version": 1,
"retrieved": "2026-03-14T10:00:00.000Z",
"meta": {
"show": "spotify:show:0tJRC0UsObPCWLmmzmOkIs",
"endpoint": "episodePerformanceAllTime",
"episode": "spotify:episode:7tCwxfSBukfYDYvHD8QbK7"
},
"range": {
"start": "2026-03-07",
"end": "2026-03-14"
},
"data": {
"episodeByUri": {
"episodePerformanceTotalAllTime": {
"analyticsValue": {
"analyticsValue": {
"__typename": "PerformanceValue",
"medianCompletionSeconds": 72,
"percentiles": [
{
"audiencePercentage": 50.0,
"completionPercentage": 25
},
{
"audiencePercentage": 25.0,
"completionPercentage": 50
},
{
"audiencePercentage": 13.0,
"completionPercentage": 75
},
{
"audiencePercentage": 13.0,
"completionPercentage": 100
}
],
"points": [
{
"sampleCount": 8,
"second": 0
},
{
"sampleCount": 8,
"second": 1
}
]
}
},
"endDate": "",
"startDate": ""
},
"uri": "spotify:episode:7tCwxfSBukfYDYvHD8QbK7"
}
}
}
37 changes: 37 additions & 0 deletions fixtures/spotifyGraphqlEpisodePlaysDaily.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,37 @@
{
"provider": "spotify",
"version": 1,
"retrieved": "2026-03-14T10:00:00.000Z",
"meta": {
"show": "spotify:show:0tJRC0UsObPCWLmmzmOkIs",
"endpoint": "episodePlaysDaily",
"episode": "spotify:episode:7tCwxfSBukfYDYvHD8QbK7"
},
"range": {
"start": "2026-03-07",
"end": "2026-03-14"
},
"data": {
"episodeByUri": {
"episodePlaysDaily": {
"analyticsValue": {
"analyticsValue": {
"__typename": "TimeSeriesValue",
"points": [
{
"date": "2026-03-13",
"value": {
"__typename": "CountValueLong",
"value": 7
}
}
]
}
},
"endDate": "2026-03-14",
"startDate": "2026-03-07"
},
"uri": "spotify:episode:7tCwxfSBukfYDYvHD8QbK7"
}
}
}
46 changes: 46 additions & 0 deletions fixtures/spotifyGraphqlEpisodeStreamsAndDownloads.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,46 @@
{
"provider": "spotify",
"version": 1,
"retrieved": "2026-03-14T10:00:00.000Z",
"meta": {
"show": "spotify:show:0tJRC0UsObPCWLmmzmOkIs",
"endpoint": "episodeStreamsAndDownloads",
"episode": "spotify:episode:7tCwxfSBukfYDYvHD8QbK7"
},
"range": {
"start": "2026-03-07",
"end": "2026-03-14"
},
"data": {
"episodeByUri": {
"episodeStreamsAndDownloads": {
"analyticsValue": {
"analyticsValue": {
"__typename": "StreamsAndDownloadsValue",
"downloads": 0,
"streams": 0,
"downloadsTimeSeries": {
"__typename": "TimeSeriesValue",
"points": [
{
"date": "2026-02-15",
"value": {
"__typename": "CountValueLong",
"value": 0
}
}
]
},
"streamsTimeSeries": {
"__typename": "TimeSeriesValue",
"points": []
}
}
},
"endDate": "2026-03-14",
"startDate": "2026-03-07"
},
"uri": "spotify:episode:7tCwxfSBukfYDYvHD8QbK7"
}
}
}
66 changes: 66 additions & 0 deletions fixtures/spotifyGraphqlShowAudienceDiscovery.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,66 @@
{
"provider": "spotify",
"version": 1,
"retrieved": "2026-03-14T10:00:00.000Z",
"meta": {
"show": "spotify:show:0tJRC0UsObPCWLmmzmOkIs",
"endpoint": "showAudienceDiscovery"
},
"range": {
"start": "2026-03-07",
"end": "2026-03-14"
},
"data": {
"showByShowUri": {
"impressionsFunnel": {
"analyticsValue": {
"analyticsValue": {
"__typename": "FunnelValue",
"steps": [
{
"conversionRate": 0.0,
"count": 0,
"displayName": "Reached",
"displayNameFull": "People you reached",
"stepName": "impressions"
}
]
}
},
"endDate": "2026-03-14",
"startDate": "2026-03-07"
},
"audienceSize": {
"analyticsValue": {
"analyticsValue": {
"__typename": "SingleValueLong",
"value": 0
}
},
"endDate": "2026-03-14",
"startDate": "2026-03-07"
},
"audienceFollowRate": {
"analyticsValue": {
"analyticsValue": {
"__typename": "PercentageValueFloat",
"value": 0.0
}
},
"endDate": "2026-03-14",
"startDate": "2026-03-07"
},
"consumptionHoursPerPerson": {
"analyticsValue": {
"analyticsValue": {
"__typename": "PercentageValueFloat",
"value": 0.0
}
},
"endDate": "2026-03-14",
"startDate": "2026-03-07"
},
"uri": "spotify:show:0tJRC0UsObPCWLmmzmOkIs"
}
}
}
31 changes: 31 additions & 0 deletions fixtures/spotifyGraphqlShowDemographicsStats.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,31 @@
{
"provider": "spotify",
"version": 1,
"retrieved": "2026-03-14T10:00:00.000Z",
"meta": {
"show": "spotify:show:0tJRC0UsObPCWLmmzmOkIs",
"endpoint": "showDemographicsStats"
},
"range": {
"start": "2026-03-07",
"end": "2026-03-14"
},
"data": {
"showByShowUri": {
"showStreamsFaceted": {
"analyticsValue": {
"analyticsValue": {
"__typename": "FacetedAnalyticsValue",
"ageBreakdown": [],
"countryBreakdown": [],
"genderBreakdown": null,
"totalValue": 0
}
},
"endDate": "2026-03-14",
"startDate": "2026-03-07"
},
"uri": "spotify:show:0tJRC0UsObPCWLmmzmOkIs"
}
}
}
26 changes: 26 additions & 0 deletions fixtures/spotifyGraphqlShowGeoStats.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
{
"provider": "spotify",
"version": 1,
"retrieved": "2026-03-14T10:00:00.000Z",
"meta": {
"show": "spotify:show:0tJRC0UsObPCWLmmzmOkIs",
"endpoint": "showGeoStats"
},
"range": {
"start": "2026-03-07",
"end": "2026-03-14"
},
"data": {
"showByShowUri": {
"showStreamsAndDownloadsByGeo": {
"analyticsValue": {
"analyticsValue": {
"__typename": "StreamsAndDownloadsByGeoValue",
"geos": []
}
}
},
"uri": "spotify:show:0tJRC0UsObPCWLmmzmOkIs"
}
}
}
Loading
Loading