Skip to content

Commit 9ce2735

Browse files
feat: add constitutive properties to show entities operation (#116)
* feat: add constitutive properties to show entities operation * chore: swap order of observed and constitutive properties
1 parent e4acec3 commit 9ce2735

File tree

1 file changed

+13
-1
lines changed

1 file changed

+13
-1
lines changed

orchestrator/schema/request.py

Lines changed: 13 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -260,6 +260,12 @@ def series_representation(
260260
for res in self.measurements
261261
]
262262

263+
#
264+
entities_constitutive_properties_series = {
265+
entity.identifier: entity.seriesRepresentation(constitutiveOnly=True)
266+
for entity in self.entities
267+
}
268+
263269
#
264270
measurement_series = []
265271
occurrences = {}
@@ -278,7 +284,13 @@ def series_representation(
278284
"result_index": result_index,
279285
}
280286
)
281-
measurement_series.append(pd.concat([req, s]))
287+
288+
# We are dealing with Series, so we want to avoid duplicate keys
289+
# The only keys that can clash are the ones between the entities'
290+
# constitutive properties and the ones coming from the MeasurementResult
291+
e = entities_constitutive_properties_series[s["identifier"]]
292+
e = e[e.index.difference(s.keys())]
293+
measurement_series.append(pd.concat([req, e, s]))
282294

283295
return measurement_series
284296

0 commit comments

Comments
 (0)