Closed fjuniorr closed 6 months ago
This is done in https://github.com/fjuniorr/flowmapper/commit/abc58f735895a6462f0fc8304e3d6706d7cb3c79 but there is one possible shape for context data that I don't yet know how to handle with glom (ie. a spec that returns ["water", "ocean"]
):
flow = {
"uuid": "74a0aabb-e11b-4f3b-8921-45e447b33393",
"compartment": {
"name": "water"
},
"subcompartment": {
"name": "ocean"
},
"unit": {
"name": "kg"
}
}
It would likely involve glom(data, '*.name')
with some sort of filtering.
I'm closing this and will reopen as needed.
Currently
Context.from_dict
only handles contexts with two segments and the glom spec for the field mapping must specify each segment separately. For example:The idea is to require a glom spec that returns a list of segments, and change
Context.from_dict
accordingly. Here are some examples of specs that return["water", "ocean"]
for different shapes source flows: