python-gedcom
python-gedcom copied to clipboard
[Feature request] get INDI ID number
Is your feature request related to a problem? Please describe.
Hi, I want to get the ID number of INDI (like @I5465477880020118059@) in order to give a kind of unique tag for each name.
0 @I5465477880020118059@ INDI
1 NAME Chee Lin /TAN 陳/
2 GIVN Chee Lin
1 SEX M
1 EVEN
2 TYPE Misc Event
1 BIRT
2 DATE 1944
Describe the solution you'd like
I would like to know if there is some way I get the ID number of INDI (like @I5465477880020118059@)
I have tried this, but only got None for INDI_ID_number
from gedcom.element.individual import IndividualElement
from gedcom.parser import Parser
import gedcom
def generate_names_json(file_name):
file_path = file_name
gedcom_parser = Parser()
gedcom_parser.parse_file(file_path)
root_child_elements = gedcom_parser.get_root_child_elements()
count_individual = 0
for element in root_child_elements:
curr_element_dict = {}
if isinstance(element, IndividualElement):
if element.get_tag() == gedcom.tags.GEDCOM_TAG_INDIVIDUAL:
curr_element_dict['INDI_ID_number'] = element.get_value()
curr_element_dict['name'] = element.get_name()
print(curr_element_dict)
Any ideas relevant will be very helpful for me. Thanks very much for your help!
Hey @ljm0. Good idea! Will have a look on that after finishing the PR #53. You are also open to create a PR for this :)
Is this not the same as using get_pointer() on the element?