Sorting by price with Amazon AWS - amazon-web-services

As part of an ItemSearch operation with Amazon AWS, one can sort the results by price. Does anyone know which actual price the sort is performed by? Sale Price? Regular Price?

Assuming you're sorting them in lowest-to-highest order, it lists them by the lowest available price per item. There's list price, new price (sale price), and used price to choose from. If I remember correctly, you can customize your query to include any or all of these prices. Whichever of these three is lowest determines the sort placement for an item. See the results on ThriftCart.com (generated by AWS query) for an example.

Related

Aws step function - check if multiple entries in dynamo are updated

I have stepfunction for calculating operation cost of Departments. Each department consists of Employees. Employee is individual records in dynamo with fields (EmpId, Salary, Salary_Status(Processed, Pending, Not_Eligible))
Department operation cost Stepfunction example: Runs for individual departments
Start -> Step1: updateEmployeeSalaryLambda -> step2: wait for employee salary to be updated(Dynamo) -> doFoo() -> End
Is there a way to do the dynamo check from stepfunction directly .i.e check if all employees in a particular department have Salary_Status == Paid?
Thanks for all the help
There are two ways of doing it.
Introduce a sort key. Possible sort key design for your application may be: [Department]#[Salary_Status]. You can query it from another Lambda within your Step Function. If you know how many employees are in the department, you can count if the number matches the count of found paid employees. Another option is to check how many employees don't have Paid status (refer to this).
If you need more complex query you can also leverage secondary index.

How to solve "hot" hash key issue (space skewed data) in DynamoDB?

For example, I am using DynamoDB to store product purchase records. The hash key is product ID and the range key is purchase time.
Some popular products can have a lot of purchase records (space skewed) so that read/write requests can get throttled for "hot" partitions while other partitions are not using full throughput.
How to solve this problem and still be able to get latest purchase records? Thanks!
You can use a cache solution in order to achieve this.
You can follow the guidelines when designing a table to cache the popular items:
http://docs.aws.amazon.com/amazondynamodb/latest/developerguide/GuidelinesForTables.html#GuidelinesForTables.CachePopularItems
My solution for this is to use elasticache (Redis), you can create a list that represent the last purchases per product and trim the last 100 purchases for each product, for example:
LPUSH product:100 2016-08-13:purchaseId
LTRIM product:100 0 99
Will trim the list to last 100 items.
I hope this help...

AWS API to get the price displayed on amazon site

On an Amazon site, there is usually a List Price and a Price. I am trying to figure out how to obtain Price programmatically.
For example: This product has List Price $35 and Price $26
Through the ItemLookUp API, the List Price can be obtained easily but is there a way to get the Price from Amazon API?
First I thought that 'price' is the price that amazon sells the item at, but for this previously mentioned product this Price is $26 while the amazon's own lowest price is $28.76
Then I thought Price is the lowest price that is eligible for Prime, but I can't find easy way of getting this information.
If you make sure to include the Offers response group, you can get the lowest new price, lowest used price, etc. And if you need to, you can filter it to only offers from Amazon. That should give you the functionality you're needing. You can also find out if a specific offer is eligible for super saver shipping through that response group - which should be the same ones that are prime eligible.
Here's some more info on response groups and the different ones available - a very useful resource to dig through if you're wondering where to get a specific piece of info from.
I realize it's been a month since you asked this question, but I hope this helps. Let me know if you need any more clarification.

How to get shipping costs of an order with Amazon MWS Api?

I would like to get shipping costs of an order. I can get amount, customer information, purchase date of an order... but where is the shipping cost?
Any code or link would be very helpful.
Thanks.
Assuming that you are using the Orders API, the shipping charges for each item are stored in the shippingPrice property of the OrderItem type. You need to use the ListOrderItems operation to retrieve the order's items.
See page 26 of the Orders API documentation for a description of shippingPrice property. See page 25 for a description of the ListOrderItems operation.

Django webapp - tracking financial account information

I need some coding advice as I am worried that I am creating, well, bloated code that is inefficient.
I have a webapp that keeps track of a company's financial data. I have a table called Accounts with a collection of records corresponding to the typical financial accounts such as revenue, cash, accounts payable, accounts receivable, and so on. These records are simply name holders to be pointed at as foreign keys.
I also have a table called Account_Transaction which records all the transactions of money in and out of all the accounts in Accounts. Essentially, the Account_Transaction table does all the heavy lifting while pointing to the various accounts being altered.
For example, when a sale is made, two records are created in the Account_Transaction table. One record to increase the cash balance and a second record to increase the revenue balance.
Trans Record 1:
Acct: Cash
Amt: 50.00
Date: Nov 1, 2011
Trans Record 2:
Acct: Revenue
Amt: 50.00
Date: Nov 1, 2011
So now I have two records, but they each point to a different account. Now if I want to view my cash balance, I have to look at each Account_Transaction record and check if the record deals with Cash. If so, add/subtract the amount of that record and move to the next.
During a typical business day, there may be upwards of 200-300 transactions like the one above. As such, the Account_Transaction table will grow pretty quickly. After a few months, the table could have a few thousand records. Granted this isn't much for a database, however, every time the user wants to know the current balance of, say, accounts receivable, I have to traverse the entire Account_Transaction table to sum up all records that deal with the account name "Accounts Receivable".
I'm not sure I have designed this in the most optimal manner. I had considered creating a distinct table for each account (one for "Cash", another for "Accounts Receivable" another for "Revenue" etc...), but with that approach I was creating 15-20 tables with the exact same parameters, other than their name. This seemed like poor design so I went with this Account_Transaction idea.
Does this seem like an appropriate way to handle this kind of data? Is there a better way to do this that I should really be adopting?
Thanks!
Why do you need to iterate through all the records to figure out the status of Accounts Receievable accounts? Am I missing something in thinking you can't just use a .filter within the Django ORM to selectively pick the records you need?
As your records grow, you could add some date filtering to your reports. In most cases, your accountant will only want numbers for this quarter, month, etc., not entire historic data.
Add an index to that column to optimize selection and then check out Djangos aggregation to Sum up values from your database.
Finally, you could do some conservative caching to speed up things for "quick view" style reports where you just want a total number very quickly, but you need to be careful with this to not have false positives, so reseting that cache on any change to the records would be a must.
Why don't you keep track of the exact available amount in the Account table? The Account_Transaction could only be used to view transaction history.