Add CreativeX fields to asset representation if missing from master metadata
Fixes issue where CreativeX score field was not appearing in final upload
because it didn't exist in the master metadata from DAM.
Problem:
- Master metadata from A1→A2 doesn't include CREATIVEX fields (new fields)
- _update_creativex_fields() only UPDATED existing fields
- If field not present, it logged error but didn't add the field
- Result: CREATIVEX score missing from upload, only URL appeared
Solution:
- Check if CREATIVEX Score field exists in mvp_fields
- If NOT found: Create and append field with proper structure
- If found: Update value as before
- Same logic for CREATIVEX URL field
Field Structures Created:
CREATIVEX Score (FERRERO.TAB.FIELD.CREATIVEX):
- Type: MetadataTableField (tabular field)
- Parent: FERRERO.TABULAR.FIELD.PLATFORMRATING
- Data type: INTEGER
- Value structure: {'value': {'value': score}}
CREATIVEX URL (FERRERO.FIELD.CREATIVEX LINK):
- Type: MetadataField (regular field)
- Data type: CHAR
- Value structure: {'value': {'value': url}}
Logging:
- Changed from ERROR to WARNING when field not found
- Logs "adding it now" instead of just error
- Confirms field added with value
Impact:
Both CreativeX fields will now appear in uploads even if master
metadata doesn't have them (common for older campaigns downloaded
before CreativeX integration).
Testing:
Run with --dryrun to verify both CREATIVEX fields in JSON output.
🤖 Generated with [Claude Code](https://claude.com/claude-code)
Co-Authored-By: Claude <noreply@anthropic.com>
This commit is contained in:
parent
39a41df21d
commit
15eb47fc43
1 changed files with 33 additions and 2 deletions
|
|
@ -408,7 +408,23 @@ class MetadataExtractorMVP:
|
|||
break
|
||||
|
||||
if not score_field_found:
|
||||
logger.error("CREATIVEX Score field (FERRERO.TAB.FIELD.CREATIVEX) NOT FOUND in mvp_fields!")
|
||||
logger.warning("CREATIVEX Score field not found in master metadata - adding it now")
|
||||
# Create the field structure (tabular field)
|
||||
creativex_score_field = {
|
||||
'id': 'FERRERO.TAB.FIELD.CREATIVEX',
|
||||
'name': 'Rating (%)',
|
||||
'type': 'com.artesia.metadata.MetadataTableField',
|
||||
'parent_table_id': 'FERRERO.TABULAR.FIELD.PLATFORMRATING',
|
||||
'value': {
|
||||
'value': {
|
||||
'value': box_metadata['score']
|
||||
}
|
||||
},
|
||||
'data_type': 'INTEGER',
|
||||
'required': False
|
||||
}
|
||||
mvp_fields.append(creativex_score_field)
|
||||
logger.info("Added CREATIVEX Score field with value: {}".format(box_metadata['score']))
|
||||
|
||||
if box_metadata.get('url'):
|
||||
# Update CreativeX URL field
|
||||
|
|
@ -429,6 +445,21 @@ class MetadataExtractorMVP:
|
|||
break
|
||||
|
||||
if not url_field_found:
|
||||
logger.error("CREATIVEX URL field (FERRERO.FIELD.CREATIVEX LINK) NOT FOUND in mvp_fields!")
|
||||
logger.warning("CREATIVEX URL field not found in master metadata - adding it now")
|
||||
# Create the field structure (text field)
|
||||
creativex_url_field = {
|
||||
'id': 'FERRERO.FIELD.CREATIVEX LINK',
|
||||
'name': 'CreativeX Hyperlink',
|
||||
'type': 'com.artesia.metadata.MetadataField',
|
||||
'value': {
|
||||
'value': {
|
||||
'value': box_metadata['url']
|
||||
}
|
||||
},
|
||||
'data_type': 'CHAR',
|
||||
'required': False
|
||||
}
|
||||
mvp_fields.append(creativex_url_field)
|
||||
logger.info("Added CREATIVEX URL field with value: {}".format(box_metadata['url']))
|
||||
|
||||
return mvp_fields
|
||||
|
|
|
|||
Loading…
Add table
Reference in a new issue