sample_data.py 10 KB

123456789101112131415161718192021222324252627282930313233343536373839404142434445464748495051525354555657585960616263646566676869707172737475767778798081828384858687888990919293949596979899100101102103104105106107108109110111112113114115116117118119120121122123124125126127128129130131132133134135136137138139140141142143144145146147148149150151152153154155156157158159160161162163164165166167168169170171172173174175176177178179180181182183184185186187188189190191192193194195196197198199200201202203204205206207208209210211212213214215216217218219220221222223224225226227228229230231232233234235236237238239240241242243244245246247248249250251252253254255256257258259260261262263264265266267268269270271272273274275276277278279280281282283284285286287288289290291292293294295296297298299300301302303304305306307308309310311312313314315316317318319
  1. # # sample_data.py
  2. # """
  3. # Sample data to test the attribute scoring system
  4. # """
  5. # SAMPLE_CATEGORY_RULES = [
  6. # {
  7. # 'category': 'Electronics',
  8. # 'attribute_name': 'brand',
  9. # 'is_mandatory': True,
  10. # 'valid_values': ['Apple', 'Samsung', 'Sony', 'LG', 'Dell', 'HP', 'Lenovo'],
  11. # 'data_type': 'string'
  12. # },
  13. # {
  14. # 'category': 'Electronics',
  15. # 'attribute_name': 'color',
  16. # 'is_mandatory': True,
  17. # 'valid_values': ['Black', 'White', 'Silver', 'Gray', 'Blue', 'Red', 'Gold', 'Rose Gold'],
  18. # 'data_type': 'string'
  19. # },
  20. # {
  21. # 'category': 'Electronics',
  22. # 'attribute_name': 'warranty',
  23. # 'is_mandatory': True,
  24. # 'valid_values': ['1 Year', '2 Years', '3 Years', 'Lifetime'],
  25. # 'data_type': 'string'
  26. # },
  27. # {
  28. # 'category': 'Electronics',
  29. # 'attribute_name': 'condition',
  30. # 'is_mandatory': True,
  31. # 'valid_values': ['New', 'Refurbished', 'Used'],
  32. # 'data_type': 'string'
  33. # },
  34. # {
  35. # 'category': 'Electronics',
  36. # 'attribute_name': 'model',
  37. # 'is_mandatory': False,
  38. # 'valid_values': [],
  39. # 'data_type': 'string'
  40. # },
  41. # {
  42. # 'category': 'Clothing',
  43. # 'attribute_name': 'brand',
  44. # 'is_mandatory': True,
  45. # 'valid_values': ['Nike', 'Adidas', 'Puma', 'Reebok', 'Under Armour'],
  46. # 'data_type': 'string'
  47. # },
  48. # {
  49. # 'category': 'Clothing',
  50. # 'attribute_name': 'size',
  51. # 'is_mandatory': True,
  52. # 'valid_values': ['XS', 'S', 'M', 'L', 'XL', 'XXL'],
  53. # 'data_type': 'string'
  54. # },
  55. # {
  56. # 'category': 'Clothing',
  57. # 'attribute_name': 'color',
  58. # 'is_mandatory': True,
  59. # 'valid_values': ['Black', 'White', 'Blue', 'Red', 'Green', 'Yellow', 'Gray'],
  60. # 'data_type': 'string'
  61. # },
  62. # {
  63. # 'category': 'Clothing',
  64. # 'attribute_name': 'material',
  65. # 'is_mandatory': True,
  66. # 'valid_values': ['Cotton', 'Polyester', 'Wool', 'Silk', 'Nylon', 'Blend'],
  67. # 'data_type': 'string'
  68. # },
  69. # ]
  70. # SAMPLE_PRODUCTS = [
  71. # {
  72. # 'sku': 'ELEC-001',
  73. # 'category': 'Electronics',
  74. # 'title': 'Apple MacBook Pro 14-inch Space Gray',
  75. # 'description': 'Latest Apple MacBook Pro with M3 chip, 14-inch display in Space Gray color.',
  76. # 'attributes': {
  77. # 'brand': 'Apple',
  78. # 'color': 'Space Gray', # Should suggest "Gray"
  79. # 'warranty': '1 Year',
  80. # 'condition': 'New',
  81. # 'model': 'MacBook Pro 14"'
  82. # }
  83. # },
  84. # {
  85. # 'sku': 'ELEC-002',
  86. # 'category': 'Electronics',
  87. # 'title': 'Samsung Galaxy S24 Ultra',
  88. # 'description': 'Flagship Samsung phone with advanced camera system.',
  89. # 'attributes': {
  90. # 'brand': 'Samsung',
  91. # 'color': 'blak', # Typo - should suggest "Black"
  92. # 'warranty': 'N/A', # Placeholder - should flag
  93. # 'condition': 'new', # Case mismatch - should suggest "New"
  94. # # Missing 'model'
  95. # }
  96. # },
  97. # {
  98. # 'sku': 'ELEC-003',
  99. # 'category': 'Electronics',
  100. # 'title': 'Sony WH-1000XM5 Wireless Headphones',
  101. # 'description': 'Premium noise-cancelling headphones from Sony.',
  102. # 'attributes': {
  103. # # Missing 'brand' - mandatory field
  104. # 'color': 'Black',
  105. # 'warranty': '2 Years',
  106. # 'condition': 'Refurbished'
  107. # }
  108. # },
  109. # {
  110. # 'sku': 'CLTH-001',
  111. # 'category': 'Clothing',
  112. # 'title': 'Nike Dri-FIT Running T-Shirt Blue Medium',
  113. # 'description': 'Lightweight Nike running shirt in blue color, size Medium.',
  114. # 'attributes': {
  115. # 'brand': 'Nike',
  116. # 'size': 'M',
  117. # 'color': 'Blue',
  118. # 'material': 'Polyester'
  119. # }
  120. # },
  121. # {
  122. # 'sku': 'CLTH-002',
  123. # 'category': 'Clothing',
  124. # 'title': 'Adidas Hoodie',
  125. # 'description': 'Comfortable hoodie for casual wear.',
  126. # 'attributes': {
  127. # 'brand': 'Adiddas', # Typo - should suggest "Adidas"
  128. # 'size': 'Large', # Should suggest "L"
  129. # 'color': '', # Empty - should flag
  130. # # Missing 'material' - mandatory field
  131. # }
  132. # },
  133. # ]
  134. # sample_data.py
  135. """
  136. Sample data to test the attribute scoring system
  137. """
  138. # ... SAMPLE_CATEGORY_RULES remains the same ...
  139. SAMPLE_CATEGORY_RULES = [
  140. {
  141. 'category': 'Electronics',
  142. 'attribute_name': 'brand',
  143. 'is_mandatory': True,
  144. 'valid_values': ['Apple', 'Samsung', 'Sony', 'LG', 'Dell', 'HP', 'Lenovo'],
  145. 'data_type': 'string'
  146. },
  147. {
  148. 'category': 'Electronics',
  149. 'attribute_name': 'color',
  150. 'is_mandatory': True,
  151. 'valid_values': ['Black', 'White', 'Silver', 'Gray', 'Blue', 'Red', 'Gold', 'Rose Gold'],
  152. 'data_type': 'string'
  153. },
  154. {
  155. 'category': 'Electronics',
  156. 'attribute_name': 'warranty',
  157. 'is_mandatory': True,
  158. 'valid_values': ['1 Year', '2 Years', '3 Years', 'Lifetime'],
  159. 'data_type': 'string'
  160. },
  161. {
  162. 'category': 'Electronics',
  163. 'attribute_name': 'condition',
  164. 'is_mandatory': True,
  165. 'valid_values': ['New', 'Refurbished', 'Used'],
  166. 'data_type': 'string'
  167. },
  168. {
  169. 'category': 'Electronics',
  170. 'attribute_name': 'model',
  171. 'is_mandatory': False,
  172. 'valid_values': [],
  173. 'data_type': 'string'
  174. },
  175. {
  176. 'category': 'Clothing',
  177. 'attribute_name': 'brand',
  178. 'is_mandatory': True,
  179. 'valid_values': ['Nike', 'Adidas', 'Puma', 'Reebok', 'Under Armour'],
  180. 'data_type': 'string'
  181. },
  182. {
  183. 'category': 'Clothing',
  184. 'attribute_name': 'size',
  185. 'is_mandatory': True,
  186. 'valid_values': ['XS', 'S', 'M', 'L', 'XL', 'XXL'],
  187. 'data_type': 'string'
  188. },
  189. {
  190. 'category': 'Clothing',
  191. 'attribute_name': 'color',
  192. 'is_mandatory': True,
  193. 'valid_values': ['Black', 'White', 'Blue', 'Red', 'Green', 'Yellow', 'Gray'],
  194. 'data_type': 'string'
  195. },
  196. {
  197. 'category': 'Clothing',
  198. 'attribute_name': 'material',
  199. 'is_mandatory': True,
  200. 'valid_values': ['Cotton', 'Polyester', 'Wool', 'Silk', 'Nylon', 'Blend'],
  201. 'data_type': 'string'
  202. },
  203. ]
  204. # --- NEW SAMPLE CONTENT RULES ---
  205. SAMPLE_CONTENT_RULES = [
  206. # Global Rules
  207. {
  208. 'category': None, # Applies to all categories
  209. 'field_name': 'description',
  210. 'is_mandatory': True,
  211. 'min_word_count': 200,
  212. 'max_word_count': 500,
  213. },
  214. {
  215. 'category': None, # Applies to all categories
  216. 'field_name': 'title',
  217. 'is_mandatory': True,
  218. 'min_word_count': 40,
  219. 'max_word_count': 100,
  220. },
  221. {
  222. 'category': None,
  223. 'field_name': 'seo_title',
  224. 'is_mandatory': True,
  225. 'min_length': 40,
  226. 'max_length': 60,
  227. },
  228. {
  229. 'category': None,
  230. 'field_name': 'seo_description',
  231. 'is_mandatory': True,
  232. 'min_length': 120,
  233. 'max_length': 160,
  234. },
  235. # Category-Specific Rules
  236. {
  237. 'category': 'Electronics',
  238. 'field_name': 'title',
  239. 'is_mandatory': True,
  240. 'min_word_count': 4,
  241. 'must_contain_keywords': ['Apple', 'Samsung', 'Sony', 'HP'], # Must contain one of the major brands
  242. },
  243. {
  244. 'category': 'Clothing',
  245. 'field_name': 'title',
  246. 'is_mandatory': True,
  247. 'must_contain_keywords': ['T-Shirt', 'Hoodie', 'Jacket'],
  248. },
  249. ]
  250. # ... SAMPLE_PRODUCTS updated with content fields ...
  251. SAMPLE_PRODUCTS = [
  252. {
  253. 'sku': 'ELEC-001',
  254. 'category': 'Electronics',
  255. 'title': 'Apple MacBook Pro 14-inch Space Gray', # Good title (5 words, contains "Apple")
  256. 'description': 'Latest Apple MacBook Pro with M3 chip, 14-inch display in Space Gray color.', # 16 words - Good
  257. 'seo_title': 'Buy Apple MacBook Pro 14-inch M3 Space Gray', # 42 chars - Good
  258. '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
  259. 'attributes': {
  260. 'brand': 'Apple',
  261. 'color': 'Space Gray',
  262. 'warranty': '1 Year',
  263. 'condition': 'New',
  264. 'model': 'MacBook Pro 14"'
  265. }
  266. },
  267. {
  268. 'sku': 'ELEC-002',
  269. 'category': 'Electronics',
  270. 'title': 'Samsung Galaxy S24 Ultra', # Bad title (4 words, missing attribute-like details)
  271. 'description': 'Flagship Samsung phone.', # Bad description (3 words - fails min_word_count 10)
  272. 'seo_title': 'Samsung Galaxy S24 Ultra', # Bad SEO Title (26 chars - fails min_length 40)
  273. 'seo_description': 'Experience the best of mobile technology.', # Bad SEO Description (45 chars - fails min_length 120)
  274. 'attributes': {
  275. 'brand': 'Samsung',
  276. 'color': 'blak',
  277. 'warranty': 'N/A',
  278. 'condition': 'new',
  279. }
  280. },
  281. {
  282. 'sku': 'ELEC-003',
  283. 'category': 'Electronics',
  284. 'title': 'Sony WH-1000XM5 Wireless Headphones',
  285. '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.)
  286. 'seo_title': 'Sony WH-1000XM5 Noise Cancelling Wireless Headphones', # 57 chars - Good
  287. 'seo_description': '', # Bad (missing/empty - fails is_mandatory)
  288. 'attributes': {
  289. 'color': 'Black',
  290. 'warranty': '2 Years',
  291. 'condition': 'Refurbished'
  292. }
  293. },
  294. {
  295. 'sku': 'CLTH-002',
  296. 'category': 'Clothing',
  297. 'title': 'Adidas Comfy Hoodie', # Good title (contains "Hoodie")
  298. 'description': 'Comfortable hoodie for casual wear.', # Bad (4 words - fails min_word_count 10)
  299. 'seo_title': 'Adidas Comfy Hoodie for Men and Women', # 38 chars - Bad (fails min_length 40)
  300. '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
  301. 'attributes': {
  302. 'brand': 'Adiddas',
  303. 'size': 'Large',
  304. 'color': '',
  305. }
  306. },
  307. ]