normalize_entity(base_entity_id, new_entity_id, index, additional_variables=None, copy_variables=None, make_time_index=None, make_secondary_time_index=None, new_entity_time_index=None, new_entity_secondary_time_index=None, time_index_reduce='first')¶
Create a new entity and relationship from unique values of an existing variable.
- base_entity_id (str) – Entity id from which to split.
- new_entity_id (str) – Id of the new entity.
- index (str) – Variable in old entity that will become index of new entity. Relationship will be created across this variable.
- additional_variables (list[str]) – List of variable ids to remove from base_entity and move to new entity.
- copy_variables (list[str]) – List of variable ids to copy from old entity and move to new entity.
- make_time_index (bool or str, optional) – Create time index for new entity based on time index in base_entity, optionally specifying which variable in base_entity to use for time_index. If specified as True without a specific variable, uses the primary time index. Defaults to True if base entity has a time index.
- make_secondary_time_index (dict[str -> list[str]], optional) – Create a secondary time index from key. Values of dictionary are the variables to associate with the secondary time index. Only one secondary time index is allowed. If None, only associate the time index.
- new_entity_time_index (str, optional) – Rename new entity time index.
- new_entity_secondary_time_index (str, optional) – Rename new entity secondary time index.
- time_index_reduce (str) – If making a time_index, choose either the ‘first’ time or the ‘last’ time from the associated children instances. If creating a secondary time index, then the primary time index always reduces using ‘first’, and secondary using ‘last’.