toddsundsted / ktistec

Single user ActivityPub (https://www.w3.org/TR/activitypub/) server.
GNU Affero General Public License v3.0
350 stars 21 forks source link

Question: How do I get the number of followers I had at a particular date? #81

Closed vrthra closed 6 months ago

vrthra commented 7 months ago

I am curious about the change in followers over time. What is the best way to do this? (I am happy to run an SQL query on the Ktistec db).

toddsundsted commented 7 months ago

@vrthra the following will get you all of the follow relationships from someone to you:

sqlite> .mode column
sqlite> .headers on
sqlite> select * from relationships where type = "Relationship::Social::Follow" and to_iri = "https://social.gopinath.org/actors/rahul";
id      created_at               updated_at               type                          from_iri                                                  to_iri                                      confirmed  visible
------  -----------------------  -----------------------  ----------------------------  --------------------------------------------------------  ------------------------------------------  ---------  -------
...

you can pretty easily bin up the followers by the date/time they were created, which will give you a picture of growth.

toddsundsted commented 7 months ago

a slightly different way to look at it is the number of inbound follow requests:

select * from activities where type = "ActivityPub::Activity::Follow" and object_iri = "https://social.gopinath.org/actors/rahul";
id      created_at               updated_at               type                           iri                                                                                      visible  published                actor_iri                                                 object_iri                                  target_iri  to                                                                cc  summary  undone_at
------  -----------------------  -----------------------  -----------------------------  ---------------------------------------------------------------------------------------  -------  -----------------------  --------------------------------------------------------  ------------------------------------------  ----------  ----------------------------------------------------------------  --  -------  -----------------------
...
vrthra commented 7 months ago

Thank you! Much appreciated.