jim256 / ebay

0 stars 0 forks source link

Quick Question - Reason for "Salvage" title_type #23

Closed jim256 closed 4 years ago

jim256 commented 4 years ago

Hey, @james-carpenter , I just noticed that this car was stored in my table as title_type = "Salvage":

https://www.ebay.com/itm/2014-Audi-RS5-Coupe-2D/333407953362?hash=item4da0a9a1d2:g:RYkAAOSwZ3td1~EX

I'm having trouble understanding why, because I'm not finding any of the keywords like branded, salvage, etc. on the page. Would you mind letting me know why / how that would have happened?

I was wondering if it was this: image

But I think we already went over that

james-carpenter commented 4 years ago

Yes, this is what's causing that behavior. The title_type is Unspecified, which would get removed at the top of process_item with this if it handled that in addition to not specified:

        # clean out the 'not specified's
        for name in [k for k, v in item.items() if v and v.lower() in ['not specified', '--']]:
            del item[name]

Then it would skip the mapping you called out above.

        if item.get('title_type'):
            item['title_type'] = self._map_field(self._TITLE_TYPE_MAPPING, item.get('title_type'))

As it is, the Unspecified survives and hits the default mapping of Salvage. The straightforward fix for this would be to add unspecified to the list of values to remove with the line below.

for name in [k for k, v in item.items() if v and v.lower() in ['unspecified', 'not specified', '--']]:
jim256 commented 4 years ago

Hey @james-carpenter , I hope you had a great Thanksgiving! I really appreciate that helpful explanation! I apologize for my delay - I had a lot of unexpected issues arise.

Just to clarify - this would result in title_type = NULL in the case of an "Unspecified" title type, correct? And this would catch "Unspecified" for all fields, not just title_type, correct?

james-carpenter commented 4 years ago

You got it. Right on all counts.

Thanksgiving was a wonderful time with family. I certainly hope the same for you.

jim256 commented 4 years ago

Glad to hear it! Ok perfect, thanks again.