简体   繁体   中英

How do I make correct Gedcom Files?

What would the correct way to format the gedcom file be because my current way is not working for more info I am using https://www.familyecho.com/?page=api to generate the images. When I add a second family it does not work anymore. But it works fine with one family.


 Individuals = [(1, 'James', 'Smith'), (2, 'Jack', 'Smith'), (3, 'John', 'Smith'), (4, 'Jane', 'Smith'), (5, 'Jill', 'Smith')]
Families = [(1, 1, 2, 3), (2, 3, 4, 5)]
print(Individuals,Families)



with open('F.ged','w') as Gedcomfile:
    for person in Individuals:
        Gedcomfile.write(f"""
        0 @I{person[0]}@ INDI
        1 NAME {person[1]} /{person[2]}/
        2 GIVN {person[1]} 
        2 SURN {person[2]}
        """)
    for family in Families:
        Gedcomfile.write(f"""
        0 @F{family[0]}@ FAM
        1 HUSB @I{family[1]}@
        1 WIFE @I{family[2]}@
        1 CHIL @I{family[3]}@
        """)

Gedcom file:

0 @I1@ INDI
1 NAME James /Smith/
2 GIVN James
2 SURN Smith

0 @I2@ INDI
1 NAME Jack /Smith/
2 GIVN Jack
2 SURN Smith

0 @I3@ INDI
1 NAME John /Smith/
2 GIVN John
2 SURN Smith

0 @I4@ INDI
1 NAME Jane /Smith/
2 GIVN Jane
2 SURN Smith

0 @I5@ INDI
1 NAME Jill /Smith/
2 GIVN Jill
2 SURN Smith

0 @F1@ FAM
1 HUSB @I1@
1 WIFE @I2@
1 CHIL @I3@

0 @F2@ FAM
1 HUSB @I3@
1 WIFE @I4@
1 CHIL @I5@

You've provided the HUSB, WIFE and CHIL links in the FAM record. But GEDCOM also requires the reverse links in the INDI records.

FAMS (S=Spouse) is the reverse of HUSB and WIFE.

FAMC (C=Child) is the reverse of CHIL.

eg In your example, you need to add to the @I3@ INDI record, the following two lines:

1 FAMC @F1@
1 FAMS @F2@

The technical post webpages of this site follow the CC BY-SA 4.0 protocol. If you need to reprint, please indicate the site URL or the original address.Any question please contact:yoyou2525@163.com.

 
粤ICP备18138465号  © 2020-2024 STACKOOM.COM