:information_source: This is a funded feature. Please use the Clockify project with the following name when working on this, including review and test: #9170 OFN DFC Products
Description
Subtask of:
10289
- As a: enterprise user
- On page: Visiting a DFC compliant platform like the DFC Prototype.
- I want to be able to do: Import OFN data.
We need to find a way to match OFN product categories (Spree::Taxon) with DFC ProductType. The OFN side is different on every instance and depends on the local language.
For example in Australia we have:
```
Spree::Taxon.pluck(:name)
=>
["Wood",
"Household",
"Fungi",
"Gifts",
"Sweets & Treats",
"Prepared Meals",
"Boxes",
"Vegetables",
"Oils & Spreads",
"Fodder",
"Herbs & Spices",
"Pickles & Preserves",
"Meat & Fish",
"Fibre",
"Personal Care",
"Fruit",
"Specials",
"Bulk Buy",
"Plants & Garden",
"Dairy",
"Drinks",
"Poultry & Eggs",
"Pulses & Grains",
"Nuts & Dried Fruits",
"Bakery",
"Products"]
```
And in France:
```
Spree::Taxon.distinct.pluck(:name)
=>
["ALCOOL FORT",
"LÉGUMINEUSES",
"AUTRES",
"PRODUITS POUR BÉBÉ",
"VIN ROSE",
"CHAMPAGNE",
"CHARCUTERIES",
"BIERE",
"VIN ROUGE",
"COSMÉTIQUES",
"PROMOTIONS",
"HERBES & ÉPICES",
"PRODUIT",
"PRODUITS MÉNAGERS",
"PAINS, FARINES, CÉRÉALES",
"CIDRE",
"PRODUITS ARTISANAUX",
"POISSON",
"PLATS PRÉPARÉS",
"PORC",
"FRUITS",
"FRUITS SECS & NOIX",
"THÉS, CAFÉS",
"VIANDE",
"BIERE BLANCHE",
"ŒUFS",
"BOEUF",
"SERVICES",
"PRODUITS LAITIERS",
"PRODUITS SUCRÉS",
"FLEURS",
"Pants et Graines",
"CHOCOLAT ET CACAO",
"VEAU",
"LÉGUMES",
"RIZ, PÂTES & CO",
"TRAITEUR",
"GIBIERS",
"AUTRES ALCOOLS",
"AGNEAU",
"PANIERS",
"BOISSONS, JUS",
"Miel et produits de la ruche",
"BIERE AMBRÉE",
"BIERE BLONDE",
"CONSERVES & BOCAUX",
"HUILES & VINAIGRES",
"VIN BLANC",
"FRUITS & LÉGUMES",
"VOLAILLES"]
```
#### Solution ideas
1. We could try to match by name. This would currently fail in most cases. We can rename categories in OFN to match the DFC name but the DFC standard currently contains only English and French. Other languages would, at least currently, not work.
2. We could add a new field to `Spree::Taxon` to link to the DFC category. Once instance managers copied the links to DFC categories into OFN then it can be used in the DFC export and import.
3. We could replace all current OFN categories with DFC categories. Instead of instance managers maintaining the categories, we could load the DFC database. We would need to contribute to the DFC to add all languages we support or use Transifex to translate the category names (or both). Instances then need to change the DFC standard if they want to change the categories.
I think that the last option would be the best long-term but it also requires a mapping of current categories to DFC categories for the migration. So solution 2 could be a good intermediate step to achieve the mapping and see if we can map everything to the DFC.
None of this would be ready for the demo in June. So we could create a short hard-coded mapping of some categories just for the data used in the demo. I will post this in Slack to discuss as well.
:information_source: This is a funded feature. Please use the Clockify project with the following name when working on this, including review and test:
#9170 OFN DFC Products
Description
Subtask of:
10289
- As a: enterprise user - On page: Visiting a DFC compliant platform like the DFC Prototype. - I want to be able to do: Import OFN data.
Acceptance Criteria & Tests
EDIT The work on the connector itself should be tracked separately in
10828 DFC Ruby Connector
.