messariAtlas - Overtime Social Activty
    Updated 2024-01-04
    WITH
    main_posts AS (
    SELECT block_timestamp,
    tx_hash,
    block_id AS og_post_id,
    block_id AS current_post_id,
    signer_id,
    post_text
    FROM near.social.fact_posts
    ),
    reply_posts AS (
    SELECT block_timestamp,
    tx_hash,
    try_parse_json(try_parse_json(try_parse_json(node_data):"comment"):"item"):"blockHeight" AS og_post_id,
    block_id AS current_post_id,
    signer_id,
    try_parse_json(try_parse_json(node_data):"comment"):"text" AS post_text
    FROM near.social.fact_decoded_actions
    WHERE node = 'post'
    AND og_post_id IS NOT NULL
    ),
    all_posts AS (
    SELECT * FROM main_posts
    UNION ALL
    SELECT * FROM reply_posts
    ),
    likes AS (
    SELECT *,
    try_parse_json(try_parse_json(try_parse_json(node_data):"like"):"key"):"blockHeight" AS og_post_id,
    split(try_parse_json(try_parse_json(try_parse_json(node_data):"like"):"key"):"path", '/')[0] AS liked
    FROM near.social.fact_decoded_actions
    WHERE node_data::string LIKE '{"like"%'
    ),

    -- Aggregations
    posts_over_time AS (
    Last run: about 1 year ago
    DATE
    POSTS_COUNT
    REPLIES_COUNT
    LIKES_COUNT
    1
    2022-10-05 00:00:00.000001
    2
    2022-12-14 00:00:00.000006
    3
    2022-12-15 00:00:00.000001
    4
    2022-12-18 00:00:00.000004
    5
    2022-12-19 00:00:00.000003
    6
    2022-12-20 00:00:00.000500
    7
    2022-12-21 00:00:00.0005200
    8
    2022-12-22 00:00:00.0002104
    9
    2022-12-23 00:00:00.00010055
    10
    2022-12-24 00:00:00.000261238
    11
    2022-12-25 00:00:00.00017740
    12
    2022-12-26 00:00:00.00015630
    13
    2022-12-27 00:00:00.0007534
    14
    2022-12-28 00:00:00.0009324
    15
    2022-12-29 00:00:00.0006121
    16
    2022-12-30 00:00:00.0003121
    17
    2022-12-31 00:00:00.000403
    18
    2023-01-01 00:00:00.00014318
    19
    2023-01-02 00:00:00.00010383
    20
    2023-01-03 00:00:00.00081131
    ...
    425
    16KB
    5s