pediatric-ai-scribe-v3/docs/learning-hub.md
Daniel b97c5f146b v6.1: Turnstile bot protection, LiteLLM provider, PPTX tables, audio backup fixes, docs
- Add Cloudflare Turnstile to login, register, and password reset forms
- Switch AI provider to LiteLLM, transcription to OpenAI Whisper
- Change domain to scribe.pedshub.com
- Fix PPTX export: add tables, bold/italic, numbered lists, code blocks, blockquotes
- Fix announcement banner close button (CSP was blocking inline onclick)
- Fix auth middleware: empty Bearer token now falls through to cookie auth
- Fix audio backups: only save on transcription failure, stop auto-deleting on success
- Soften AI correction injection to prevent model hallucination from correction history
- Fix LiteLLM TTS model name handling (no incorrect openai/ prefix)
- Expand AI instructions textarea in Learning Hub CMS
- Update README for v6 with all features and providers
- Add comprehensive docs/: architecture, API reference, database schema,
  authentication, AI providers, speech, learning hub, configuration, deployment
2026-04-04 22:56:24 +02:00

130 lines
3.7 KiB
Markdown

# Learning Hub and CMS
This document covers the Learning Hub feature, including content types, user-facing features, the content management system (CMS), presentation export, semantic search, and database schema.
---
## Content Types
The Learning Hub supports four content types:
| Type | Description |
|------|-------------|
| `article` | Rich HTML body with an optional attached quiz. |
| `pearl` | Concise clinical snippets for quick reference. |
| `quiz` | Quiz-only resources (no article body). |
| `presentation` | Marp markdown rendered as slides. |
---
## User Features
### Browsing and Search
- Browse content by category.
- Search supports three modes: **keyword**, **semantic** (vector similarity), and **hybrid** (combined).
### Articles
- View articles with rich HTML content.
- Articles may include an embedded quiz.
### Quizzes
- Question types: multiple choice (MCQ), multi-select, and true/false.
- Scoring is calculated on submission.
- Explanations are shown per question after submission.
- Users can view quiz progress and past attempts.
### Presentations
- Marp-rendered slides displayed in a modal viewer.
- Navigation via keyboard arrows and touch/swipe gestures.
---
## CMS (Moderator and Admin)
### Content Editing
- Create, edit, and publish content using a **Tiptap** rich text editor.
- Content can be saved as draft or published.
### AI Content Generation
AI can generate content from several input sources:
- **Topic description:** Provide a text prompt describing the desired content.
- **Uploaded files:** Supports PDF, TXT, MD, HTML, CSV, and JSON. Up to 100 MB per file, maximum 10 files.
- **Nextcloud WebDAV:** Pull files directly from a connected Nextcloud instance.
Generation options:
- Select the AI model used for generation.
- Configure target **slide count** (for presentations) or **word count** (for articles).
### Quiz Builder
- Add and remove questions.
- Add and remove answer options per question.
- Mark correct answers and provide explanations.
### Marp Slide Editor
- Edit Marp markdown directly.
- **Preview** button renders slides in real time.
- **PPTX Download** exports slides to PowerPoint format.
---
## PPTX Export
Presentation export uses the `pptxgenjs` library to produce PowerPoint files.
### Layout
- 16:9 widescreen aspect ratio.
- Slide numbers rendered in the bottom-right corner.
### Supported Content
- **Tables:** Header row with alternating row colors.
- **Inline formatting:** Bold, italic, and inline code.
- **Numbered lists** and **bullet lists**.
- **Code blocks:** Rendered with a grey background.
- **Blockquotes:** Rendered with a blue accent bar on the left.
- **Sub-headings.**
- **Mixed content per slide:** Slides can contain any combination of the above elements.
---
## Semantic Search
### Vector Storage
- Uses the **pgvector** PostgreSQL extension.
- Embeddings are stored as **768-dimensional** vectors.
- An **IVFFLAT** index is used for fast approximate nearest-neighbor similarity search.
### Embedding Models
| Priority | Model | Provider |
|----------|-------|----------|
| Default | `text-embedding-005` | Google Vertex AI |
| Fallback | `text-embedding-3-small` | OpenAI |
### Hybrid Search
Hybrid search combines keyword matching (PostgreSQL full-text search) with vector similarity results to produce a merged, ranked result set.
---
## Database Tables
| Table | Purpose |
|-------|---------|
| `learning_categories` | Content categories for organizing resources. |
| `learning_content` | Content records including body, metadata, and an `embedding` vector column. |
| `learning_questions` | Quiz questions linked to content. |
| `learning_options` | Answer options for each question. |
| `learning_progress` | Per-user quiz attempt history and scores. |