Harshit Pathak 3 mesi fa
parent
commit
fe3b742fd5

+ 1 - 1
content_quality_tool/settings.py

@@ -109,7 +109,7 @@ STATICFILES_DIRS = [
 # https://docs.djangoproject.com/en/5.2/ref/settings/#default-auto-field
 DEFAULT_AUTO_FIELD = 'django.db.models.BigAutoField'
 # Gemini API Configuration
-GEMINI_API_KEY = os.environ.get('GEMINI_API_KEY', 'AIzaSyAyxp26jdVFlocHVsMYR6Weq2GCB5rblGs')
+GEMINI_API_KEY = os.environ.get('GEMINI_API_KEY', 'AIzaSyBCoVdOMbB5u7BJglqjvVUfpgeYEHhI208')
 #AIzaSyAyxp26jdVFlocHVsMYR6Weq2GCB5rblGs, AIzaSyDxsW5DoaZP7evNE5b9Gcj8b3_GjoYk-9M
 MEDIA_ROOT = BASE_DIR / 'media'
 MEDIA_URL = '/media/'

+ 52 - 9
content_quality_tool_public/static/js/attr-extraction.js

@@ -881,7 +881,7 @@ function renderProductsTable(items = getCurrentSlice()) {
     trh.appendChild(thSelect);
 
     // Other headers
-    ['Image', 'Product', 'SKU', 'Type', 'Short Description'].forEach(h => {
+    ['Image', 'Product', 'SKU', 'Type', 'Description'].forEach(h => {
         const th = document.createElement('th');
         th.textContent = h;
         trh.appendChild(th);
@@ -930,10 +930,53 @@ function renderProductsTable(items = getCurrentSlice()) {
             tdType.appendChild(b);
             tr.appendChild(tdType);
 
+            // const tdDesc = document.createElement('td');
+            // tdDesc.innerHTML = p.product_short_description || '';
+            // tr.appendChild(tdDesc);
+
             const tdDesc = document.createElement('td');
-            tdDesc.innerHTML = p.product_short_description || '';
+
+            // Create a container for descriptions
+            const descContainer = document.createElement('div');
+            descContainer.classList.add('description-cell');
+
+            // Short description (always visible)
+            const shortDesc = document.createElement('div');
+            shortDesc.classList.add('short-desc');
+            shortDesc.innerHTML = `<strong>Short Description:</strong> ${p.product_short_description || 'N/A'}`;
+
+            // Long description (hidden initially)
+            const longDesc = document.createElement('div');
+            longDesc.classList.add('long-desc');
+            longDesc.innerHTML = `<strong>Long Description:</strong> ${p.product_long_description || 'N/A'}`;
+            longDesc.style.display = 'none';
+
+            // Button to toggle long description
+            const toggleBtn = document.createElement('button');
+            toggleBtn.textContent = 'Show Long Description';
+            toggleBtn.classList.add('btn');
+            toggleBtn.classList.add('btn-primary');
+            toggleBtn.classList.add('btn-sm');
+            toggleBtn.classList.add('btn-toggle-desc');
+            toggleBtn.style.fontSize = 'smaller';
+            toggleBtn.style.margin = '5px';
+
+
+            // Toggle logic
+            toggleBtn.addEventListener('click', () => {
+            const isVisible = longDesc.style.display === 'block';
+            longDesc.style.display = isVisible ? 'none' : 'block';
+            toggleBtn.textContent = isVisible ? 'Show Long Description' : 'Hide Long Description';
+            });
+
+            // Append elements in order
+            descContainer.appendChild(shortDesc);
+            descContainer.appendChild(toggleBtn);
+            descContainer.appendChild(longDesc);
+            tdDesc.appendChild(descContainer);
             tr.appendChild(tdDesc);
 
+
             // Handle attribute rows (kept your same logic)
             const detailRow = document.createElement('tr');
             detailRow.classList.add('attribute-detail-row');
@@ -1610,13 +1653,13 @@ function renderMandatoryComparisonTable(attributes, title, productType) {
                 select.appendChild(option);
             });
 
-            if (!attr.isMatch && attr.aiValue !== 'N/A') {
-                const newOpt = document.createElement('option');
-                newOpt.value = attr.aiValue;
-                newOpt.textContent = attr.aiValue; // + " (new)";
-                newOpt.selected = true;
-                select.appendChild(newOpt);
-            }
+            // if (!attr.isMatch && attr.aiValue !== 'N/A') {
+            //     const newOpt = document.createElement('option');
+            //     newOpt.value = attr.aiValue;
+            //     newOpt.textContent = attr.aiValue; // + " (new)";
+            //     newOpt.selected = true;
+            //     select.appendChild(newOpt);
+            // }
 
             aiTd.appendChild(select);
             row.appendChild(aiTd);

+ 1 - 1
content_quality_tool_public/templates/attr-extraction.html

@@ -241,7 +241,7 @@
             <div id="successToast" class="toast align-items-center text-bg-success border-0" role="alert" aria-live="assertive" aria-atomic="true">
             <div class="d-flex">
                 <div class="toast-body">
-                Attribute extracted successfully.
+                Attribute saved successfully.
                 </div>
                 <button type="button" class="btn-close btn-close-white me-2 m-auto" data-bs-dismiss="toast" aria-label="Close"></button>
             </div>

+ 456 - 1
content_quality_tool_public/templates/get-data.html

@@ -252,11 +252,375 @@
      <script>
         const mediaUrl = "./../media/";
         console.log("mediaUrl",mediaUrl);
+        let apiresults_without_filter;
+        // 2. Function to filter the products based on localStorage 'productType'
+function filterProductsByCategory() {
+    // A. Retrieve the target category from localStorage
+    // Use a key like 'productType' as requested, or adjust if your localStorage key is different.
+    const targetCategory = localStorage.getItem('selectedproductType');
+
+    // Handle case where localStorage value is missing or empty
+    if (!targetCategory) {
+        console.warn("localStorage item 'productType' not found or is empty. Returning all products.");
+        return productData;
+    }
+
+    // B. Filter the product array
+    // We assume that the category is available at the top level of each product object.
+    const filteredData = apiresults_without_filter.filter(product => {
+        // Ensure both values are compared consistently (case-insensitive trim)
+        const productCategory = product.category ? product.category.trim().toLowerCase() : product.product_type ? product.product_type.trim().toLowerCase() : '';
+        const filterValue = targetCategory.trim().toLowerCase();
+        
+        return productCategory === filterValue;
+    });
+
+    return filteredData;
+}
         document.addEventListener('DOMContentLoaded', function () {
+            var html = '';
             // const responseDiv = document.getElementById('batchScoreMessage');
             // Show loader
             $('#full-page-loader').show();
-            fetch('/core/api/batch-score/', {
+            // console.log("localStorage.getItem('analyticsdata')",localStorage.getItem('analyticsdata'));
+            if (localStorage.getItem('analyticsdata') !== null) {
+                // console.log('Data key exists in localStorage');
+                apiresults_stringify = localStorage.getItem('analyticsdata');
+                apiresults_without_filter = JSON.parse(apiresults_stringify);
+
+                apiresults = filterProductsByCategory();
+                // apiresults = [];
+
+                // Define performance buckets
+                    const bucketRanges = {
+                        excellent: [85, 100],
+                        good: [70, 84.99],
+                        fair: [50, 69.99],
+                        poor: [0, 49.99]
+                    };
+
+                    // Helper function to classify score
+                    function classify(score) {
+                        for (const [bucket, [low, high]] of Object.entries(bucketRanges)) {
+                        if (score >= low && score <= high) return bucket;
+                        }
+                        return 'unknown';
+                    }
+
+                    // Group products by product type
+                    const grouped = {};
+
+                    apiresults.forEach(item => {
+                        const valuesUsed = item?.ai_suggestions?.title_construction?.values_used || [];
+                        const productType = item?.category || item?.product_type || 'Unknown';
+                        const score = item.final_score || 0;
+                        const breakdown = item.breakdown || {};
+                        const titleQuality = breakdown.title_quality || 0;
+                        const descriptionQuality = breakdown.description_quality || 0;
+                        const imageScore = breakdown.image_score || item.image_score || 0;
+
+                        if (!grouped[productType]) grouped[productType] = [];
+                        grouped[productType].push({
+                        score,
+                        titleQuality,
+                        descriptionQuality,
+                        imageScore,
+                        bucket: classify(score)
+                        });
+                    });
+
+                    // Prepare final JSON structure
+                    const output = {
+                        performance_summary: { excellent: 0, good: 0, fair: 0, poor: 0 },
+                        product_metrics: []
+                    };
+
+                    for (const [ptype, items] of Object.entries(grouped)) {
+                        const total = items.length;
+                        const bucketCounts = { excellent: 0, good: 0, fair: 0, poor: 0 };
+                        let scoreSum = 0, titleSum = 0, descSum = 0, imageSum = 0;
+
+                        items.forEach(item => {
+                        bucketCounts[item.bucket]++;
+                        scoreSum += item.score;
+                        titleSum += item.titleQuality;
+                        descSum += item.descriptionQuality;
+                        imageSum += item.imageScore;
+                        });
+
+                        output.performance_summary.excellent += bucketCounts.excellent;
+                        output.performance_summary.good += bucketCounts.good;
+                        output.performance_summary.fair += bucketCounts.fair;
+                        output.performance_summary.poor += bucketCounts.poor;
+
+                        output.product_metrics.push({
+                        product_type: ptype,
+                        products: total,
+                        avg_score: (scoreSum / total).toFixed(2),
+                        excellent_percent: `${Math.round((bucketCounts.excellent / total) * 100)}%`,
+                        good_percent: `${Math.round((bucketCounts.good / total) * 100)}%`,
+                        fair_percent: `${Math.round((bucketCounts.fair / total) * 100)}%`,
+                        poor_percent: `${Math.round((bucketCounts.poor / total) * 100)}%`,
+                        avg_title_quality: (titleSum / total).toFixed(2),
+                        avg_description_quality: (descSum / total).toFixed(2),
+                        avg_image_quality: (imageSum / total).toFixed(2)
+                        });
+                    }
+                    localStorage.setItem('performanceAnalysis',JSON.stringify(output));
+                     apiresults.forEach(element => {
+                        // console.log(element.final_score);
+                        var initial_score = '';
+                        var after_score = ''
+                        var base_keys = { 'Title': 'title_quality', 'Description': 'description_quality', 'Image': 'image_score', 'Attributes': 'attributes' }
+
+                        
+
+                        Object.entries(base_keys).forEach(([key, value]) => {
+                            let name = key;
+                            
+                            key = key.toLowerCase();
+                            console.log("key",key);
+                            console.log(element.breakdown[value], value);
+                            var per = 0
+                            if (element.breakdown[value]) {
+                                per = element.breakdown[value];
+                            }
+                            var intial_desc = '';
+                            if (element.categorized_feedback[key]) {
+                                // console.log(element.categorized_feedback[key].issues);
+                                intial_desc = element.categorized_feedback[key].issues.join(', ');
+                            }
+                            if(key == "image"){
+                                // Build the breakdown progress HTML
+                                let breakdownHtml = '';
+
+                                for (const [key, value] of Object.entries(element.image_breakdown)) {
+                                    breakdownHtml += `
+                                        <div style="margin-bottom: 10px;">
+                                            <strong>${key.charAt(0).toUpperCase() + key.slice(1)}</strong>
+                                            <div class="progress progress-sm mt-1">
+                                                <div class="progress-bar bg-success" role="progressbar"
+                                                    aria-valuenow="${value}" aria-valuemin="0" aria-valuemax="100"
+                                                    style="width: ${value}%">
+                                                </div>
+                                            </div>
+                                            <small>${value}%</small>
+                                        </div>
+                                    `;
+                                }
+                                initial_score += `<tr>
+                                                        <td class="wow bounceInLeft">
+                                                            <a>
+                                                                `+ name + `
+                                                            </a>
+                                                        </td>
+
+                                                        <td class="project_progress wow bounceInRight">
+                                                            <div class="progress progress-sm">
+                                                                <div class="progress-bar bg-green" role="progressbar"
+                                                                    aria-valuenow="`+ per + `" aria-valuemin="0" aria-valuemax="100"
+                                                                    style="width: `+ per + `%">
+                                                                </div>
+                                                            </div>
+                                                            <small>
+                                                                `+ per + `%
+                                                            </small>
+                                                        </td>
+
+                                                    </tr>
+                                                    <tr>
+                                                    <td class="wow bounceInLeft" colspan='2' data-wow-delay="0.2s">
+                                                        <div style='max-height:100px;overflow-y:auto;'>  
+                                                            `+ breakdownHtml + `
+                                                        </div>
+                                                        </td>
+                                                    </tr>`;
+                            
+                            }else{
+                                initial_score += `<tr>
+                                                        <td class="wow bounceInLeft">
+                                                            <a>
+                                                                `+ name + `
+                                                            </a>
+                                                        </td>
+
+                                                        <td class="project_progress wow bounceInRight">
+                                                            <div class="progress progress-sm">
+                                                                <div class="progress-bar bg-green" role="progressbar"
+                                                                    aria-valuenow="`+ per + `" aria-valuemin="0" aria-valuemax="100"
+                                                                    style="width: `+ per + `%">
+                                                                </div>
+                                                            </div>
+                                                            <small>
+                                                                `+ per + `%
+                                                            </small>
+                                                        </td>
+
+                                                    </tr>
+                                                    <tr>
+                                                    <td class="wow bounceInLeft" colspan='2' data-wow-delay="0.2s">
+                                                        <div style='max-height:100px;overflow-y:auto;'>  
+                                                        <small>
+                                                            `+ intial_desc + `
+                                                        </small>
+                                                        </div>
+                                                        </td>
+                                                    </tr>`;
+                            }                        
+                        });
+                        
+
+                        Object.keys(base_keys).forEach(k => {
+                            let name = k;
+                            k = k.toLowerCase();
+                            var ik = 'improved_' + k
+                            console.log("ik",ik);
+                            var after_desc = '';
+                            if (element.ai_suggestions.content[ik]) {
+                                console.log(element.ai_suggestions.content);
+                                after_desc = element.ai_suggestions.content[ik];
+                            }
+
+                            let missing_attributes = '';
+                            if(k == "attributes"){
+                                if(element?.ai_suggestions?.content?.missing_attributes){
+                                    Object.entries(element?.ai_suggestions?.content?.missing_attributes).forEach(([key, value]) => {     
+                                        missing_attributes += `<li><span class="attribute-label">${key}:</span> ${value}</li>`         
+                                    });
+                                }
+                            }
+
+
+                            if(k == "image"){
+                                after_score += `<tr>
+                                        <td class="wow bounceInLeft">
+                                            <a>
+                                                `+ name + ` Note
+                                            </a>
+                                        </td>
+                                    </tr>
+                                    <tr>
+                                    <td class="wow bounceInLeft" colspan='2'  data-wow-delay="0.2s">
+                                        <div style='max-height:100px;overflow-y:auto;'>  
+                                        <small>
+                                              ${element?.ai_suggestions?.image?.note ? element.ai_suggestions.image.note : 'No notes available'}
+                                        </small>
+                                        </div>
+                                        </td>
+                                    </tr>`;
+                            }else if(k == "attributes"){
+                                after_score += `<tr>
+                                    <td class="wow bounceInLeft">
+                                        <a>
+                                           Missing `+ name + `
+                                        </a>
+                                    </td>
+                                </tr>
+                                <tr>
+                                <td class="wow bounceInLeft" colspan='2'  data-wow-delay="0.2s">
+                                    <div style='max-height:100px;overflow-y:auto;'>  
+                                    <small> <ul>
+                                        `+ missing_attributes + `
+                                    </ul></small>
+                                    </div>
+                                    </td>
+                                </tr>`;
+                            }else{
+                                after_score += `<tr>
+                                    <td class="wow bounceInLeft">
+                                        <a>
+                                            `+ name + `
+                                        </a>
+                                    </td>
+                                </tr>
+                                <tr>
+                                <td class="wow bounceInLeft" colspan='2'  data-wow-delay="0.2s">
+                                    <div style='max-height:100px;overflow-y:auto;'>  
+                                    <small>
+                                        `+ after_desc + `
+                                    </small>
+                                    </div>
+                                    </td>
+                                </tr>`;
+                            }                    
+                        })
+
+
+                        html += `<div class="row mb-4" >
+                                <div class="col-md-4">
+                                    <div class="card">
+                                        <img class="card-img-top wow pulse" data-wow-iteration="2"
+                                            src="`+mediaUrl+element.image_path+`">
+                                        
+                                        <div class="card-block">
+                                            <h4 class="card-title wow bounceInLeft d-block w-100" data-wow-delay="0.1s">` 
+                                                + element.title + 
+                                                `&nbsp; 
+                                                <a href="` + element?.product_link + `" target="_blank" class="text-decoration-none text-dark">
+                                                    <i class="bi bi-box-arrow-up-right ms-2" title="Open Product"></i>
+                                                </a>
+                                            </h4>
+                                            <p class="card-text wow bounceInLeft d-block w-100" data-wow-delay="0.2s">` + element.description + `</p>
+                                        </div>
+
+                                        <div class="card-footer wow bounceInLeft" data-wow-delay="0.3s">
+                                            <small>`+element.created_at+`</small>
+                                        </div>
+                                    </div>
+                                </div>
+
+                                <div class="col-md-4">
+                                    <div class="card">
+                                        <div class="card-header py-2">
+                                            <div class="text-sm mb-0">Initial Score</div>
+                                        </div>
+                                        <div class="card-body text-center wow bounceInDown" data-wow-iteration="0.5">
+                                            <input type="text" class="dial" value="`+ element.final_score + `" data-width="120" data-height="120"
+                                                data-readOnly='true' data-fgColor="#3c8dbc" data-bgColor="#e8e8e8"
+                                                data-thickness=".2">
+                                            <div class="mt-2">Overall Score</div>
+                                        </div>
+                                        <table class="table table-striped projects mb-0 table-sm">
+                                            <tbody>
+                                                `+ initial_score + `
+                                            </tbody>
+                                        </table>
+                                    </div>
+
+                                </div>
+                                <div class="col-md-4 after_score d-none">
+                                    <div class="card">
+                                        <div class="card-header py-2">
+                                            <div class="text-sm mb-0">Forecasted Score</div>
+                                        </div>
+                                        <div class="card-body text-center wow bounceInDown" data-wow-iteration="0.5">
+                                            <input type="text" class="dial" value="`+ element.ai_suggestions.content.quality_score_prediction + `" data-width="120" data-height="120"
+                                                data-readOnly='true' data-fgColor="#198754" data-bgColor="#e8e8e8"
+                                                data-thickness=".2">
+                                            <div class="mt-2">Overall Score</div>
+                                        </div>
+                                        <table class="table table-striped projects mb-0 table-sm">
+                                            <tbody>
+                                                `+ after_score + `
+                                            </tbody>
+                                        </table>
+                                    </div>
+                                    
+                                </div>
+                            </div > `;
+                        // console.log('werrrrrrrrrrrrrrrrrrr', html);
+
+                    });
+
+                    $('#html').html(html);
+                    $('.dial').knob();
+                    
+                    document.querySelector('.ai-fix-issues-button').style.display = 'block';
+                    console.log('Generated Metrics:', output);
+                    $('#full-page-loader').hide();
+             } else {
+                console.log('Data key not found');
+            fetch('/core/api/rr-content-card/', {
                 method: 'GET', // or 'POST' if your API expects POST
                 headers: {
                     'X-CSRFToken': document.querySelector('[name=csrfmiddlewaretoken]')?.value || ''
@@ -266,6 +630,7 @@
             .then(data => {
                 if (data.success) {
                     var html = '';
+                    localStorage.setItem('analyticsdata',JSON.stringify(data.results));
                     data.results.forEach(element => {
                         // console.log(element.final_score);
                         var initial_score = '';
@@ -519,8 +884,93 @@
                     // });
                     new WOW().init();
 
+
+                    
+                    // Define performance buckets
+                    const bucketRanges = {
+                        excellent: [85, 100],
+                        good: [70, 84.99],
+                        fair: [50, 69.99],
+                        poor: [0, 49.99]
+                    };
+
+                    // Helper function to classify score
+                    function classify(score) {
+                        for (const [bucket, [low, high]] of Object.entries(bucketRanges)) {
+                        if (score >= low && score <= high) return bucket;
+                        }
+                        return 'unknown';
+                    }
+
+                    // Group products by product type
+                    const grouped = {};
+
+                    data.results.forEach(item => {
+                        const valuesUsed = item?.ai_suggestions?.title_construction?.values_used || [];
+                        const productType = item?.category || item?.product_type || 'Unknown';
+                        const score = item.final_score || 0;
+                        const breakdown = item.breakdown || {};
+                        const titleQuality = breakdown.title_quality || 0;
+                        const descriptionQuality = breakdown.description_quality || 0;
+                        const imageScore = breakdown.image_score || item.image_score || 0;
+
+                        if (!grouped[productType]) grouped[productType] = [];
+                        grouped[productType].push({
+                        score,
+                        titleQuality,
+                        descriptionQuality,
+                        imageScore,
+                        bucket: classify(score)
+                        });
+                    });
+
+                    // Prepare final JSON structure
+                    const output = {
+                        performance_summary: { excellent: 0, good: 0, fair: 0, poor: 0 },
+                        product_metrics: []
+                    };
+
+                    for (const [ptype, items] of Object.entries(grouped)) {
+                        const total = items.length;
+                        const bucketCounts = { excellent: 0, good: 0, fair: 0, poor: 0 };
+                        let scoreSum = 0, titleSum = 0, descSum = 0, imageSum = 0;
+
+                        items.forEach(item => {
+                        bucketCounts[item.bucket]++;
+                        scoreSum += item.score;
+                        titleSum += item.titleQuality;
+                        descSum += item.descriptionQuality;
+                        imageSum += item.imageScore;
+                        });
+
+                        output.performance_summary.excellent += bucketCounts.excellent;
+                        output.performance_summary.good += bucketCounts.good;
+                        output.performance_summary.fair += bucketCounts.fair;
+                        output.performance_summary.poor += bucketCounts.poor;
+
+                        output.product_metrics.push({
+                        product_type: ptype,
+                        products: total,
+                        avg_score: (scoreSum / total).toFixed(2),
+                        excellent_percent: `${Math.round((bucketCounts.excellent / total) * 100)}%`,
+                        good_percent: `${Math.round((bucketCounts.good / total) * 100)}%`,
+                        fair_percent: `${Math.round((bucketCounts.fair / total) * 100)}%`,
+                        poor_percent: `${Math.round((bucketCounts.poor / total) * 100)}%`,
+                        avg_title_quality: (titleSum / total).toFixed(2),
+                        avg_description_quality: (descSum / total).toFixed(2),
+                        avg_image_quality: (imageSum / total).toFixed(2)
+                        });
+                    }
+
+                    localStorage.setItem('performanceAnalysis',JSON.stringify(output));
+
+                    console.log('Generated Metrics:', output);
+                    $('#full-page-loader').hide();
+
+
                     // responseDiv.innerHTML = `<div class="alert alert-success">✅ ${data.message}</div>`;
                 } else {
+                    $('#full-page-loader').hide();
                     // responseDiv.innerHTML = `<div class="alert alert-danger">❌ ${data.error}</div>`;
                 }
 
@@ -530,11 +980,16 @@
                 // }, 5000);
             })
             .catch(error => {
+                $('#full-page-loader').hide();
                 // responseDiv.innerHTML = `<div class="alert alert-danger">❌ API call failed: ${error}</div>`;
                 // setTimeout(() => {
                 //     responseDiv.innerHTML = '';
                 // }, 5000);
             });
+                       
+            
+            }
+
         });
         </script>
     

+ 4 - 1
content_quality_tool_public/templates/index.html

@@ -184,6 +184,7 @@
         integrity="sha256-+vh8GkaU7C9/wbSLIcwq82tQ2wTf44aOHA8HlBMwRI8=" crossorigin="anonymous"></script>
     <script>
         document.addEventListener('DOMContentLoaded', function () {
+        localStorage.setItem('isNewFileUpload',0);    
         const form = document.getElementById('uploadForm');
         const fileInput = document.getElementById('fileInput');
         const submitBtn = document.getElementById('submitBtn');
@@ -232,11 +233,13 @@
             .finally(() => {
                 submitBtn.textContent = 'Upload';
                 $('#full-page-loader').hide();
+                
 
                 // Remove message after 5 seconds
                 setTimeout(() => {
                     responseDiv.innerHTML = '';
-                    window.location.href = "/content-scorecard";
+                    window.location.href = "/content-quality-analytics";
+                    // window.location.href = "/content-scorecard";
                 }, 3000);
             });
         });

+ 803 - 0
content_quality_tool_public/templates/product-performance-analysis.html

@@ -0,0 +1,803 @@
+{% load static %}
+<!DOCTYPE html>
+<html lang="en"> <!--begin::Head-->
+
+<head>
+    <meta http-equiv="Content-Type" content="text/html; charset=utf-8">
+    <title>Content Scorecard</title><!--begin::Primary Meta Tags-->
+    <meta name="viewport" content="width=device-width, initial-scale=1.0">
+    <meta name="title" content="CQT | Upload">
+    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/@fontsource/source-sans-3@5.0.12/index.css"
+        integrity="sha256-tXJfXfp6Ewt1ilPzLDtQnJV4hclT9XuaZUKyUvmyr+Q=" crossorigin="anonymous">
+    <!--end::Fonts--><!--begin::Third Party Plugin(OverlayScrollbars)-->
+    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/overlayscrollbars@2.3.0/styles/overlayscrollbars.min.css"
+        integrity="sha256-dSokZseQNT08wYEWiz5iLI8QPlKxG+TswNRD8k35cpg=" crossorigin="anonymous">
+    <!--end::Third Party Plugin(OverlayScrollbars)--><!--begin::Third Party Plugin(Bootstrap Icons)-->
+    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/bootstrap-icons@1.11.0/font/bootstrap-icons.min.css"
+        integrity="sha256-Qsx5lrStHZyR9REqhUF8iQt73X06c8LGIUPzpOhwRrI=" crossorigin="anonymous">
+    <!--end::Third Party Plugin(Bootstrap Icons)--><!--begin::Required Plugin(AdminLTE)-->
+    <link rel="stylesheet" href="{% static './css/adminlte.css' %}"><!--end::Required Plugin(AdminLTE)--><!-- apexcharts -->
+    <link rel="stylesheet" href="https://cdn.jsdelivr.net/npm/apexcharts@3.37.1/dist/apexcharts.css"
+        integrity="sha256-4MX+61mt9NVvvuPjUWdUdyfZfxSB1/Rf9WtqRHgG5S0=" crossorigin="anonymous">
+    <link href="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/css/select2.min.css" rel="stylesheet" />
+    <link rel="stylesheet" href="{% static './css/select2-bootstrap4.min.css' %}">
+    <link rel="stylesheet" href="{% static './css/custom.css' %}">
+    <style>
+        .select2-container .select2-search--inline .select2-search__field {
+            position: absolute;
+            top: 3px;
+            font-size: 14px;
+        }
+        #full-page-loader {
+            position: fixed;
+            top: 0;
+            left: 0;
+            width: 100%;
+            height: 100%;
+            background-color: rgba(0, 0, 0, 0.6); /* semi-transparent black */
+            z-index: 9999;
+            display: flex;
+            justify-content: center;
+            align-items: center;
+        }
+
+        .loader-overlay .spinner-border {
+            width: 3rem;
+            height: 3rem;
+        }
+
+    </style>
+    <style>
+    body {
+        background-color: #f8f9fa;
+        font-family: 'Segoe UI', sans-serif;
+    }
+    .header {
+        background-color: #01445E;
+        color: white;
+        padding: 20px;
+        text-align: center;
+        border-radius: 8px;
+        margin-bottom: 30px;
+    }
+    .score-card {
+        border-radius: 15px;
+        color: white;
+        padding: 20px;
+        box-shadow: 0 4px 8px rgba(0,0,0,0.1);
+        text-align: center;
+    }
+    .excellent { 
+    background: linear-gradient(135deg, #2b9348, #2b9348); /* Green gradient */
+    border-left: 5px solid rgb(16, 34, 16); /* Green */
+}
+
+.good { 
+    background: linear-gradient(135deg, #49B5E0, #49B5E0); /* Blue gradient */
+    border-left: 5px solid rgb(9, 29, 37); /* Green */
+}
+
+.fair { 
+        background: linear-gradient(135deg, #4E4A5A, #4E4A5A); /* Dark Gray gradient */
+        border-left: 5px solid #29272c; /* Green */
+    
+}
+
+.poor { 
+background: linear-gradient(135deg, #F15D5C, #F15D5C); /* Red gradient */
+border-left: 5px solid #e20303; /* Green */
+}
+
+   /* .excellent { background: linear-gradient(135deg, #27B7C1, #49B5E0); }
+    .good { background: linear-gradient(135deg, #49B5E0, #27B7C1); }
+    .fair { background: linear-gradient(135deg, #4E4A5A, #49B5E0); }
+    .poor { background: linear-gradient(135deg, #01445E, #4E4A5A); } */
+    .score-card h2 {
+        font-size: 2.5rem;
+        margin-bottom: 10px;
+        font-weight: bold;
+    }
+    .score-card p {
+        font-size: 1.1rem;
+        margin: 0;
+    }
+     .rating-guide {
+            padding: 15px 0;
+        }
+        .rating-guide h5 {
+            font-weight: 600;
+            color: var(--primary-dark);
+            margin-bottom: 15px;
+        }
+        .rating-guide .badge {
+            font-size: 1rem;
+            padding: 0.8em 4em;
+            font-weight: 400;
+            /* border-radius: 20px; */
+             /* Pill shape */
+        }
+    /* .rating-guide {
+        background-color: white;
+        border-radius: 10px;
+        padding: 20px;
+        box-shadow: 0 2px 6px rgba(0,0,0,0.1);
+        margin-top: 30px;
+    } */
+    .rating-item {
+        display: inline-flex;
+        align-items: center;
+        margin-right: 30px;
+    }
+    .dot {
+        height: 15px;
+        width: 15px;
+        border-radius: 50%;
+        margin-right: 10px;
+    }
+    .dot.excellent { background-color: #27B7C1; }
+    .dot.good { background-color: #49B5E0; }
+    .dot.fair { background-color: #4E4A5A; }
+    .dot.poor { background-color: #01445E; }
+    .table thead {
+        background-color: #49B5E0;
+        color: white;
+    }
+    .category-tag {
+        background-color: #4E4A5A;
+        color: white;
+        padding: 5px 10px;
+        border-radius: 5px;
+    }
+    .btn-view {
+        background-color: #27B7C1;
+        color: white;
+    }
+    .btn-edit {
+        background-color: #01445E;
+        color: white;
+    }
+    .score-card:hover {
+        transform: translateY(-5px);
+        box-shadow: 0 12px 25px rgba(0,0,0,0.15);
+    }
+
+
+    /* Mobile view fix */
+    @media (max-width: 768px) {
+        .rating-guide .badge {
+            font-size: 0.8rem;       /* Slightly smaller text */
+            padding: 0.3rem 0.6rem;  /* Reduce padding for small screens */
+            margin: 0.15rem;         /* Tighter spacing */
+            display: block;           /* Stack badges vertically if needed */
+            width: auto;              /* Ensure badges don’t overflow */
+        }
+    }
+
+
+    /* .score-card {
+        border-left: 5px solid #01445E;
+    } */
+
+</style>
+</head>
+
+<body class="layout-fixed sidebar-expand-lg sidebar-mini app-loaded sidebar-collapse">
+    <!--begin::App Wrapper-->
+    <div class="app-wrapper"> <!--begin::Header-->
+        {% include 'header.html' %}
+        {% include 'sidebar.html' %}
+        <main class="app-main"> <!--begin::App Content Header-->
+            <div class="app-content-header"> <!--begin::Container-->
+                <div class="container-fluid"> <!--begin::Row-->
+                    <div class="row">
+                        <div class="col-sm-6">
+                            <h3 class="mb-0">📶 Content Quality Analytics</h3>
+                        </div>
+                        <div class="col-sm-6">
+                            <ol class="breadcrumb float-sm-end">
+                                <li class="breadcrumb-item"><a href="{% url 'file-upload' %}">Home</a></li>
+                                <li class="breadcrumb-item active" aria-current="page"><a href="{% url 'content-quality-analytics' %}"></a>
+                                   📶 Content Quality Analytics</a>
+                                </li>
+                            </ol>
+                        </div>
+                    </div> <!--end::Row-->
+                </div> <!--end::Container-->
+            </div>
+            <div class="app-content"> <!--begin::Container-->
+                <div class="container-fluid"> <!-- Info boxes -->
+                    <div id="full-page-loader" style="display: none;">
+                    <div class="loader-overlay">
+                        <div class="spinner-border text-light" role="status">
+                            <!-- <span class="sr-only">Loading...</span> -->
+                        </div>
+                    </div>
+                </div>
+
+                    <!-- Header -->
+                    <!-- <div class="header">
+                        <h1>Product Content Quality Analytics</h1>
+                        <p>Analyzing and improving product content to ensure the highest standards.</p>
+                    </div> -->
+
+
+                    <!-- Summary Cards -->
+                    <div class="row g-4 text-center">
+                        <div class="col-md-3">
+                            <div class="score-card excellent">
+                                <h2 id="excellence_performance">0</h2>
+                                <p>Excellent Performers</p>
+                            </div>
+                        </div>
+                        <div class="col-md-3">
+                            <div class="score-card good">
+                                <h2  id="good_performance">0</h2>
+                                <p>Good Performers</p>
+                            </div>
+                        </div>
+                        <div class="col-md-3">
+                            <div class="score-card fair">
+                                <h2  id="fair_performance">0</h2>
+                                <p>Fair Performers</p>
+                            </div>
+                        </div>
+                        <div class="col-md-3">
+                            <div class="score-card poor">
+                                <h2  id="poor_performance">0</h2>
+                                <p>Poor Performers</p>
+                            </div>
+                        </div>
+                    </div>
+
+                    <!-- Rating Guide -->
+                    <!-- <div class="rating-guide mt-4">
+                        <h5 class="mb-3">Performance Rating Guide</h5>
+                        <div class="rating-item"><div class="dot excellent"></div><span><strong>90-100:</strong> Excellent (Market Ready)</span></div>
+                        <div class="rating-item"><div class="dot good"></div><span><strong>75-89:</strong> Good (Minor Improvements)</span></div>
+                        <div class="rating-item"><div class="dot fair"></div><span><strong>60-74:</strong> Fair (Content Gaps)</span></div>
+                        <div class="rating-item"><div class="dot poor"></div><span><strong><60:</strong> Poor (Major Rework Needed)</span></div>
+                    </div> -->
+                    <br/>
+                    <div class="card">
+                        <div class="rating-guide ">
+                            <h5 style="text-align: center;">Content Performace Insights :</h5>
+                            <div style="text-align: center;">
+                                <span class="badge excellent">Excellent: 85-100%</span>
+                                <span class="badge good" >Good: 70-84%</span>
+                                <span class="badge fair" >Fair: 50-69%</span>
+                                <span class="badge poor" >Poor: Below 50%</span>
+                            </div>
+                        </div>
+                    </div>
+
+                    <!-- Table -->
+                    <div class="table-responsive mt-4">
+                        <table class="table table-bordered align-middle" >
+                            <thead>
+                                <tr>
+                                    <th>Product Type</th>
+                                    <th>Products</th>
+                                    <th>Avg Score</th>
+                                    <th>Excellent %</th>
+                                    <th>Good %</th>
+                                    <th>Fair %</th>
+                                    <th>Poor %</th>
+                                    <th>Title</th>
+                                    <th>Description</th>
+                                    <th>Images</th>
+                                    <!-- <th>Attributes</th> -->
+                                    <!-- <th>Trend</th> -->
+                                    <!-- <th>Category</th> -->
+                                    <th>Actions</th>
+                                </tr>
+                            </thead>
+                            <tbody id="productTableBody">
+                                <tr>
+                                    <!-- <td>CeraVe</td>
+                                    <td>3</td>
+                                    <td>92.3</td>
+                                    <td>100%</td>
+                                    <td>0%</td>
+                                    <td>0%</td>
+                                    <td>0%</td>
+                                    <td>9.2</td>
+                                    <td>18.7</td>
+                                    <td>22.3</td> -->
+                                    <!-- <td>19.7</td> -->
+                                    <!-- <td>+2.1</td> -->
+                                    <!-- <td><span class="category-tag">Skincare</span></td> -->
+                                    <!-- <td> -->
+                                        <!-- <button class="btn btn-view btn-sm">View</button> -->
+                                        <!-- <button class="btn btn-edit btn-sm">Edit</button> -->
+                                    <!-- </td> -->
+                                </tr>
+                                <!-- Add more rows as needed -->
+                            </tbody>
+                        </table>
+                    </div>
+
+                            </div> <!--end::Container-->
+            </div> <!--end::App Content-->
+        </main> <!--end::App Main--> <!--begin::Footer-->
+        {% include 'footer.html' %}
+
+    </div> 
+    <script src="https://code.jquery.com/jquery-3.7.1.min.js"
+        integrity="sha256-/JqT3SQfawRcv/BIHPThkBvs0OEvtFFmqPF/lYI/Cxo=" crossorigin="anonymous"></script>
+    <script src="https://cdn.jsdelivr.net/npm/overlayscrollbars@2.3.0/browser/overlayscrollbars.browser.es6.min.js"
+        integrity="sha256-H2VM7BKda+v2Z4+DRy69uknwxjyDRhszjXFhsL4gD3w=" crossorigin="anonymous"></script>
+    <!--end::Third Party Plugin(OverlayScrollbars)--><!--begin::Required Plugin(popperjs for Bootstrap 5)-->
+    <script src="https://cdn.jsdelivr.net/npm/@popperjs/core@2.11.8/dist/umd/popper.min.js"
+        integrity="sha256-whL0tQWoY1Ku1iskqPFvmZ+CHsvmRWx/PIoEvIeWh4I=" crossorigin="anonymous"></script>
+    <!--end::Required Plugin(popperjs for Bootstrap 5)--><!--begin::Required Plugin(Bootstrap 5)-->
+    <script src="https://cdn.jsdelivr.net/npm/bootstrap@5.3.2/dist/js/bootstrap.min.js"
+        integrity="sha256-YMa+wAM6QkVyz999odX7lPRxkoYAan8suedu4k2Zur8=" crossorigin="anonymous"></script>
+    <script src="https://cdn.jsdelivr.net/npm/select2@4.1.0-rc.0/dist/js/select2.min.js"></script>
+    <!--end::Required Plugin(Bootstrap 5)--><!--begin::Required Plugin(AdminLTE)-->
+    <script src="{% static './js/adminlte.js' %}"></script>
+    <!--end::Required Plugin(AdminLTE)--><!--begin::OverlayScrollbars Configure-->
+    <script>
+        const SELECTOR_SIDEBAR_WRAPPER = ".sidebar-wrapper";
+        const Default = {
+            scrollbarTheme: "os-theme-light",
+            scrollbarAutoHide: "leave",
+            scrollbarClickScroll: true,
+        };
+        document.addEventListener("DOMContentLoaded", function () {
+            const sidebarWrapper = document.querySelector(SELECTOR_SIDEBAR_WRAPPER);
+            if (
+                sidebarWrapper &&
+                typeof OverlayScrollbarsGlobal?.OverlayScrollbars !== "undefined"
+            ) {
+                OverlayScrollbarsGlobal.OverlayScrollbars(sidebarWrapper, {
+                    scrollbars: {
+                        theme: Default.scrollbarTheme,
+                        autoHide: Default.scrollbarAutoHide,
+                        clickScroll: Default.scrollbarClickScroll,
+                    },
+                });
+            }
+        });
+        $(document).ready(function () {
+            $('.select2').select2({
+                theme: 'bootstrap4',
+                placeholder: 'Select Competitors'
+            });
+        });
+    </script> <!--end::OverlayScrollbars Configure--> <!-- OPTIONAL SCRIPTS --> <!-- apexcharts -->
+    <script src="https://cdn.jsdelivr.net/npm/apexcharts@3.37.1/dist/apexcharts.min.js"
+        integrity="sha256-+vh8GkaU7C9/wbSLIcwq82tQ2wTf44aOHA8HlBMwRI8=" crossorigin="anonymous"></script>
+    <script>
+         function renderProductMetrics(data) {
+                    // Get the tbody element by ID (assuming your table has an ID of 'productTable')
+                    const tableBody = document.getElementById('productTableBody');
+
+                    // Clear any existing rows (like the placeholder CeraVe row)
+                    tableBody.innerHTML = '';
+
+                    // Loop through the product_metrics array in the data
+                    data.product_metrics.forEach(metric => {
+                        // Create a new table row element
+                        const row = document.createElement('tr');
+
+                        // Define the data points to display in order (matching the table columns)
+                        const cellData = [
+                            metric.product_type,
+                            metric.products,
+                            metric.avg_score,
+                            metric.excellent_percent,
+                            metric.good_percent,
+                            metric.fair_percent,
+                            metric.poor_percent,
+                            metric.avg_title_quality,
+                            metric.avg_description_quality,
+                            metric.avg_image_quality
+                        ];
+
+                        // Create and append the standard data cells (td)
+                        cellData.forEach(cellValue => {
+                            const cell = document.createElement('td');
+                            cell.textContent = cellValue;
+                            row.appendChild(cell);
+                        });
+
+                        // Add the 'Actions' cell with the View button
+                        const actionsCell = document.createElement('td');
+                        actionsCell.innerHTML = '<button class="btn btn-view btn-sm" onclick="viewProductInfo(`'+metric.product_type+'`)">View</button>';
+                        row.appendChild(actionsCell);
+
+                        // Append the completed row to the table body
+                        tableBody.appendChild(row);
+                        console.log("row",row);
+                    });
+                }
+
+                function updateScoreCards(summaryData) {
+    // Get the performance summary object
+    const performance = summaryData.performance_summary;
+
+    // 1. Update Excellent Performers
+    const excellentElement = document.getElementById('excellence_performance');
+    if (excellentElement) {
+        // Set the text content to the 'excellent' count
+        excellentElement.textContent = performance.excellent;
+    }
+
+    // 2. Update Good Performers
+    const goodElement = document.getElementById('good_performance');
+    if (goodElement) {
+        goodElement.textContent = performance.good;
+    }
+
+    // 3. Update Fair Performers
+    const fairElement = document.getElementById('fair_performance');
+    if (fairElement) {
+        fairElement.textContent = performance.fair;
+    }
+
+    // 4. Update Poor Performers
+    const poorElement = document.getElementById('poor_performance');
+    if (poorElement) {
+        poorElement.textContent = performance.poor;
+    }
+}
+
+                function viewProductInfo(productType){
+                    console.log("productType",productType);
+                    localStorage.setItem("selectedproductType",productType);
+                    window.location.href = "/content-scorecard";
+                }
+        document.addEventListener('DOMContentLoaded', function () {
+
+           
+            // $('#full-page-loader').show();
+            // apiresults = [];
+
+            //     // Define performance buckets
+            //         const bucketRanges = {
+            //             excellent: [85, 100],
+            //             good: [70, 84.99],
+            //             fair: [50, 69.99],
+            //             poor: [0, 49.99]
+            //         };
+
+            //         // Helper function to classify score
+            //         function classify(score) {
+            //             for (const [bucket, [low, high]] of Object.entries(bucketRanges)) {
+            //             if (score >= low && score <= high) return bucket;
+            //             }
+            //             return 'unknown';
+            //         }
+
+            //         // Group products by product type
+            //         const grouped = {};
+
+            //         apiresults.forEach(item => {
+            //             const valuesUsed = item?.ai_suggestions?.title_construction?.values_used || [];
+            //             const productType = valuesUsed[1] || 'Unknown';
+            //             const score = item.final_score || 0;
+            //             const breakdown = item.breakdown || {};
+            //             const titleQuality = breakdown.title_quality || 0;
+            //             const descriptionQuality = breakdown.description_quality || 0;
+            //             const imageScore = breakdown.image_score || item.image_score || 0;
+
+            //             if (!grouped[productType]) grouped[productType] = [];
+            //             grouped[productType].push({
+            //             score,
+            //             titleQuality,
+            //             descriptionQuality,
+            //             imageScore,
+            //             bucket: classify(score)
+            //             });
+            //         });
+                    
+
+            //         // Prepare final JSON structure
+            //         const output = {
+            //             performance_summary: { excellent: 0, good: 0, fair: 0, poor: 0 },
+            //             product_metrics: []
+            //         };
+
+            //         for (const [ptype, items] of Object.entries(grouped)) {
+            //             const total = items.length;
+            //             const bucketCounts = { excellent: 0, good: 0, fair: 0, poor: 0 };
+            //             let scoreSum = 0, titleSum = 0, descSum = 0, imageSum = 0;
+
+            //             items.forEach(item => {
+            //             bucketCounts[item.bucket]++;
+            //             scoreSum += item.score;
+            //             titleSum += item.titleQuality;
+            //             descSum += item.descriptionQuality;
+            //             imageSum += item.imageScore;
+            //             });
+
+            //             output.performance_summary.excellent += bucketCounts.excellent;
+            //             output.performance_summary.good += bucketCounts.good;
+            //             output.performance_summary.fair += bucketCounts.fair;
+            //             output.performance_summary.poor += bucketCounts.poor;
+
+            //             output.product_metrics.push({
+            //             product_type: ptype,
+            //             products: total,
+            //             avg_score: (scoreSum / total).toFixed(2),
+            //             excellent_percent: `${Math.round((bucketCounts.excellent / total) * 100)}%`,
+            //             good_percent: `${Math.round((bucketCounts.good / total) * 100)}%`,
+            //             fair_percent: `${Math.round((bucketCounts.fair / total) * 100)}%`,
+            //             poor_percent: `${Math.round((bucketCounts.poor / total) * 100)}%`,
+            //             avg_title_quality: (titleSum / total).toFixed(2),
+            //             avg_description_quality: (descSum / total).toFixed(2),
+            //             avg_image_quality: (imageSum / total).toFixed(2)
+            //             });
+            //         }
+
+            //         const total = Object.values(output.performance_summary).reduce((a, b) => a + b, 0);
+
+            //         const percentages = Object.fromEntries(
+            //         Object.entries(output.performance_summary).map(([key, value]) => [
+            //             key,
+            //             ((value / total) * 100).toFixed(2) + '%'
+            //         ])
+            //         );
+
+            //         console.log(percentages);
+
+
+            //         console.log('Generated Metrics:', output);
+            //         data = output;
+                    // 1. The JSON data you provided
+                // const data = {
+                //     "performance_summary": {
+                //         "excellent": 2,
+                //         "good": 8,
+                //         "fair": 0,
+                //         "poor": 0
+                //     },
+                //     "product_metrics": [
+                //         {
+                //             "product_type": "Unknown",
+                //             "products": 10,
+                //             "avg_score": "82.40",
+                //             "excellent_percent": "20%",
+                //             "good_percent": "80%",
+                //             "fair_percent": "0%",
+                //             "poor_percent": "0%",
+                //             "avg_title_quality": "78.52",
+                //             "avg_description_quality": "67.14",
+                //             "avg_image_quality": "32.05"
+                //         }
+                //     ]
+                // };
+
+                // 2. Function to render the table
+                
+                // 3. Call the function to render the data when the page loads
+                // document.addEventListener('DOMContentLoaded', () => {
+                    // renderProductMetrics(data);
+                    // updateScoreCards(data);
+// });
+                    // $('#full-page-loader').hide();
+            // fetch('/core/api/', {
+            //     method: 'GET', // or 'POST' if your API expects POST
+            //     headers: {
+            //         'X-CSRFToken': document.querySelector('[name=csrfmiddlewaretoken]')?.value || ''
+            //     }
+            // })
+            // .then(response => response.json())
+            // .then(data => {
+            //     console.log("data",data);
+            // })
+            // .catch(error => {
+            //     $('#full-page-loader').hide();
+
+            // The JSON data you provided (re-using the performance_summary)
+
+// Function to update the score cards
+
+            // });
+        });
+    </script>
+    <script>
+         if (localStorage.getItem('analyticsdata') !== null && localStorage.getItem('isNewFileUpload') && localStorage.getItem('isNewFileUpload') == 1) {
+                console.log('Data key exists in localStorage');
+                apiresults_stringify = localStorage.getItem('analyticsdata');
+                apiresults = JSON.parse(apiresults_stringify);
+                // apiresults = [];
+
+                // Define performance buckets
+                    const bucketRanges = {
+                        excellent: [85, 100],
+                        good: [70, 84.99],
+                        fair: [50, 69.99],
+                        poor: [0, 49.99]
+                    };
+
+                    // Helper function to classify score
+                    function classify(score) {
+                        for (const [bucket, [low, high]] of Object.entries(bucketRanges)) {
+                        if (score >= low && score <= high) return bucket;
+                        }
+                        return 'unknown';
+                    }
+
+                    // Group products by product type
+                    const grouped = {};
+
+                    apiresults.forEach(item => {
+                        const valuesUsed = item?.ai_suggestions?.title_construction?.values_used || [];
+                        const productType = item?.category || item?.product_type || 'Unknown';
+                        const score = item.final_score || 0;
+                        const breakdown = item.breakdown || {};
+                        const titleQuality = breakdown.title_quality || 0;
+                        const descriptionQuality = breakdown.description_quality || 0;
+                        const imageScore = breakdown.image_score || item.image_score || 0;
+
+                        if (!grouped[productType]) grouped[productType] = [];
+                        grouped[productType].push({
+                        score,
+                        titleQuality,
+                        descriptionQuality,
+                        imageScore,
+                        bucket: classify(score)
+                        });
+                    });
+
+                    // Prepare final JSON structure
+                    const output = {
+                        performance_summary: { excellent: 0, good: 0, fair: 0, poor: 0 },
+                        product_metrics: []
+                    };
+
+                    for (const [ptype, items] of Object.entries(grouped)) {
+                        const total = items.length;
+                        const bucketCounts = { excellent: 0, good: 0, fair: 0, poor: 0 };
+                        let scoreSum = 0, titleSum = 0, descSum = 0, imageSum = 0;
+
+                        items.forEach(item => {
+                        bucketCounts[item.bucket]++;
+                        scoreSum += item.score;
+                        titleSum += item.titleQuality;
+                        descSum += item.descriptionQuality;
+                        imageSum += item.imageScore;
+                        });
+
+                        output.performance_summary.excellent += bucketCounts.excellent;
+                        output.performance_summary.good += bucketCounts.good;
+                        output.performance_summary.fair += bucketCounts.fair;
+                        output.performance_summary.poor += bucketCounts.poor;
+
+                        output.product_metrics.push({
+                        product_type: ptype,
+                        products: total,
+                        avg_score: (scoreSum / total).toFixed(2),
+                        excellent_percent: `${Math.round((bucketCounts.excellent / total) * 100)}%`,
+                        good_percent: `${Math.round((bucketCounts.good / total) * 100)}%`,
+                        fair_percent: `${Math.round((bucketCounts.fair / total) * 100)}%`,
+                        poor_percent: `${Math.round((bucketCounts.poor / total) * 100)}%`,
+                        avg_title_quality: (titleSum / total).toFixed(2),
+                        avg_description_quality: (descSum / total).toFixed(2),
+                        avg_image_quality: (imageSum / total).toFixed(2)
+                        });
+                    }
+                    localStorage.setItem('performanceAnalysis',JSON.stringify(output));
+                    renderProductMetrics(output);
+                    updateScoreCards(output);
+
+                    console.log('Generated Metrics:', output);
+                    $('#full-page-loader').hide();
+             } else {
+                console.log('Data key not found');
+                $('#full-page-loader').show();
+            fetch('/core/api/rr-content-card/', {
+                method: 'GET', // or 'POST' if your API expects POST
+                headers: {
+                    'X-CSRFToken': document.querySelector('[name=csrfmiddlewaretoken]')?.value || ''
+                }
+            })
+            .then(response => response.json())
+            .then(data => {
+                if (data.success) {
+                    localStorage.setItem('isNewFileUpload',1);   
+                    // var html = '';
+                    localStorage.setItem('analyticsdata',JSON.stringify(data.results));
+                    
+                    // Define performance buckets
+                    const bucketRanges = {
+                        excellent: [85, 100],
+                        good: [70, 84.99],
+                        fair: [50, 69.99],
+                        poor: [0, 49.99]
+                    };
+
+                    // Helper function to classify score
+                    function classify(score) {
+                        for (const [bucket, [low, high]] of Object.entries(bucketRanges)) {
+                        if (score >= low && score <= high) return bucket;
+                        }
+                        return 'unknown';
+                    }
+
+                    // Group products by product type
+                    const grouped = {};
+
+                    data.results.forEach(item => {
+                        const valuesUsed = item?.ai_suggestions?.title_construction?.values_used || [];
+                        const productType = item?.category || item?.product_type || 'Unknown';
+                        const score = item.final_score || 0;
+                        const breakdown = item.breakdown || {};
+                        const titleQuality = breakdown.title_quality || 0;
+                        const descriptionQuality = breakdown.description_quality || 0;
+                        const imageScore = breakdown.image_score || item.image_score || 0;
+
+                        if (!grouped[productType]) grouped[productType] = [];
+                        grouped[productType].push({
+                        score,
+                        titleQuality,
+                        descriptionQuality,
+                        imageScore,
+                        bucket: classify(score)
+                        });
+                    });
+
+                    // Prepare final JSON structure
+                    const output = {
+                        performance_summary: { excellent: 0, good: 0, fair: 0, poor: 0 },
+                        product_metrics: []
+                    };
+
+                    for (const [ptype, items] of Object.entries(grouped)) {
+                        const total = items.length;
+                        const bucketCounts = { excellent: 0, good: 0, fair: 0, poor: 0 };
+                        let scoreSum = 0, titleSum = 0, descSum = 0, imageSum = 0;
+
+                        items.forEach(item => {
+                        bucketCounts[item.bucket]++;
+                        scoreSum += item.score;
+                        titleSum += item.titleQuality;
+                        descSum += item.descriptionQuality;
+                        imageSum += item.imageScore;
+                        });
+
+                        output.performance_summary.excellent += bucketCounts.excellent;
+                        output.performance_summary.good += bucketCounts.good;
+                        output.performance_summary.fair += bucketCounts.fair;
+                        output.performance_summary.poor += bucketCounts.poor;
+
+                        output.product_metrics.push({
+                        product_type: ptype,
+                        products: total,
+                        avg_score: (scoreSum / total).toFixed(2),
+                        excellent_percent: `${Math.round((bucketCounts.excellent / total) * 100)}%`,
+                        good_percent: `${Math.round((bucketCounts.good / total) * 100)}%`,
+                        fair_percent: `${Math.round((bucketCounts.fair / total) * 100)}%`,
+                        poor_percent: `${Math.round((bucketCounts.poor / total) * 100)}%`,
+                        avg_title_quality: (titleSum / total).toFixed(2),
+                        avg_description_quality: (descSum / total).toFixed(2),
+                        avg_image_quality: (imageSum / total).toFixed(2)
+                        });
+                    }
+
+                    localStorage.setItem('performanceAnalysis',JSON.stringify(output));
+                    // data = output;
+                    renderProductMetrics(output);
+                    updateScoreCards(output);
+
+                    console.log('Generated Metrics:', output);
+                    $('#full-page-loader').hide();
+
+                    // responseDiv.innerHTML = `<div class="alert alert-success">✅ ${data.message}</div>`;
+                } else {
+                    $('#full-page-loader').hide();
+                    // responseDiv.innerHTML = `<div class="alert alert-danger">❌ ${data.error}</div>`;
+                }
+            })
+            .catch(error => {
+                $('#full-page-loader').hide();
+            });
+                       
+            
+            }
+    </script>
+
+</body><!--end::Body-->
+
+</html>

+ 1 - 0
content_quality_tool_public/urls.py

@@ -12,6 +12,7 @@ urlpatterns = [
     path('content-scorecard/', views.getData, name='content-scorecard'),
     path('product-attributes/', views.getProductAttributes, name='product-attributes'),
     path('attribute-extraction/', views.getAttributeExtraction, name='attribute-extraction'),
+    path('content-quality-analytics/', views.contentQualityAnalysis, name='content-quality-analytics'),
 ]
 
 if settings.DEBUG:

+ 5 - 1
content_quality_tool_public/views.py

@@ -106,4 +106,8 @@ def getAttributeExtraction(request):
 # add-edit product type attributes page
 @login_required
 def getProductAttributes(request):
-    return render(request, 'product-attributes.html')
+    return render(request, 'product-attributes.html')
+
+@login_required
+def contentQualityAnalysis(request):
+    return render(request, 'product-performance-analysis.html')

+ 2811 - 0
core/results/rr_content_card.json

@@ -0,0 +1,2811 @@
+{
+    "success": true,
+    "processed": 10,
+    "results": [
+    {
+        "sku": "SDR-FAS-482709",
+        "title": "Blue Vanilla Blue Puff Sleeve Shirred Panel Dress",
+        "description": "Flaunt your figure in this shirred waist dress, boasting puff sleeves and a cute square neckline",
+        "image_path": "images/fashion-002.jpg",
+        "final_score": 85.66,
+        "max_score": 100,
+        "breakdown": {
+            "mandatory_fields": 100,
+            "standardization": 75,
+            "missing_values": 75,
+            "consistency": 75,
+            "seo_discoverability": 55.92,
+            "content_rules_compliance": 89.15,
+            "title_quality": 89.12,
+            "description_quality": 69.25,
+            "image_quality": null,
+            "attributes": 100,
+            "image_score": null
+        },
+        "image_score": null,
+        "image_breakdown": {},
+        "image_metadata": {},
+        "ai_suggestions": {
+            "content": {
+                "data_validation": {
+                    "available_elements": [
+                        "Brand",
+                        "Product Type",
+                        "Key Feature",
+                        "Material",
+                        "Size",
+                        "Color"
+                    ],
+                    "available_count": 6,
+                    "missing_elements": [
+                        "Gender"
+                    ],
+                    "can_build_valid_title": true,
+                    "reason": null
+                },
+                "title_construction": {
+                    "elements_used": [
+                        "Brand",
+                        "Product Type",
+                        "Key Feature",
+                        "Material",
+                        "Size",
+                        "Color"
+                    ],
+                    "values_used": [
+                        "Blue Vanilla",
+                        "Dress",
+                        "Puff Sleeve Shirred",
+                        "Cotton Blend",
+                        "M",
+                        "Blue"
+                    ],
+                    "element_count": 6,
+                    "construction_logic": "The title was built by following the specified order for CLOTHING/DRESSES: Brand → Product Type → Key Feature → Material → Size → Color. 'Blue Vanilla' is the Brand. 'Dress' was extracted as the specific Product Type from the original title. 'Puff Sleeve Shirred' was used as the Key Feature from the original title and description. 'Cotton Blend' is the Material. 'M' is the Size. 'Blue' is the Color. All elements are sourced directly from the available data inventory or the original product title/description as per rules."
+                },
+                "improved_title": "Blue Vanilla Dress Puff Sleeve Shirred Cotton Blend M Blue",
+                "improved_description": "This Blue Vanilla dress is designed to flatter your figure with its elegant shirred waist panel, creating a defined silhouette. It boasts charming puff sleeves and a stylish square neckline, adding a touch of sophistication. Crafted from a comfortable cotton blend material, this blue dress in size M offers both style and comfort for various occasions. The unique combination of shirred detailing and puff sleeves makes it a standout piece, ensuring a fashionable and flattering fit.",
+                "seo_keywords": [
+                    "Blue Vanilla dress",
+                    "Puff Sleeve dress",
+                    "Shirred dress",
+                    "Cotton Blend dress",
+                    "Blue dress M",
+                    "Blue Vanilla Puff Sleeve",
+                    "Shirred Cotton Blend dress"
+                ],
+                "corrected_attributes": {},
+                "missing_attributes": {
+                    "gender": "Cannot suggest - no source data available"
+                },
+                "improvements": [
+                    {
+                        "component": "attributes",
+                        "issue": "material: 'Cotton Blend' not recognized. Valid: Cotton, Polyester, Denim",
+                        "suggestion": "Update material attribute to a recognized valid value like 'Cotton' or 'Polyester' if applicable, or add 'Cotton Blend' to valid material list. Current data does not allow for correction.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": true
+                    },
+                    {
+                        "component": "attributes",
+                        "issue": "'size' suspiciously short: 'M'",
+                        "suggestion": "Ensure size 'M' is a complete and valid representation for the product. No change needed based on available data.",
+                        "priority": "low",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "attributes",
+                        "issue": "'Material': 'Cotton Blend' not mentioned in title/description",
+                        "suggestion": "Included 'Cotton Blend' in the improved title and description.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "title",
+                        "issue": "Title: Contains spam-like patterns (excessive caps, multiple punctuation)",
+                        "suggestion": "Rewrote title to be clear, concise, and free of spam-like patterns, using structured elements from available data.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "description",
+                        "issue": "Description: Too short (96 chars, minimum 100)",
+                        "suggestion": "Expanded description to meet minimum character length (100 chars) by adding more details from available product data.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "description",
+                        "issue": "Description: Too few words (16 words, minimum 20)",
+                        "suggestion": "Expanded description to meet minimum word count (20 words) by adding more details from available product data.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "description",
+                        "issue": "Description: Must contain at least one of: material, fit, style, occasion",
+                        "suggestion": "Ensured description includes material ('Cotton Blend') and implies fit ('flatter your figure', 'shirred waist').",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "description",
+                        "issue": "Description: Incomplete (missing: features, benefits, specifications, use_case)",
+                        "suggestion": "Elaborated on features (puff sleeves, shirred panel, square neckline), benefits (flattering figure, comfort), and potential use cases (versatile addition).",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "description",
+                        "issue": "Description: Lacks proper sentence structure",
+                        "suggestion": "Rewrote description using complete sentences and proper prose.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "SEO: Key attribute 'size: M' not mentioned in title/description",
+                        "suggestion": "Included 'M' in the improved title and description.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "SEO: Key attribute 'material: Cotton Blend' not mentioned in title/description",
+                        "suggestion": "Included 'Cotton Blend' in the improved title and description.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "SEO: Description too short (16 words, recommended 50+)",
+                        "suggestion": "Expanded description to over 50 words for better SEO.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "SEO: No descriptive/quality adjectives found",
+                        "suggestion": "Incorporated descriptive adjectives like 'elegant', 'stylish', 'comfortable', 'flattering' based on product characteristics.",
+                        "priority": "medium",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "SEO: Description lacks complete sentences (use prose, not just bullet points)",
+                        "suggestion": "Rewrote description using complete sentences and prose for improved readability and SEO.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    }
+                ],
+                "quality_score_prediction": 92.1,
+                "summary": "The product data has been significantly improved by constructing a comprehensive title using all available key attributes and expanding the description to meet length and content requirements. Key features like 'Puff Sleeve' and 'Shirred' along with material, size, and color are now prominently featured in both the title and description. Data limitations include the absence of gender information and the material 'Cotton Blend' not being recognized by the system, which requires external data validation.",
+                "hallucination_verification": {
+                    "passed": true,
+                    "invented_data": [],
+                    "all_data_sourced": true,
+                    "title_meets_minimum_length": true
+                }
+            },
+            "image": {}
+        },
+        "categorized_feedback": {
+            "attributes": {
+                "issues": [],
+                "suggestions": [
+                    "Include more product attributes in description"
+                ]
+            },
+            "title": {
+                "issues": [
+                    "Contains spam-like patterns (excessive caps, multiple punctuation)"
+                ],
+                "suggestions": []
+            },
+            "description": {
+                "issues": [
+                    "Too short (96 chars, minimum 100)",
+                    "Too few words (16 words, minimum 20)",
+                    "Must contain at least one of: material, fit, style, occasion",
+                    "Incomplete (missing: features, benefits, specifications, use_case)",
+                    "Lacks proper sentence structure"
+                ],
+                "suggestions": [
+                    "Expand description to 50-150 words for better SEO",
+                    "Expand Description to at least 100 characters",
+                    "Expand Description to at least 20 words with more details",
+                    "Add one of these keywords to Description: material, fit, style",
+                    "Add features, benefits, specifications, and use cases"
+                ]
+            },
+            "seo": {
+                "issues": [
+                    "Key attribute 'size: M' not mentioned in title/description",
+                    "Key attribute 'material: Cotton Blend' not mentioned in title/description",
+                    "Description too short (16 words, recommended 50+)",
+                    "No descriptive/quality adjectives found",
+                    "Description lacks complete sentences (use prose, not just bullet points)",
+                    "No high-value search terms found (e.g., 'premium', 'durable', 'best')"
+                ],
+                "suggestions": [
+                    "Add 1-2 quality/value indicators to attract more searches"
+                ]
+            },
+            "images": {
+                "issues": [
+                    "No image provided"
+                ],
+                "suggestions": [
+                    "Upload product image"
+                ]
+            },
+            "general": {
+                "issues": [
+                    "material: 'Cotton Blend' not recognized. Valid: Cotton, Polyester, Denim",
+                    "'size' suspiciously short: 'M'",
+                    "'Material': 'Cotton Blend' not mentioned in title/description"
+                ],
+                "suggestions": [
+                    "Change material to one of: Cotton, Polyester, Denim",
+                    "Provide more detailed size",
+                    "Add 'size: M' to title or first line of description",
+                    "Add 'material: Cotton Blend' to title or first line of description",
+                    "Add descriptive words like 'premium', 'durable', 'comfortable' to enhance appeal",
+                    "Write 2-3 complete sentences describing the product",
+                    "Consider expanding title to 50-100 characters for better SEO",
+                    "Remove spam indicators, use professional language",
+                    "Write in complete sentences, not just bullet points"
+                ]
+            }
+        },
+        "issues": [
+            "material: 'Cotton Blend' not recognized. Valid: Cotton, Polyester, Denim",
+            "'size' suspiciously short: 'M'",
+            "'Material': 'Cotton Blend' not mentioned in title/description",
+            "SEO: Key attribute 'size: M' not mentioned in title/description",
+            "SEO: Key attribute 'material: Cotton Blend' not mentioned in title/description",
+            "SEO: Description too short (16 words, recommended 50+)",
+            "SEO: No descriptive/quality adjectives found",
+            "SEO: Description lacks complete sentences (use prose, not just bullet points)",
+            "SEO: No high-value search terms found (e.g., 'premium', 'durable', 'best')",
+            "Description: Too short (96 chars, minimum 100)",
+            "Description: Too few words (16 words, minimum 20)",
+            "Description: Must contain at least one of: material, fit, style, occasion",
+            "Title: Contains spam-like patterns (excessive caps, multiple punctuation)",
+            "Description: Incomplete (missing: features, benefits, specifications, use_case)",
+            "Description: Lacks proper sentence structure",
+            "No image provided"
+        ],
+        "suggestions": [
+            "Change material to one of: Cotton, Polyester, Denim",
+            "Provide more detailed size",
+            "Add 'size: M' to title or first line of description",
+            "Add 'material: Cotton Blend' to title or first line of description",
+            "Expand description to 50-150 words for better SEO",
+            "Add descriptive words like 'premium', 'durable', 'comfortable' to enhance appeal",
+            "Write 2-3 complete sentences describing the product",
+            "Add 1-2 quality/value indicators to attract more searches",
+            "Expand Description to at least 100 characters",
+            "Expand Description to at least 20 words with more details",
+            "Add one of these keywords to Description: material, fit, style",
+            "Consider expanding title to 50-100 characters for better SEO",
+            "Remove spam indicators, use professional language",
+            "Add features, benefits, specifications, and use cases",
+            "Include more product attributes in description",
+            "Write in complete sentences, not just bullet points",
+            "Upload product image"
+        ],
+        "processing_time": 48.84,
+        "product_type": "Fashion"
+    },
+    {
+        "sku": "CLTH-001",
+        "title": "Nike Running T-Shirt Blue Medium",
+        "description": "Lightweight Nike running shirt.",
+        "image_path": "images/CLTH-001.jpg",
+        "final_score": 85.55,
+        "max_score": 100,
+        "breakdown": {
+            "mandatory_fields": 100,
+            "standardization": 100,
+            "missing_values": 0,
+            "consistency": 75,
+            "seo_discoverability": 65.5,
+            "content_rules_compliance": 100,
+            "title_quality": 91.12,
+            "description_quality": 67.75,
+            "image_quality": null,
+            "attributes": 100,
+            "image_score": 87.5
+        },
+        "image_score": 87.5,
+        "image_breakdown": {
+            "resolution": 70,
+            "clarity": 100,
+            "background": 90,
+            "size": 80,
+            "format": 100
+        },
+        "image_metadata": {
+            "width": 960,
+            "height": 640,
+            "dpi": [
+                null,
+                null
+            ],
+            "format": "JPG",
+            "mode": "RGB",
+            "file_size_mb": 0.11,
+            "dominant_color_rgb": [
+                252,
+                252,
+                251
+            ],
+            "dominant_color_hex": "#fcfcfb",
+            "dominant_color_name": "snow",
+            "background_coverage": 47.63
+        },
+        "ai_suggestions": {
+            "content": {
+                "data_validation": {
+                    "available_elements": [
+                        "Brand",
+                        "Product Type",
+                        "Material",
+                        "Size",
+                        "Color"
+                    ],
+                    "available_count": 5,
+                    "missing_elements": [
+                        "Gender",
+                        "Key Feature"
+                    ],
+                    "can_build_valid_title": true,
+                    "reason": ""
+                },
+                "title_construction": {
+                    "elements_used": [
+                        "Brand",
+                        "Product Type",
+                        "Material",
+                        "Size",
+                        "Color"
+                    ],
+                    "values_used": [
+                        "Nike",
+                        "Clothing",
+                        "Polyester",
+                        "M",
+                        "Blue"
+                    ],
+                    "element_count": 5,
+                    "construction_logic": "Built by ordering available elements: Brand, Product Type, Material, Size, Color, as per CLOTHING category rules and using only values from the 'EXTRACTED DATA INVENTORY'."
+                },
+                "improved_title": "Nike Clothing Polyester M Blue",
+                "improved_description": "This product is a piece of Nike brand clothing. It is constructed from Polyester material, offering a specific textile composition. The item is presented in a distinct Blue color. It is offered in a Medium size, providing a particular fit dimension. This combination of brand, material, color, and size defines this specific clothing article.",
+                "seo_keywords": [
+                    "Nike",
+                    "Clothing",
+                    "Polyester",
+                    "Blue",
+                    "M"
+                ],
+                "corrected_attributes": {},
+                "missing_attributes": {
+                    "Gender": "Cannot suggest - no source data available",
+                    "Key Feature": "Cannot suggest - no source data available"
+                },
+                "improvements": [
+                    {
+                        "component": "attributes",
+                        "issue": "'size' suspiciously short: 'M'",
+                        "suggestion": "Consider providing full size name (e.g., 'Medium') if available in external data, otherwise 'M' is acceptable as a standard abbreviation.",
+                        "priority": "low",
+                        "confidence": "high",
+                        "requires_external_data": true
+                    },
+                    {
+                        "component": "attributes",
+                        "issue": "'Material': 'Polyester' not mentioned in title/description",
+                        "suggestion": "Integrate 'Polyester' into the improved title and description to enhance product information.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "title",
+                        "issue": "Title: Contains spam-like patterns (excessive caps, multiple punctuation)",
+                        "suggestion": "Rewrite title to be concise, factual, and free of spam-like patterns, using available product data.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "description",
+                        "issue": "Description: Incomplete (missing: features, benefits, use_case)",
+                        "suggestion": "Expand description to include features, benefits, and use cases. Note: This requires additional product data not currently available.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": true
+                    },
+                    {
+                        "component": "description",
+                        "issue": "Description: Lacks proper sentence structure",
+                        "suggestion": "Rewrite description using complete sentences and prose to improve readability and information flow.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "SEO: Description too short (4 words, recommended 50+)",
+                        "suggestion": "Expand description to meet recommended length (50-150 words) by elaborating on available product details. Note: Full compliance may require additional product data.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": true
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "SEO: Description lacks complete sentences (use prose, not just bullet points)",
+                        "suggestion": "Rewrite description using complete sentences and prose for better SEO and readability.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "SEO: Missing common search term 'brand' for Clothing",
+                        "suggestion": "Include 'Nike' (Brand) in the improved title, description, and SEO keywords.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "SEO: Missing common search term 'size' for Clothing",
+                        "suggestion": "Include 'M' (Size) in the improved title, description, and SEO keywords.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "SEO: Missing common search term 'color' for Clothing",
+                        "suggestion": "Include 'Blue' (Color) in the improved title, description, and SEO keywords.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    }
+                ],
+                "quality_score_prediction": 90.3,
+                "summary": "The product title and description have been significantly improved by incorporating all available factual data, including brand, product type, material, size, and color. SEO has been enhanced by ensuring these key terms are present in the title, description, and keywords. However, the description's completeness and length are limited by the absence of detailed feature, benefit, and use-case information in the provided source data.",
+                "hallucination_verification": {
+                    "passed": true,
+                    "invented_data": [],
+                    "all_data_sourced": true,
+                    "title_meets_minimum_length": true
+                }
+            },
+            "image": {
+                "note": "No improvements needed"
+            }
+        },
+        "categorized_feedback": {
+            "attributes": {
+                "issues": [],
+                "suggestions": [
+                    "Include more product attributes in description"
+                ]
+            },
+            "title": {
+                "issues": [
+                    "Contains spam-like patterns (excessive caps, multiple punctuation)"
+                ],
+                "suggestions": []
+            },
+            "description": {
+                "issues": [
+                    "Incomplete (missing: features, benefits, use_case)",
+                    "Lacks proper sentence structure",
+                    "Weak opening sentence"
+                ],
+                "suggestions": [
+                    "Expand description to 50-150 words for better SEO",
+                    "Add features, benefits, specifications, and use cases"
+                ]
+            },
+            "seo": {
+                "issues": [
+                    "Description too short (4 words, recommended 50+)",
+                    "Description lacks complete sentences (use prose, not just bullet points)",
+                    "Missing common search term 'brand' for Clothing",
+                    "Missing common search term 'size' for Clothing",
+                    "Missing common search term 'color' for Clothing",
+                    "Missing common search term 'material' for Clothing",
+                    "Missing common search term 'fit' for Clothing",
+                    "Missing common search term 'style' for Clothing",
+                    "Missing common search term 'occasion' for Clothing",
+                    "Missing common search term 'care' for Clothing"
+                ],
+                "suggestions": [
+                    "Consider mentioning 'brand' if applicable to improve searchability",
+                    "Consider mentioning 'size' if applicable to improve searchability",
+                    "Consider mentioning 'color' if applicable to improve searchability",
+                    "Consider mentioning 'material' if applicable to improve searchability",
+                    "Consider mentioning 'fit' if applicable to improve searchability",
+                    "Consider mentioning 'style' if applicable to improve searchability",
+                    "Consider mentioning 'occasion' if applicable to improve searchability",
+                    "Consider mentioning 'care' if applicable to improve searchability"
+                ]
+            },
+            "images": {
+                "issues": [],
+                "suggestions": [
+                    "DPI information not available in image, ensure high-quality source",
+                    "Image width acceptable but could be larger (current: 960px)",
+                    "Image aspect ratio unusual (1.50), consider standard format"
+                ]
+            },
+            "general": {
+                "issues": [
+                    "'size' suspiciously short: 'M'",
+                    "'Material': 'Polyester' not mentioned in title/description"
+                ],
+                "suggestions": [
+                    "Provide more detailed size",
+                    "Consider adding more descriptive adjectives for better engagement",
+                    "Write 2-3 complete sentences describing the product",
+                    "Consider adding more value-indicating terms for better positioning",
+                    "Consider expanding title to 50-100 characters for better SEO",
+                    "Remove spam indicators, use professional language",
+                    "Write in complete sentences, not just bullet points",
+                    "Start with a strong, descriptive opening sentence"
+                ]
+            }
+        },
+        "issues": [
+            "'size' suspiciously short: 'M'",
+            "'Material': 'Polyester' not mentioned in title/description",
+            "SEO: Description too short (4 words, recommended 50+)",
+            "SEO: Description lacks complete sentences (use prose, not just bullet points)",
+            "SEO: Missing common search term 'brand' for Clothing",
+            "SEO: Missing common search term 'size' for Clothing",
+            "SEO: Missing common search term 'color' for Clothing",
+            "SEO: Missing common search term 'material' for Clothing",
+            "SEO: Missing common search term 'fit' for Clothing",
+            "SEO: Missing common search term 'style' for Clothing",
+            "SEO: Missing common search term 'occasion' for Clothing",
+            "SEO: Missing common search term 'care' for Clothing",
+            "Title: Contains spam-like patterns (excessive caps, multiple punctuation)",
+            "Description: Incomplete (missing: features, benefits, use_case)",
+            "Description: Lacks proper sentence structure",
+            "Description: Weak opening sentence"
+        ],
+        "suggestions": [
+            "Provide more detailed size",
+            "Expand description to 50-150 words for better SEO",
+            "Consider adding more descriptive adjectives for better engagement",
+            "Write 2-3 complete sentences describing the product",
+            "Consider mentioning 'brand' if applicable to improve searchability",
+            "Consider mentioning 'size' if applicable to improve searchability",
+            "Consider mentioning 'color' if applicable to improve searchability",
+            "Consider mentioning 'material' if applicable to improve searchability",
+            "Consider mentioning 'fit' if applicable to improve searchability",
+            "Consider mentioning 'style' if applicable to improve searchability",
+            "Consider mentioning 'occasion' if applicable to improve searchability",
+            "Consider mentioning 'care' if applicable to improve searchability",
+            "Consider adding more value-indicating terms for better positioning",
+            "Consider expanding title to 50-100 characters for better SEO",
+            "Remove spam indicators, use professional language",
+            "Add features, benefits, specifications, and use cases",
+            "Include more product attributes in description",
+            "Write in complete sentences, not just bullet points",
+            "Start with a strong, descriptive opening sentence",
+            "DPI information not available in image, ensure high-quality source",
+            "Image width acceptable but could be larger (current: 960px)",
+            "Image aspect ratio unusual (1.50), consider standard format"
+        ],
+        "processing_time": 55.89,
+        "product_type": "Clothing"
+    },
+    {
+        "sku": "SDR-PRF-684913",
+        "title": "Calvin Klein Euphoria Eau de Parfum for Women 50ml",
+        "description": "One of the world's leading lifestyle brands, Calvin Klein is synonymous with authentic modern minimalist style. Everything it creates —clothing, accessories, home design—becomes a timeless classic. The label's award-winning fragrances are no exception. Calvin Klein's portfolio of bold and iconic scents continues to redefine the world of perfume.*",
+        "image_path": "images/perfume-001.jpg",
+        "final_score": 83.72,
+        "max_score": 100,
+        "breakdown": {
+            "mandatory_fields": 100,
+            "standardization": 50,
+            "missing_values": 100,
+            "consistency": 100,
+            "seo_discoverability": 76.62,
+            "content_rules_compliance": 83.75,
+            "title_quality": 83.12,
+            "description_quality": 67.81,
+            "image_quality": null,
+            "attributes": 100,
+            "image_score": null
+        },
+        "image_score": null,
+        "image_breakdown": {},
+        "image_metadata": {},
+        "ai_suggestions": {
+            "content": {
+                "data_validation": {
+                    "available_elements": [
+                        "Brand",
+                        "Gender",
+                        "Product Type",
+                        "Key Feature",
+                        "Size"
+                    ],
+                    "available_count": 5,
+                    "missing_elements": [
+                        "Material",
+                        "Color"
+                    ],
+                    "can_build_valid_title": true,
+                    "reason": ""
+                },
+                "title_construction": {
+                    "elements_used": [
+                        "Brand",
+                        "Product Name",
+                        "Fragrance Type",
+                        "Gender",
+                        "Size"
+                    ],
+                    "values_used": [
+                        "Calvin Klein",
+                        "Euphoria",
+                        "Eau de Parfum",
+                        "Women's",
+                        "50ml"
+                    ],
+                    "element_count": 5,
+                    "construction_logic": "Built using the PERFUME element ordering: Brand, Product Name (extracted from original title), Fragrance Type (from Key Feature), Gender, and Size, all sourced from available ✅ data or original title as per extraction priority rules."
+                },
+                "improved_title": "Calvin Klein Euphoria Eau de Parfum Women's 50ml",
+                "improved_description": "Experience the captivating scent of Calvin Klein Euphoria Eau de Parfum for Women. This 50ml fragrance features a refreshing top note of Pomegranate, which gracefully transitions into a delicate middle note of Orchid. Designed specifically for women, this Eau de Parfum is known for its Long Lasting longevity, ensuring a memorable presence throughout the day. The convenient 50ml size makes it perfect for both daily wear and special occasions, embodying the authentic, modern minimalist style synonymous with the Calvin Klein brand.",
+                "seo_keywords": [
+                    "Calvin Klein Euphoria",
+                    "Eau de Parfum Women",
+                    "50ml perfume",
+                    "Pomegranate Orchid fragrance",
+                    "Calvin Klein perfume for women"
+                ],
+                "corrected_attributes": {},
+                "missing_attributes": {},
+                "improvements": [
+                    {
+                        "component": "attributes",
+                        "issue": "top_notes: 'Pomegranate' not recognized. Valid: Citrus, Bergamot, Lavender",
+                        "suggestion": "Update 'top_notes' to a recognized value from the valid list (e.g., Citrus, Bergamot, Lavender) if the product formulation allows, or add 'Pomegranate' to the system's valid list.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": true
+                    },
+                    {
+                        "component": "attributes",
+                        "issue": "middle_notes: 'Orchid' not recognized. Valid: Jasmine, Musk, Vanilla",
+                        "suggestion": "Update 'middle_notes' to a recognized value from the valid list (e.g., Jasmine, Musk, Vanilla) if the product formulation allows, or add 'Orchid' to the system's valid list.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": true
+                    },
+                    {
+                        "component": "title",
+                        "issue": "Title: Must contain at least one of: Short, Moderate, Long Lasting",
+                        "suggestion": "The improved title adheres to the strict rule of using only ✅ available elements. 'Long Lasting' is present in the product attributes but not in the ✅ list for title construction, therefore it cannot be included in the title. It has been incorporated into the improved description.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "title",
+                        "issue": "Title: Contains spam-like patterns (excessive caps, multiple punctuation)",
+                        "suggestion": "The improved title 'Calvin Klein Euphoria Eau de Parfum Women's 50ml' removes any spam-like patterns and adheres to standard capitalization.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "description",
+                        "issue": "Description: Must contain at least one of: Men, Women, Unisex",
+                        "suggestion": "The improved description now explicitly states 'for Women', addressing this requirement.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "description",
+                        "issue": "Description: Incomplete (missing: features, benefits, specifications, use_case)",
+                        "suggestion": "The improved description now includes key features (Pomegranate, Orchid, Long Lasting), benefits (captivating, memorable), specifications (Eau de Parfum, 50ml), and use-case (daily use or special occasions), all derived from available product data.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "SEO: Key attribute 'top_notes: Pomegranate' not mentioned in title/description",
+                        "suggestion": "The improved description now explicitly mentions 'top note of Pomegranate', addressing this SEO gap.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "SEO: Title missing key attributes (brand, model, color, size)",
+                        "suggestion": "The improved title 'Calvin Klein Euphoria Eau de Parfum Women's 50ml' now includes Brand ('Calvin Klein'), Product Name/Model ('Euphoria'), and Size ('50ml'). Color is not available.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    }
+                ],
+                "quality_score_prediction": 92.5,
+                "summary": "Significant improvements have been made to the product title and description by incorporating key factual data such as brand, product name, fragrance type, gender, size, and specific notes. The description is now more comprehensive, addressing missing features, benefits, and use cases. Data limitations prevented the inclusion of 'Long Lasting' in the title due to strict element sourcing rules, and attribute corrections require external validation for unrecognized notes.",
+                "hallucination_verification": {
+                    "passed": true,
+                    "invented_data": [],
+                    "all_data_sourced": true,
+                    "title_meets_minimum_length": true
+                }
+            },
+            "image": {}
+        },
+        "categorized_feedback": {
+            "attributes": {
+                "issues": [],
+                "suggestions": [
+                    "Include at least 2-3 key attributes in title",
+                    "Consider adding more attributes: ",
+                    "Include more product attributes in description"
+                ]
+            },
+            "title": {
+                "issues": [
+                    "Must contain at least one of: Short, Moderate, Long Lasting",
+                    "Contains spam-like patterns (excessive caps, multiple punctuation)"
+                ],
+                "suggestions": [
+                    "Add one of these keywords to Title: Short, Moderate, Long Lasting"
+                ]
+            },
+            "description": {
+                "issues": [
+                    "Must contain at least one of: Men, Women, Unisex",
+                    "Incomplete (missing: features, benefits, specifications, use_case)"
+                ],
+                "suggestions": [
+                    "Add one of these keywords to Description: Men, Women, Unisex",
+                    "Add features, benefits, specifications, and use cases"
+                ]
+            },
+            "seo": {
+                "issues": [
+                    "Key attribute 'top_notes: Pomegranate' not mentioned in title/description",
+                    "Title missing key attributes (brand, model, color, size)"
+                ],
+                "suggestions": []
+            },
+            "images": {
+                "issues": [
+                    "No image provided"
+                ],
+                "suggestions": [
+                    "Upload product image"
+                ]
+            },
+            "general": {
+                "issues": [
+                    "top_notes: 'Pomegranate' not recognized. Valid: Citrus, Bergamot, Lavender",
+                    "middle_notes: 'Orchid' not recognized. Valid: Jasmine, Musk, Vanilla"
+                ],
+                "suggestions": [
+                    "Change top_notes to one of: Citrus, Bergamot, Lavender",
+                    "Change middle_notes to one of: Jasmine, Musk, Vanilla",
+                    "Add 'top_notes: Pomegranate' to title or first line of description",
+                    "Consider adding more value-indicating terms for better positioning",
+                    "Remove spam indicators, use professional language",
+                    "Description readability is moderate, simplify complex sentences",
+                    "Break long description into paragraphs for readability",
+                    "Consider adding a subtle call-to-action or conclusion"
+                ]
+            }
+        },
+        "issues": [
+            "top_notes: 'Pomegranate' not recognized. Valid: Citrus, Bergamot, Lavender",
+            "middle_notes: 'Orchid' not recognized. Valid: Jasmine, Musk, Vanilla",
+            "SEO: Key attribute 'top_notes: Pomegranate' not mentioned in title/description",
+            "SEO: Title missing key attributes (brand, model, color, size)",
+            "Title: Must contain at least one of: Short, Moderate, Long Lasting",
+            "Description: Must contain at least one of: Men, Women, Unisex",
+            "Title: Contains spam-like patterns (excessive caps, multiple punctuation)",
+            "Description: Incomplete (missing: features, benefits, specifications, use_case)",
+            "No image provided"
+        ],
+        "suggestions": [
+            "Change top_notes to one of: Citrus, Bergamot, Lavender",
+            "Change middle_notes to one of: Jasmine, Musk, Vanilla",
+            "Add 'top_notes: Pomegranate' to title or first line of description",
+            "Consider adding more value-indicating terms for better positioning",
+            "Include at least 2-3 key attributes in title",
+            "Add one of these keywords to Title: Short, Moderate, Long Lasting",
+            "Add one of these keywords to Description: Men, Women, Unisex",
+            "Consider adding more attributes: ",
+            "Remove spam indicators, use professional language",
+            "Description readability is moderate, simplify complex sentences",
+            "Add features, benefits, specifications, and use cases",
+            "Include more product attributes in description",
+            "Break long description into paragraphs for readability",
+            "Consider adding a subtle call-to-action or conclusion",
+            "Upload product image"
+        ],
+        "processing_time": 60.38,
+        "product_type": "Perfumes"
+    },
+    {
+        "sku": "SDR-SKN-713846",
+        "title": "CeraVe Moisturising Cream with Ceramides for Dry to Very Dry Skin 50ml",
+        "description": "For dry to very dry skin, a rich cream moisturiser for face & body that delivers instant & long‑lasting hydration, for up to 24 hours. Also suitable for eczema prone skin. Enriched with Hyaluronic Acid, 3 Essential Ceramides, and formulated with CeraVe's patented MVE delivery technology, this cream hydrates & helps protect the skin's natural barrier. Developed with Dermatologists: All CeraVe skincare products have been Developed with Dermatologists.\n\nKey Ingredients: Enriched with Hyaluronic Acid & 3 Essential Ceramides. Formulated with a patented Multivesicular Emulsion (MVE) technology, to deliver controlled release of hydration helping skin stay hydrated for up to 24 hours.",
+        "image_path": "images/skincare-001.jpg",
+        "final_score": 83.77,
+        "max_score": 100,
+        "breakdown": {
+            "mandatory_fields": 100,
+            "standardization": 50,
+            "missing_values": 100,
+            "consistency": 100,
+            "seo_discoverability": 64.82,
+            "content_rules_compliance": 92.5,
+            "title_quality": 83.12,
+            "description_quality": 67.94,
+            "image_quality": null,
+            "attributes": 100,
+            "image_score": null
+        },
+        "image_score": null,
+        "image_breakdown": {},
+        "image_metadata": {},
+        "ai_suggestions": {
+            "content": {
+                "data_validation": {
+                    "available_elements": [
+                        "Brand",
+                        "Product Type",
+                        "Key Feature",
+                        "Size"
+                    ],
+                    "available_count": 4,
+                    "missing_elements": [
+                        "Gender",
+                        "Material",
+                        "Color"
+                    ],
+                    "can_build_valid_title": true,
+                    "reason": null
+                },
+                "title_construction": {
+                    "elements_used": [
+                        "Brand",
+                        "Product Type",
+                        "Key Feature",
+                        "Size"
+                    ],
+                    "values_used": [
+                        "CeraVe",
+                        "Skincare",
+                        "Ceramides",
+                        "50ml"
+                    ],
+                    "element_count": 4,
+                    "construction_logic": "The title was constructed using the available elements in the specified SKINCARE order: Brand, Product Type, Key Ingredient (mapped from Key Feature), and Size. All values are sourced directly from the ✅ available data inventory."
+                },
+                "improved_title": "CeraVe Skincare Ceramides 50ml",
+                "improved_description": "CeraVe Skincare offers a rich moisturising cream, expertly formulated for dry to very dry skin. This 50ml cream provides instant and long-lasting hydration for up to 24 hours, and is also suitable for eczema-prone skin. Enriched with essential Ceramides and Hyaluronic Acid, it helps to protect the skin's natural barrier. Developed with dermatologists, this CeraVe cream utilizes patented MVE delivery technology to ensure effective hydration.",
+                "seo_keywords": [
+                    "CeraVe",
+                    "Skincare",
+                    "Ceramides",
+                    "50ml",
+                    "Moisturising Cream",
+                    "Dry Skin",
+                    "Hyaluronic Acid",
+                    "Hydrating"
+                ],
+                "corrected_attributes": {},
+                "missing_attributes": {
+                    "gender": "Cannot suggest - no source data available",
+                    "material": "Cannot suggest - no source data available",
+                    "color": "Cannot suggest - no source data available"
+                },
+                "improvements": [
+                    {
+                        "component": "attributes",
+                        "issue": "skin_type: 'Dry to Very Dry' not recognized. Valid: Dry, Oily, Combination",
+                        "suggestion": "Update attribute definition to include 'Dry to Very Dry' as a valid option, or provide clear mapping rules for complex skin types. Cannot correct without losing information.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": true
+                    },
+                    {
+                        "component": "attributes",
+                        "issue": "key_ingredient: 'Ceramides & Hyaluronic Acid' not recognized. Valid: Vitamin C, Hyaluronic Acid, Niacinamide",
+                        "suggestion": "Update attribute definition to include 'Ceramides' or 'Ceramides & Hyaluronic Acid' as a valid key ingredient, or allow multiple key ingredients. Cannot correct without losing information.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": true
+                    },
+                    {
+                        "component": "title",
+                        "issue": "Title: Contains spam-like patterns (excessive caps, multiple punctuation)",
+                        "suggestion": "The improved title has been rewritten to remove spam-like patterns and adhere to standard capitalization.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "description",
+                        "issue": "Description: ~16 potential spelling errors",
+                        "suggestion": "Review and correct all spelling errors in the description.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "description",
+                        "issue": "Description: Very difficult to read (complex sentences)",
+                        "suggestion": "The improved description has been simplified with clearer sentence structure for better readability.",
+                        "priority": "medium",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "SEO: Key attribute 'key_ingredient: Ceramides & Hyaluronic Acid' not mentioned in title/description",
+                        "suggestion": "The improved title and description now explicitly mention 'Ceramides' and 'Hyaluronic Acid' for better SEO.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "SEO: No descriptive/quality adjectives found",
+                        "suggestion": "Add relevant descriptive adjectives (e.g., 'effective', 'gentle') if supported by product data or brand guidelines. Cannot invent without data.",
+                        "priority": "medium",
+                        "confidence": "high",
+                        "requires_external_data": true
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "SEO: No high-value search terms found (e.g., 'premium', 'durable', 'best')",
+                        "suggestion": "Incorporate high-value search terms if applicable and supported by product positioning. Cannot invent without data.",
+                        "priority": "medium",
+                        "confidence": "high",
+                        "requires_external_data": true
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "SEO: Title missing key attributes (brand, model, color, size)",
+                        "suggestion": "The improved title now includes the brand, key feature (Ceramides), and size for improved SEO.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    }
+                ],
+                "quality_score_prediction": 92.5,
+                "summary": "The product data has been enhanced with a clear, concise title incorporating key brand, product type, ingredient, and size information. The description has been rewritten for improved readability and SEO, ensuring all factual details are present. Attribute corrections are limited by the absence of valid mapping options for existing data, highlighting a need for updated attribute definitions.",
+                "hallucination_verification": {
+                    "passed": true,
+                    "invented_data": [],
+                    "all_data_sourced": true,
+                    "title_meets_minimum_length": true
+                }
+            },
+            "image": {}
+        },
+        "categorized_feedback": {
+            "attributes": {
+                "issues": [],
+                "suggestions": [
+                    "Include at least 2-3 key attributes in title",
+                    "Consider adding more attributes: ",
+                    "Include more product attributes in description"
+                ]
+            },
+            "title": {
+                "issues": [
+                    "Must contain at least one of: Yes, No",
+                    "Contains spam-like patterns (excessive caps, multiple punctuation)"
+                ],
+                "suggestions": [
+                    "Add one of these keywords to Title: Yes, No"
+                ]
+            },
+            "description": {
+                "issues": [
+                    "~16 potential spelling errors",
+                    "Very difficult to read (complex sentences)"
+                ],
+                "suggestions": []
+            },
+            "seo": {
+                "issues": [
+                    "Key attribute 'key_ingredient: Ceramides & Hyaluronic Acid' not mentioned in title/description",
+                    "No descriptive/quality adjectives found",
+                    "No high-value search terms found (e.g., 'premium', 'durable', 'best')",
+                    "Title missing key attributes (brand, model, color, size)"
+                ],
+                "suggestions": [
+                    "Add 1-2 quality/value indicators to attract more searches"
+                ]
+            },
+            "images": {
+                "issues": [
+                    "No image provided"
+                ],
+                "suggestions": [
+                    "Upload product image"
+                ]
+            },
+            "general": {
+                "issues": [
+                    "skin_type: 'Dry to Very Dry' not recognized. Valid: Dry, Oily, Combination",
+                    "key_ingredient: 'Ceramides & Hyaluronic Acid' not recognized. Valid: Vitamin C, Hyaluronic Acid, Niacinamide"
+                ],
+                "suggestions": [
+                    "Change skin_type to one of: Dry, Oily, Combination",
+                    "Change key_ingredient to one of: Vitamin C, Hyaluronic Acid, Niacinamide",
+                    "Add 'key_ingredient: Ceramides & Hyaluronic Acid' to title or first line of description",
+                    "Add descriptive words like 'premium', 'durable', 'comfortable' to enhance appeal",
+                    "Remove spam indicators, use professional language",
+                    "Run spell-check and correct misspellings",
+                    "Description has significant overlap with title, add unique information",
+                    "Simplify language, use shorter sentences and common words",
+                    "Consider adding: features, specifications",
+                    "Consider adding a subtle call-to-action or conclusion"
+                ]
+            }
+        },
+        "issues": [
+            "skin_type: 'Dry to Very Dry' not recognized. Valid: Dry, Oily, Combination",
+            "key_ingredient: 'Ceramides & Hyaluronic Acid' not recognized. Valid: Vitamin C, Hyaluronic Acid, Niacinamide",
+            "SEO: Key attribute 'key_ingredient: Ceramides & Hyaluronic Acid' not mentioned in title/description",
+            "SEO: No descriptive/quality adjectives found",
+            "SEO: No high-value search terms found (e.g., 'premium', 'durable', 'best')",
+            "SEO: Title missing key attributes (brand, model, color, size)",
+            "Title: Must contain at least one of: Yes, No",
+            "Title: Contains spam-like patterns (excessive caps, multiple punctuation)",
+            "Description: ~16 potential spelling errors",
+            "Description: Very difficult to read (complex sentences)",
+            "No image provided"
+        ],
+        "suggestions": [
+            "Change skin_type to one of: Dry, Oily, Combination",
+            "Change key_ingredient to one of: Vitamin C, Hyaluronic Acid, Niacinamide",
+            "Add 'key_ingredient: Ceramides & Hyaluronic Acid' to title or first line of description",
+            "Add descriptive words like 'premium', 'durable', 'comfortable' to enhance appeal",
+            "Add 1-2 quality/value indicators to attract more searches",
+            "Include at least 2-3 key attributes in title",
+            "Add one of these keywords to Title: Yes, No",
+            "Consider adding more attributes: ",
+            "Remove spam indicators, use professional language",
+            "Run spell-check and correct misspellings",
+            "Description has significant overlap with title, add unique information",
+            "Simplify language, use shorter sentences and common words",
+            "Consider adding: features, specifications",
+            "Include more product attributes in description",
+            "Consider adding a subtle call-to-action or conclusion",
+            "Upload product image"
+        ],
+        "processing_time": 114.09,
+        "product_type": "Skincare"
+    },
+    {
+        "sku": "SDR-SKN-259430",
+        "title": "CeraVe Resurfacing Retinol Serum with Ceramides & Niacinamide for Blemish‑Prone Skin 30ml",
+        "description": "Resurfacing Retinol Serum designed to reduce the appearance of post-acne marks by exfoliating & brightening the skin, while protecting the skin’s natural barrier. Suitable for blemish-prone skin, sensitive and younger skin.\n\n: All CeraVe products have been Developed with Dermatologists.\n\nSpecifically Formulated for Blenish Prone Skin: This resurfacing retinol serum gently exfoliates to help fade the appearance of post-acne marks and even skin tone, while protecting the skin’s natural barrier.\n\nActive Ingredients: Containing Encapsulated Retinol & Liquorice Root Extract, this CeraVe retinol serum exfoliates and brightens With Niacinamide & 3 Essential Ceramides, the product helps protect the skin barrier",
+        "image_path": "images/skincare-002.jpg",
+        "final_score": 84.93,
+        "max_score": 100,
+        "breakdown": {
+            "mandatory_fields": 100,
+            "standardization": 50,
+            "missing_values": 100,
+            "consistency": 100,
+            "seo_discoverability": 64.49,
+            "content_rules_compliance": 100,
+            "title_quality": 83.12,
+            "description_quality": 70.94,
+            "image_quality": null,
+            "attributes": 100,
+            "image_score": null
+        },
+        "image_score": null,
+        "image_breakdown": {},
+        "image_metadata": {},
+        "ai_suggestions": {
+            "content": {
+                "data_validation": {
+                    "available_elements": [
+                        "Brand",
+                        "Product Type",
+                        "Key Feature",
+                        "Size"
+                    ],
+                    "available_count": 4,
+                    "missing_elements": [
+                        "Gender",
+                        "Material",
+                        "Color"
+                    ],
+                    "can_build_valid_title": true,
+                    "reason": ""
+                },
+                "title_construction": {
+                    "elements_used": [
+                        "Brand",
+                        "Product Type",
+                        "Key Feature",
+                        "Size"
+                    ],
+                    "values_used": [
+                        "CeraVe",
+                        "Skincare",
+                        "Resurfacing Brightening",
+                        "30ml"
+                    ],
+                    "element_count": 4,
+                    "construction_logic": "The title was built using the available elements in the specified order for SKINCARE: Brand, Product Type, Key Feature (combining 'Resurfacing' and 'Brightening'), and Size. All values are sourced directly from the 'EXTRACTED DATA INVENTORY'."
+                },
+                "improved_title": "CeraVe Skincare Resurfacing Brightening 30ml",
+                "improved_description": "CeraVe Skincare Resurfacing Retinol Serum, 30ml, is expertly formulated to target blemish-prone skin. This serum works to reduce the appearance of post-acne marks through its resurfacing and brightening properties. Developed with dermatologists, it gently exfoliates the skin to help even tone while protecting the skin's natural barrier. Key ingredients include Retinol and Niacinamide, known for their skin-enhancing benefits.",
+                "seo_keywords": [
+                    "CeraVe",
+                    "Skincare",
+                    "Resurfacing Serum",
+                    "Brightening Serum",
+                    "Retinol",
+                    "Niacinamide",
+                    "Blemish-Prone Skin",
+                    "Post-Acne Marks",
+                    "30ml"
+                ],
+                "corrected_attributes": {},
+                "missing_attributes": {},
+                "improvements": [
+                    {
+                        "component": "attributes",
+                        "issue": "skin_type: 'Blemish-Prone' not recognized by validator",
+                        "suggestion": "Update validator's accepted values for 'skin_type' to include 'Blemish-Prone' or map it to an existing valid type if appropriate. The product data is factual.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": true
+                    },
+                    {
+                        "component": "attributes",
+                        "issue": "key_ingredient: 'Retinol & Niacinamide' not recognized by validator",
+                        "suggestion": "Update validator's accepted values for 'key_ingredient' to include 'Retinol' and allow for multiple ingredients, or map 'Retinol & Niacinamide' to 'Niacinamide' if Retinol cannot be added. The product data is factual.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": true
+                    },
+                    {
+                        "component": "title",
+                        "issue": "Title contains spam-like patterns (excessive caps, multiple punctuation)",
+                        "suggestion": "Improved title generated: 'CeraVe Skincare Resurfacing Brightening 30ml' removes excessive punctuation and ensures proper capitalization.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "description",
+                        "issue": "~16 potential spelling errors",
+                        "suggestion": "Review and correct spelling errors in the original description (e.g., 'Blenish' should be 'Blemish').",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "description",
+                        "issue": "Very difficult to read (complex sentences)",
+                        "suggestion": "Improved description generated with clearer, more concise sentences for better readability.",
+                        "priority": "medium",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "Key attribute 'key_ingredient: Retinol & Niacinamide' not mentioned in title/description",
+                        "suggestion": "The improved description now explicitly mentions 'Retinol and Niacinamide'. The improved title focuses on the primary features as per rules.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "No descriptive/quality adjectives found",
+                        "suggestion": "Consider adding descriptive adjectives like 'effective' or 'gentle' if supported by product claims, but this requires external data verification.",
+                        "priority": "medium",
+                        "confidence": "medium",
+                        "requires_external_data": true
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "No high-value search terms found (e.g., 'premium', 'durable', 'best')",
+                        "suggestion": "High-value search terms like 'premium' or 'best' are not supported by the provided data and should not be invented.",
+                        "priority": "low",
+                        "confidence": "high",
+                        "requires_external_data": true
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "Title missing key attributes (brand, model, color, size)",
+                        "suggestion": "Improved title now includes Brand, Product Type, Key Feature, and Size, addressing the missing attributes based on available data. Color and model are not available.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    }
+                ],
+                "quality_score_prediction": 92.5,
+                "summary": "The product data has been enhanced with an improved title and description, incorporating all available factual elements like brand, product type, key features, and size. Key attributes such as 'skin_type' and 'key_ingredient' were identified as factual but not recognized by the current validation rules, indicating a need for validator updates rather than data correction. SEO has been improved by including relevant keywords and addressing missing attributes in the title.",
+                "hallucination_verification": {
+                    "passed": true,
+                    "invented_data": [],
+                    "all_data_sourced": true,
+                    "title_meets_minimum_length": true
+                }
+            },
+            "image": {}
+        },
+        "categorized_feedback": {
+            "attributes": {
+                "issues": [],
+                "suggestions": [
+                    "Include at least 2-3 key attributes in title",
+                    "Consider adding more attributes: ",
+                    "Include more product attributes in description"
+                ]
+            },
+            "title": {
+                "issues": [
+                    "Contains spam-like patterns (excessive caps, multiple punctuation)"
+                ],
+                "suggestions": []
+            },
+            "description": {
+                "issues": [
+                    "~16 potential spelling errors",
+                    "Very difficult to read (complex sentences)"
+                ],
+                "suggestions": []
+            },
+            "seo": {
+                "issues": [
+                    "Key attribute 'key_ingredient: Retinol & Niacinamide' not mentioned in title/description",
+                    "No descriptive/quality adjectives found",
+                    "No high-value search terms found (e.g., 'premium', 'durable', 'best')",
+                    "Title missing key attributes (brand, model, color, size)"
+                ],
+                "suggestions": [
+                    "Add 1-2 quality/value indicators to attract more searches"
+                ]
+            },
+            "images": {
+                "issues": [
+                    "No image provided"
+                ],
+                "suggestions": [
+                    "Upload product image"
+                ]
+            },
+            "general": {
+                "issues": [
+                    "skin_type: 'Blemish-Prone' not recognized. Valid: Dry, Oily, Combination",
+                    "key_ingredient: 'Retinol & Niacinamide' not recognized. Valid: Vitamin C, Hyaluronic Acid, Niacinamide"
+                ],
+                "suggestions": [
+                    "Change skin_type to one of: Dry, Oily, Combination",
+                    "Change key_ingredient to one of: Vitamin C, Hyaluronic Acid, Niacinamide",
+                    "Add 'key_ingredient: Retinol & Niacinamide' to title or first line of description",
+                    "Add descriptive words like 'premium', 'durable', 'comfortable' to enhance appeal",
+                    "Remove spam indicators, use professional language",
+                    "Run spell-check and correct misspellings",
+                    "Description has significant overlap with title, add unique information",
+                    "Simplify language, use shorter sentences and common words",
+                    "Consider adding a subtle call-to-action or conclusion"
+                ]
+            }
+        },
+        "issues": [
+            "skin_type: 'Blemish-Prone' not recognized. Valid: Dry, Oily, Combination",
+            "key_ingredient: 'Retinol & Niacinamide' not recognized. Valid: Vitamin C, Hyaluronic Acid, Niacinamide",
+            "SEO: Key attribute 'key_ingredient: Retinol & Niacinamide' not mentioned in title/description",
+            "SEO: No descriptive/quality adjectives found",
+            "SEO: No high-value search terms found (e.g., 'premium', 'durable', 'best')",
+            "SEO: Title missing key attributes (brand, model, color, size)",
+            "Title: Contains spam-like patterns (excessive caps, multiple punctuation)",
+            "Description: ~16 potential spelling errors",
+            "Description: Very difficult to read (complex sentences)",
+            "No image provided"
+        ],
+        "suggestions": [
+            "Change skin_type to one of: Dry, Oily, Combination",
+            "Change key_ingredient to one of: Vitamin C, Hyaluronic Acid, Niacinamide",
+            "Add 'key_ingredient: Retinol & Niacinamide' to title or first line of description",
+            "Add descriptive words like 'premium', 'durable', 'comfortable' to enhance appeal",
+            "Add 1-2 quality/value indicators to attract more searches",
+            "Include at least 2-3 key attributes in title",
+            "Consider adding more attributes: ",
+            "Remove spam indicators, use professional language",
+            "Run spell-check and correct misspellings",
+            "Description has significant overlap with title, add unique information",
+            "Simplify language, use shorter sentences and common words",
+            "Include more product attributes in description",
+            "Consider adding a subtle call-to-action or conclusion",
+            "Upload product image"
+        ],
+        "processing_time": 115.64,
+        "product_type": "Skincare"
+    },
+    {
+        "sku": "SDR-PRF-175624",
+        "title": "Police To Be Woman Eau de Parfum 40ml",
+        "description": "This sexy fragrance oozes a magnetic attraction with fruity clementine and lime delicately blended with sensual white flowers all wrapped up in sweet candies.",
+        "image_path": "images/perfume-002.jpg",
+        "final_score": 82.66,
+        "max_score": 100,
+        "breakdown": {
+            "mandatory_fields": 100,
+            "standardization": 50,
+            "missing_values": 100,
+            "consistency": 100,
+            "seo_discoverability": 78.88,
+            "content_rules_compliance": 92.5,
+            "title_quality": 79.88,
+            "description_quality": 67,
+            "image_quality": null,
+            "attributes": 100,
+            "image_score": null
+        },
+        "image_score": null,
+        "image_breakdown": {},
+        "image_metadata": {},
+        "ai_suggestions": {
+            "content": {
+                "data_validation": {
+                    "available_elements": [
+                        "Brand",
+                        "Product Type",
+                        "Key Feature",
+                        "Size"
+                    ],
+                    "available_count": 4,
+                    "missing_elements": [
+                        "Gender",
+                        "Material",
+                        "Color"
+                    ],
+                    "can_build_valid_title": true,
+                    "reason": null
+                },
+                "title_construction": {
+                    "elements_used": [
+                        "Brand",
+                        "Product Type",
+                        "Key Feature",
+                        "Size"
+                    ],
+                    "values_used": [
+                        "Police",
+                        "Perfumes",
+                        "Eau De Parfum",
+                        "40ml"
+                    ],
+                    "element_count": 4,
+                    "construction_logic": "The title was constructed using the available ✅ elements following the PERFUME ordering rule as closely as possible: Brand (Police), followed by Product Type (Perfumes), then Key Feature (Eau De Parfum, which aligns with Fragrance Type), and finally Size (40ml). The 'Product Name' element from the PERFUME rule was omitted as 'To Be Woman' was not an approved ✅ element."
+                },
+                "improved_title": "Police Perfumes Eau De Parfum 40ml",
+                "improved_description": "Police To Be Woman Eau de Parfum 40ml offers a captivating fragrance experience. This alluring scent features fruity clementine as a vibrant top note, leading into a heart of sensual white flowers. As an Eau de Parfum, it provides a moderate longevity, ensuring a lasting impression. The 40ml size is perfect for everyday use or travel, embodying magnetic attraction with its delicate blend of notes.",
+                "seo_keywords": [
+                    "Police perfume",
+                    "Eau de Parfum 40ml",
+                    "Clementine fragrance",
+                    "White Flowers scent",
+                    "moderate longevity perfume",
+                    "Police fragrance"
+                ],
+                "corrected_attributes": {},
+                "missing_attributes": {
+                    "gender": "Cannot suggest - no source data available",
+                    "material": "Cannot suggest - no source data available",
+                    "color": "Cannot suggest - no source data available"
+                },
+                "improvements": [
+                    {
+                        "component": "attributes",
+                        "issue": "top_notes: 'Clementine' not recognized. Valid: Citrus, Bergamot, Lavender",
+                        "suggestion": "Update 'top_notes' to a recognized value like 'Citrus' if 'Clementine' is a type of citrus, or add 'Clementine' to the valid list. Requires external data/category rule update.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": true
+                    },
+                    {
+                        "component": "attributes",
+                        "issue": "middle_notes: 'White Flowers' not recognized. Valid: Jasmine, Musk, Vanilla",
+                        "suggestion": "Update 'middle_notes' to a recognized value like 'Jasmine' if 'White Flowers' refers to a specific flower, or add 'White Flowers' to the valid list. Requires external data/category rule update.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": true
+                    },
+                    {
+                        "component": "title",
+                        "issue": "Title: Must contain at least one of: Short, Moderate, Long Lasting",
+                        "suggestion": "The improved title 'Police Perfumes Eau De Parfum 40ml' does not explicitly contain a longevity term. While 'Eau De Parfum' implies moderate longevity, adding 'Moderate' would require it to be an approved ✅ element for the title. The original attributes include 'longevity': 'Moderate'. Consider adding 'Moderate' to the title if it becomes an approved ✅ element.",
+                        "priority": "medium",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "title",
+                        "issue": "Title: Contains spam-like patterns (excessive caps, multiple punctuation)",
+                        "suggestion": "The improved title 'Police Perfumes Eau De Parfum 40ml' avoids spam-like patterns, excessive capitalization, and multiple punctuation.",
+                        "priority": "low",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "description",
+                        "issue": "Description: Incomplete (missing: features, benefits, specifications, use_case)",
+                        "suggestion": "The improved description incorporates available features (clementine, white flowers, Eau de Parfum, 40ml) and benefits (magnetic attraction, lasting impression). Further details would require more source data.",
+                        "priority": "medium",
+                        "confidence": "high",
+                        "requires_external_data": true
+                    },
+                    {
+                        "component": "description",
+                        "issue": "Description: Lacks proper sentence structure",
+                        "suggestion": "The improved description uses complete sentences and prose to enhance readability and structure.",
+                        "priority": "low",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "SEO: No descriptive/quality adjectives found",
+                        "suggestion": "The improved description uses adjectives like 'captivating', 'alluring', 'vibrant', 'sensual', 'lasting'. Further unique adjectives would require more source data.",
+                        "priority": "medium",
+                        "confidence": "high",
+                        "requires_external_data": true
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "SEO: Description lacks complete sentences (use prose, not just bullet points)",
+                        "suggestion": "The improved description is written in complete sentences and prose.",
+                        "priority": "low",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "SEO: No high-value search terms found (e.g., 'premium', 'durable', 'best')",
+                        "suggestion": "High-value search terms like 'premium' or 'best' cannot be added without explicit source data to support them. The improved title and description leverage existing high-value terms like 'Police', 'Eau de Parfum', and specific notes.",
+                        "priority": "medium",
+                        "confidence": "high",
+                        "requires_external_data": true
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "SEO: Title missing key attributes (brand, model, color, size)",
+                        "suggestion": "The improved title 'Police Perfumes Eau De Parfum 40ml' includes Brand ('Police'), Product Type ('Perfumes'), Key Feature ('Eau De Parfum'), and Size ('40ml'). 'Model' (Product Name) and 'Color' are not available as approved ✅ elements for title construction.",
+                        "priority": "low",
+                        "confidence": "high",
+                        "requires_external_data": true
+                    }
+                ],
+                "quality_score_prediction": 94,
+                "summary": "The product data has been enhanced with a more descriptive title and an improved description, leveraging all available factual information. Key attributes like brand, product type, key feature, and size are now prominently featured. While several SEO and attribute issues were addressed, further improvements are limited by the absence of additional specific product details such as gender, specific notes, or explicit quality descriptors.",
+                "hallucination_verification": {
+                    "passed": true,
+                    "invented_data": [],
+                    "all_data_sourced": true,
+                    "title_meets_minimum_length": true
+                }
+            },
+            "image": {}
+        },
+        "categorized_feedback": {
+            "attributes": {
+                "issues": [],
+                "suggestions": [
+                    "Include at least 2-3 key attributes in title",
+                    "Consider adding more attributes: ",
+                    "Include more product attributes in description"
+                ]
+            },
+            "title": {
+                "issues": [
+                    "Must contain at least one of: Short, Moderate, Long Lasting",
+                    "Contains spam-like patterns (excessive caps, multiple punctuation)"
+                ],
+                "suggestions": [
+                    "Add one of these keywords to Title: Short, Moderate, Long Lasting"
+                ]
+            },
+            "description": {
+                "issues": [
+                    "Incomplete (missing: features, benefits, specifications, use_case)",
+                    "Lacks proper sentence structure"
+                ],
+                "suggestions": [
+                    "Add features, benefits, specifications, and use cases"
+                ]
+            },
+            "seo": {
+                "issues": [
+                    "No descriptive/quality adjectives found",
+                    "Description lacks complete sentences (use prose, not just bullet points)",
+                    "No high-value search terms found (e.g., 'premium', 'durable', 'best')",
+                    "Title missing key attributes (brand, model, color, size)"
+                ],
+                "suggestions": [
+                    "Add 1-2 quality/value indicators to attract more searches"
+                ]
+            },
+            "images": {
+                "issues": [
+                    "No image provided"
+                ],
+                "suggestions": [
+                    "Upload product image"
+                ]
+            },
+            "general": {
+                "issues": [
+                    "top_notes: 'Clementine' not recognized. Valid: Citrus, Bergamot, Lavender",
+                    "middle_notes: 'White Flowers' not recognized. Valid: Jasmine, Musk, Vanilla"
+                ],
+                "suggestions": [
+                    "Change top_notes to one of: Citrus, Bergamot, Lavender",
+                    "Change middle_notes to one of: Jasmine, Musk, Vanilla",
+                    "Add descriptive words like 'premium', 'durable', 'comfortable' to enhance appeal",
+                    "Write 2-3 complete sentences describing the product",
+                    "Consider expanding title to 50-100 characters for better SEO",
+                    "Remove spam indicators, use professional language",
+                    "Description readability is moderate, simplify complex sentences",
+                    "Write in complete sentences, not just bullet points"
+                ]
+            }
+        },
+        "issues": [
+            "top_notes: 'Clementine' not recognized. Valid: Citrus, Bergamot, Lavender",
+            "middle_notes: 'White Flowers' not recognized. Valid: Jasmine, Musk, Vanilla",
+            "SEO: No descriptive/quality adjectives found",
+            "SEO: Description lacks complete sentences (use prose, not just bullet points)",
+            "SEO: No high-value search terms found (e.g., 'premium', 'durable', 'best')",
+            "SEO: Title missing key attributes (brand, model, color, size)",
+            "Title: Must contain at least one of: Short, Moderate, Long Lasting",
+            "Title: Contains spam-like patterns (excessive caps, multiple punctuation)",
+            "Description: Incomplete (missing: features, benefits, specifications, use_case)",
+            "Description: Lacks proper sentence structure",
+            "No image provided"
+        ],
+        "suggestions": [
+            "Change top_notes to one of: Citrus, Bergamot, Lavender",
+            "Change middle_notes to one of: Jasmine, Musk, Vanilla",
+            "Add descriptive words like 'premium', 'durable', 'comfortable' to enhance appeal",
+            "Write 2-3 complete sentences describing the product",
+            "Add 1-2 quality/value indicators to attract more searches",
+            "Include at least 2-3 key attributes in title",
+            "Add one of these keywords to Title: Short, Moderate, Long Lasting",
+            "Consider expanding title to 50-100 characters for better SEO",
+            "Consider adding more attributes: ",
+            "Remove spam indicators, use professional language",
+            "Description readability is moderate, simplify complex sentences",
+            "Add features, benefits, specifications, and use cases",
+            "Include more product attributes in description",
+            "Write in complete sentences, not just bullet points",
+            "Upload product image"
+        ],
+        "processing_time": 61.87,
+        "product_type": "Perfumes"
+    },
+    {
+        "sku": "ELEC-001",
+        "title": "Apple MacBook Pro 14-inch",
+        "description": "Latest Apple MacBook Pro with M3 chip.",
+        "image_path": "images/CLTH-001.jpg",
+        "final_score": 80.21,
+        "max_score": 100,
+        "breakdown": {
+            "mandatory_fields": 100,
+            "standardization": 100,
+            "missing_values": 100,
+            "consistency": 50,
+            "seo_discoverability": 61.38,
+            "content_rules_compliance": 100,
+            "title_quality": 74.38,
+            "description_quality": 63.92,
+            "image_quality": null,
+            "attributes": 100,
+            "image_score": 87.5
+        },
+        "image_score": 87.5,
+        "image_breakdown": {
+            "resolution": 70,
+            "clarity": 100,
+            "background": 90,
+            "size": 80,
+            "format": 100
+        },
+        "image_metadata": {
+            "width": 960,
+            "height": 640,
+            "dpi": [
+                null,
+                null
+            ],
+            "format": "JPG",
+            "mode": "RGB",
+            "file_size_mb": 0.11,
+            "dominant_color_rgb": [
+                252,
+                252,
+                251
+            ],
+            "dominant_color_hex": "#fcfcfb",
+            "dominant_color_name": "snow",
+            "background_coverage": 47.63
+        },
+        "ai_suggestions": {
+            "content": {
+                "data_validation": {
+                    "available_elements": [
+                        "Brand",
+                        "Product Type",
+                        "Color"
+                    ],
+                    "available_count": 3,
+                    "missing_elements": [
+                        "Gender",
+                        "Key Feature",
+                        "Material",
+                        "Size"
+                    ],
+                    "can_build_valid_title": true,
+                    "reason": ""
+                },
+                "title_construction": {
+                    "elements_used": [
+                        "Brand",
+                        "Product Type",
+                        "Color"
+                    ],
+                    "values_used": [
+                        "Apple",
+                        "Electronics",
+                        "Gray"
+                    ],
+                    "element_count": 3,
+                    "construction_logic": "The title was constructed using the available 'Brand', 'Product Type', and 'Color' elements in that specific order, adhering strictly to the instruction to only use ✅ marked values from the extracted data inventory."
+                },
+                "improved_title": "Apple Electronics Gray",
+                "improved_description": "This is a high-quality Apple Electronics product, presented in a sleek Gray finish. As a reliable electronic device from the renowned Apple brand, it offers consistent performance and a sophisticated aesthetic. The modern Gray color provides a versatile look, suitable for various environments. This Apple Electronics item is designed to meet contemporary needs and comes with a 1 Year warranty, ensuring peace of mind for the user.",
+                "seo_keywords": [
+                    "Apple",
+                    "Electronics",
+                    "Gray",
+                    "Apple Electronics",
+                    "Gray Electronics",
+                    "Electronic device",
+                    "Apple brand"
+                ],
+                "corrected_attributes": {},
+                "missing_attributes": {
+                    "Gender": "Cannot suggest - no source data available",
+                    "Key Feature": "Cannot suggest - no source data available",
+                    "Material": "Cannot suggest - no source data available",
+                    "Size": "Cannot suggest - no source data available"
+                },
+                "improvements": [
+                    {
+                        "component": "attributes",
+                        "issue": "'Color': 'Gray' not mentioned in title/description",
+                        "suggestion": "The improved title and description now explicitly mention the 'Gray' color.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "title",
+                        "issue": "Title: Contains spam-like patterns (excessive caps, multiple punctuation)",
+                        "suggestion": "The improved title has been reconstructed using a standardized format, avoiding any spam-like patterns or excessive punctuation.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "description",
+                        "issue": "SEO: Description too short (7 words, recommended 50+)",
+                        "suggestion": "The description has been expanded to meet the recommended length of 50-150 words, utilizing all available product data (Brand, Product Type, Color, Warranty).",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "description",
+                        "issue": "SEO: No descriptive/quality adjectives found",
+                        "suggestion": "Descriptive adjectives such as 'sleek' and 'renowned' have been incorporated into the description based on available product attributes.",
+                        "priority": "medium",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "description",
+                        "issue": "SEO: Description lacks complete sentences (use prose, not just bullet points)",
+                        "suggestion": "The description has been rewritten into complete, flowing sentences to improve readability and SEO quality.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "SEO: Missing common search term 'brand' for Electronics",
+                        "suggestion": "The brand 'Apple' is now prominently featured in the improved title, description, and SEO keywords.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "SEO: Missing common search term 'model' for Electronics",
+                        "suggestion": "Cannot suggest a specific 'model' as no model name (e.g., MacBook Pro) is available in the ✅ extracted data inventory. This requires external data.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": true
+                    }
+                ],
+                "quality_score_prediction": 93.7,
+                "summary": "The product data has been improved by generating a standardized title and an expanded, prose-based description, incorporating all available factual elements like Brand, Product Type, Color, and Warranty. SEO has been enhanced by including relevant keywords and addressing description length and sentence structure. However, the improvements are significantly limited by the lack of specific product details such as model and key features in the provided source data.",
+                "hallucination_verification": {
+                    "passed": true,
+                    "invented_data": [],
+                    "all_data_sourced": true,
+                    "title_meets_minimum_length": true
+                }
+            },
+            "image": {
+                "note": "No improvements needed"
+            }
+        },
+        "categorized_feedback": {
+            "attributes": {
+                "issues": [],
+                "suggestions": [
+                    "Include at least 2-3 key attributes in title",
+                    "Consider adding more attributes: color: Gray",
+                    "Include more product attributes in description"
+                ]
+            },
+            "title": {
+                "issues": [
+                    "Contains spam-like patterns (excessive caps, multiple punctuation)"
+                ],
+                "suggestions": [
+                    "Expand title to include key attributes (brand, model, key features)"
+                ]
+            },
+            "description": {
+                "issues": [
+                    "Incomplete (missing: features, benefits, specifications, use_case)",
+                    "Lacks proper sentence structure"
+                ],
+                "suggestions": [
+                    "Expand description to 50-150 words for better SEO",
+                    "Add features, benefits, specifications, and use cases"
+                ]
+            },
+            "seo": {
+                "issues": [
+                    "Description too short (7 words, recommended 50+)",
+                    "No descriptive/quality adjectives found",
+                    "Description lacks complete sentences (use prose, not just bullet points)",
+                    "Missing common search term 'brand' for Electronics",
+                    "Missing common search term 'model' for Electronics",
+                    "Missing common search term 'warranty' for Electronics",
+                    "Missing common search term 'condition' for Electronics",
+                    "Missing common search term 'specs' for Electronics",
+                    "Missing common search term 'features' for Electronics",
+                    "Missing common search term 'technology' for Electronics",
+                    "No high-value search terms found (e.g., 'premium', 'durable', 'best')",
+                    "Title too short (25 chars, recommended 50-100)",
+                    "Title missing key attributes (brand, model, color, size)"
+                ],
+                "suggestions": [
+                    "Consider mentioning 'brand' if applicable to improve searchability",
+                    "Consider mentioning 'model' if applicable to improve searchability",
+                    "Consider mentioning 'warranty' if applicable to improve searchability",
+                    "Consider mentioning 'condition' if applicable to improve searchability",
+                    "Consider mentioning 'specs' if applicable to improve searchability",
+                    "Consider mentioning 'features' if applicable to improve searchability",
+                    "Consider mentioning 'technology' if applicable to improve searchability",
+                    "Add 1-2 quality/value indicators to attract more searches"
+                ]
+            },
+            "images": {
+                "issues": [],
+                "suggestions": [
+                    "DPI information not available in image, ensure high-quality source",
+                    "Image width acceptable but could be larger (current: 960px)",
+                    "Image aspect ratio unusual (1.50), consider standard format"
+                ]
+            },
+            "general": {
+                "issues": [
+                    "'Color': 'Gray' not mentioned in title/description"
+                ],
+                "suggestions": [
+                    "Add descriptive words like 'premium', 'durable', 'comfortable' to enhance appeal",
+                    "Write 2-3 complete sentences describing the product",
+                    "Consider expanding title to 50-100 characters for better SEO",
+                    "Remove spam indicators, use professional language",
+                    "Title too few words, expand with descriptive terms",
+                    "Description has significant overlap with title, add unique information",
+                    "Write in complete sentences, not just bullet points"
+                ]
+            }
+        },
+        "issues": [
+            "'Color': 'Gray' not mentioned in title/description",
+            "SEO: Description too short (7 words, recommended 50+)",
+            "SEO: No descriptive/quality adjectives found",
+            "SEO: Description lacks complete sentences (use prose, not just bullet points)",
+            "SEO: Missing common search term 'brand' for Electronics",
+            "SEO: Missing common search term 'model' for Electronics",
+            "SEO: Missing common search term 'warranty' for Electronics",
+            "SEO: Missing common search term 'condition' for Electronics",
+            "SEO: Missing common search term 'specs' for Electronics",
+            "SEO: Missing common search term 'features' for Electronics",
+            "SEO: Missing common search term 'technology' for Electronics",
+            "SEO: No high-value search terms found (e.g., 'premium', 'durable', 'best')",
+            "SEO: Title too short (25 chars, recommended 50-100)",
+            "SEO: Title missing key attributes (brand, model, color, size)",
+            "Title: Contains spam-like patterns (excessive caps, multiple punctuation)",
+            "Description: Incomplete (missing: features, benefits, specifications, use_case)",
+            "Description: Lacks proper sentence structure"
+        ],
+        "suggestions": [
+            "Expand description to 50-150 words for better SEO",
+            "Add descriptive words like 'premium', 'durable', 'comfortable' to enhance appeal",
+            "Write 2-3 complete sentences describing the product",
+            "Consider mentioning 'brand' if applicable to improve searchability",
+            "Consider mentioning 'model' if applicable to improve searchability",
+            "Consider mentioning 'warranty' if applicable to improve searchability",
+            "Consider mentioning 'condition' if applicable to improve searchability",
+            "Consider mentioning 'specs' if applicable to improve searchability",
+            "Consider mentioning 'features' if applicable to improve searchability",
+            "Consider mentioning 'technology' if applicable to improve searchability",
+            "Add 1-2 quality/value indicators to attract more searches",
+            "Expand title to include key attributes (brand, model, key features)",
+            "Include at least 2-3 key attributes in title",
+            "Consider expanding title to 50-100 characters for better SEO",
+            "Consider adding more attributes: color: Gray",
+            "Remove spam indicators, use professional language",
+            "Title too few words, expand with descriptive terms",
+            "Description has significant overlap with title, add unique information",
+            "Add features, benefits, specifications, and use cases",
+            "Include more product attributes in description",
+            "Write in complete sentences, not just bullet points",
+            "DPI information not available in image, ensure high-quality source",
+            "Image width acceptable but could be larger (current: 960px)",
+            "Image aspect ratio unusual (1.50), consider standard format"
+        ],
+        "processing_time": 120.03,
+        "product_type": "Electronics"
+    },
+    {
+        "sku": "SDR-FAS-934215",
+        "title": "QUIZ Lemon Drop Sleeve Maxi Dress",
+        "description": "Cowl neck Drop sleeve Ruched waist. Model height: 5'6\" Model wears UK 8 / US 4 / EUR 36.",
+        "image_path": "images/fashion-001.jpg",
+        "final_score": 83.4,
+        "max_score": 100,
+        "breakdown": {
+            "mandatory_fields": 100,
+            "standardization": 50,
+            "missing_values": 100,
+            "consistency": 50,
+            "seo_discoverability": 58.92,
+            "content_rules_compliance": 89.76,
+            "title_quality": 78.88,
+            "description_quality": 69.5,
+            "image_quality": null,
+            "attributes": 100,
+            "image_score": null
+        },
+        "image_score": null,
+        "image_breakdown": {},
+        "image_metadata": {},
+        "ai_suggestions": {
+            "content": {
+                "data_validation": {
+                    "available_elements": [
+                        "Brand",
+                        "Product Type",
+                        "Material",
+                        "Size",
+                        "Color"
+                    ],
+                    "available_count": 5,
+                    "missing_elements": [
+                        "Gender",
+                        "Key Feature"
+                    ],
+                    "can_build_valid_title": true,
+                    "reason": ""
+                },
+                "title_construction": {
+                    "elements_used": [
+                        "Brand",
+                        "Product Type",
+                        "Material",
+                        "Size",
+                        "Color"
+                    ],
+                    "values_used": [
+                        "QUIZ",
+                        "Fashion",
+                        "Polyester",
+                        "UK 8",
+                        "Yellow"
+                    ],
+                    "element_count": 5,
+                    "construction_logic": "Title constructed by following the specified element order for Clothing/Dresses: Brand, Product Type, Material, Size, Color, using only values from the 'EXTRACTED DATA INVENTORY'."
+                },
+                "improved_title": "QUIZ Fashion Polyester UK 8 Yellow",
+                "improved_description": "This QUIZ Fashion item is crafted from high-quality Polyester, ensuring a durable and lasting garment. Designed in a vibrant Yellow color, this piece is available in UK 8. It's an essential addition to any wardrobe, perfect for various fashion occasions. The Polyester material ensures easy care and maintains its quality over time.",
+                "seo_keywords": [
+                    "QUIZ fashion",
+                    "Polyester fashion",
+                    "Yellow UK 8",
+                    "QUIZ apparel",
+                    "durable Polyester"
+                ],
+                "corrected_attributes": {},
+                "missing_attributes": {
+                    "Gender": "Cannot suggest - no source data available",
+                    "Key Feature": "Cannot suggest - no source data available"
+                },
+                "improvements": [
+                    {
+                        "component": "attributes",
+                        "issue": "size: 'UK 8' not recognized by system. Valid: XS, S, M",
+                        "suggestion": "The value 'UK 8' is factual product data. Suggest updating the system's valid size list to include 'UK 8' or providing a mapping to a recognized standard if available.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": true
+                    },
+                    {
+                        "component": "attributes",
+                        "issue": "color: 'Yellow' not recognized by system. Valid: Black, White, Blue",
+                        "suggestion": "The value 'Yellow' is factual product data. Suggest updating the system's valid color list to include 'Yellow' or providing a mapping to a recognized standard if available.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": true
+                    },
+                    {
+                        "component": "attributes",
+                        "issue": "'Color': 'Yellow' not mentioned in title/description",
+                        "suggestion": "Ensure 'Yellow' is explicitly mentioned in the improved title and description for better product visibility and SEO.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "attributes",
+                        "issue": "'Material': 'Polyester' not mentioned in title/description",
+                        "suggestion": "Ensure 'Polyester' is explicitly mentioned in the improved title and description for better product visibility and SEO.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "title",
+                        "issue": "Title: Contains spam-like patterns (excessive caps, multiple punctuation)",
+                        "suggestion": "Rewrite title to be concise and descriptive, avoiding excessive capitalization and punctuation. Use the improved_title provided.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "description",
+                        "issue": "Description: Too short (88 chars, minimum 100)",
+                        "suggestion": "Expand description to meet minimum length requirement (100 characters) and provide more detail using available product data.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "description",
+                        "issue": "Description: Too few words (19 words, minimum 20)",
+                        "suggestion": "Expand description to meet minimum word count (20 words) and provide more detail using available product data.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "description",
+                        "issue": "Description: Must contain at least one of: material, fit, style, occasion",
+                        "suggestion": "Ensure description includes 'material' (Polyester). 'Fit', 'style', and 'occasion' cannot be added without additional source data.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "description",
+                        "issue": "~8 potential spelling errors",
+                        "suggestion": "Review description for spelling errors and correct them.",
+                        "priority": "medium",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "SEO: Key attribute 'color: Yellow' not mentioned in title/description",
+                        "suggestion": "Integrate 'Yellow' into the improved title and description for better SEO and searchability.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "SEO: Key attribute 'material: Polyester' not mentioned in title/description",
+                        "suggestion": "Integrate 'Polyester' into the improved title and description for better SEO and searchability.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "SEO: Description too short (19 words, recommended 50+)",
+                        "suggestion": "Expand description to at least 50 words, incorporating relevant keywords from available data to improve SEO ranking.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "SEO: No descriptive/quality adjectives found",
+                        "suggestion": "Add descriptive adjectives (e.g., 'vibrant', 'high-quality', 'durable') based on product type and material, ensuring they are not invented features.",
+                        "priority": "medium",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "SEO: No high-value search terms found (e.g., 'premium', 'durable', 'best')",
+                        "suggestion": "Incorporate high-value search terms like 'durable' and 'high-quality' where appropriate, based on the product's material and type, without inventing facts.",
+                        "priority": "medium",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    }
+                ],
+                "quality_score_prediction": 93.5,
+                "summary": "The product data has been significantly improved by generating a descriptive title and an expanded description, both strictly adhering to the available factual elements: Brand, Product Type, Material, Size, and Color. Key attributes like 'Yellow' and 'Polyester' are now prominently featured in the title and description, addressing previous SEO and content gaps. While the system flagged 'UK 8' and 'Yellow' as unrecognized, these factual values are retained, with a recommendation for system updates or mapping to ensure data integrity.",
+                "hallucination_verification": {
+                    "passed": true,
+                    "invented_data": [],
+                    "all_data_sourced": true,
+                    "title_meets_minimum_length": true
+                }
+            },
+            "image": {}
+        },
+        "categorized_feedback": {
+            "attributes": {
+                "issues": [],
+                "suggestions": [
+                    "Include at least 2-3 key attributes in title",
+                    "Consider adding more attributes: color: Yellow, size: UK 8",
+                    "Include more product attributes in description"
+                ]
+            },
+            "title": {
+                "issues": [
+                    "Contains spam-like patterns (excessive caps, multiple punctuation)"
+                ],
+                "suggestions": []
+            },
+            "description": {
+                "issues": [
+                    "Too short (88 chars, minimum 100)",
+                    "Too few words (19 words, minimum 20)",
+                    "Must contain at least one of: material, fit, style, occasion",
+                    "~8 potential spelling errors",
+                    "Incomplete (missing: features, benefits, specifications, use_case)"
+                ],
+                "suggestions": [
+                    "Expand description to 50-150 words for better SEO",
+                    "Expand Description to at least 100 characters",
+                    "Expand Description to at least 20 words with more details",
+                    "Add one of these keywords to Description: material, fit, style",
+                    "Add features, benefits, specifications, and use cases"
+                ]
+            },
+            "seo": {
+                "issues": [
+                    "Key attribute 'color: Yellow' not mentioned in title/description",
+                    "Key attribute 'material: Polyester' not mentioned in title/description",
+                    "Description too short (19 words, recommended 50+)",
+                    "No descriptive/quality adjectives found",
+                    "No high-value search terms found (e.g., 'premium', 'durable', 'best')",
+                    "Title missing key attributes (brand, model, color, size)"
+                ],
+                "suggestions": [
+                    "Add 1-2 quality/value indicators to attract more searches"
+                ]
+            },
+            "images": {
+                "issues": [
+                    "No image provided"
+                ],
+                "suggestions": [
+                    "Upload product image"
+                ]
+            },
+            "general": {
+                "issues": [
+                    "size: 'UK 8' not recognized. Valid: XS, S, M",
+                    "color: 'Yellow' not recognized. Valid: Black, White, Blue",
+                    "'Color': 'Yellow' not mentioned in title/description",
+                    "'Material': 'Polyester' not mentioned in title/description"
+                ],
+                "suggestions": [
+                    "Change size to one of: XS, S, M",
+                    "Change color to one of: Black, White, Blue",
+                    "Add 'color: Yellow' to title or first line of description",
+                    "Add 'material: Polyester' to title or first line of description",
+                    "Add descriptive words like 'premium', 'durable', 'comfortable' to enhance appeal",
+                    "Consider expanding title to 50-100 characters for better SEO",
+                    "Remove spam indicators, use professional language",
+                    "Run spell-check and correct misspellings"
+                ]
+            }
+        },
+        "issues": [
+            "size: 'UK 8' not recognized. Valid: XS, S, M",
+            "color: 'Yellow' not recognized. Valid: Black, White, Blue",
+            "'Color': 'Yellow' not mentioned in title/description",
+            "'Material': 'Polyester' not mentioned in title/description",
+            "SEO: Key attribute 'color: Yellow' not mentioned in title/description",
+            "SEO: Key attribute 'material: Polyester' not mentioned in title/description",
+            "SEO: Description too short (19 words, recommended 50+)",
+            "SEO: No descriptive/quality adjectives found",
+            "SEO: No high-value search terms found (e.g., 'premium', 'durable', 'best')",
+            "SEO: Title missing key attributes (brand, model, color, size)",
+            "Description: Too short (88 chars, minimum 100)",
+            "Description: Too few words (19 words, minimum 20)",
+            "Description: Must contain at least one of: material, fit, style, occasion",
+            "Title: Contains spam-like patterns (excessive caps, multiple punctuation)",
+            "Description: ~8 potential spelling errors",
+            "Description: Incomplete (missing: features, benefits, specifications, use_case)",
+            "No image provided"
+        ],
+        "suggestions": [
+            "Change size to one of: XS, S, M",
+            "Change color to one of: Black, White, Blue",
+            "Add 'color: Yellow' to title or first line of description",
+            "Add 'material: Polyester' to title or first line of description",
+            "Expand description to 50-150 words for better SEO",
+            "Add descriptive words like 'premium', 'durable', 'comfortable' to enhance appeal",
+            "Add 1-2 quality/value indicators to attract more searches",
+            "Include at least 2-3 key attributes in title",
+            "Expand Description to at least 100 characters",
+            "Expand Description to at least 20 words with more details",
+            "Add one of these keywords to Description: material, fit, style",
+            "Consider expanding title to 50-100 characters for better SEO",
+            "Consider adding more attributes: color: Yellow, size: UK 8",
+            "Remove spam indicators, use professional language",
+            "Run spell-check and correct misspellings",
+            "Add features, benefits, specifications, and use cases",
+            "Include more product attributes in description",
+            "Upload product image"
+        ],
+        "processing_time": 127.54,
+        "product_type": "Fashion"
+    },
+    {
+        "sku": "Mobile-001",
+        "title": "OnePlus 9RT blue",
+        "description": "Latest stylest mobile phone",
+        "image_path": "images/oneplus-9rt-back-panel.jpg",
+        "final_score": 78.89,
+        "max_score": 100,
+        "breakdown": {
+            "mandatory_fields": 100,
+            "standardization": 0,
+            "missing_values": 100,
+            "consistency": 50,
+            "seo_discoverability": 55.38,
+            "content_rules_compliance": 90.62,
+            "title_quality": 75.62,
+            "description_quality": 59.75,
+            "image_quality": null,
+            "attributes": 100,
+            "image_score": 71.13
+        },
+        "image_score": 71.13,
+        "image_breakdown": {
+            "resolution": 65.38,
+            "clarity": 49.62,
+            "background": 75,
+            "size": 82.5,
+            "format": 100
+        },
+        "image_metadata": {
+            "width": 1072,
+            "height": 675,
+            "dpi": [
+                96,
+                96
+            ],
+            "format": "JPG",
+            "mode": "RGB",
+            "file_size_mb": 0.12,
+            "dominant_color_rgb": [
+                155,
+                136,
+                119
+            ],
+            "dominant_color_hex": "#9b8877",
+            "dominant_color_name": "gray",
+            "background_coverage": 63.8
+        },
+        "ai_suggestions": {
+            "content": {
+                "data_validation": {
+                    "available_elements": [
+                        "Brand",
+                        "Product Type",
+                        "Color"
+                    ],
+                    "available_count": 3,
+                    "missing_elements": [
+                        "Gender",
+                        "Key Feature",
+                        "Material",
+                        "Size"
+                    ],
+                    "can_build_valid_title": true,
+                    "reason": ""
+                },
+                "title_construction": {
+                    "elements_used": [
+                        "Brand",
+                        "Product Type",
+                        "Color"
+                    ],
+                    "values_used": [
+                        "OnePlus",
+                        "Electronics",
+                        "Gray"
+                    ],
+                    "element_count": 3,
+                    "construction_logic": "The improved_title was constructed using the available Brand ('OnePlus'), Product Type ('Electronics'), and Color ('Gray') in a logical order. All elements are from the explicitly available and allowed data."
+                },
+                "improved_title": "OnePlus Electronics Gray",
+                "improved_description": "This OnePlus Electronics product is a mobile phone, presented in a distinct Gray color. It is backed by a 1 Year warranty, ensuring reliability. As a core Electronics device from the OnePlus brand, this mobile phone is built for essential communication and daily tasks.",
+                "seo_keywords": [
+                    "OnePlus",
+                    "Electronics",
+                    "Gray mobile phone",
+                    "OnePlus Electronics",
+                    "Gray",
+                    "mobile phone"
+                ],
+                "corrected_attributes": {},
+                "missing_attributes": {
+                    "model": "Cannot suggest - no source data available",
+                    "gender": "Cannot suggest - no source data available",
+                    "key_feature": "Cannot suggest - no source data available",
+                    "material": "Cannot suggest - no source data available",
+                    "size": "Cannot suggest - no source data available"
+                },
+                "improvements": [
+                    {
+                        "component": "attributes",
+                        "issue": "brand: 'OnePlus' not recognized. Valid: Apple, Samsung, Sony",
+                        "suggestion": "Validate 'OnePlus' as a recognized brand for Electronics or update the list of valid brands. The provided brand 'OnePlus' has been used in the improved title and description.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": true
+                    },
+                    {
+                        "component": "attributes",
+                        "issue": "'Color': 'Gray' not mentioned in title/description",
+                        "suggestion": "The color 'Gray' has been explicitly included in the improved title and description for consistency and completeness.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "Description too short (4 words, recommended 50+)",
+                        "suggestion": "The description has been expanded to approximately 50 words, incorporating available product data (brand, product type, color, warranty) to meet length recommendations.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "No descriptive/quality adjectives found",
+                        "suggestion": "Descriptive terms like 'distinct' and 'essential' have been added to the description, derived from the product type and brand, without inventing new features.",
+                        "priority": "medium",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "Description lacks complete sentences (use prose, not just bullet points)",
+                        "suggestion": "The description has been rewritten into complete, flowing sentences to improve readability and SEO.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "Missing common search term 'brand' for Electronics",
+                        "suggestion": "The brand 'OnePlus' is prominently featured in the improved title, description, and SEO keywords.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "Missing common search term 'model' for Electronics",
+                        "suggestion": "To improve SEO, 'model' information should be added if available from external data sources. Currently, no model data is available in the provided source.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": true
+                    }
+                ],
+                "quality_score_prediction": 90.9,
+                "summary": "The product listing has been significantly improved by generating a comprehensive title and an expanded description, both strictly adhering to available data. Key improvements include incorporating the brand, product type, and color into the title, and enriching the description with details like warranty. However, the absence of specific model, gender, material, and size data limits further enhancement and SEO optimization.",
+                "hallucination_verification": {
+                    "passed": true,
+                    "invented_data": [],
+                    "all_data_sourced": true,
+                    "title_meets_minimum_length": true
+                }
+            },
+            "image": {
+                "error": "Failed to parse AI response",
+                "raw_response": "{\n  \"priority_fixes\": [\n    \"Address and eliminate blurriness to significantly improve image clarity (current score: 49.6).\",\n    \"Replace the current gray background with a pure white background to meet product image standards.\"\n  ],\n  \"recommended_specs\": {\n    \"width\": 1200,\n    \"height\": 1200,\n    \"format\": \"JPEG\",\n    \"background\": \"white\"\n  },\n  \"improvement_notes\": [\n    \"To improve clarity and resolution, ensure proper lighting, use a stable camera (e.g., tripod), and verify the product "
+            }
+        },
+        "categorized_feedback": {
+            "attributes": {
+                "issues": [],
+                "suggestions": [
+                    "Include at least 2-3 key attributes in title",
+                    "Consider adding more attributes: color: Gray",
+                    "Include more product attributes in description"
+                ]
+            },
+            "title": {
+                "issues": [
+                    "Too few words (3 words, minimum 4)",
+                    "Must contain at least one of: Apple, Samsung, Sony, HP",
+                    "Too short (16 chars, minimum 20)",
+                    "Contains spam-like patterns (excessive caps, multiple punctuation)"
+                ],
+                "suggestions": [
+                    "Expand title to include key attributes (brand, model, key features)",
+                    "Expand Title to at least 4 words with more details",
+                    "Add one of these keywords to Title: Apple, Samsung, Sony",
+                    "Expand title to 50-100 characters with key product details"
+                ]
+            },
+            "description": {
+                "issues": [
+                    "Incomplete (missing: features, benefits, specifications, use_case)",
+                    "Lacks proper sentence structure",
+                    "Weak opening sentence"
+                ],
+                "suggestions": [
+                    "Expand description to 50-150 words for better SEO",
+                    "Add features, benefits, specifications, and use cases"
+                ]
+            },
+            "seo": {
+                "issues": [
+                    "Description too short (4 words, recommended 50+)",
+                    "No descriptive/quality adjectives found",
+                    "Description lacks complete sentences (use prose, not just bullet points)",
+                    "Missing common search term 'brand' for Electronics",
+                    "Missing common search term 'model' for Electronics",
+                    "Missing common search term 'warranty' for Electronics",
+                    "Missing common search term 'condition' for Electronics",
+                    "Missing common search term 'specs' for Electronics",
+                    "Missing common search term 'features' for Electronics",
+                    "Missing common search term 'technology' for Electronics",
+                    "No high-value search terms found (e.g., 'premium', 'durable', 'best')",
+                    "Title too short (16 chars, recommended 50-100)",
+                    "Title missing key attributes (brand, model, color, size)"
+                ],
+                "suggestions": [
+                    "Consider mentioning 'brand' if applicable to improve searchability",
+                    "Consider mentioning 'model' if applicable to improve searchability",
+                    "Consider mentioning 'warranty' if applicable to improve searchability",
+                    "Consider mentioning 'condition' if applicable to improve searchability",
+                    "Consider mentioning 'specs' if applicable to improve searchability",
+                    "Consider mentioning 'features' if applicable to improve searchability",
+                    "Consider mentioning 'technology' if applicable to improve searchability",
+                    "Add 1-2 quality/value indicators to attract more searches"
+                ]
+            },
+            "images": {
+                "issues": [
+                    "Blurry/low clarity (variance: 99.24)",
+                    "Non-white background (gray)"
+                ],
+                "suggestions": [
+                    "Resolution acceptable but could be better (current: 96.0 DPI)",
+                    "Use sharp, well-focused images (variance should be > 500)",
+                    "Use white or light neutral background for e-commerce standards",
+                    "Image aspect ratio unusual (1.59), consider standard format"
+                ]
+            },
+            "general": {
+                "issues": [
+                    "brand: 'OnePlus' not recognized. Valid: Apple, Samsung, Sony",
+                    "'Color': 'Gray' not mentioned in title/description"
+                ],
+                "suggestions": [
+                    "Change brand to one of: Apple, Samsung, Sony",
+                    "Add descriptive words like 'premium', 'durable', 'comfortable' to enhance appeal",
+                    "Write 2-3 complete sentences describing the product",
+                    "Remove spam indicators, use professional language",
+                    "Title too few words, expand with descriptive terms",
+                    "Write in complete sentences, not just bullet points",
+                    "Start with a strong, descriptive opening sentence"
+                ]
+            }
+        },
+        "issues": [
+            "brand: 'OnePlus' not recognized. Valid: Apple, Samsung, Sony",
+            "'Color': 'Gray' not mentioned in title/description",
+            "SEO: Description too short (4 words, recommended 50+)",
+            "SEO: No descriptive/quality adjectives found",
+            "SEO: Description lacks complete sentences (use prose, not just bullet points)",
+            "SEO: Missing common search term 'brand' for Electronics",
+            "SEO: Missing common search term 'model' for Electronics",
+            "SEO: Missing common search term 'warranty' for Electronics",
+            "SEO: Missing common search term 'condition' for Electronics",
+            "SEO: Missing common search term 'specs' for Electronics",
+            "SEO: Missing common search term 'features' for Electronics",
+            "SEO: Missing common search term 'technology' for Electronics",
+            "SEO: No high-value search terms found (e.g., 'premium', 'durable', 'best')",
+            "SEO: Title too short (16 chars, recommended 50-100)",
+            "SEO: Title missing key attributes (brand, model, color, size)",
+            "Title: Too few words (3 words, minimum 4)",
+            "Title: Must contain at least one of: Apple, Samsung, Sony, HP",
+            "Title: Too short (16 chars, minimum 20)",
+            "Title: Contains spam-like patterns (excessive caps, multiple punctuation)",
+            "Description: Incomplete (missing: features, benefits, specifications, use_case)",
+            "Description: Lacks proper sentence structure",
+            "Description: Weak opening sentence",
+            "Image: Blurry/low clarity (variance: 99.24)",
+            "Image: Non-white background (gray)"
+        ],
+        "suggestions": [
+            "Change brand to one of: Apple, Samsung, Sony",
+            "Expand description to 50-150 words for better SEO",
+            "Add descriptive words like 'premium', 'durable', 'comfortable' to enhance appeal",
+            "Write 2-3 complete sentences describing the product",
+            "Consider mentioning 'brand' if applicable to improve searchability",
+            "Consider mentioning 'model' if applicable to improve searchability",
+            "Consider mentioning 'warranty' if applicable to improve searchability",
+            "Consider mentioning 'condition' if applicable to improve searchability",
+            "Consider mentioning 'specs' if applicable to improve searchability",
+            "Consider mentioning 'features' if applicable to improve searchability",
+            "Consider mentioning 'technology' if applicable to improve searchability",
+            "Add 1-2 quality/value indicators to attract more searches",
+            "Expand title to include key attributes (brand, model, key features)",
+            "Include at least 2-3 key attributes in title",
+            "Expand Title to at least 4 words with more details",
+            "Add one of these keywords to Title: Apple, Samsung, Sony",
+            "Expand title to 50-100 characters with key product details",
+            "Consider adding more attributes: color: Gray",
+            "Remove spam indicators, use professional language",
+            "Title too few words, expand with descriptive terms",
+            "Add features, benefits, specifications, and use cases",
+            "Include more product attributes in description",
+            "Write in complete sentences, not just bullet points",
+            "Start with a strong, descriptive opening sentence",
+            "Resolution acceptable but could be better (current: 96.0 DPI)",
+            "Use sharp, well-focused images (variance should be > 500)",
+            "Use white or light neutral background for e-commerce standards",
+            "Image aspect ratio unusual (1.59), consider standard format"
+        ],
+        "processing_time": 127.96,
+        "product_type": "Electronics"
+    },
+    {
+        "sku": "Trimmer-01",
+        "title": "Beard Trimmer",
+        "description": "Get a skin friendly trim with the help of SkinProtect Comb. It gives you a comfortable clean look while providing extra skin protection.",
+        "image_path": "images/trimmer.jpg",
+        "final_score": 75.24,
+        "max_score": 100,
+        "breakdown": {
+            "mandatory_fields": 100,
+            "standardization": 100,
+            "missing_values": 100,
+            "consistency": 0,
+            "seo_discoverability": 46.12,
+            "content_rules_compliance": 88.75,
+            "title_quality": 46.88,
+            "description_quality": 67.5,
+            "image_quality": null,
+            "attributes": 100,
+            "image_score": 74.41
+        },
+        "image_score": 74.41,
+        "image_breakdown": {
+            "resolution": 100,
+            "clarity": 10.49,
+            "background": 100,
+            "size": 78.6,
+            "format": 100
+        },
+        "image_metadata": {
+            "width": 679,
+            "height": 679,
+            "dpi": [
+                300,
+                300
+            ],
+            "format": "JPG",
+            "mode": "RGB",
+            "file_size_mb": 0.05,
+            "dominant_color_rgb": [
+                252,
+                252,
+                252
+            ],
+            "dominant_color_hex": "#fcfcfc",
+            "dominant_color_name": "snow",
+            "background_coverage": 70.78
+        },
+        "ai_suggestions": {
+            "content": {
+                "data_validation": {
+                    "available_elements": [
+                        "Brand",
+                        "Product Type"
+                    ],
+                    "available_count": 2,
+                    "missing_elements": [
+                        "Gender",
+                        "Key Feature",
+                        "Material",
+                        "Size",
+                        "Color"
+                    ],
+                    "can_build_valid_title": true,
+                    "reason": null
+                },
+                "title_construction": {
+                    "elements_used": [
+                        "Brand",
+                        "Product Type",
+                        "Key Feature (extracted from description)"
+                    ],
+                    "values_used": [
+                        "Philips",
+                        "Trimmer",
+                        "SkinProtect Comb"
+                    ],
+                    "element_count": 3,
+                    "construction_logic": "The title was constructed using 'Philips' (Brand) and 'Trimmer' (Product Type) from the available ✅ elements. Since only 2 elements were explicitly available, Rule 6 from the 'ABSOLUTE PROHIBITIONS' was applied, allowing extraction of a key feature from the description. 'SkinProtect Comb' was identified as a key feature in the description and used as the third element, adhering to the 'AT LEAST 3 elements' requirement without inventing data."
+                },
+                "improved_title": "Philips Trimmer SkinProtect Comb",
+                "improved_description": "The Philips Trimmer is engineered for a superior and comfortable grooming experience. It features an innovative SkinProtect Comb, specifically designed to provide a skin-friendly trim, ensuring minimal irritation. This advanced technology allows you to achieve a clean and polished look while offering extra skin protection. The Philips Trimmer delivers both effectiveness and gentleness, making it an essential tool for your grooming routine.",
+                "seo_keywords": [
+                    "Philips trimmer",
+                    "beard trimmer",
+                    "SkinProtect Comb",
+                    "skin friendly trim",
+                    "skin protection",
+                    "Philips grooming",
+                    "comfortable trim"
+                ],
+                "corrected_attributes": {},
+                "missing_attributes": {
+                    "gender": "Cannot suggest - no source data available",
+                    "material": "Cannot suggest - no source data available",
+                    "size": "Cannot suggest - no source data available",
+                    "color": "Cannot suggest - no source data available",
+                    "warranty": "Cannot suggest - no source data available"
+                },
+                "improvements": [
+                    {
+                        "component": "attributes",
+                        "issue": "'Color': 'None' not mentioned in title/description",
+                        "suggestion": "Add a specific color attribute if available from external data. Currently, 'None' is provided.",
+                        "priority": "medium",
+                        "confidence": "high",
+                        "requires_external_data": true
+                    },
+                    {
+                        "component": "description",
+                        "issue": "Description: Incomplete (missing: features, benefits, specifications, use_case)",
+                        "suggestion": "Expand the description further by detailing the benefits of the SkinProtect Comb, specific use cases (e.g., for beard, stubble), and any other unmentioned features or specifications if available from product data.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": false
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "SEO: No high-value search terms found (e.g., 'premium', 'durable', 'best')",
+                        "suggestion": "Incorporate high-value search terms that accurately reflect the product's quality and benefits, if supported by product data or brand guidelines.",
+                        "priority": "medium",
+                        "confidence": "medium",
+                        "requires_external_data": true
+                    },
+                    {
+                        "component": "seo",
+                        "issue": "SEO: Title missing key attributes (model, color, size)",
+                        "suggestion": "Add specific model number, color, and size to the title if these attributes become available, to improve search visibility and user clarity.",
+                        "priority": "high",
+                        "confidence": "high",
+                        "requires_external_data": true
+                    }
+                ],
+                "quality_score_prediction": 92,
+                "summary": "The product title has been significantly improved by incorporating the brand, product type, and a key feature extracted from the description, meeting the minimum element requirement. The description has been enhanced to provide more detail on the product's benefits and features. Further improvements could be made by acquiring additional attribute data such as color, model, and size to enrich both the title and description, and by strategically adding high-value SEO terms.",
+                "hallucination_verification": {
+                    "passed": true,
+                    "invented_data": [],
+                    "all_data_sourced": true,
+                    "title_meets_minimum_length": true
+                }
+            },
+            "image": {
+                "error": "Failed to parse AI response",
+                "raw_response": "{\n  \"priority_fixes\": [\n    \"Reshoot the product image, ensuring it is sharp, in focus, and free from blur.\",\n    \"Optimize lighting to enhance clarity and detail of the Beard Trimmer.\",\n    \"Verify camera focus and settings (e.g., aperture,"
+            }
+        },
+        "categorized_feedback": {
+            "attributes": {
+                "issues": [],
+                "suggestions": [
+                    "Include at least 2-3 key attributes in title",
+                    "Include at least 2-3 key attributes (brand, model, color)",
+                    "Include more product attributes in description"
+                ]
+            },
+            "title": {
+                "issues": [
+                    "Too few words (2 words, minimum 4)",
+                    "Must contain at least one of: Philips, Beardo",
+                    "Too short (13 chars, minimum 20)",
+                    "Brand 'Philips' not clearly mentioned",
+                    "No key attributes found",
+                    "Contains spam-like patterns (excessive caps, multiple punctuation)"
+                ],
+                "suggestions": [
+                    "Expand title to include key attributes (brand, model, key features)",
+                    "Expand Title to at least 4 words with more details",
+                    "Add one of these keywords to Title: Philips, Beardo",
+                    "Expand title to 50-100 characters with key product details",
+                    "Add brand name 'Philips' to title start"
+                ]
+            },
+            "description": {
+                "issues": [
+                    "Incomplete (missing: features, benefits, specifications, use_case)"
+                ],
+                "suggestions": [
+                    "Add features, benefits, specifications, and use cases"
+                ]
+            },
+            "seo": {
+                "issues": [
+                    "Key attribute 'brand: Philips' not mentioned in title/description",
+                    "No high-value search terms found (e.g., 'premium', 'durable', 'best')",
+                    "Title too short (13 chars, recommended 50-100)",
+                    "Title missing key attributes (brand, model, color, size)"
+                ],
+                "suggestions": [
+                    "Add 1-2 quality/value indicators to attract more searches"
+                ]
+            },
+            "images": {
+                "issues": [
+                    "Blurry/low clarity (variance: 20.98)"
+                ],
+                "suggestions": [
+                    "Use sharp, well-focused images (variance should be > 500)",
+                    "Image width acceptable but could be larger (current: 679px)"
+                ]
+            },
+            "general": {
+                "issues": [
+                    "'Brand': 'Philips' not mentioned in title/description",
+                    "'Color': 'None' not mentioned in title/description"
+                ],
+                "suggestions": [
+                    "Add 'brand: Philips' to title or first line of description",
+                    "Consider adding more descriptive adjectives for better engagement",
+                    "Remove spam indicators, use professional language",
+                    "Title too few words, expand with descriptive terms"
+                ]
+            }
+        },
+        "issues": [
+            "'Brand': 'Philips' not mentioned in title/description",
+            "'Color': 'None' not mentioned in title/description",
+            "SEO: Key attribute 'brand: Philips' not mentioned in title/description",
+            "SEO: No high-value search terms found (e.g., 'premium', 'durable', 'best')",
+            "SEO: Title too short (13 chars, recommended 50-100)",
+            "SEO: Title missing key attributes (brand, model, color, size)",
+            "Title: Too few words (2 words, minimum 4)",
+            "Title: Must contain at least one of: Philips, Beardo",
+            "Title: Too short (13 chars, minimum 20)",
+            "Title: Brand 'Philips' not clearly mentioned",
+            "Title: No key attributes found",
+            "Title: Contains spam-like patterns (excessive caps, multiple punctuation)",
+            "Description: Incomplete (missing: features, benefits, specifications, use_case)",
+            "Image: Blurry/low clarity (variance: 20.98)"
+        ],
+        "suggestions": [
+            "Add 'brand: Philips' to title or first line of description",
+            "Consider adding more descriptive adjectives for better engagement",
+            "Add 1-2 quality/value indicators to attract more searches",
+            "Expand title to include key attributes (brand, model, key features)",
+            "Include at least 2-3 key attributes in title",
+            "Expand Title to at least 4 words with more details",
+            "Add one of these keywords to Title: Philips, Beardo",
+            "Expand title to 50-100 characters with key product details",
+            "Add brand name 'Philips' to title start",
+            "Include at least 2-3 key attributes (brand, model, color)",
+            "Remove spam indicators, use professional language",
+            "Title too few words, expand with descriptive terms",
+            "Add features, benefits, specifications, and use cases",
+            "Include more product attributes in description",
+            "Use sharp, well-focused images (variance should be > 500)",
+            "Image width acceptable but could be larger (current: 679px)"
+        ],
+        "processing_time": 132.91,
+        "product_type": "Trimmer"
+    }
+],
+    "errors": [
+        {
+            "sku": "",
+            "error": "Missing SKU or category"
+        }
+    ],
+    "elapsed_seconds": 165.2,
+    "analyticsResult": {
+        "error": "Failed to parse analytics result"
+    }
+}

+ 310 - 152
core/services/gemini_service.py

@@ -1860,8 +1860,6 @@
 
 
 
-
-
 
 
 
@@ -2090,7 +2088,7 @@ class GeminiAttributeService:
                     'error': 'No response from AI',
                     'fallback_suggestions': self._generate_fallback_suggestions(limited_issues)
                 }
-                time.sleep(6)
+                time.sleep(30)
                 return result
             
             if not response.candidates:
@@ -2099,7 +2097,7 @@ class GeminiAttributeService:
                     'error': 'No candidates in response',
                     'fallback_suggestions': self._generate_fallback_suggestions(limited_issues)
                 }
-                time.sleep(6)
+                time.sleep(30)
                 return result
             
             candidate = response.candidates[0]
@@ -2131,7 +2129,7 @@ class GeminiAttributeService:
                     'finish_reason': finish_reason,
                     'fallback_suggestions': self._generate_fallback_suggestions(limited_issues)
                 }
-                time.sleep(6)
+                time.sleep(30)
                 return result
             
             # Parse successful response
@@ -2145,7 +2143,7 @@ class GeminiAttributeService:
                 logger.info(f"SKU {sku}: Successfully generated and parsed AI suggestions")
             
             logger.debug(f"SKU {sku}: Sleeping 6 seconds to respect API rate limits")
-            time.sleep(6)
+            time.sleep(30)
 
             return suggestions
             
@@ -2159,13 +2157,13 @@ class GeminiAttributeService:
             return result
     
     def _build_comprehensive_prompt(
-        self,
-        product: Dict,
-        issues: List[str],
-        rules: List[Dict],
-        scores: Dict
-    ) -> str:
-        """Build comprehensive prompt for all quality aspects with title structure analysis"""
+    self,
+    product: Dict,
+    issues: List[str],
+    rules: List[Dict],
+    scores: Dict
+) -> str:
+        """Build comprehensive prompt with MAXIMUM anti-hallucination enforcement and mandatory multi-element titles"""
         sku = product.get('sku', 'UNKNOWN')
         logger.debug(f"SKU {sku}: Building comprehensive prompt")
         
@@ -2186,147 +2184,310 @@ class GeminiAttributeService:
         import random
         quality_score_target = random.uniform(90.2, 95.9)
         
-        prompt = f"""Analyze this e-commerce product and provide comprehensive quality improvements including detailed title structure analysis.
-
-Note: quality_score_prediction should be in range of 90 to 95 
-
-PRODUCT DATA:
-SKU: {product.get('sku')}
-Category: {product.get('category')}
-Title: {product.get('title', '')[:250]}
-Description: {product.get('description', '')[:400]}
-Attributes: {json.dumps(product.get('attributes', {}), ensure_ascii=False)}
-
-QUALITY SCORES (out of 100):
-- Mandatory Fields: {scores.get('mandatory_fields', 0):.1f}
-- Standardization: {scores.get('standardization', 0):.1f}
-- Missing Values: {scores.get('missing_values', 0):.1f}
-- Consistency: {scores.get('consistency', 0):.1f}
-- SEO: {scores.get('seo_discoverability', 0):.1f}
-- Title Quality: {scores.get('title_quality', 0):.1f}
-- Description Quality: {scores.get('description_quality', 0):.1f}
-
-CATEGORY RULES:
-Mandatory Attributes: {', '.join(mandatory_attrs)}
-Valid Values: {json.dumps(valid_values_map, ensure_ascii=False)}
-
-ISSUES FOUND:
-Attributes ({len(attribute_issues)}):
-{chr(10).join(f"  • {i}" for i in attribute_issues[:8])}
-
-Title ({len(title_issues)}):
-{chr(10).join(f"  • {i}" for i in title_issues[:5])}
-
-Description ({len(desc_issues)}):
-{chr(10).join(f"  • {i}" for i in desc_issues[:5])}
-
-SEO ({len(seo_issues)}):
-{chr(10).join(f"  • {i}" for i in seo_issues[:5])}
-
-CATEGORY-SPECIFIC TITLE STRUCTURE GUIDELINES:
-
-For T-Shirts:
-Recommended sequence: Brand + Gender + Product Type + Key Feature + Material + Size + Color + Pack Size
-Element explanations:
-- Brand: Builds trust and improves SEO ranking
-- Gender: Targets specific audience (Men's/Women's/Unisex)
-- Product Type: Core identifier (T-Shirt, Tee, Polo)
-- Key Feature: Differentiator (Slim Fit, V-Neck, Graphic)
-- Material: Search relevance (Cotton, Polyester, Blend)
-- Size: Conversion factor (S/M/L/XL or Specific measurements)
-- Color: Visual match (Black, White, Navy Blue)
-- Pack Size: Value indicator (Pack of 3, Single)
-
-Examples:
-✓ Good: "Nike Men's Slim Fit Cotton T-Shirt, Black, Large"
-✓ Good: "Hanes Women's V-Neck Polyester Blend T-Shirt Pack of 3, White, Medium"
-✗ Bad: "Nice T-Shirt for Men" (missing brand, features, specifics)
-✗ Bad: "SUPER COMFORTABLE AMAZING TSHIRT BLACK" (all caps, no structure)
-
-For Food:
-Recommended sequence: Brand + Product Name + Flavor/Variety + Size/Weight + Type + Pack Size
-Element explanations:
-- Brand: Recognition and trust (Kellogg's, Organic Valley)
-- Product Name: Core identity (Corn Flakes, Whole Milk)
-- Flavor/Variety: Taste appeal (Original, Chocolate, Strawberry)
-- Size/Weight: Practical info (18 oz, 1 Gallon, 500g)
-- Type: Dietary needs (Organic, Gluten-Free, Low-Fat)
-- Pack Size: Bulk value (Box, 6-Pack, Family Size)
-
-Examples:
-✓ Good: "Kellogg's Corn Flakes Cereal, Original Flavor, 18 oz Box"
-✓ Good: "Organic Valley Whole Milk, 1 Gallon, Grass-Fed"
-✗ Bad: "Delicious Cereal" (missing brand, specifics, size)
-✗ Bad: "Food Product 500g" (generic, no appeal)
-
-For Chairs:
-Recommended sequence: Brand + Type + Key Feature + Material + Color + Additional Features
-Element explanations:
-- Brand: Quality assurance (Herman Miller, IKEA)
-- Type: Category search (Office Chair, Desk Chair, Gaming Chair)
-- Key Feature: Differentiator (Ergonomic, High Back, Swivel)
-- Material: Durability info (Mesh, Leather, Fabric)
-- Color: Aesthetic match (Black, Gray, White)
-- Additional Features: Conversion boost (Adjustable Arms, Lumbar Support)
-
-Examples:
-✓ Good: "Herman Miller Aeron Ergonomic Office Chair, Mesh Fabric, Black, Adjustable Arms"
-✓ Good: "IKEA Markus Swivel Desk Chair, Leather, Gray, High Back"
-✗ Bad: "Comfortable Chair" (missing brand, type, features)
-✗ Bad: "Chair for Office Black Color" (awkward structure, no features)
-
-CRITICAL INSTRUCTION - TITLE STRUCTURE ANALYSIS:
-You MUST analyze the current product title and identify which elements are present or missing based on the category-specific structure above. For each element in the recommended sequence, indicate:
-- "present": The element exists in the title with the actual value found
-- "missing": The element is not in the title
-- "value": The actual text/value found for that element (if present)
-
-Return ONLY this JSON structure:
-{{
-  "title_structure_analysis": {{
-    "category": "T-Shirts/Food/Chairs",
-    "recommended_sequence": ["Brand", "Gender", "Product Type", "Key Feature", "Material", "Size", "Color", "Pack Size"],
-    "current_title_breakdown": {{
-      "Brand": {{"status": "present/missing", "value": "Nike" or null, "explanation": "why it matters"}},
-      "Gender": {{"status": "present/missing", "value": "Men's" or null, "explanation": "targets audience"}},
-      "Product Type": {{"status": "present/missing", "value": "T-Shirt" or null, "explanation": "core identifier"}},
-      "Key Feature": {{"status": "present/missing", "value": "Slim Fit" or null, "explanation": "differentiator"}},
-      "Material": {{"status": "present/missing", "value": "Cotton" or null, "explanation": "search relevance"}},
-      "Size": {{"status": "present/missing", "value": "Large" or null, "explanation": "conversion factor"}},
-      "Color": {{"status": "present/missing", "value": "Black" or null, "explanation": "visual match"}},
-      "Pack Size": {{"status": "present/missing", "value": null, "explanation": "value indicator"}}
-    }},
-    "completeness_score": 75,
-    "missing_elements": ["Size", "Pack Size"],
-    "structure_quality": "good/fair/poor",
-    "structure_notes": "Brief assessment of title structure quality"
-  }},
-  "corrected_attributes": {{
-    "attr_name": "corrected_value"
-  }},
-  "missing_attributes": {{
-    "attr_name": "suggested_value"
-  }},
-  "improved_title": "optimized title following recommended sequence with all elements",
-  "improved_description": "enhanced description (50-150 words, features, benefits, specs, use cases)",
-  "seo_keywords": ["keyword1", "keyword2", "keyword3"],
-  "improvements": [
+        # Extract ALL data sources comprehensively
+        available_attrs = product.get('attributes', {})
+        title = product.get('title', '')
+        description = product.get('description', '')
+        category = product.get('category', '')
+        
+        # Helper function to safely extract values
+        def safe_extract(sources, keys):
+            """Extract first non-empty value from multiple sources and keys"""
+            for source in sources:
+                if not source:
+                    continue
+                for key in keys:
+                    val = source.get(key) if isinstance(source, dict) else None
+                    if val and str(val).strip() and str(val).lower() not in ['null', 'none', 'n/a', 'na', '']:
+                        return str(val).strip()
+            return None
+        
+        # Extract from title by parsing common patterns
+        def extract_from_title(title_text, pattern_type):
+            """Extract information from title text"""
+            if not title_text:
+                return None
+            title_lower = title_text.lower()
+            
+            if pattern_type == 'brand':
+                # Brand is usually first word(s) before product type
+                words = title_text.split()
+                if words:
+                    return words[0]
+            elif pattern_type == 'size':
+                # Look for size patterns: 50ml, 30ml, L, M, S, XL, etc.
+                size_match = re.search(r'\b(\d+(?:\.\d+)?(?:ml|oz|g|kg|l|lb))\b', title_text, re.IGNORECASE)
+                if size_match:
+                    return size_match.group(1)
+                size_match = re.search(r'\b(XXS|XS|S|M|L|XL|XXL|XXXL)\b', title_text, re.IGNORECASE)
+                if size_match:
+                    return size_match.group(1)
+            elif pattern_type == 'color':
+                # Common colors
+                colors = ['black', 'white', 'blue', 'red', 'green', 'yellow', 'pink', 'purple', 'brown', 'grey', 'gray', 'beige', 'navy', 'orange']
+                for color in colors:
+                    if color in title_lower:
+                        return color.title()
+            elif pattern_type == 'gender':
+                if "women" in title_lower or "women's" in title_lower:
+                    return "Women's"
+                elif "men" in title_lower or "men's" in title_lower:
+                    return "Men's"
+                elif "unisex" in title_lower:
+                    return "Unisex"
+            
+            return None
+        
+        # Comprehensive extraction with multiple fallback sources
+        brand = safe_extract(
+            [available_attrs, {'title_extract': extract_from_title(title, 'brand')}],
+            ['brand', 'Brand', 'BRAND', 'manufacturer', 'Manufacturer', 'title_extract']
+        )
+        
+        gender = safe_extract(
+            [available_attrs, {'title_extract': extract_from_title(title, 'gender')}],
+            ['gender', 'Gender', 'GENDER', 'target_gender', 'title_extract']
+        )
+        
+        material = safe_extract(
+            [available_attrs],
+            ['material', 'Material', 'MATERIAL', 'fabric', 'Fabric']
+        )
+        
+        size = safe_extract(
+            [available_attrs, {'title_extract': extract_from_title(title, 'size')}],
+            ['size', 'Size', 'SIZE', 'volume', 'Volume', 'weight', 'Weight', 'title_extract']
+        )
+        
+        color = safe_extract(
+            [available_attrs, {'title_extract': extract_from_title(title, 'color')}],
+            ['color', 'Color', 'COLOR', 'colour', 'Colour', 'title_extract']
+        )
+        
+        product_type = safe_extract(
+            [available_attrs, {'category': category}],
+            ['product_type', 'type', 'Type', 'category', 'Category', 'product_category']
+        )
+        
+        # Extract key features from title and description
+        feature_keywords = ['puff sleeve', 'shirred', 'slim fit', 'regular fit', 'long lasting', 
+                        'resurfacing', 'moisturizing', 'hydrating', 'anti-aging', 'brightening',
+                        'eau de parfum', 'eau de toilette', 'retinol', 'ceramides', 'niacinamide']
+        
+        key_features = []
+        combined_text = f"{title} {description}".lower()
+        for feature in feature_keywords:
+            if feature in combined_text:
+                # Capitalize properly
+                key_features.append(' '.join(word.capitalize() for word in feature.split()))
+        
+        key_feature = ', '.join(key_features[:2]) if key_features else None
+        
+        # Create explicit data inventory
+        data_inventory = {
+            'Brand': brand,
+            'Gender': gender,
+            'Product Type': product_type or category,
+            'Key Feature': key_feature,
+            'Material': material,
+            'Size': size,
+            'Color': color
+        }
+        
+        # Filter to only available data
+        available_data = {k: v for k, v in data_inventory.items() if v}
+        missing_data = [k for k, v in data_inventory.items() if not v]
+        
+        # Create detailed inventory display
+        inventory_display = "\n".join([
+            f"  ✅ {k}: \"{v}\"" for k, v in available_data.items()
+        ])
+        
+        missing_display = "\n".join([
+            f"  ❌ {k}: NOT AVAILABLE - MUST NOT USE" for k in missing_data
+        ])
+        
+        prompt = f"""You are a strict e-commerce data validator. Generate ONLY factual product improvements.
+
+    🚫 ABSOLUTE PROHIBITIONS (WILL CAUSE FAILURE):
+    1. NEVER invent sizes (M, L, XL, S, etc.) if not in data below
+    2. NEVER invent materials (Cotton, Polyester, etc.) if not in data below
+    3. NEVER invent features (Slim Fit, Regular, etc.) if not in data below
+    4. NEVER use generic terms like "Long Lasting", "Standard", "Classic" unless in original data
+    5. The improved_title MUST contain AT LEAST 3 elements from available data
+    6. If only 1-2 elements available, reuse product type with key features from description
+
+    Note: quality_score_prediction should be in range of 90 to 95 
+
+    ═══════════════════════════════════════════════════════════
+    PRODUCT DATA - THIS IS YOUR ONLY SOURCE OF TRUTH:
+    ═══════════════════════════════════════════════════════════
+    SKU: {product.get('sku')}
+    Category: {category}
+    Title: {title}
+    Description: {description[:500]}
+    All Attributes: {json.dumps(available_attrs, ensure_ascii=False)}
+
+    ═══════════════════════════════════════════════════════════
+    EXTRACTED DATA INVENTORY - USE ONLY THESE VALUES:
+    ═══════════════════════════════════════════════════════════
+    {inventory_display if inventory_display else "  (No attributes extracted)"}
+
+    {missing_display}
+
+    TOTAL AVAILABLE: {len(available_data)} elements
+    TOTAL MISSING: {len(missing_data)} elements
+
+    ⚠️ CRITICAL: Your improved_title can ONLY use values shown above with ✅
+
+    ═══════════════════════════════════════════════════════════
+    QUALITY SCORES (out of 100):
+    ═══════════════════════════════════════════════════════════
+    - Mandatory Fields: {scores.get('mandatory_fields', 0):.1f}
+    - Standardization: {scores.get('standardization', 0):.1f}
+    - Missing Values: {scores.get('missing_values', 0):.1f}
+    - Consistency: {scores.get('consistency', 0):.1f}
+    - SEO: {scores.get('seo_discoverability', 0):.1f}
+    - Title Quality: {scores.get('title_quality', 0):.1f}
+    - Description Quality: {scores.get('description_quality', 0):.1f}
+
+    CATEGORY RULES:
+    Mandatory Attributes: {', '.join(mandatory_attrs)}
+
+    ═══════════════════════════════════════════════════════════
+    ISSUES FOUND:
+    ═══════════════════════════════════════════════════════════
+    Attributes ({len(attribute_issues)}):
+    {chr(10).join(f"  • {i}" for i in attribute_issues[:8])}
+
+    Title ({len(title_issues)}):
+    {chr(10).join(f"  • {i}" for i in title_issues[:5])}
+
+    Description ({len(desc_issues)}):
+    {chr(10).join(f"  • {i}" for i in desc_issues[:5])}
+
+    SEO ({len(seo_issues)}):
+    {chr(10).join(f"  • {i}" for i in seo_issues[:5])}
+
+    ═══════════════════════════════════════════════════════════
+    TITLE CONSTRUCTION RULES:
+    ═══════════════════════════════════════════════════════════
+
+    RULE 1: MINIMUM LENGTH REQUIREMENT
+    - improved_title MUST contain AT LEAST 3 distinct elements
+    - If fewer than 3 elements available, extract more from description
+    - Single-word titles are STRICTLY FORBIDDEN
+
+    RULE 2: ELEMENT ORDERING (use available elements in this order)
+    For CLOTHING/DRESSES:
+    Brand → Gender → Product Type → Key Feature → Material → Size → Color
+    
+    For SKINCARE:
+    Brand → Product Type → Key Benefit → Skin Type → Key Ingredient → Size
+    
+    For PERFUME:
+    Brand → Product Name → Fragrance Type → Gender → Size → Concentration
+
+    RULE 3: EXTRACTION PRIORITY
+    1. Use explicit attribute values first (✅ marked above)
+    2. Extract from title if obvious (e.g., "Puff Sleeve" from "Puff Sleeve Dress")
+    3. Extract from description if clear (e.g., "Hydrating" from "delivers hydration")
+    4. NEVER invent if not extractable
+
+    ═══════════════════════════════════════════════════════════
+    EXAMPLES OF CORRECT BEHAVIOR:
+    ═══════════════════════════════════════════════════════════
+
+    Example 1 - DRESS:
+    Available: Brand="Blue Vanilla", Product Type="Dress", Key Feature="Puff Sleeve Shirred", Color="Blue"
+    Missing: Size, Material, Gender
+    ✅ CORRECT: "Blue Vanilla Dress Puff Sleeve Shirred Blue"
+    ❌ WRONG: "Blue Vanilla M Blue" (too short, invented size)
+    ❌ WRONG: "Blue Vanilla Dress Slim Fit Cotton M Blue" (invented Slim Fit, Cotton, M)
+
+    Example 2 - SKINCARE:
+    Available: Brand="CeraVe", Product Type="Moisturising Cream", Key Benefit="Hydrating", Key Ingredient="Ceramides", Size="50ml"
+    Missing: Skin Type, Material
+    ✅ CORRECT: "CeraVe Moisturising Cream Hydrating Ceramides 50ml"
+    ❌ WRONG: "CeraVe" (too short)
+    ❌ WRONG: "CeraVe Cream Hydrating Dry Skin 50ml" (invented "Dry Skin" - though in description, not in attributes)
+
+    Example 3 - PERFUME:
+    Available: Brand="Calvin Klein", Product Name="Euphoria", Fragrance Type="Eau de Parfum", Gender="Women", Size="50ml"
+    Missing: Concentration, Color
+    ✅ CORRECT: "Calvin Klein Euphoria Eau de Parfum Women 50ml"
+    ❌ WRONG: "Calvin Klein Euphoria Eau de Parfum Long Lasting" (invented "Long Lasting", missing size)
+
+    ═══════════════════════════════════════════════════════════
+    RESPONSE FORMAT:
+    ═══════════════════════════════════════════════════════════
+
+    Return ONLY this JSON structure:
+
     {{
-      "component": "attributes/title/description/seo",
-      "issue": "specific issue",
-      "suggestion": "how to fix",
-      "priority": "high/medium/low",
-      "confidence": "high/medium/low"
+    "data_validation": {{
+        "available_elements": {list(available_data.keys())},
+        "available_count": {len(available_data)},
+        "missing_elements": {missing_data},
+        "can_build_valid_title": true/false,
+        "reason": "explanation if cannot build valid title"
+    }},
+    "title_construction": {{
+        "elements_used": ["element1", "element2", "element3"],
+        "values_used": ["value1", "value2", "value3"],
+        "element_count": 3,
+        "construction_logic": "Explain how you built the title using ONLY available data"
+    }},
+    "improved_title": "MUST BE 3+ ELEMENTS, USING ONLY ✅ VALUES ABOVE",
+    "improved_description": "enhanced description (50-150 words, based ONLY on available product data)",
+    "seo_keywords": ["keyword1", "keyword2", "keyword3"],
+    "corrected_attributes": {{
+        "attr_name": "corrected_value (ONLY if data exists to correct)"
+    }},
+    "missing_attributes": {{
+        "attr_name": "Cannot suggest - no source data available"
+    }},
+    "improvements": [
+        {{
+        "component": "attributes/title/description/seo",
+        "issue": "specific issue",
+        "suggestion": "how to fix (state if data unavailable)",
+        "priority": "high/medium/low",
+        "confidence": "high/medium/low",
+        "requires_external_data": true/false
+        }}
+    ],
+    "quality_score_prediction": {quality_score_target:.1f},
+    "summary": "2-3 sentences on improvements, noting data limitations",
+    "hallucination_verification": {{
+        "passed": true/false,
+        "invented_data": [],
+        "all_data_sourced": true/false,
+        "title_meets_minimum_length": true/false
+    }}
     }}
-  ],
-  "quality_score_prediction": {quality_score_target:.1f},
-  "summary": "Brief 2-3 sentence summary of key improvements needed"
-}}
 
-CRITICAL: Keep response under 7000 tokens. Focus on top 5 most impactful improvements and complete title structure analysis."""
+    ═══════════════════════════════════════════════════════════
+    FINAL VERIFICATION BEFORE RESPONDING:
+    ═══════════════════════════════════════════════════════════
+    □ Does improved_title contain AT LEAST 3 elements?
+    □ Is EVERY element in improved_title present in "✅ Available" list?
+    □ Did I avoid ALL values marked with "❌ NOT AVAILABLE"?
+    □ Did I check that I didn't invent sizes (M, L, XL)?
+    □ Did I check that I didn't invent materials (Cotton, Polyester)?
+    □ Did I check that I didn't invent generic features (Long Lasting, Standard)?
+    □ Is my title longer than just 1-2 words?
+
+    If you cannot build a valid title with at least 3 elements from available data,
+    set "can_build_valid_title": false and explain why in the response."""
+        
+        logger.debug(f"SKU {sku}: Prompt built with maximum enforcement, final length: {len(prompt)} characters")
+        logger.debug(f"SKU {sku}: Available data elements: {list(available_data.keys())}")
+        logger.debug(f"SKU {sku}: Missing data elements: {missing_data}")
         
-        logger.debug(f"SKU {sku}: Prompt built, final length: {len(prompt)} characters")
         return prompt
+
+
     
     def _parse_response(self, response_text: str, sku: str = 'UNKNOWN') -> Dict:
         """Enhanced JSON parsing with fallback strategies"""
@@ -2518,6 +2679,3 @@ CRITICAL: Keep response under 7000 tokens. Focus on top 5 most impactful improve
         
         logger.info(f"Generated {len(suggestions)} fallback suggestions")
         return suggestions
-    
-
-    

+ 3 - 0
core/urls.py

@@ -23,6 +23,7 @@ from core.views import (
 )
 from .views import open_outlook_mail
 from .views import ProductTypeQualityMetricsView
+from .views import rr_content_card_view
 
 
 
@@ -41,4 +42,6 @@ urlpatterns = [
     path('api/quality-metrics/', ProductTypeQualityMetricsView.as_view(), name='quality-metrics'),
 
     path('run-script/', open_outlook_mail, name='open_outlook_mail'),
+
+    path('api/rr-content-card/', rr_content_card_view, name='rr_content_card_api'),
 ]

+ 25 - 1
core/views.py

@@ -732,7 +732,8 @@ class BatchScoreViewV2(View):
                 'categorized_feedback': categorized,
                 'issues': all_issues,
                 'suggestions': all_suggestions,
-                'processing_time': total_time
+                'processing_time': total_time,
+                'product_type': category
             }
 
 
@@ -774,6 +775,7 @@ class BatchScoreViewV2(View):
                 return JsonResponse({'error': 'No products found in database'}, status=404)
 
             results, errors, elapsed = self._run_batch(products)
+
             return JsonResponse({
                 'success': True,
                 'processed': len(results),
@@ -1036,3 +1038,25 @@ class ProductTypeQualityMetricsView(APIView):
         ]
 
         return Response(results, status=status.HTTP_200_OK)
+
+
+
+
+
+import json
+import os
+from django.http import JsonResponse
+from django.conf import settings
+
+def rr_content_card_view(request):
+    file_path = os.path.join(settings.BASE_DIR, 'core', 'results', 'rr_content_card.json')
+    
+    try:
+        with open(file_path, 'r', encoding='utf-8') as file:
+            data = json.load(file)
+        # Return the exact JSON content
+        return JsonResponse(data, safe=False, json_dumps_params={'ensure_ascii': False, 'indent': 2})
+    except FileNotFoundError:
+        return JsonResponse({'error': 'File not found'}, status=404)
+    except json.JSONDecodeError:
+        return JsonResponse({'error': 'Invalid JSON format'}, status=500)

BIN
media/images/fashion-001.jpg


BIN
media/images/fashion-002.jpg


BIN
media/images/perfume-001.jpg


BIN
media/images/perfume-002.jpg


BIN
media/images/skincare-001.jpg


BIN
media/images/skincare-002.jpg