-
-
Notifications
You must be signed in to change notification settings - Fork 729
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
DFC import: Find broader taxon if we don't have a specific one #13109
Conversation
We didn't actually need the extra class.
For example, when importing `beef` products associate the type `meat-product` instead because we don't have a specific beef category.
# recursive call | ||
record_type(current_product_type, narrower) | ||
end | ||
DataFoodConsortium::Connector::SKOSParser.concepts[dfc_id] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
In this commit I kept the spec file untouched and it passes.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice ! Is this a recent addition to the connector ?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Very clever!
My first thought was: why not just load all DFC taxons into OFN? But I imagine that list would be very unwieldy and cause other challenges for categorising products.
This method makes is way more manageable.
taxons = priority_list.lazy.map do |type| | ||
Spree::Taxon.find_by(dfc_id: type.semanticId) | ||
end.compact | ||
|
||
taxons.first || Spree::Taxon.first |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice to see different ways of doing things. I probably would have ended up with an each
or reduce
loop, but this is nice 👍
Yes, that is a long-term idea. But for the migration, we need to map current taxons to DFC types. Therefore we added UI in OFN to add a dfc_id to each taxon. I don't know how many instances have done that. They all have different taxons in the database and that is part of discovery for DFC as well. If the DFC is missing something, we need to add it there. Then we would be in a position to migrate taxon associations to pure DFC ids and get rid of OFN's custom taxons. Then there are of course a lot more product types then we currently have as taxons. So first we would need to improve the UX to make the selection easier. But none of this work has been requested and scheduled so far. We have bigger fish to fry. |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice one 👍
# recursive call | ||
record_type(current_product_type, narrower) | ||
end | ||
DataFoodConsortium::Connector::SKOSParser.concepts[dfc_id] |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Nice ! Is this a recent addition to the connector ?
@RaggedStaff I see you deployed this to staging. Did you want to do any further testing, or are you happy to merge this? |
No. I needed to add that for the DFC importer. |
Shopify catalog is not ready for testing. It doesn't have the right product types. We can merge this. |
What? Why?
One of the suppliers in the UK is importing beef products but we don't have a beef product category (taxon). Luckily the DFC organises product types with links to broader concepts. So we can go up in the product type hierarchy until we find a matching type, like meat product.
What should we test?
Release notes
Changelog Category (reviewers may add a label for the release notes):
The title of the pull request will be included in the release notes.
Dependencies
Documentation updates