FOLIO-FSE / FOLIO-FSE/folio_migration_tools
Implement/identify solution for correctly mapping categories to multiple objects in the same array
- Dominant language
- Python
- Stars
- 14
- Forks
- 10
- Avg merge
- 55m
- Merged PRs (30d)
- 7
Description
I tried achieving it with this data
```JSON
{
"EMAIL": "email1@abebooks.com",
"email1_categories": "sls",
"EMAIL2": "email2@abebooks.com",
"email2_categories": "tspt",
}
```
by mapping this way:
```Python
email_categories_map = [
{
"email1_categories": "tspt",
"email2_categories": "*",
"folio_value": "Technical Support",
},
{
"email1_categories": "sls",
"email2_categories": "*",
"folio_value": "Sales"
},
{
"email1_categories": "*",
"email2_categories": "tspt",
"folio_value": "Technical Support",
},
{
"email1_categories": "*",
"email2_categories": "sls",
"folio_value": "Sales"
},
{
"email1_categories": "*",
"email_2categories": "*",
"folio_value": "General"
}
]
```
```JSON
{
"folio_field": "emails[0].categories[0]",
"legacy_field": "email1_categories",
"value": "",
"description": "",
},
{
"folio_field": "emails[0].isPrimary",
"legacy_field": "Not mapped",
"value": true,
"description": "",
},
{
"folio_field": "emails[0].value",
"legacy_field": "EMAIL",
"value": "",
"description": "",
},
{
"folio_field": "emails[1].isPrimary",
"legacy_field": "Not mapped",
"value": false,
"description": "",
},
{
"folio_field": "emails[1].value",
"legacy_field": "EMAIL2",
"value": "",
"description": "",
},
{
"folio_field": "emails[1].categories[0]",
"legacy_field": "email2_categories",
"value": "",
"description": "",
},
```
but it seems what happens is that the in the ref data mapping handling in mapper_base will take the **first** matching wildcard row, not the one where the non-wildcarded value is in the column corresponding to what is mapped to this specific field (email1 **or** email2).
I wonder if a solution to this could be if we explicitly stated all mapped columns in the object mapping file (which would also look quite nice). Kind of like:
```JSON
{
"folio_field": "loanType",
"legacy_field": "MTYPE",
"value": "",
"description": "",
},
```
and
```JSON
{
"folio_field": "loanType",
"legacy_field": "LOCATION",
"value": "",
"description": "",
},
```
for single column ref data mappings, and
```JSON
{
"folio_field": "loanType",
"legacy_field": "MTYPE ; LOCATION",
"value": "",
"description": "",
},
```
for a multi-column one, and the ref data mapping ONLY looked at the column(s) specified for that property in the mapping.
Contributor guide
Assessment
This issue has not been assessed yet.