To create a mapping rule to combine multiple fields into a new field use this syntax:
;;sourse_type1|souce_type2;destination
You can find an example in ./tests/integration_tests/test_data/mappings.csv
There are two ways to calculate article number according to the task:
- Take field
article_number
- Take combination of fields
article_number_{N}
I've chosen the first option as a more straightforward one. But there are ways to switch to the second option:
- Use the fields combination rule to combine article numbers into one entity
- Change method
Variation.get_article_number
logic to combine all articles number only for grouping variations (they'll still be separate article fields)
Main entry point for creating catalog is CatalogBuilder.build_catalog
. Method returns catalog as a dictionary
that can be converted to json or used as a field for another data contract
To run unit tests run py -m unittest discover
in the project root directory (csv-to-json)