# Data model: Respellion Learning Platform ## Overview All structured data lives in **PocketBase** (SQLite). There is **no vector store** — retrieval is computed at runtime with a local TF-IDF index over `topics` (`src/lib/retrieval.js`). Schema is defined by JS migrations in `pb_migrations/` (applied automatically by the PocketBase binary) and mirrored for local bootstrap in `scripts/setup-pb-collections.mjs`. The data-access layer is `src/lib/db.js`. All collections use PocketBase's auto `id`, plus `created` / `updated` autodate fields unless noted otherwise. --- ## PocketBase collections ### `topics` Knowledge graph nodes. Created during ingestion, enriched for curriculum. | Field | Type | Notes | |---|---|---| | id | text | kebab-case slug (e.g. `holacratic-roles`) | | label | text | display name | | type | text | `concept` · `role` · `process` (ingestion); `fact` is excluded from learning | | description | text | 1–2 sentence summary | | learning_relevance | text | `core` · `standard` · `peripheral` · `exclude` | | relevance_locked | bool | if true, re-ingestion will not overwrite `learning_relevance` | | theme | text | subject grouping (used by curriculum generation) | | complexity_weight | number | 1–5 (curriculum ordering) | | difficulty | text | `introductory` · `intermediate` · `advanced` | Topics with `type='fact'` or `learning_relevance='exclude'` are filtered out of learning, micro-learning, curriculum, and test selection. --- ### `relations` Knowledge graph edges between topics. | Field | Type | Notes | |---|---|---| | source | text | topic id | | target | text | topic id | | type | text | `related_to` · `depends_on` · `part_of` · `executed_by` | Edges are de-duplicated on the `(source, target, type)` tuple. --- ### `content` On-demand long-form learning content, one record per topic. | Field | Type | Notes | |---|---|---| | topic_id | text | topic this content belongs to | | data | json | merged object — only generated types are present | `data` shape (each key generated independently and shallow-merged): ```json { "article": { "title", "intro", "sections": [{ "heading", "body" }], "keyTakeaways": [] }, "slides": [ { "title", "bullets": [], "speakerNote" } ], "infographic": { "headline", "tagline", "stats": [{ "value", "label", "icon" }], "steps": [{ "number", "title", "description", "icon" }], "quote", "colorTheme" } } ``` > There is no `podcast` key. The podcast type was removed. --- ### `micro_learnings` Generated micro-learning artifacts. One record per topic per type. | Field | Type | Notes | |---|---|---| | topic_id | relation → `topics` | cascade delete | | type | select | `concept_explainer` · `scenario_quiz` · `flashcard_set` | | content | json | structured output, schema varies per type | | status | select | `draft` · `published` (only `published` is visible to employees) | **Content JSON per type:** ```json // concept_explainer { "sections": [ { "title": "string", "content": "string (HTML:

,