Updated 2023-11-01
    with t1 as (SELECT a.tx_hash
    , a.block_timestamp
    , a.signer_id AS commenter_account_id
    , try_parse_json(a.node_data[k.value]) AS action_data
    , action_data:item:blockHeight::integer AS post_block_height
    , action_data:item:path::string AS post_path
    , split(post_path, '/')[0]::string AS post_author_account_id
    , action_data:item:type::string AS post_type

    FROM near.social.fact_decoded_actions AS a
    , LATERAL FLATTEN (input => (CASE WHEN is_object(a.node_data) THEN object_keys(a.node_data) ELSE NULL END)) AS k

    WHERE a.node = 'post'
    AND k.value = 'comment'
    AND post_type = 'social'
    and BLOCK_TIMESTAMP >= CURRENT_DATE - {{Time_period_days}}
    )

    select
    distinct post_author_account_id as "Author",
    count(distinct tx_hash) as no_comments
    from t1
    group by 1
    order by 2 desc limit 10


    Run a query to Download Data