Query to create some groups based on activity

I merged and improved them (with my poor sql skills), if I need usernames I just download CSV and copy/paste username column
I add likes_received_max so I can split groups, excluding the group above.

For example
first_steps: 5 likes (<30), 500 posts read, >5 post last year,
beginners: 30 likes (<100), 1000 posts read, >10 post last year
padawan: 100 likes, 2000 post read, >10 post last year
hero: 200likes, 5000 post read, >10 post last year

-- [params]
-- int :likes_received
-- int :posts_read
-- int :likes_received_max
-- int :posts_count



WITH user_activity AS (
    SELECT 
        p.user_id, 
        COUNT(p.id) as posts_count
    FROM posts p
    LEFT JOIN topics t ON t.id = p.topic_id
    WHERE p.created_at::date >= CURRENT_DATE - INTERVAL '1 YEAR'
        AND t.deleted_at IS NULL
        AND p.deleted_at IS NULL
        AND t.archetype = 'regular'
    GROUP BY 1
)

SELECT 
    us.user_id,
    u.username,
    us.likes_received,
    us.posts_read_count,
    ua.posts_count,
    u.title
FROM user_stats us
  JOIN user_activity ua ON UA.user_id = us.user_id
  JOIN users u ON u.id = us.user_id
WHERE us.likes_received >= :likes_received
  AND us.posts_read_count >= :posts_read
  AND ua.posts_count >= :posts_count
  AND us.likes_received < :likes_received_max
ORDER BY 2 ASC, 3 ASC, 4 ASC