import avesterra as av
[docs]
def set_feature(person_entity: av.AvEntity, home_address: str, work_address: str, auth: av.AvAuthorization):
"""
A person can have multiple addresses. Features, Facets/Factors & Factors, and
Frames are Avial constructs that can be used to add additional attributes to a Fact.
This function shows how facets and factors can be used for multiple addresses. When to use
Features, facets, or Frames is a modeling discussion and not applicable to this lesson.
:param person_entity: The entity ID of the person entity to add the feature.
:param home_address: Person's home address.
:param work_address: Person's work address.
:param auth: The Orchestra server authorization that allows entity operations.
"""
av.set_feature(
entity=person_entity,
attribute=av.AvAttribute.ADDRESS,
name='Home Address',
key='home_address',
value=av.AvValue.encode_string(home_address),
authorization=auth,
)
av.set_feature(
entity=person_entity,
attribute=av.AvAttribute.ADDRESS,
name='Work Address',
key='work_address',
value=av.AvValue.encode_string(work_address),
authorization=auth,
)