Activity Streams 2.0 - bounswe/bounswe2025group5 GitHub Wiki

📑 Activity Streams 2.0 Overview

Activity Streams 2.0 (AS2.0) is a W3C standard for describing social and user-driven actions in a consistent, machine-readable format.
It provides a simple data model for capturing who did what, to what, and when — for example, a user liking a post, creating content, or joining a challenge.


🔑 Core Concepts

  • Actor → the entity performing the action (e.g., a user).
  • Activity → the action being performed (e.g., Like, Create, Join).
  • Object → the target of the action (e.g., a post, challenge, or badge).
  • Resulting Context → optional, like the collection or feed where the action belongs.

🧩 Example Activities

Like a Post

{
  "@context": "https://www.w3.org/ns/activitystreams",
  "type": "Like",
  "actor": "https://example.com/users/u123",
  "object": "https://example.com/posts/p456"
}

Comment on a Post

{
  "type": "Create",
  "actor": "https://example.com/users/u123",
  "object": {
    "type": "Note",
    "content": "This is my comment",
    "inReplyTo": "https://example.com/posts/p456"
  }
}

⚡ Why It Matters for Us

  • Consistency → Instead of handling likes, comments, shares, and saves separately, we can treat them all as Activities.
  • Interoperability → Using a standard format means our data model aligns with other platforms (like Mastodon, ActivityPub).
  • Extensibility → Easy to define custom activities (e.g., LogWaste, EarnBadge) without redesigning the system.
  • Future-proofing → Opens doors for features like activity feeds, external integrations, and richer analytics.

📝 Relevance to Our App

Our app already includes user actions that map directly to Activity Streams 2.0 concepts:

App Concept Glossary Term / Requirement AS2.0 Mapping
Create a post Post (1.1.4.1) Create (object = Note)
Like a post Like Post (1.1.4.6) Like
Comment on a post Comment (1.1.4.7) Create (object = Note, with inReplyTo)
Share a post Share (1.1.4.8) Announce
Save a post Save (1.1.4.5) Add (target = Saved items)
Join a challenge Community Sustainability Challenge (1.1.3.1) Join
Log waste Waste Log (1.1.2.1) Create (custom type = WasteLog)
Earn achievement badge Achievement Badge (1.2.3.2, 1.2.3.6) Achieve (custom)
Redeem eco-friendly reward Eco-friendly Reward (1.1.5.3) Consume or custom

⚙️ Potential Changes and Future Considerations for Adaptation

As part of adopting Activity Streams 2.0, several potential changes and enhancements to the system have been identified to make the app more standardized, consistent, and future-proof:

  • Standardized Activity Modeling:
    Existing user actions—such as creating posts, liking, commenting, sharing, saving, joining challenges, logging waste, and earning badges—can be represented consistently as standardized activities. This provides a unified structure for tracking, storing, and analyzing interactions, and ensures that all activities are compatible with Activity Streams 2.0.

  • Additions to Requirements:
    To comply with standards, a new section under system requirements (e.g., 1.2.6 Standardization Requirements) should be added, stating that all user interactions should be represented using a standardized activity formats. Here is the suggested section:

1.2.6 Standardization Requirements

1.2.6.1 The system shall model user interactions (e.g., Like, Comment, Share, Save, Join Challenge) using standardized vocabularies and data formats.
1.2.6.2 In particular, the system shall represent user actions following the W3C Activity Streams 2.0 specification where applicable, to ensure consistency, interoperability, and extensibility.

  • User Follow System:
    If a follow/unfollow feature is added, these actions should also be represented as standardized activities (Follow / Unfollow) to maintain consistency across the activity stream. This allows integration with activity feeds, notifications, and analytics without additional data-model redesign.

  • Custom Domain-Specific Activities:
    Certain app-specific actions, such as LogWaste, RedeemReward, or AchieveBadge, can be modeled as custom activity types while remaining compatible with Activity Streams 2.0.