StoredashboardETLFeed
StoredashboardETLFeed reads data from orderdb
, transforms the data in a structured model, and copies the data to Redshift.
Redshift is Amazon’s fully managed, petabyte-scale cloud-based data warehouse service.
Transformation Process
The steps involved in the transformation process are:
- Delete the previously created files by the feed.
- Read the last successful feed runtime from the feed run history table. If the feed is a fresh run, the feed runtime would be one (1) day, by default.
- Look for any changes in the table schema of the source JSON file. If there are table structure changes, the feed alters the schema in Redshift. If the feed is a fresh run, it creates all the tables in Redshift before loading the data.
- Read the data from the order table (MongoDB) and transform it into a structured format. An order document is transformed into the following tables:
ordersummary
orderderails
orderpromotion
orderproducts
orderpayment
.csv
files in the output folder. - Create a manifest file in each folder based on the files. Upload the files which are available in the output folders to the given S3 path.
- Trigger Redshift’s COPY statement to load the data from S3 to Redshift.
Note: The S3 details and Redshift cluster details are passed in the Job params. The order DB and feed details are read from the feed’s service config feature.
reportAthenaETLFeed
The feed reportAthenaETLFeed
extracts MongoDB document of Order service from omsdb
and transform it into the structured .csv
files. It uploads the .csv
files into AWS S3.
The steps involved in the transformation process are:
- Delete the previously created files in the output location.
- Parse the
serviceConfig
field of the Order and Feed services to fetch the Order and Feed DB details. While creating the feed, you have to specify the Feed and Order services in theserviceConfig
field. - Read the last successful run time from the feed run history table of the Feed DB. If the feed is run for the first time, extract the last run time from the job parameter or extract the previous day as last run time.
- Using the last run time from the step 3, the feed job queries the OMS DB and fetches the orders created and updated since the last run time till the current feed run time, and transforms it into the
.csv
files with the specific fields. There are five.csv
files created for this feed. - Check whether the job created the new files or not. If no orders were created or updated in the specific period, indicates no files were created. In this case, you should abort the job and wait for the next run. If the new files were created, you upload all the files to AWS S3 and wait for the next feed run.
CSV Files
The CSV files are:
Order Summary
The file name is:
ordersummary_<_YYYYMMDDHHmmSS>_<IDX>
The following table lists fields of the file:
Field Name | Desccription |
---|---|
uploadtime | Specifies the time when the file was created. |
orderid | Indicates the unique ID of the order. |
collectionid | Indicates the collection ID under which the order was created. |
createdtime | Contains the time when the order was created. |
updatedtime | Specifies the time when the order was last updated. |
createdby | Indicates the user who has created the order in theAdmin console. |
storeid | Indicates the store in which the order was placed. |
userid | Specifies end user who has created the order. |
totalsale | Contains the total sale of the order calculated from Math. |
totaldiscount | Indicates the total discount of the order calculated from Math. |
totaltax | Indicates the total tax of the order calculated from Math. |
Order Details
The file name is:
orderdetails_<_YYYYMMDDHHmmSS>_<IDX>
The following table lists fields of the file:
Field Name Description
uploadtime
Specifies the time when the file was created.
orderid
Specifies the unique ID of the order.
collectionid
Specifies the collection ID under which the order was created.
createdtime
Specifies the time when the order was created.
updatedtime
Specifies the time when the order was last updated.
createdby
Specifies the user who has created the order in the Admin console.
storeid
Indicates the store ID in which the order was placed.
userid
Specifies the end user who has placed the order.
firstname
Indicates the first name of the user.
lastname
Indicates the last name of the user.
itemid
Indicates the ID of the item in the order.
productid
Contains the ID of the product from the catalog.
productname
Indicates the name of the product.
sku
Specifies the SKU ID of the product.
quantity
Indicates the quantity placed.
style
Contains the style type.
color
Indicates the color of the product placed.
fit
Indicates the fit type of the product.
size
Specifies the size of the product placed.
categoryid
Indicates the category ID under which the product was placed.
vendor
Specifies the vendor name of the product.
itemstatus
Indicates the status of the item placed.
paymentid
Indicates the payment ID in the order.
paymentmode
Indicates the mode of payment.
paymentvalue
Indicates the total amount in the payment.
paymenttype
Indicates the payment type.
currency
Specifies the currency type of the payment.
Order Payment
The file name is:
orderpayment_<_YYYYMMDDHHmmSS>_<IDX>
The following table lists fields of the file:
Field Name Description
uploadtime
Specifies the time when the file was created.
orderid
Contains the unique ID of the order.
collectionid
Indicates the collection ID under which the order was created.
createdtime
Indicates the time when the order was created.
updatedtime
Indicates the time when the order was last updated.
createdby
Indicates the user who has created the order in Admin console.
storeid
Indicates the store in which the order was placed.
userid
Specifies the end user who has created the order.
paymentid
Contains the payment ID in the order.
paymentmode
Indicates the mode of payment.
paymentvalue
Specifies the total amount in the payment.
paymenttype
Indicates the payment type.
paymentstatus
Contains the payment status.
Order Product
The file name is:
orderproduct_<_YYYYMMDDHHmmSS>_<IDX>
The following table lists fields of the file:
Field Name Description
uploadtime
Specifies the time when the file was created.
orderid
Specifies the unique ID of the order.
collectionid
Indicates the collection ID under which the order was created.
createdtime
Specifies the time when the order has been created
updatedtime
Indicates the time when the order was last updated
createdby
Indicates the user who created the order in admin.
storeid
Indicates the store in which the order was placed.
userid
Indicates the end user ID who has created the order.
firstname
Indicates the first name of the user.
lastname
Indicates the last name of the user.
itemid
Indicates the ID of the item in the order.
productid
Specifies the ID of the product from the catalog.
productname
Specifies the name of the product.
sku
Specifies the SKU ID of the product.
quantity
Contains the quantity placed.
style
Indicates the style type.
color
Specifies the color of the product placed.
fit
Indicates the fit type of the product.
size
Contains the size of the product placed.
categoryid
Specifies the category ID under which the product was placed.
vendor
Contains the vendor name of the product.
unitprice
Specifies the price of the product per unit.
saleprice
Contains the sale price in the order.
mode
Indicates the payment mode.
totalsale
Indicates the total sale of the product.
Order Promotion
The file name is:
orderpromotion_<_YYYYMMDDHHmmSS>_<IDX>
The following table lists the fields of the file:
Field Name Description
uploadtime
Indicates the time when the file has been created.
orderid
Specifies unique ID of the order.
collectionid
Indicates the collection ID under which the order was created.
createdtime
Contains the time when the order was created.
updatedtime
Indicates the time when the order was last updated.
createdby
Contains the user who has created the order in Admin console.
storeid
Indicates the store in which the order was placed.
userid
Indicates the end user who has created the order.
firstname
Indicates the first name of the user.
lastname
Specifies the last name of the user.
totalordersale
Indicates the total sale value of the order.
totalordertax
Contains the total tax of the order.
totalorderdiscount
Indicates the total discount in the order.
offerid
Specifies the offer ID.
promocode
Indicates the promocode used.
promoname
Specifies the promotion name.
promolevel
Indicates the promotion level.
mode
Indicates the mode.
totaldiscount
Indicates the total discount by the promotion.
Note: For detailed information about Feeds microservice, see here. |
Revision History
2019-01-24 | Ananthi – Content updated for February 2020 release.
2019-05-08 | Ananthi – Minor copyedits.
2019-05-01 | PLK – Content copyedited.
2019-04-17 | MA – Content uploaded.