123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319 |
- # # sample_data.py
- # """
- # Sample data to test the attribute scoring system
- # """
- # SAMPLE_CATEGORY_RULES = [
- # {
- # 'category': 'Electronics',
- # 'attribute_name': 'brand',
- # 'is_mandatory': True,
- # 'valid_values': ['Apple', 'Samsung', 'Sony', 'LG', 'Dell', 'HP', 'Lenovo'],
- # 'data_type': 'string'
- # },
- # {
- # 'category': 'Electronics',
- # 'attribute_name': 'color',
- # 'is_mandatory': True,
- # 'valid_values': ['Black', 'White', 'Silver', 'Gray', 'Blue', 'Red', 'Gold', 'Rose Gold'],
- # 'data_type': 'string'
- # },
- # {
- # 'category': 'Electronics',
- # 'attribute_name': 'warranty',
- # 'is_mandatory': True,
- # 'valid_values': ['1 Year', '2 Years', '3 Years', 'Lifetime'],
- # 'data_type': 'string'
- # },
- # {
- # 'category': 'Electronics',
- # 'attribute_name': 'condition',
- # 'is_mandatory': True,
- # 'valid_values': ['New', 'Refurbished', 'Used'],
- # 'data_type': 'string'
- # },
- # {
- # 'category': 'Electronics',
- # 'attribute_name': 'model',
- # 'is_mandatory': False,
- # 'valid_values': [],
- # 'data_type': 'string'
- # },
- # {
- # 'category': 'Clothing',
- # 'attribute_name': 'brand',
- # 'is_mandatory': True,
- # 'valid_values': ['Nike', 'Adidas', 'Puma', 'Reebok', 'Under Armour'],
- # 'data_type': 'string'
- # },
- # {
- # 'category': 'Clothing',
- # 'attribute_name': 'size',
- # 'is_mandatory': True,
- # 'valid_values': ['XS', 'S', 'M', 'L', 'XL', 'XXL'],
- # 'data_type': 'string'
- # },
- # {
- # 'category': 'Clothing',
- # 'attribute_name': 'color',
- # 'is_mandatory': True,
- # 'valid_values': ['Black', 'White', 'Blue', 'Red', 'Green', 'Yellow', 'Gray'],
- # 'data_type': 'string'
- # },
- # {
- # 'category': 'Clothing',
- # 'attribute_name': 'material',
- # 'is_mandatory': True,
- # 'valid_values': ['Cotton', 'Polyester', 'Wool', 'Silk', 'Nylon', 'Blend'],
- # 'data_type': 'string'
- # },
- # ]
- # SAMPLE_PRODUCTS = [
- # {
- # 'sku': 'ELEC-001',
- # 'category': 'Electronics',
- # 'title': 'Apple MacBook Pro 14-inch Space Gray',
- # 'description': 'Latest Apple MacBook Pro with M3 chip, 14-inch display in Space Gray color.',
- # 'attributes': {
- # 'brand': 'Apple',
- # 'color': 'Space Gray', # Should suggest "Gray"
- # 'warranty': '1 Year',
- # 'condition': 'New',
- # 'model': 'MacBook Pro 14"'
- # }
- # },
- # {
- # 'sku': 'ELEC-002',
- # 'category': 'Electronics',
- # 'title': 'Samsung Galaxy S24 Ultra',
- # 'description': 'Flagship Samsung phone with advanced camera system.',
- # 'attributes': {
- # 'brand': 'Samsung',
- # 'color': 'blak', # Typo - should suggest "Black"
- # 'warranty': 'N/A', # Placeholder - should flag
- # 'condition': 'new', # Case mismatch - should suggest "New"
- # # Missing 'model'
- # }
- # },
- # {
- # 'sku': 'ELEC-003',
- # 'category': 'Electronics',
- # 'title': 'Sony WH-1000XM5 Wireless Headphones',
- # 'description': 'Premium noise-cancelling headphones from Sony.',
- # 'attributes': {
- # # Missing 'brand' - mandatory field
- # 'color': 'Black',
- # 'warranty': '2 Years',
- # 'condition': 'Refurbished'
- # }
- # },
- # {
- # 'sku': 'CLTH-001',
- # 'category': 'Clothing',
- # 'title': 'Nike Dri-FIT Running T-Shirt Blue Medium',
- # 'description': 'Lightweight Nike running shirt in blue color, size Medium.',
- # 'attributes': {
- # 'brand': 'Nike',
- # 'size': 'M',
- # 'color': 'Blue',
- # 'material': 'Polyester'
- # }
- # },
- # {
- # 'sku': 'CLTH-002',
- # 'category': 'Clothing',
- # 'title': 'Adidas Hoodie',
- # 'description': 'Comfortable hoodie for casual wear.',
- # 'attributes': {
- # 'brand': 'Adiddas', # Typo - should suggest "Adidas"
- # 'size': 'Large', # Should suggest "L"
- # 'color': '', # Empty - should flag
- # # Missing 'material' - mandatory field
- # }
- # },
- # ]
- # sample_data.py
- """
- Sample data to test the attribute scoring system
- """
- # ... SAMPLE_CATEGORY_RULES remains the same ...
- SAMPLE_CATEGORY_RULES = [
- {
- 'category': 'Electronics',
- 'attribute_name': 'brand',
- 'is_mandatory': True,
- 'valid_values': ['Apple', 'Samsung', 'Sony', 'LG', 'Dell', 'HP', 'Lenovo'],
- 'data_type': 'string'
- },
- {
- 'category': 'Electronics',
- 'attribute_name': 'color',
- 'is_mandatory': True,
- 'valid_values': ['Black', 'White', 'Silver', 'Gray', 'Blue', 'Red', 'Gold', 'Rose Gold'],
- 'data_type': 'string'
- },
- {
- 'category': 'Electronics',
- 'attribute_name': 'warranty',
- 'is_mandatory': True,
- 'valid_values': ['1 Year', '2 Years', '3 Years', 'Lifetime'],
- 'data_type': 'string'
- },
- {
- 'category': 'Electronics',
- 'attribute_name': 'condition',
- 'is_mandatory': True,
- 'valid_values': ['New', 'Refurbished', 'Used'],
- 'data_type': 'string'
- },
- {
- 'category': 'Electronics',
- 'attribute_name': 'model',
- 'is_mandatory': False,
- 'valid_values': [],
- 'data_type': 'string'
- },
- {
- 'category': 'Clothing',
- 'attribute_name': 'brand',
- 'is_mandatory': True,
- 'valid_values': ['Nike', 'Adidas', 'Puma', 'Reebok', 'Under Armour'],
- 'data_type': 'string'
- },
- {
- 'category': 'Clothing',
- 'attribute_name': 'size',
- 'is_mandatory': True,
- 'valid_values': ['XS', 'S', 'M', 'L', 'XL', 'XXL'],
- 'data_type': 'string'
- },
- {
- 'category': 'Clothing',
- 'attribute_name': 'color',
- 'is_mandatory': True,
- 'valid_values': ['Black', 'White', 'Blue', 'Red', 'Green', 'Yellow', 'Gray'],
- 'data_type': 'string'
- },
- {
- 'category': 'Clothing',
- 'attribute_name': 'material',
- 'is_mandatory': True,
- 'valid_values': ['Cotton', 'Polyester', 'Wool', 'Silk', 'Nylon', 'Blend'],
- 'data_type': 'string'
- },
- ]
- # --- NEW SAMPLE CONTENT RULES ---
- SAMPLE_CONTENT_RULES = [
- # Global Rules
- {
- 'category': None, # Applies to all categories
- 'field_name': 'description',
- 'is_mandatory': True,
- 'min_word_count': 200,
- 'max_word_count': 500,
- },
- {
- 'category': None, # Applies to all categories
- 'field_name': 'title',
- 'is_mandatory': True,
- 'min_word_count': 40,
- 'max_word_count': 100,
- },
- {
- 'category': None,
- 'field_name': 'seo_title',
- 'is_mandatory': True,
- 'min_length': 40,
- 'max_length': 60,
- },
- {
- 'category': None,
- 'field_name': 'seo_description',
- 'is_mandatory': True,
- 'min_length': 120,
- 'max_length': 160,
- },
- # Category-Specific Rules
- {
- 'category': 'Electronics',
- 'field_name': 'title',
- 'is_mandatory': True,
- 'min_word_count': 4,
- 'must_contain_keywords': ['Apple', 'Samsung', 'Sony', 'HP'], # Must contain one of the major brands
- },
- {
- 'category': 'Clothing',
- 'field_name': 'title',
- 'is_mandatory': True,
- 'must_contain_keywords': ['T-Shirt', 'Hoodie', 'Jacket'],
- },
- ]
- # ... SAMPLE_PRODUCTS updated with content fields ...
- SAMPLE_PRODUCTS = [
- {
- 'sku': 'ELEC-001',
- 'category': 'Electronics',
- 'title': 'Apple MacBook Pro 14-inch Space Gray', # Good title (5 words, contains "Apple")
- 'description': 'Latest Apple MacBook Pro with M3 chip, 14-inch display in Space Gray color.', # 16 words - Good
- 'seo_title': 'Buy Apple MacBook Pro 14-inch M3 Space Gray', # 42 chars - Good
- 'seo_description': 'The ultimate laptop for professionals. Features the revolutionary M3 chip, a stunning 14-inch Liquid Retina XDR display, and all-day battery life.', # 155 chars - Good
- 'attributes': {
- 'brand': 'Apple',
- 'color': 'Space Gray',
- 'warranty': '1 Year',
- 'condition': 'New',
- 'model': 'MacBook Pro 14"'
- }
- },
- {
- 'sku': 'ELEC-002',
- 'category': 'Electronics',
- 'title': 'Samsung Galaxy S24 Ultra', # Bad title (4 words, missing attribute-like details)
- 'description': 'Flagship Samsung phone.', # Bad description (3 words - fails min_word_count 10)
- 'seo_title': 'Samsung Galaxy S24 Ultra', # Bad SEO Title (26 chars - fails min_length 40)
- 'seo_description': 'Experience the best of mobile technology.', # Bad SEO Description (45 chars - fails min_length 120)
- 'attributes': {
- 'brand': 'Samsung',
- 'color': 'blak',
- 'warranty': 'N/A',
- 'condition': 'new',
- }
- },
- {
- 'sku': 'ELEC-003',
- 'category': 'Electronics',
- 'title': 'Sony WH-1000XM5 Wireless Headphones',
- 'description': 'Premium noise-cancelling headphones from Sony.', # Good description (5 words - **NOTE**: The rule is 10 words, this fails. I'm keeping it as a failure for testing.)
- 'seo_title': 'Sony WH-1000XM5 Noise Cancelling Wireless Headphones', # 57 chars - Good
- 'seo_description': '', # Bad (missing/empty - fails is_mandatory)
- 'attributes': {
- 'color': 'Black',
- 'warranty': '2 Years',
- 'condition': 'Refurbished'
- }
- },
- {
- 'sku': 'CLTH-002',
- 'category': 'Clothing',
- 'title': 'Adidas Comfy Hoodie', # Good title (contains "Hoodie")
- 'description': 'Comfortable hoodie for casual wear.', # Bad (4 words - fails min_word_count 10)
- 'seo_title': 'Adidas Comfy Hoodie for Men and Women', # 38 chars - Bad (fails min_length 40)
- 'seo_description': 'The perfect blend of style and comfort. Made from a durable cotton blend, ideal for lounging or a casual outing. Available in multiple sizes and colors.', # 160 chars - Good
- 'attributes': {
- 'brand': 'Adiddas',
- 'size': 'Large',
- 'color': '',
- }
- },
- ]
|