Source code for module.lesson_5_frames

import avesterra as av
from dotenv import load_dotenv, find_dotenv
import orchestra.env as env
from utils import (
    create_person_entity,
    how_to_get_frames_from_entity,
    set_person_facts,
    set_person_frames,
)


[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( person_entity=john_entity, name="John Smith", address="101 South Home", occupation="Software Engineer", company="IBM", auth=auth, ) set_person_facts.set_person_facts( person_entity=jane_entity, name="Jane Smith", address="501 North Home", occupation="Sales", company="AMAZON", auth=auth, ) # Create list of people entities people_data = [john_entity, jane_entity] # Add the list of people as a frame to the report entity's date fact report_entity = set_person_frames.set_person_frames( people_data=people_data, auth=auth ) # Examples of how to get the frames from teh report entity. how_to_get_frames_from_entity.examples_of_get_frames_by_retrieve( report_entity=report_entity, auth=auth ) how_to_get_frames_from_entity.examples_of_get_frames_by_brute_force( report_entity=report_entity, person_entity=john_entity, auth=auth ) how_to_get_frames_from_entity.examples_of_get_frames_by_brute_force( report_entity=report_entity, person_entity=jane_entity, auth=auth ) print("") print("----------------Lookup these Entity IDs in Maestro or avu ----------------") print(f"john entity: {john_entity}") print(f"jane entity: {jane_entity}") print(f"report entity: {report_entity}") print("------------------------------------------------------------------") av.finalize()
if __name__ == "__main__": main()