Closed wweevv-johndpope closed 5 months ago
sorry for above guff - I close this ticket tomorrow on other account. I basically needed this simple facebook feed test case.
in this test:
Sally follows Bob but not Bill. Both Bob and Bill have activities (like liking a book or a movie). When fetching the feed for Sally, only Bob's activities should appear because Sally follows Bob but not Bill.
# Define users Sally, Bob, and Bill
sally = Actor("sally", "person")
bob = Actor("bob", "person")
bill = Actor("bill", "person")
# Sally follows Bob
tst_manager.follow("sally", "bob", now)
# Bob likes a book
book = Object("book1", "book")
bob_likes_book = Activity("like", bob, book, published=now)
tst_manager.add_activity_feed(bob_likes_book)
# Bill likes a movie (Sally does not follow Bill)
movie = Object("movie1", "movie")
bill_likes_movie = Activity("like", bill, movie, published=now)
tst_manager.add_activity_feed(bill_likes_movie)
# Fetch and print activities for users Sally follows
sally_feed_aggregator = RecentTypeAggregator("sally")
sally_feed = tst_manager.get_feeds(sally_feed_aggregator)
print("Sally's feed:", sally_feed)
Sally's feed: [{'type': 'like', 'activities': [{'actor': {'id': 'bob', 'type': 'person'}, 'published': '2024-04-04T23:19:06.416193', 'object': {'id': 'book1', 'type': 'book'}}]}]
FYI - worth a read regarding elasticsearch 8 + licenses. https://aws.amazon.com/what-is/opensearch/
I'm at a point where I don't know how / why things work. or how I think things should work - are not aligning.
I have some superficial questions on code / tests. here goes - thanks in advance for any insights.
Question is) where is edoquiros in test_00_manager? https://github.com/qlands/elasticfeeds/blob/master/elasticfeeds/tests/test_00_manager.py#L67C36-L67C45
because you're using "cquiros" it is describing linkedActivity / activity_id / Link / cquiros - can you help unpack this?
BACKGROUND
I successfully create the indexes
In another process / importing liked youtube videos
this successfully adds the activity / it's basically - a user "Blabla" liked a video - and the extra field contains youtube content.
✅ - this is working
and I get the following json using this query
✅ - this is working
BUT -
now as another user - "johnpope" I want to follow user id "blabla" I use the helper.
and now I want to see the feeds for johnpope - (like facebook feeds / friends did posts / liked stuff etc)
this api is simply using the aggregator
do I need something else?
I dug into the other tests - and see this. https://github.com/qlands/elasticfeeds/blob/master/elasticfeeds/tests/test_02_aggregators.py#L37C3-L39C54
here - would substituting "cquiros" with "johnpope" basically be the equivalent of viewing the feeds for johnpope? That would contain
do I want to target the feeds or network here for a feed for johnpope (which would just show "blabla" user?
maybe with the DateWeightAggregator we could make show the variable name -
UPDATE
UPDATE for sanity test -
I can see the testnetwork
and I can see the uuid doesn't make sense - and I can easily delete it.
tst_linked_activity = LinkedActivity(activity_id=str(uuid.uuid4())) // obviously wrong - must match the actor_id ??
this is the code