Closed fjuniorr closed 11 months ago
The above is fixed in https://github.com/fjuniorr/flowmapper/commit/9bd77f08759adc7e30e6a835596a0c24d0e870f0 but now there is another problem.
Because in the field mapping the context
key could be a list such as ['categories.0', 'categories.1']
this can't be used as a dict key in format_match_result which means I can't generate any of the formats discussed in https://github.com/fjuniorr/flowmapper/issues/1.
Need to think about the best way forward.
Something like:
["compartment.compartment.#text", "compartment.subcompartment.#text"][0].split('.')[0]
would work when all levels of the context share the same initial key. However it would not work for example in this flow schema (which is fictitious):
flow = {
"name": "Carbon dioxide, in air",
"categories": "emission/air",
"subcategories": ["troposphere", "high"],
"unit": "kg",
"CAS": "000124-38-9",
}
context_mapping = ["categories", "subcategories"]
The example mapping between simapro-flows.json and ElementaryExchanges-3.7.xml is in mapping.json.
This is the first example in which the simapro flowlist has the full context and no uuid
.
I still did not run a mapping in a simapro flow list don't have and
uuid
and I think the current field mapping format could present challenges.I can't leave it out. Should I do:
The returned object from
flowmapper.format_match_result
will likely have anuuid
key with a value of "". This is probably not what we want.