Skip to content

Knowledge Entity

Last Updated: 2026-03-09 Version: 2.0 (Consolidated)

The Knowledge entity is the heart of the Yappa Knowledge Hub. it represents a single, verifiable unit of information captured from Slack, the Web, or manual entry.

🏮 Core Purpose

Beyond being a "data bucket," the Knowledge entity serves as:

  • Source of Truth: Maps a snippet of information to its original source (Slack message, URL).
  • AI Context: Provides the raw text used by AiSummaryService to generate role-specific summaries.
  • Sync Anchor: Uses a notionId to remain consistent with the cloud-based Notion database.

🏗️ Data Architecture

Notion Mapping

The entity is designed for high-fidelity sync with Notion. Key mapped fields include:

  • Title: Cleaned and validated from the source.
  • Content: The main body of text (supports Markdown).
  • Category: A relationship to a Category entity (mapped to a Relation property in Notion).
  • Target Groups: Audience labels used for routing.

AI Metadata

We store structured metadata to track the AI's interaction with this item:

  • Summaries: (JSON/Relationship) Links to versioned AI summaries.
  • URL Metadata: Scraped data (OpenGraph tags, descriptions) if the knowledge was sourced from a link.
  • Source Message: JSON blob containing the original Slack event_id and user_id for traceability.

⚖️ Business Logic

Status Workflow

Knowledge items follow a standard lifecycle:

  1. pending: Initial state upon submission.
  2. published: Synced to Notion and visible in Slack Home.
  3. archived: No longer active but preserved for history.

Verification Logic

The entity includes guards to ensure data integrity during sync:

  • isSyncable(): Returns true if the item has the minimum required fields (Title, Content) to be sent to Notion.
  • updateFromNotion(): Logic for merging external changes back into the local cache.

Technical Details

  • Location: src/Entity/Knowledge.php
  • Repository: src/Repository/KnowledgeRepository.php
  • ORM: Doctrine (mapped to the knowledge table).

TIP

Use the KnowledgeRepository::search() method for optimized full-text search across Title and Content fields.