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,
            "description": "Lifetime",
            "notes": null,
            "sources": []
        }
    ]
}

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

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

Load a person

>>> p = genealogy.person()

>>> p.load("a1b2c3.json")

>>> 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,
            "description": "Lifetime",
            "notes": null,
            "sources": []
        }
    ]
}

Add life event

>>> p = genealogy.person()

>>> p.load("a1b2c3.json")

>>> p.add_event(
        start="1900-1-1",
        description="Birth",
        notes="Town, County",
        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,
            "description": "Lifetime",
            "notes": null,
            "sources": []
        },
        {
            "start": "1900-1-1",
            "finish": null,
            "description": "Birth",
            "notes": "Town, County",
            "sources": [
                "Birth Certificate of Joe BLOGGS dob 01/01/1900"
            ]
        }
    ]
}

Edit data

>>> p = genealogy.person()

>>> p.load("a1b2c3.json")

>>> p.data['life_events][0]
{'start': None, 'finish': None, 'description': 'Lifetime', '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,
            "description": "Lifetime",
            "notes": null,
            "sources": [
                "Birth Certificate of Joe BLOGGS dob 01/01/1900"
            ]
        },
        {
            "start": "1900-1-1",
            "finish": null,
            "description": "Birth",
            "notes": "Town, County",
            "sources": [
                "Birth Certificate of Joe BLOGGS dob 01/01/1900"
            ]
        }
    ]
}

Link parent(s) and child

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

>>> p = load("a1b2c3.json")

>>> 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,
            "description": "Lifetime",
            "notes": null,
            "sources": [
                "Birth Certificate of Joe BLOGGS dob 01/01/1900"
            ]
        },
        {
            "start": "1900-1-1",
            "finish": null,
            "description": "Birth",
            "notes": "Town, County",
            "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 Distribution

genealogy-0.0.2.tar.gz (4.4 kB view details)

Uploaded Source

Built Distribution

genealogy-0.0.2-py3-none-any.whl (5.3 kB view details)

Uploaded Python 3

File details

Details for the file genealogy-0.0.2.tar.gz.

File metadata

  • Download URL: genealogy-0.0.2.tar.gz
  • Upload date:
  • Size: 4.4 kB
  • Tags: Source
  • 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.2.tar.gz
Algorithm Hash digest
SHA256 5a7a1cc12b3d0b57b0be1813218a86fee97b95f69ab1dd52ee5ff4959fe7e4ee
MD5 7df8d5e932128288aeffe9380ef9a80f
BLAKE2b-256 3c8eddf3ab0ea7f15603355cd4e4efbc4bb65bd107bfe3a55dd7d672004233f5

See more details on using hashes here.

File details

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

File metadata

  • Download URL: genealogy-0.0.2-py3-none-any.whl
  • Upload date:
  • Size: 5.3 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.2-py3-none-any.whl
Algorithm Hash digest
SHA256 b1cdbdb9f7a8138d13346855b6c01a043b14129da0ef00a728ce3cc115641223
MD5 dc324c99e4b6e96d7bc7e23440375863
BLAKE2b-256 34bb74b2a1bb4cacc7951aa8539aa0ce5767f8bc3d202f753aa9913688e2f56c

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