Add B1→B2 workflow implementation guide
Created B1_B2_WORKFLOW_TODO.md with complete implementation plan: Ready to Implement: - B1→B2 Global Masters workflow (PHP interface) - B1→B2 Python automation script - Status change buttons (B1↔B2) - Email templates for Global campaigns Foundation Complete: ✅ searchGlobalCampaigns() method added ✅ searchAllCampaignTypes() method added ✅ Debug view shows both Local and Global campaigns ✅ Test campaign verified (NUTELLA PLANT-BASED LAUNCH, Status: B1) Next Steps Documented: - Add B1→B2 workflow tab - Add action handlers - Add status change buttons - Create Python b1_to_b2_download.py - Update DAM client with Global campaign search - Add email templates Estimated Time: 4-6 hours Test Campaign Ready: 676f2bcde4c7bcf7ef783e97f7495069bf50b6bc Load B1_B2_WORKFLOW_TODO.md in next session to continue! 🤖 Generated with Claude Code Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
00f35169a1
commit
a9a0bf22ab
1 changed files with 275 additions and 0 deletions
275
B1_B2_WORKFLOW_TODO.md
Normal file
275
B1_B2_WORKFLOW_TODO.md
Normal file
|
|
@ -0,0 +1,275 @@
|
|||
# B1→B2 Global Masters Workflow - Implementation Guide
|
||||
|
||||
**Status:** Search methods added, ready to implement full workflow
|
||||
**Campaign Type:** Global comm (B-series status codes)
|
||||
**Test Campaign:** NUTELLA PLANT-BASED LAUNCH (676f2bcde4c7bcf7ef783e97f7495069bf50b6bc)
|
||||
|
||||
---
|
||||
|
||||
## ✅ Already Complete
|
||||
|
||||
1. **StatusManager Methods** ✅
|
||||
- `searchGlobalCampaigns()` - Search for Global comm campaigns
|
||||
- `searchAllCampaignTypes()` - Search for both Local and Global
|
||||
- Updated debug search to show both campaign types
|
||||
|
||||
2. **Test Campaign Verified** ✅
|
||||
- Folder ID: 676f2bcde4c7bcf7ef783e97f7495069bf50b6bc
|
||||
- Name: NUTELLA PLANT-BASED LAUNCH
|
||||
- Status: B1
|
||||
- Campaign Type: Global comm
|
||||
- Accessible via API
|
||||
|
||||
---
|
||||
|
||||
## 📋 TODO: PHP Interface (B1→B2 Workflow)
|
||||
|
||||
### 1. Add New Tab in workflow_v3.php
|
||||
|
||||
**Location:** After Upload from Box tab, before closing tabs div
|
||||
|
||||
**Add:**
|
||||
```php
|
||||
<button class="tab <?= $currentTab === 'b1-b2' ? 'active' : '' ?>"
|
||||
onclick="switchTab('b1-b2')">
|
||||
🌍 Global Masters (B1→B2)
|
||||
</button>
|
||||
```
|
||||
|
||||
### 2. Add Tab Content Section
|
||||
|
||||
**Template (copy from Download Workflow A1→A2):**
|
||||
```php
|
||||
<!-- Global Masters Workflow Tab -->
|
||||
<div id="tab-b1-b2" class="tab-content <?= $currentTab === 'b1-b2' ? 'active' : '' ?>">
|
||||
<h2>🌍 Global Masters Workflow: B1 → B2</h2>
|
||||
<p>Download Global Master assets and prepare for re-mastering</p>
|
||||
|
||||
<form method="POST">
|
||||
<input type="hidden" name="tab" value="b1-b2">
|
||||
<input type="hidden" name="action" value="load_campaigns_b1">
|
||||
<button type="submit" class="btn btn-primary">
|
||||
Load Campaigns (Content Scaling Status = B1)
|
||||
</button>
|
||||
</form>
|
||||
|
||||
<!-- Rest similar to A1→A2 workflow -->
|
||||
</div>
|
||||
```
|
||||
|
||||
### 3. Add Action Handlers
|
||||
|
||||
**Actions to add:**
|
||||
- `load_campaigns_b1` - Load campaigns with status B1
|
||||
- `select_campaign_b1` - Select a B1 campaign
|
||||
- `get_global_master_assets` - Get master assets from campaign
|
||||
- `download_global_asset` - Download individual asset
|
||||
- `download_all_global_assets` - Download all assets
|
||||
- `download_and_upload_global_to_box` - Download from DAM, upload to Box
|
||||
- `update_status_to_b2` - Update status B1 → B2
|
||||
- `reset_to_b1` - Reset status to B1 (for testing)
|
||||
|
||||
### 4. Add Status Change Buttons in Debug View
|
||||
|
||||
**Location:** In the debug campaign display (around line 1920)
|
||||
|
||||
**Add for each campaign:**
|
||||
```php
|
||||
<?php if ($campaign['status'] === 'B1'): ?>
|
||||
<button type="submit" class="btn btn-success">
|
||||
Update to B2
|
||||
</button>
|
||||
<?php elseif ($campaign['status'] === 'B2'): ?>
|
||||
<button type="submit" class="btn btn-warning">
|
||||
Reset to B1
|
||||
</button>
|
||||
<?php endif; ?>
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 📋 TODO: Python Script (b1_to_b2_download.py)
|
||||
|
||||
### Create New Script
|
||||
|
||||
**File:** `Python-Version/scripts/b1_to_b2_download.py`
|
||||
|
||||
**Differences from A1→A2:**
|
||||
1. Search for B1 status (not A1)
|
||||
2. Search for "Global comm" campaigns (not "Local Adaptation")
|
||||
3. Use `dam.search_campaigns(status='B1')` - need to update DAM client
|
||||
4. Update status B1 → B2 (not A1 → A2)
|
||||
5. Same folder logic (348304357505)
|
||||
6. Same Box upload with tracking IDs
|
||||
7. Same all-done check
|
||||
8. Different email templates (b1_to_b2_complete, b1_to_b2_partial)
|
||||
|
||||
### Update DAM Client
|
||||
|
||||
**File:** `Python-Version/scripts/shared/dam_client.py`
|
||||
|
||||
**Add method:**
|
||||
```python
|
||||
def search_global_campaigns(self, status=None):
|
||||
"""Search for Global comm campaigns (B-series)"""
|
||||
# Change search condition value to 'Global comm'
|
||||
```
|
||||
|
||||
### Email Templates
|
||||
|
||||
**Add to notifier.py:**
|
||||
- `b1_to_b2_complete` - Success email for B1→B2
|
||||
- `b1_to_b2_partial` - Partial completion for B1→B2
|
||||
|
||||
---
|
||||
|
||||
## 🔧 Implementation Steps
|
||||
|
||||
### Step 1: PHP Interface (2-3 hours)
|
||||
1. Add B1→B2 tab to workflow
|
||||
2. Copy and adapt A1→A2 workflow code
|
||||
3. Update action handlers for B1/B2
|
||||
4. Add status change buttons
|
||||
5. Test with folder: 676f2bcde4c7bcf7ef783e97f7495069bf50b6bc
|
||||
|
||||
### Step 2: Python Script (1-2 hours)
|
||||
1. Copy a1_to_a2_download.py → b1_to_b2_download.py
|
||||
2. Update search to use Global comm campaigns
|
||||
3. Update status codes (B1, B2)
|
||||
4. Add email templates
|
||||
5. Test with B1 campaign
|
||||
|
||||
### Step 3: Testing (1 hour)
|
||||
1. Test PHP workflow with NUTELLA campaign
|
||||
2. Test Python script
|
||||
3. Verify Box uploads
|
||||
4. Verify database storage
|
||||
5. Verify status changes
|
||||
6. Verify emails
|
||||
|
||||
---
|
||||
|
||||
## 📝 Code Templates
|
||||
|
||||
### loadCampaignsByStatus for B1
|
||||
|
||||
```php
|
||||
function loadCampaignsByStatusB1($testRunner, $status)
|
||||
{
|
||||
$statusManager = createStatusManager($testRunner);
|
||||
$response = $statusManager->searchGlobalCampaigns($testRunner);
|
||||
|
||||
if ($response['success']) {
|
||||
$allCampaigns = CampaignFormatter::getActionableCampaigns($response['body'], []);
|
||||
$filteredCampaigns = CampaignFormatter::getActionableCampaigns($response['body'], ['status' => $status]);
|
||||
return $filteredCampaigns;
|
||||
}
|
||||
|
||||
return [];
|
||||
}
|
||||
```
|
||||
|
||||
### Python DAM Client Search
|
||||
|
||||
```python
|
||||
def search_global_campaigns(self, status=None):
|
||||
"""Search for Global comm campaigns (B-series)"""
|
||||
search_condition = {
|
||||
"search_condition_list": {
|
||||
"search_condition": [
|
||||
{
|
||||
"type": "com.artesia.search.SearchScalarCondition",
|
||||
"metadata_field_id": "ARTESIA.FIELD.CONTAINER TYPE NAME",
|
||||
"relational_operator_id": "ARTESIA.OPERATOR.CHAR.CONTAINS",
|
||||
"value": "GLOBALCAMPAING",
|
||||
"left_paren": "(",
|
||||
"right_paren": ")"
|
||||
},
|
||||
{
|
||||
"type": "com.artesia.search.SearchScalarCondition",
|
||||
"metadata_field_id": "FERRERO.FIELD.CAMPAIGN TYPE",
|
||||
"relational_operator_id": "ARTESIA.OPERATOR.CHAR.CONTAINS",
|
||||
"value": "Global comm",
|
||||
"relational_operator": "and"
|
||||
}
|
||||
]
|
||||
}
|
||||
}
|
||||
# ... rest same as search_campaigns
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🎯 Expected Behavior
|
||||
|
||||
**B1→B2 PHP Workflow:**
|
||||
1. Load campaigns with status B1 (Global comm campaigns)
|
||||
2. Select campaign (e.g., NUTELLA PLANT-BASED LAUNCH)
|
||||
3. Get Global Master Assets
|
||||
4. Download assets
|
||||
5. Upload to Box with tracking IDs
|
||||
6. Update status B1 → B2 when all done
|
||||
|
||||
**B1→B2 Python Script:**
|
||||
```bash
|
||||
python scripts/b1_to_b2_download.py
|
||||
```
|
||||
- Searches for B1 Global campaigns
|
||||
- Processes first one
|
||||
- Downloads master assets
|
||||
- Uploads to Box
|
||||
- Updates B1 → B2
|
||||
- Sends webhook and email
|
||||
|
||||
**Cron Setup:**
|
||||
```bash
|
||||
# A1→A2: Local Adaptation every 5 minutes
|
||||
*/5 * * * * python scripts/a1_to_a2_download.py
|
||||
|
||||
# B1→B2: Global Masters every 5 minutes
|
||||
*/5 * * * * python scripts/b1_to_b2_download.py
|
||||
```
|
||||
|
||||
---
|
||||
|
||||
## 🧪 Testing Checklist
|
||||
|
||||
- [ ] B1 campaigns appear in debug view
|
||||
- [ ] Can select B1 campaign
|
||||
- [ ] Can get Global Master Assets
|
||||
- [ ] Can download assets
|
||||
- [ ] Can upload to Box
|
||||
- [ ] Status updates B1 → B2
|
||||
- [ ] Can reset B2 → B1
|
||||
- [ ] Python script finds B1 campaigns
|
||||
- [ ] Python script processes Global campaign
|
||||
- [ ] Email notifications work
|
||||
- [ ] Webhook sent to Make.com
|
||||
|
||||
---
|
||||
|
||||
## 📁 Files to Modify/Create
|
||||
|
||||
### PHP (Modify):
|
||||
- `src/StatusManager.php` ✅ Done
|
||||
- `workflow_v3.php` - Add tab, actions, handlers
|
||||
|
||||
### Python (Create):
|
||||
- `scripts/b1_to_b2_download.py` - New script
|
||||
- `scripts/shared/dam_client.py` - Add search_global_campaigns()
|
||||
- `scripts/shared/notifier.py` - Add B1→B2 email templates
|
||||
|
||||
### Configuration:
|
||||
- `.env` - No changes needed
|
||||
- `config/config.yaml` - No changes needed
|
||||
- `config/field_mappings.yaml` - No changes needed
|
||||
|
||||
---
|
||||
|
||||
**Estimated Time:** 4-6 hours total
|
||||
**Status:** Foundation complete, ready to build
|
||||
**Test Campaign Available:** NUTELLA PLANT-BASED LAUNCH (B1)
|
||||
|
||||
---
|
||||
|
||||
**Load this file in next session to continue with B1→B2 implementation!**
|
||||
Loading…
Add table
Reference in a new issue