Activity Streams 2.0 Detailed Research - bounswe/bounswe2024group6 GitHub Wiki

Activity Streams 2.0 Standard Documentation

1. Purpose and Benefits

Overview

Activity Streams 2.0 is a JSON-based format for describing social activities, enabling standardized representation of social interactions and events across different platforms and applications.

Key Benefits

  • Interoperability: Enables seamless data exchange between different social platforms and applications
  • Standardization: Provides a consistent format for representing social activities
  • Extensibility: Allows for custom vocabularies while maintaining compatibility
  • Machine-readable: Facilitates automated processing and analysis of social data
  • Platform Independence: Works across different platforms and technologies

2. Standard Requirements

Core Components

  1. Actor

    • Must identify who performed the activity
    • Required properties: type, id
    • Example: Person, Organization, Application
  2. Verb/Action

    • Must specify the action performed
    • Standard verbs like: create, update, delete, follow, like
    • Custom verbs must be clearly documented
  3. Object

    • Must identify the target of the activity
    • Required properties: type, id
    • Can be any type of content or entity
  4. Optional Components

    • target: The recipient of the activity
    • context: Additional contextual information
    • published: Timestamp of the activity
    • summary: Human-readable description

Format Requirements

{
  "@context": "https://www.w3.org/ns/activitystreams",
  "type": "Activity",
  "actor": {
    "type": "Person",
    "id": "user123",
    "name": "John Doe"
  },
  "verb": "create",
  "object": {
    "type": "Note",
    "id": "note456",
    "content": "Hello, world!"
  },
  "published": "2024-11-05T12:00:00Z"
}

Validation Rules

  1. All activities must include:

    • Valid JSON-LD context
    • Actor with type and id
    • Action/verb
    • Object with type and id
  2. Timestamps must use ISO 8601 format

  3. IDs must be unique and URL-compatible

3. Enforcement and Implementation

Development Practices

  1. Code Review Requirements

    • All activity payloads must be validated against the schema
    • Custom types and verbs must be documented
    • Review checklist must include Activity Streams compliance
  2. Automated Validation

    • Implement JSON Schema validation
    • Set up CI/CD pipeline checks
    • Use linting tools for Activity Streams format
  3. Testing Requirements

    • Unit tests for activity generation
    • Integration tests for activity consumption
    • Validation tests for custom types

Monitoring and Compliance

  1. Runtime Validation

    • Implement validation middleware
    • Log validation failures
    • Monitor compliance metrics
  2. Documentation Requirements

    • All custom types must be documented
    • Implementation guides must be maintained
    • API documentation must include Activity Streams examples
  3. Error Handling

    • Define standard error responses
    • Implement fallback behaviors
    • Provide clear error messages

Domain-Specific Implementation

Custom Types

{
  "@context": "https://www.w3.org/ns/activitystreams",
  "type": "QuizActivity",
  "actor": {
    "type": "User",
    "id": "alitariksahin",
    "name": "Ali Tarık Şahin"
  },
  "verb": "solve",
  "object": {
    "type": "Quiz",
    "id": "quiz_356",
    "level": "C1",
    "title": "Local Cuisines"
  },
  "result": {
    "type": "Score",
    "score": 95,
    "maxScore": 100
  },
  "published": "2024-11-05T14:30:00Z"
}