Skip to main content

A package for recording Genealogy.

Project description

genealogy

A package for recording genealogy in human and machine readable .json files. The .json file format has been chosen over the gedcom file format to enable better accessability and interoperability for the recorded data. The package will create .json records in the current working directory.

Dates are ISO format and require a year as the minumum. 'About' dates not accepted.

Requires Python 3.7+.

Installation

pip install genealogy

Usage

Create a person

>>> p = genealogy.person()

>>> p.create(fn=["Joe"], ln=["BLOGGS"], dob="1900-1-1", pob="Town, County")

>>> p.print()
{
    "id": "a1b2c3",
    "last_names": ["BLOGGS"],
    "first_names": ["Joe"],
    "date_of_birth": "1900-1-1",
    "place_of_birth": "Town, County",
    "date_of_death": null,
    "place_of_death": null,
    "direct_relatives": {
        "ascendants": [],
        "descendants": [],
        "partners": []
    },
    "life_events": [
        {
            "start": "1900-1-1",
            "finish": null,
            "title": "Lifetime',
            "description": null,
            "notes": null,
            "sources": []
        }
    ]
}

>>> p.data['date_of_death'] = "1970-1-1"

>>> p.save()
a1b2c3.json saved.

Load a person

>>> p = genealogy.person(load='a1b2c3')

>>> p.print()
{
    "id": "a1b2c3",
    "last_names": ["BLOGGS"],
    "first_names": ["Joe"],
    "date_of_birth": "1900-1-1",
    "place_of_birth": "Town, County",
    "date_of_death": "1970-1-1",
    "place_of_death": null,
    "direct_relatives": {
        "ascendants": [],
        "descendants": [],
        "partners": []
    },
    "life_events": [
        {
            "start": "1900-1-1",
            "finish": null,
            "title": "Lifetime',
            "description": null,
            "notes": null,
            "sources": []
        }
    ]
}

Add life event

>>> p = genealogy.person(load="a1b2c3")

>>> p.add_event(
        start="1900-1-1",
        title="Birth",
        description="Town, County",
        notes="",
        sources=[
            "Birth Certificate of Joe BLOGGS dob 01/01/1900"
        ])

>>> p.save()
a1b2c3.json saved.

>>> p.print()
{
    "id": "a1b2c3",
    "last_names": ["BLOGGS"],
    "first_names": ["Joe"],
    "date_of_birth": "1900-1-1",
    "place_of_birth": "Town, County",
    "date_of_death": "1970-1-1",
    "place_of_death": null,
    "direct_relatives": {
        "ascendants": [],
        "descendants": [],
        "partners": []
    },
    "life_events": [
        {
            "start": "1900-1-1",
            "finish": null,
            "title": "Lifetime',
            "description": null,
            "notes": null,
            "sources": []
        },
        {
            "start": "1900-1-1",
            "finish": null,
            title="Birth",
            description="Town, County",
            notes="",
            "sources": [
                "Birth Certificate of Joe BLOGGS dob 01/01/1900"
            ]
        }
    ]
}

Edit data

>>> p = genealogy.person(load="a1b2c3")

>>> p.data['life_events][0]
{'start': None, 'finish': None, 'title': 'Lifetime', description': None, 'notes': None, 'sources': []}

>>> p.data['life_events][0]['sources'].append("Birth Certificate of Joe BLOGGS dob 01/01/1900")

>>> p.save()
a1b2c3.json saved.

>>> p.print()
{
    "id": "a1b2c3",
    "last_names": ["BLOGGS"],
    "first_names": ["Joe"],
    "date_of_birth": "1900-1-1",
    "place_of_birth": "Town, County",
    "date_of_death": "1970-1-1",
    "place_of_death": null,
    "direct_relatives": {
        "ascendants": [],
        "descendants": [],
        "partners": []
    },
    "life_events": [
        {
            "start": "1900-1-1",
            "finish": null,
            "title": "Lifetime",
            "description": null,
            "notes": null,
            "sources": [
                "Birth Certificate of Joe BLOGGS dob 01/01/1900"
            ]
        },
        {
            "start": "1900-1-1",
            "finish": null,
            title="Birth",
            description="Town, County",
            notes="",
            "sources": [
                "Birth Certificate of Joe BLOGGS dob 01/01/1900"
            ]
        }
    ]
}

Link parent(s) and child

>>> genealogy.link_child(
         parents=["g4h5i6", "m7n8o9"],
         child="a1b2c3")

>>> p = genealogy.person(load="a1b2c3")

>>> p.print()
{
    "id": "a1b2c3",
    "last_names": ["BLOGGS"],
    "first_names": ["Joe"],
    "date_of_birth": "1900-1-1",
    "place_of_birth": "Town, County",
    "date_of_death": "1970-1-1",
    "place_of_death": null,
    "direct_relatives": {
        "ascendants": ["g4h5i6", "m7n8o9"],
        "descendants": [],
        "partners": []
    },
    "life_events": [
        {
            "start": "1900-1-1",
            "finish": null,
            "title": "Lifetime",
            "description": null,
            "notes": null,
            "sources": [
                "Birth Certificate of Joe BLOGGS dob 01/01/1900"
            ]
        },
        {
            "start": "1900-1-1",
            "finish": null,
            title="Birth",
            description="Town, County",
            notes="",
            "sources": [
                "Birth Certificate of Joe BLOGGS dob 01/01/1900"
            ]
        }
    ]
}

Project details


Download files

Download the file for your platform. If you're not sure which to choose, learn more about installing packages.

Source Distributions

No source distribution files available for this release.See tutorial on generating distribution archives.

Built Distribution

genealogy-0.0.3-py3-none-any.whl (4.8 kB view details)

Uploaded Python 3

File details

Details for the file genealogy-0.0.3-py3-none-any.whl.

File metadata

  • Download URL: genealogy-0.0.3-py3-none-any.whl
  • Upload date:
  • Size: 4.8 kB
  • Tags: Python 3
  • Uploaded using Trusted Publishing? No
  • Uploaded via: twine/1.13.0 pkginfo/1.5.0.1 requests/2.21.0 setuptools/41.0.1 requests-toolbelt/0.9.1 tqdm/4.31.1 CPython/3.7.1

File hashes

Hashes for genealogy-0.0.3-py3-none-any.whl
Algorithm Hash digest
SHA256 cced91a032c086e3d8d453e91049c4ae05a5ac150ed63ea8e5a2d224221fb500
MD5 a81b425038bc47f0323d43997e291aa5
BLAKE2b-256 869542598d99e45f23c7d1dae15eaad665b3273de5756d4061d7e48e6b7797ba

See more details on using hashes here.

Supported by

AWS AWS Cloud computing and Security Sponsor Datadog Datadog Monitoring Fastly Fastly CDN Google Google Download Analytics Microsoft Microsoft PSF Sponsor Pingdom Pingdom Monitoring Sentry Sentry Error logging StatusPage StatusPage Status page