Logo
New RPC users get 35% off their first monthView the offer
OnFinality Learn
Integration & Development12 min read

Chartex Music Analytics: Building a Reproducible Cross-Platform Data Pipeline

A practical methodology for collecting, normalizing, and validating Chartex-style music intelligence data across TikTok, Spotify, YouTube, and Instagram without fabricating benchmarks.

TL;DR

Chartex is a music intelligence platform that tracks songs and sounds across TikTok, Spotify, YouTube, Instagram Reels, and Shazam, helping labels, A&Rs, and artists see which versions of a track are going viral. This article does not reproduce any vendor's private numbers; instead it explains the data model behind this class of tool and gives you a reproducible pipeline you can run against your own data sources. You will design a normalized schema, ingest and deduplicate sound-level records, validate freshness and completeness, and diagnose the most common cross-platform attribution failures. Every measurement step is something you execute yourself, so results are auditable rather than copied from a marketing page.

Scope and the Direct Answer

Chartex, as the term is used in music analytics, refers to a platform category that aggregates song and sound performance across short-video and streaming services so that labels, A&Rs, and artists can spot viral trends early. The public product pages describe tracking of TikTok sounds, Spotify streams, YouTube views, Instagram Reels, and Shazam counts, with charts and per-sound breakdowns. That description is the documented behavior; the exact metric definitions, refresh cadence, and historical depth are vendor-specific and should be confirmed in your own account or API contract.

This article is methodology-focused. It shows how to build a pipeline that produces Chartex-style outputs from sources you control or are licensed to query, and how to verify that the outputs are trustworthy. If your actual need is a short recommendation about which RPC endpoint or provider to use for an on-chain component of your stack, that belongs in the RPC Assistant rather than here; see the RPC endpoints guide for the general model.

  • Documented: cross-platform tracking of songs and sounds, per-sound breakdowns, charts, and creator/video attribution.
  • Not documented here: exact metric formulas, refresh intervals, or guaranteed coverage per region.
  • Your responsibility: choose sources, define metric semantics, and run validation before trusting any dashboard.

Prerequisites and Assumptions

The pipeline below assumes you have authorized access to at least two data sources: a short-video platform (TikTok or Instagram Reels) and a streaming platform (Spotify or YouTube). It also assumes a relational store (PostgreSQL is used in examples) and a scheduler such as cron or a workflow orchestrator. No specific vendor API keys are assumed; replace placeholders with your own credentials.

You should also decide up front whether you are tracking canonical recordings, sound objects, or creator uploads. These are different entities and conflating them is the most common cause of inflated or duplicated counts. If your pipeline also touches blockchain data for royalty or attribution purposes, keep that path separate and route node access through a managed provider; the multi-chain RPC endpoints guide explains the tradeoffs.

  • Authorized API access to at least two platforms.
  • PostgreSQL 14+ or equivalent with JSONB support.
  • A scheduler and a secrets manager for API credentials.
  • A defined metric dictionary agreed with stakeholders before ingestion.

Mental Model: Songs, Sounds, and Creators Are Different Entities

A song is a canonical recording with an ISRC. A sound is a platform-specific audio object that may be the original track, a sped-up version, a remix, an AI cover, or a creator's original audio. A creator is an account that publishes videos using a sound. Chartex-style dashboards are useful precisely because they separate these layers: one song can map to dozens of sounds, and one sound can be used across thousands of videos.

Design your schema around that hierarchy. Store a songs table keyed by ISRC where available, a sounds table keyed by platform plus platform sound ID, and a videos table keyed by platform plus video ID. A sound_song_map table resolves the many-to-many relationship, and a metrics_daily table stores time-series observations. This structure lets you answer both 'how is the song doing overall' and 'which sound is driving it' without recomputing joins at query time.

CREATE TABLE songs (
  song_id BIGSERIAL PRIMARY KEY,
  isrc TEXT UNIQUE,
  title TEXT NOT NULL,
  artist TEXT NOT NULL
);

CREATE TABLE sounds (
  sound_id BIGSERIAL PRIMARY KEY,
  platform TEXT NOT NULL,
  platform_sound_id TEXT NOT NULL,
  sound_name TEXT,
  UNIQUE (platform, platform_sound_id)
);

CREATE TABLE sound_song_map (
  sound_id BIGINT REFERENCES sounds(sound_id),
  song_id BIGINT REFERENCES songs(song_id),
  confidence NUMERIC(3,2),
  PRIMARY KEY (sound_id, song_id)
);

CREATE TABLE metrics_daily (
  entity_type TEXT NOT NULL,
  entity_id BIGINT NOT NULL,
  metric TEXT NOT NULL,
  observed_on DATE NOT NULL,
  value BIGINT NOT NULL,
  source TEXT NOT NULL,
  PRIMARY KEY (entity_type, entity_id, metric, observed_on, source)
);

Ingestion Procedure with Runnable Code

Start with a single source and a single metric so you can validate the shape before scaling. The Python example below fetches a paginated list of sounds for a given song from a placeholder endpoint, normalizes the response, and upserts into the schema above. Replace API_BASE, API_TOKEN, and the response field names with those from your authorized source.

Run the script on a schedule and log every request with its timestamp, status code, and record count. That log is what makes later validation possible; without it you cannot distinguish a genuine drop in a metric from a failed or partial fetch.

import os, requests, psycopg2
from datetime import date

API_BASE = os.environ["API_BASE"]
TOKEN = os.environ["API_TOKEN"]
DB = psycopg2.connect(os.environ["DATABASE_URL"])

def fetch_sounds(song_id, cursor=None):
    params = {"song_id": song_id, "limit": 100}
    if cursor:
        params["cursor"] = cursor
    r = requests.get(f"{API_BASE}/sounds", params=params,
                     headers={"Authorization": f"Bearer {TOKEN}"}, timeout=30)
    r.raise_for_status()
    return r.json()

def upsert_sound(cur, platform, sound):
    cur.execute("""
        INSERT INTO sounds (platform, platform_sound_id, sound_name)
        VALUES (%s, %s, %s)
        ON CONFLICT (platform, platform_sound_id)
        DO UPDATE SET sound_name = EXCLUDED.sound_name
        RETURNING sound_id
    """, (platform, sound["id"], sound.get("name")))
    return cur.fetchone()[0]

with DB, DB.cursor() as cur:
    page = fetch_sounds(song_id=12345)
    for s in page["items"]:
        sid = upsert_sound(cur, "tiktok", s)
        cur.execute("""
            INSERT INTO metrics_daily (entity_type, entity_id, metric, observed_on, value, source)
            VALUES ('sound', %s, 'video_count', %s, %s, 'tiktok')
            ON CONFLICT (entity_type, entity_id, metric, observed_on, source)
            DO UPDATE SET value = EXCLUDED.value
        """, (sid, date.today(), s["video_count"]))

Normalization and Cross-Platform Attribution

Attribution is where most pipelines silently fail. A TikTok sound named 'Come With Me (Sped Up)' and a Spotify track named 'Come With Me' may or may not be the same recording. Use a layered matching strategy: exact ISRC match first, then normalized title plus artist with fuzzy scoring, then manual review for high-impact sounds. Store the confidence score so downstream queries can filter on it.

Normalize text consistently before matching: lowercase, strip punctuation, collapse whitespace, and remove common suffixes such as 'sped up', 'slowed', 'remix', and 'cover' into separate version tags rather than discarding them. Keep the original strings in a raw column so you can re-run matching when your rules change.

  • Exact ISRC match: highest confidence, use when available.
  • Title plus artist fuzzy match: medium confidence, threshold and review.
  • Sound-name-only match: low confidence, never auto-merge without review.
  • Version tags (sped up, remix, cover) stored separately from the base title.

Verification: Expected Results and a Results Table Procedure

After ingestion, verify three things: completeness (did every expected entity arrive), freshness (is the latest observation within your expected window), and consistency (do totals reconcile across tables). The SQL below returns a results table you can paste into your runbook. Do not fill in expected values from a vendor page; record what your own pipeline produces and compare against the previous run.

CheckQuery purposePass condition
CompletenessCount sounds per song vs. source API totalEqual within 1%
FreshnessMax observed_on per sourceWithin 24 hours of run time
ConsistencySum of sound video_count vs. video table countEqual within known dedup tolerance
AttributionShare of sounds with confidence >= 0.9Meets your agreed threshold
Error rateFailed requests in ingestion logBelow your alert threshold

Run this after every scheduled load and store the output alongside the run log. A metric that moves without a corresponding change in the underlying source is a pipeline bug, not a trend.

SELECT source,
       MAX(observed_on) AS latest_observation,
       CURRENT_DATE - MAX(observed_on) AS days_stale
FROM metrics_daily
GROUP BY source
ORDER BY days_stale DESC;

SELECT s.song_id,
       COUNT(DISTINCT m.entity_id) AS sounds_with_metrics,
       COUNT(DISTINCT s.sound_id) AS sounds_mapped
FROM sound_song_map s
LEFT JOIN metrics_daily m
  ON m.entity_type = 'sound' AND m.entity_id = s.sound_id
GROUP BY s.song_id;

Troubleshooting Common Pipeline Failures

Most failures fall into four buckets: authentication and rate limits, schema drift, duplicate entities, and timezone misalignment. Rate limits usually appear as HTTP 429 responses and partial pages; back off exponentially and record the retry count. Schema drift appears as missing fields after a source changes its response shape; validate against a JSON schema on every fetch and fail loudly rather than writing nulls.

Duplicate entities arise when the same sound is returned under different platform IDs, often after a platform migration. Timezone misalignment causes daily metrics to shift by a day between sources; store all timestamps in UTC and convert only at presentation time. If your pipeline also queries blockchain nodes for on-chain royalty data, endpoint reliability becomes a separate failure domain; the blockchain node hosting guide covers the operational side.

  • HTTP 429: exponential backoff, cap retries, alert on sustained failures.
  • Missing fields: validate JSON schema, fail the batch, do not write partial rows.
  • Duplicate sounds: dedupe on platform plus platform_sound_id, review merges.
  • Date drift: store UTC, document the reporting timezone explicitly.

Limitations and Tradeoffs

Cross-platform music analytics is inherently approximate. Platforms do not expose identical metric definitions, and some counts are sampled or delayed. A pipeline that claims exact parity across TikTok, Spotify, and YouTube is overstating its precision. Treat the output as directional intelligence for prioritization, not as audited financial data.

There is also a cost tradeoff. Higher-frequency polling improves freshness but increases API usage and storage. Start with daily granularity, measure how often your decisions actually depend on intraday data, and only then increase frequency. For teams running their own infrastructure, dedicated nodes and managed RPC can reduce operational overhead; see the dedicated node and RPC pricing pages for the cost model, and the networks directory for supported chains if your pipeline touches on-chain data.

Next Steps: From Pipeline to Decision Support

Once validation passes consistently, add a charting layer that surfaces the metrics your team actually acts on: sound-level growth rate, creator concentration, and cross-platform correlation. Keep the raw tables intact so you can recompute charts when definitions change. Document the metric dictionary in the same repository as the pipeline code so the two never drift apart.

If you need a concrete endpoint or provider recommendation for the infrastructure side of your stack, use the RPC Assistant rather than embedding a provider choice in this methodology. For a broader view of how managed API services fit into a data platform, the API service overview is the right starting point.

  • Freeze the metric dictionary before building dashboards.
  • Re-run validation after every schema or source change.
  • Separate directional intelligence from audited reporting.
  • Route infrastructure questions to RPC Assistant.

Never Worry about Infrastructure Again

OnFinality takes away the heavy lifting of DevOps so you can build smarter and faster.

Get Started