Skip to content

A Python 3 package that parses a GEDCOM Remastered Standard, and generates an object model.

License

Notifications You must be signed in to change notification settings

shaun-wilson/gedcom-remastered-parser-python

Folders and files

NameName
Last commit message
Last commit date

Latest commit

 

History

10 Commits
 
 
 
 
 
 
 
 
 
 

Repository files navigation

GEDCOM Remastered Parser (Python)

A Python 3 package that parses a GEDCOM Remastered Standard, and generates an object model.

The schema knows how to read and write it's elements to files, and the output should be syntactically equal to the original.

The package will have the ability to modify the schema, whether by adding, removing, or altering existing definitions.

This package does not parse actual GEDCOM files, and does not validate GEDCOM data. This functionality will be created in another package.

This package was created with Python 3.7.

from gedcom_remastered_parser import Schema

schema = Schema.generate_from_files(
    [
        'C:/gedcom-remastered/gedcom-5.5.1/gedcom-5.5.1-structures.txt',
        'C:/gedcom-remastered/gedcom-5.5.1/gedcom-5.5.1-primitives.txt',
        'C:/gedcom-remastered/gedcom-5.5.1/gedcom-5.5.1-tags.txt',
    ]
)

# Ensure the schema round-trips correctly.
for element_type in ("structures", "primitives", "tags"):
    with open(f"regen-{element_type}.txt", 'w') as file_writer:
        file_writer.write( "\n".join(element.txt_definition for element in getattr(schema, element_type).values()) )

About

A Python 3 package that parses a GEDCOM Remastered Standard, and generates an object model.

Resources

License

Stars

Watchers

Forks

Releases

No releases published

Packages

No packages published

Languages