-
Notifications
You must be signed in to change notification settings - Fork 1
/
missing_people.py
34 lines (26 loc) · 946 Bytes
/
missing_people.py
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
"""
Scan through a WikiTree API response and find people not listed
in the data dump (Private/Living people).
"""
import argparse
import json
import data_reader
parser = argparse.ArgumentParser()
parser.add_argument("dna_connections_file",
help="Response to an API request: api.php?action=getConnectedProfilesByDNATest&key=<person>&dna_id=<id>")
parser.add_argument("--version", help="Data version (defaults to most recent).")
args = parser.parse_args()
db = data_reader.Database(args.version)
with open(args.dna_connections_file) as f:
results = json.load(f)
num_people = 0
num_missing = 0
for result in results:
for person in result["connections"]:
num_people += 1
user_num = int(person["Id"])
if not db.has_person(user_num):
num_missing += 1
print(user_num, person["Name"])
print("Checked %d people. Missing %d (%d%%)" %
(num_people, num_missing, 100. * num_missing / num_people))