from dotenv import load_dotenv, find_dotenv
import avesterra as av
import orchestra.env as env
from utils import (
create_person_entity,
how_to_get_features_from_entities,
set_person_facts,
set_person_features,
)
[docs]
def main():
# Initialize connection to AvesTerra server at IP Address
load_dotenv(find_dotenv())
host = env.get_or_raise("AVESTERRA_HOST")
cert_dir = env.get_or_raise("AVESTERRA_CERTIFICATE_DIR_PATH")
auth = env.get_or_raise("AVESTERRA_AUTH", av.AvAuthorization)
av.initialize(server=host, directory=cert_dir, socket_count=2)
# Create some people
john_entity = create_person_entity.create_entity("John Smith", auth=auth)
jane_entity = create_person_entity.create_entity("Jane Smith", auth=auth)
# Set some person facts
set_person_facts.set_person_facts(
john_entity, "John Smith", "101 South Home", "Software Engineer", "IBM", auth
)
set_person_facts.set_person_facts(
jane_entity, "Jane Smith", "501 North Home", "Sales", "AMAZON", auth
)
# Set the feature on the fact
set_person_features.set_feature(
john_entity, "101 South Home", "101 Work Lane", auth
)
set_person_features.set_feature(
jane_entity, "501 North Home", "501 Work Lane", auth
)
# Show how to get features
how_to_get_features_from_entities.examples_of_get_features_by_retrieve(
john_entity, av.AvAttribute.ADDRESS, auth
)
how_to_get_features_from_entities.examples_of_get_features_by_brute_force(
john_entity, auth
)
print("")
print("----------------Lookup these Entity IDs in Maestro or auv ----------------")
print(f"John_entity: {john_entity}")
print(f"Jane_entity: {jane_entity}")
av.finalize()
if __name__ == "__main__":
main()