9
answers
1
watching
441
views

Objective: Take a sample feed, parse it, augment it, and output individual JSON objects for each product in it.

product.txt

  • The file contains several fields of basic product information for 1000 products.
  • Data for each product is on one line, with fields separated by a vertical pipe character.

This particular retailer classifies products into a particular store, department, category, and subcategory.

Example >

  • A Blender might have the following "taxonomy" or category classification.

Home & Garden > Kitchen & Dining > Appliances > Blenders

Store

Department

Category

Subcategory

store_id

department_id

category_id

subcategory_id

 

These IDs are also represented in a sort of shorthand.

  • They should all be prefixed by the first three letters of their respective field name.

A store_id of 1 becomes sto1

A department_id of 2 becomes dep2

A category_id of 3 becomes cat3

A subcategory_id of 4 becomes sub4

targets.txt

  • A system to keep track of these various classifications
    • Example
      • A store_id of sto40 maps to a “target value” of 187298 in PromoteIQ's system

Output Example:

The desired output for the first product is one line of JSON that when pretty-printed looks like:

{

  "sku": "22067130",

  "name": "Brainboxes ES-571 Brainboxes Es-571 Industrial Isolated Ethernet to Serial + Switch - 1 x Network (R",

  "description": "Brainboxes ES-571 Brand New Includes Lifetime Warranty Product # ES-571 Factory floors can be harsh environments.",

  "priceList": 387.95,

  "taxonomy": [

    "sto2",

    "dep7",

    "cat270",

    "sub18532"

  ],

  "targetValues": [

    187167,

    187177,

    187950,

    196404

  ]

}

 

The taxonomy IDs have been mapped to their long form and placed in the taxonomy property.

  • Each taxonomy ID has also been mapped to its corresponding target value ID from the targets.txt file
    • and that result is stored in the targetValues
    • The priceList property is the product price as a JSON float, not a string

For unlimited access to Homework Help, a Homework+ subscription is required.

Unlock all answers

Get 1 free homework help answer.
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in
Already have an account? Log in

Weekly leaderboard

Start filling in the gaps now
Log in