1

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@
Flow
  • 846
  • 9
  • 24
eRED
  • 21
  • 3
  • Your program writes data into a database, reads data back again, and writes the data to a GEDCOM file. Then, you upload this file to an online service to generate images. *Somewhere* in this chain there is a problem, but you do not tell us how this problem manifests itself. I guess that the online service refuses to accept the file. In that case, all the code is irrelevant — you could just show us the file, and ask “what’s wrong with this GEDCOM file?”. Alternatively, if you know how the file is wrong, you could ask “why does my file look like this, I expected it to look like that!” – Ture Pålsson Oct 09 '22 at 06:39
  • @TurePålsson hello, the main problem is the second family. – eRED Oct 09 '22 at 06:49
  • @TurePålsson is that better? – eRED Oct 09 '22 at 06:59

1 Answers1

2

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.

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

1 FAMC @F1@
1 FAMS @F2@
lkessler
  • 19,819
  • 36
  • 132
  • 203