def process_neo4j(args): # Get family data of the person global points try: main_person = Person() main_person.uniq_id = args.id1 taapeli_person = Person() taapeli_person.uniq_id = args.id2 # The fetching of the family and parents data of the main person is # split to two operations: # # If there are no parents in the db the result of # get_parentin_id() operation is empty, # but the get_family_data operation prints out # the family of the main person. result = main_person.get_parentin_id() for record in result: main_parents_hlink = record["parentin_hlink"] result = taapeli_person.get_parentin_id() for record in result: taapeli_parents_hlink = record["parentin_hlink"] compare_parents_data(main_parents_hlink, taapeli_parents_hlink) compare_family_data(main_person, taapeli_person) print("=== === Total points: " + str(points) + " === ===") except Exception as err: print("Virhe: {0}".format(err), file=stderr)
def process_neo4j(args): # Get family data of the person global points try: t = time.perf_counter() print_cnt = 0 total_points = [] compared_ids = [] taapeli_ids = [] u = User() u.userid = args.userid result = u.get_ids_and_refnames_of_people_of_user() for record in result: p = Person() # This id is the unique key of the node p.uniq_id = record["id"] refname = record["refname"] p.get_person_and_name_data_by_id() # Use the first name of the refname as a search key, # E.g. refname = "Matti Johannes" ---> search with "Matti" names = refname.split(" ") tresult = Name.get_ids_of_people_with_refname_and_user_given('Taapeli', names[0]) for trecord in tresult: tp = Person() tp.uniq_id = trecord["id"] # The fetching of the family and parents data of the main person is # split to two operations: # # If there are no parents in the db the result of # get_parentin_id() operation is empty, # but the get_family_data operation prints out # the family of the main person. result = p.get_parentin_id() for record in result: main_parents_hlink = record["parentin_hlink"] result = tp.get_parentin_id() for record in result: taapeli_parents_hlink = record["parentin_hlink"] compare_parents_data(main_parents_hlink, taapeli_parents_hlink) compare_family_data(p, tp) total_points.append(points) compared_ids.append(p.uniq_id) taapeli_ids.append(tp.uniq_id) print_cnt += 1 print("\nTotal points # Compared ids # Taapeli ids") print("-----------------------------------------") for i in range(len(total_points)): print("\n " + str(total_points[i]) + " # " + str(compared_ids[i]) + " # " + str(taapeli_ids[i])) print("\nLines printted: " + str(print_cnt)) elapsed_time = time.perf_counter() - t print("\nTime needed: " + str(elapsed_time) + " seconds") except Exception as err: print("Virhe: {0}".format(err), file=stderr)