- Created a new `docs/planning/` directory to better organize architecture and implementation planning documents. - Moved existing planning documents into the new directory for improved accessibility. - Updated `README.md` to reflect the new document structure and added references to the organized planning documents. - Enhanced overall documentation management for easier navigation and maintenance.
310 lines
11 KiB
Markdown
310 lines
11 KiB
Markdown
# CONTENT WORKFLOW & ENTRY POINTS
|
|
**Complete Workflow Diagrams for Writer → Linker → Optimizer**
|
|
|
|
---
|
|
|
|
## WORKFLOW 1: WRITER → LINKER → OPTIMIZER → PUBLISH
|
|
|
|
```
|
|
┌─────────────┐
|
|
│ Writer │
|
|
│ Generates │
|
|
│ Content │
|
|
└──────┬──────┘
|
|
│
|
|
▼
|
|
┌─────────────────────┐
|
|
│ Content Saved │
|
|
│ source='igny8' │
|
|
│ sync_status='native'│
|
|
│ status='draft' │
|
|
└──────┬──────────────┘
|
|
│
|
|
▼
|
|
┌─────────────────────┐
|
|
│ Linker Trigger │
|
|
│ (Auto or Manual) │
|
|
└──────┬──────────────┘
|
|
│
|
|
▼
|
|
┌─────────────────────┐
|
|
│ LinkerService │
|
|
│ - Finds candidates │
|
|
│ - Injects links │
|
|
│ - Updates content │
|
|
└──────┬──────────────┘
|
|
│
|
|
▼
|
|
┌─────────────────────┐
|
|
│ Content Updated │
|
|
│ linker_version++ │
|
|
│ internal_links[] │
|
|
│ status='linked' │
|
|
└──────┬──────────────┘
|
|
│
|
|
▼
|
|
┌─────────────────────┐
|
|
│ Optimizer Trigger │
|
|
│ (Auto or Manual) │
|
|
└──────┬──────────────┘
|
|
│
|
|
▼
|
|
┌─────────────────────┐
|
|
│ OptimizerService │
|
|
│ - Analyzes content │
|
|
│ - Optimizes │
|
|
│ - Stores results │
|
|
└──────┬──────────────┘
|
|
│
|
|
▼
|
|
┌─────────────────────┐
|
|
│ Content Updated │
|
|
│ optimizer_version++ │
|
|
│ status='optimized' │
|
|
└──────┬──────────────┘
|
|
│
|
|
▼
|
|
┌─────────────────────┐
|
|
│ PublisherService │
|
|
│ - WordPress │
|
|
│ - Sites Renderer │
|
|
│ - Shopify │
|
|
└─────────────────────┘
|
|
```
|
|
|
|
---
|
|
|
|
## WORKFLOW 2: WORDPRESS SYNC → OPTIMIZER → PUBLISH
|
|
|
|
```
|
|
┌─────────────────┐
|
|
│ WordPress │
|
|
│ Plugin Syncs │
|
|
│ Posts to IGNY8 │
|
|
└────────┬────────┘
|
|
│
|
|
▼
|
|
┌─────────────────────────┐
|
|
│ ContentSyncService │
|
|
│ sync_from_wordpress() │
|
|
└────────┬────────────────┘
|
|
│
|
|
▼
|
|
┌─────────────────────────┐
|
|
│ Content Created │
|
|
│ source='wordpress' │
|
|
│ sync_status='synced' │
|
|
│ external_id=wp_post_id │
|
|
│ external_url=wp_url │
|
|
└────────┬────────────────┘
|
|
│
|
|
▼
|
|
┌─────────────────────────┐
|
|
│ Content Visible │
|
|
│ in Writer/Content List │
|
|
│ (Filterable by source) │
|
|
└────────┬────────────────┘
|
|
│
|
|
▼
|
|
┌─────────────────────────┐
|
|
│ User Selects Content │
|
|
│ Clicks "Optimize" │
|
|
└────────┬────────────────┘
|
|
│
|
|
▼
|
|
┌─────────────────────────┐
|
|
│ OptimizerService │
|
|
│ optimize_from_wordpress_│
|
|
│ sync(content_id) │
|
|
└────────┬────────────────┘
|
|
│
|
|
▼
|
|
┌─────────────────────────┐
|
|
│ Optimizer Processes │
|
|
│ (Same logic as IGNY8) │
|
|
│ - Analyzes │
|
|
│ - Optimizes │
|
|
│ - Stores results │
|
|
└────────┬────────────────┘
|
|
│
|
|
▼
|
|
┌─────────────────────────┐
|
|
│ OptimizationTask │
|
|
│ Created │
|
|
│ Original preserved │
|
|
└────────┬────────────────┘
|
|
│
|
|
▼
|
|
┌─────────────────────────┐
|
|
│ Optional: Sync Back │
|
|
│ to WordPress │
|
|
│ (Two-way sync) │
|
|
└─────────────────────────┘
|
|
```
|
|
|
|
---
|
|
|
|
## WORKFLOW 3: 3RD PARTY SYNC → OPTIMIZER → PUBLISH
|
|
|
|
```
|
|
┌─────────────────┐
|
|
│ Shopify/API │
|
|
│ Syncs Content │
|
|
│ to IGNY8 │
|
|
└────────┬────────┘
|
|
│
|
|
▼
|
|
┌─────────────────────────┐
|
|
│ ContentSyncService │
|
|
│ sync_from_shopify() │
|
|
│ or sync_from_custom() │
|
|
└────────┬────────────────┘
|
|
│
|
|
▼
|
|
┌─────────────────────────┐
|
|
│ Content Created │
|
|
│ source='shopify'/'custom'│
|
|
│ sync_status='imported' │
|
|
│ external_id=external_id │
|
|
│ external_url=external_url│
|
|
└────────┬────────────────┘
|
|
│
|
|
▼
|
|
┌─────────────────────────┐
|
|
│ Content Visible │
|
|
│ in Writer/Content List │
|
|
│ (Filterable by source) │
|
|
└────────┬────────────────┘
|
|
│
|
|
▼
|
|
┌─────────────────────────┐
|
|
│ User Selects Content │
|
|
│ Clicks "Optimize" │
|
|
└────────┬────────────────┘
|
|
│
|
|
▼
|
|
┌─────────────────────────┐
|
|
│ OptimizerService │
|
|
│ optimize_from_external_ │
|
|
│ sync(content_id) │
|
|
└────────┬────────────────┘
|
|
│
|
|
▼
|
|
┌─────────────────────────┐
|
|
│ Optimizer Processes │
|
|
│ (Same logic) │
|
|
└────────┬────────────────┘
|
|
│
|
|
▼
|
|
┌─────────────────────────┐
|
|
│ OptimizationTask │
|
|
│ Created │
|
|
└─────────────────────────┘
|
|
```
|
|
|
|
---
|
|
|
|
## WORKFLOW 4: MANUAL SELECTION → LINKER/OPTIMIZER
|
|
|
|
```
|
|
┌─────────────────────────┐
|
|
│ User Views Content List │
|
|
│ (Any source) │
|
|
└────────┬────────────────┘
|
|
│
|
|
▼
|
|
┌─────────────────────────┐
|
|
│ User Selects Content │
|
|
│ (Can filter by source) │
|
|
└────────┬────────────────┘
|
|
│
|
|
▼
|
|
┌─────────────────────────┐
|
|
│ User Clicks Action: │
|
|
│ - "Add Links" │
|
|
│ - "Optimize" │
|
|
│ - "Link & Optimize" │
|
|
└────────┬────────────────┘
|
|
│
|
|
▼
|
|
┌─────────────────────────┐
|
|
│ LinkerService or │
|
|
│ OptimizerService │
|
|
│ (Works for any source) │
|
|
└────────┬────────────────┘
|
|
│
|
|
▼
|
|
┌─────────────────────────┐
|
|
│ Content Processed │
|
|
│ Results Stored │
|
|
└─────────────────────────┘
|
|
```
|
|
|
|
---
|
|
|
|
## CONTENT STORAGE STRATEGY
|
|
|
|
### Unified Content Model
|
|
|
|
All content stored in same `Content` model, differentiated by flags:
|
|
|
|
| Field | Values | Purpose |
|
|
|-------|--------|---------|
|
|
| `source` | `'igny8'`, `'wordpress'`, `'shopify'`, `'custom'` | Where content came from |
|
|
| `sync_status` | `'native'`, `'imported'`, `'synced'` | How content was added |
|
|
| `external_id` | String | External platform ID |
|
|
| `external_url` | URL | External platform URL |
|
|
| `sync_metadata` | JSON | Platform-specific data |
|
|
|
|
### Content Filtering
|
|
|
|
**Frontend Filters**:
|
|
- By source: Show only IGNY8, WordPress, Shopify, or All
|
|
- By sync_status: Show Native, Imported, Synced, or All
|
|
- By optimization status: Not optimized, Optimized, Needs optimization
|
|
- By linking status: Not linked, Linked, Needs linking
|
|
|
|
**Backend Queries**:
|
|
```python
|
|
# Get all IGNY8 content
|
|
Content.objects.filter(source='igny8', sync_status='native')
|
|
|
|
# Get all WordPress synced content
|
|
Content.objects.filter(source='wordpress', sync_status='synced')
|
|
|
|
# Get all content ready for optimization
|
|
Content.objects.filter(optimizer_version=0)
|
|
|
|
# Get all content ready for linking
|
|
Content.objects.filter(linker_version=0)
|
|
```
|
|
|
|
---
|
|
|
|
## ENTRY POINT SUMMARY
|
|
|
|
| Entry Point | Trigger | Content Source | Goes Through |
|
|
|-------------|---------|----------------|--------------|
|
|
| **Writer → Linker** | Auto or Manual | `source='igny8'` | Linker → Optimizer |
|
|
| **Writer → Optimizer** | Auto or Manual | `source='igny8'` | Optimizer (skip linker) |
|
|
| **WordPress Sync → Optimizer** | Manual or Auto | `source='wordpress'` | Optimizer only |
|
|
| **3rd Party Sync → Optimizer** | Manual or Auto | `source='shopify'/'custom'` | Optimizer only |
|
|
| **Manual Selection → Linker** | Manual | Any source | Linker only |
|
|
| **Manual Selection → Optimizer** | Manual | Any source | Optimizer only |
|
|
|
|
---
|
|
|
|
## KEY PRINCIPLES
|
|
|
|
1. **Unified Storage**: All content in same model, filtered by flags
|
|
2. **Source Agnostic**: Linker/Optimizer work on any content source
|
|
3. **Flexible Entry**: Multiple ways to enter pipeline
|
|
4. **Preserve Original**: Original content always preserved
|
|
5. **Version Tracking**: `linker_version` and `optimizer_version` track processing
|
|
6. **Filterable**: Content can be filtered by source, sync_status, processing status
|
|
|
|
---
|
|
|
|
**END OF DOCUMENT**
|
|
|