From 0f49cc6cbc68cbae26eb92d953d938753f7b2bba Mon Sep 17 00:00:00 2001 From: nickviljoen Date: Tue, 28 Apr 2026 16:08:03 +0200 Subject: [PATCH] Enhancement: SDA (Supporting Documents for Approval) asset type Adds SDA as a new asset type for License claim translations supporting the EOL (External Legal Opinion) workflow. - SDA maps to externallegalopinion in DAM (same as EOL). - Field overrides match EOL (Agency = "-", Prod Company = "-", Languages = Global, IP Right = Yes, Licensing = No, validity dates removed) plus a fixed Description: "Translation of License claim - For approval purposes only". - Added asset_type_overrides section to field_mappings_ppr.yaml; it was missing, so EOL overrides weren't actually applying on PPR. Both EOL and SDA blocks are now defined for both PPR and PROD. - _apply_asset_type_overrides now appends a simple string field when the override targets a field not yet in mvp_fields, so the SDA description is set even if the filename has no subject_title. Co-Authored-By: Claude Opus 4.7 (1M context) --- .../config/asset_type_mappings.yaml | 1 + Python-Version/config/field_mappings_ppr.yaml | 23 +++++++++++++++++++ .../config/field_mappings_prod.yaml | 10 ++++++++ .../scripts/shared/metadata_extractor_mvp.py | 10 +++++++- 4 files changed, 43 insertions(+), 1 deletion(-) diff --git a/Python-Version/config/asset_type_mappings.yaml b/Python-Version/config/asset_type_mappings.yaml index 6e70170..43e9333 100644 --- a/Python-Version/config/asset_type_mappings.yaml +++ b/Python-Version/config/asset_type_mappings.yaml @@ -48,6 +48,7 @@ VIE: visualidentityelements # Brand Visual Identity Elements # External Legal Opinion EOL: externallegalopinion # External Legal Opinion (triggers field overrides) +SDA: externallegalopinion # Supporting Documents for Approval - License claim translations (triggers field overrides) # Note: If a 3-letter code is not in this mapping, it will be passed through as-is # and may fail DAM validation if the code doesn't exist in DAM's domain diff --git a/Python-Version/config/field_mappings_ppr.yaml b/Python-Version/config/field_mappings_ppr.yaml index 25de6ef..23f4299 100644 --- a/Python-Version/config/field_mappings_ppr.yaml +++ b/Python-Version/config/field_mappings_ppr.yaml @@ -76,3 +76,26 @@ defaults: FERRERO.MARKETING.FIELD.VIDEO_POST_PROD_COMPANY: "Oliver Marketing Ltd" FERRERO.MARKETING.FIELD.AUDIO_POST_PROD_COMPANY: "Oliver Marketing Ltd" FERRERO.MARKET.PROD_COMPANY: "-" # Production House + +# Asset type overrides (keyed by 3-letter asset type code) +# Applied AFTER normal field updates and forced values +# Overrides specific fields when a matching asset type is detected in the filename +asset_type_overrides: + EOL: # External Legal Opinion - selected as asset type in naming tool + FERRERO.MARKETING.FIELD.AGENCY NAME: "-" + FERRERO.MARKET.PROD_COMPANY: "-" + MAIN_LANGUAGES: "Global" + FERRERO.MARKET.FIELD.IPRIGHT: "Yes" + FERRERO.MARKET.FIELD.LICENSIN: "No" + FERRERO.FIELD.ASSET VALIDITY START PERIOD: "" # Remove validity dates for EOL + FERRERO.FIELD.ASSET VALIDITY END PERIOD: "" # Remove validity dates for EOL + + SDA: # Supporting Documents for Approval - License claim translations supporting EOL + FERRERO.MARKETING.FIELD.AGENCY NAME: "-" + FERRERO.MARKET.PROD_COMPANY: "-" + MAIN_LANGUAGES: "Global" + FERRERO.MARKET.FIELD.IPRIGHT: "Yes" + FERRERO.MARKET.FIELD.LICENSIN: "No" + FERRERO.FIELD.ASSET VALIDITY START PERIOD: "" # Remove validity dates for SDA + FERRERO.FIELD.ASSET VALIDITY END PERIOD: "" # Remove validity dates for SDA + ARTESIA.FIELD.ASSET DESCRIPTION: "Translation of License claim - For approval purposes only" diff --git a/Python-Version/config/field_mappings_prod.yaml b/Python-Version/config/field_mappings_prod.yaml index aa7607b..d1271cf 100644 --- a/Python-Version/config/field_mappings_prod.yaml +++ b/Python-Version/config/field_mappings_prod.yaml @@ -89,3 +89,13 @@ asset_type_overrides: FERRERO.MARKET.FIELD.LICENSIN: "No" FERRERO.FIELD.ASSET VALIDITY START PERIOD: "" # Remove validity dates for EOL FERRERO.FIELD.ASSET VALIDITY END PERIOD: "" # Remove validity dates for EOL + + SDA: # Supporting Documents for Approval - License claim translations supporting EOL + FERRERO.MARKETING.FIELD.AGENCY NAME: "-" + FERRERO.MARKET.PROD_COMPANY: "-" + MAIN_LANGUAGES: "Global" + FERRERO.MARKET.FIELD.IPRIGHT: "Yes" + FERRERO.MARKET.FIELD.LICENSIN: "No" + FERRERO.FIELD.ASSET VALIDITY START PERIOD: "" # Remove validity dates for SDA + FERRERO.FIELD.ASSET VALIDITY END PERIOD: "" # Remove validity dates for SDA + ARTESIA.FIELD.ASSET DESCRIPTION: "Translation of License claim - For approval purposes only" diff --git a/Python-Version/scripts/shared/metadata_extractor_mvp.py b/Python-Version/scripts/shared/metadata_extractor_mvp.py index 208067e..93c5845 100644 --- a/Python-Version/scripts/shared/metadata_extractor_mvp.py +++ b/Python-Version/scripts/shared/metadata_extractor_mvp.py @@ -403,7 +403,15 @@ class MetadataExtractorMVP: break if not field_found: - logger.warning("Asset type override field '{}' not found in MVP fields - skipping".format(field_id)) + # Field not present yet (e.g. description has no subject_title from filename). + # Append as a simple string field so the override still takes effect. Tabular + # / domained overrides aren't supported here — they should already be in + # mvp_fields via _add_missing_fields. + mvp_fields.append({ + 'id': field_id, + 'value': {'value': {'type': 'string', 'value': override_value}} + }) + logger.info("Asset type override: {} = {} (added missing field)".format(field_id, override_value)) return mvp_fields