FastGedcom
  • API Reference
    • fastgedcom
      • fastgedcom.base
      • fastgedcom.family_link
      • fastgedcom.helpers
      • fastgedcom.parser
  • Gedcom documentation links
  • PyPI page
  • Code source
  • Code examples
FastGedcom
  • API Reference
  • fastgedcom
  • fastgedcom.family_link
  • View page source

fastgedcom.family_link

Define the FamilyLink class used to bypass family records and ease the access to relatives.

Classes

FamilyLink

Class with methods to easily get relatives of someone.

Module Contents

class fastgedcom.family_link.FamilyLink(document: fastgedcom.base.Document)[source]

Class with methods to easily get relatives of someone.

Methods ending in _ref (such as get_children_ref()) are called by their non-_ref counterparts (such as get_children()). Use the first set of methods when you need performance. Use the second set of methods for convenience.

The class uses 2 dictionnaries to store family relations:

  • The parents dictionnary is used to get the parents of someone (via the FAMC of the person).

  • The unions dictionnary is used to get the spouses or children (via the FAMS of the person).

Not all methods use those dictionnaries, for example the get_parent_family_ref() does not.

document[source]
parents: dict[fastgedcom.base.IndiRef, tuple[fastgedcom.base.Record | fastgedcom.base.FakeLine, fastgedcom.base.Record | fastgedcom.base.FakeLine]][source]
unions: collections.defaultdict[fastgedcom.base.IndiRef, list[fastgedcom.base.Record]][source]
_build_dicts() → None[source]
get_parent_family_ref(child: fastgedcom.base.TrueLine | fastgedcom.base.FakeLine) → fastgedcom.base.FamRef | None[source]

Return the family reference with the parents of the person.

get_parent_family(child: fastgedcom.base.TrueLine | fastgedcom.base.FakeLine) → fastgedcom.base.Record | fastgedcom.base.FakeLine[source]

Return the family record with the parents of the person.

get_parents(child: fastgedcom.base.IndiRef) → tuple[fastgedcom.base.Record | fastgedcom.base.FakeLine, fastgedcom.base.Record | fastgedcom.base.FakeLine][source]

Return the father and the mother of the person.

get_unions(spouse: fastgedcom.base.IndiRef) → list[fastgedcom.base.Record][source]

Return the unions of the person.

get_unions_with(spouse1: fastgedcom.base.IndiRef, spouse2: fastgedcom.base.IndiRef) → list[fastgedcom.base.Record][source]

Return the unions between the two people.

In most cases, there should be only one union, but remarriage between the same two people could happen.

get_children_ref(parent: fastgedcom.base.IndiRef) → list[fastgedcom.base.IndiRef][source]

Return the children’s references of a person.

get_children(parent: fastgedcom.base.IndiRef) → list[fastgedcom.base.Record][source]

Return the children’s records of a person.

get_children_with_ref(spouse1: fastgedcom.base.IndiRef, spouse2: fastgedcom.base.IndiRef) → list[fastgedcom.base.IndiRef][source]

Return the children’s references of the couple.

get_children_with(spouse1: fastgedcom.base.IndiRef, spouse2: fastgedcom.base.IndiRef) → list[fastgedcom.base.Record][source]

Return the children’s records of the couple.

get_spouses_ref(indi: fastgedcom.base.IndiRef) → list[fastgedcom.base.IndiRef][source]

Return the spouses’ references of the person.

get_spouses(indi: fastgedcom.base.IndiRef) → list[fastgedcom.base.Record][source]

Return the spouses’ records of the person.

get_all_siblings_ref(indi: fastgedcom.base.IndiRef) → list[fastgedcom.base.IndiRef][source]

Return the siblings’ references of the person. Stepsiblings included.

get_all_siblings(indi: fastgedcom.base.IndiRef) → list[fastgedcom.base.Record][source]

Return the siblings’ records of the person. Stepsiblings included.

get_siblings_ref(indi: fastgedcom.base.IndiRef) → list[fastgedcom.base.IndiRef][source]

Return the siblings’ references of the person. Stepsiblings excluded.

get_siblings(indi: fastgedcom.base.IndiRef) → list[fastgedcom.base.Record][source]

Return the siblings’ records of the person. Stepsiblings excluded.

get_stepsiblings_ref(indi: fastgedcom.base.IndiRef) → list[fastgedcom.base.IndiRef][source]

Return the stepsiblings’ references of the person. Siblings excluded.

get_stepsiblings(indi: fastgedcom.base.IndiRef) → list[fastgedcom.base.Record][source]

Return the stepsiblings of the person. Siblings excluded.

get_spouse_in_fam_ref(indi: fastgedcom.base.IndiRef, fam: fastgedcom.base.Record) → fastgedcom.base.IndiRef | None[source]

Return the spouse’s reference of the family that is not the person’s.

get_spouse_in_fam(indi: fastgedcom.base.IndiRef, fam: fastgedcom.base.Record) → fastgedcom.base.Record | fastgedcom.base.FakeLine[source]

Return the spouse’s record of the family that is not the person’s.

traverse_ref(indi: fastgedcom.base.IndiRef, ascent: int = 0, descent: int = 0) → list[fastgedcom.base.IndiRef][source]

Recursively traverse the parents of the person and then their children.

The degree of kinship is equal to the sum ascent + descent.

traverse(indi: fastgedcom.base.IndiRef, ascent: int = 0, descent: int = 0) → list[fastgedcom.base.Record][source]

Recursively traverse the parents of the person and then their children.

The degree of kinship is equal to the sum ascent + descent.

get_relatives_ref(indi: fastgedcom.base.IndiRef, generation_diff: int = 0, collateral_diff: int = 0) → list[fastgedcom.base.IndiRef][source]

Return relatives’s references of the person. See get_relatives() for more details.

get_relatives(indi: fastgedcom.base.IndiRef, generation_diff: int = 0, collateral_diff: int = 0) → list[fastgedcom.base.Record][source]

Return relatives of the person.

Parameters:
  • generation_diff –

    stand for the difference in generation:

    value

    meaning

    1

    parents

    2

    grandparents

    -1

    children

    -2

    grand-children

    etc.

  • collateral_diff –

    is used for the same-generation difference, must be positive:

    value

    meaning

    1

    siblings

    2

    cousins

    3

    grand-cousins

    etc.

The combinaison can be read as:

  • when generation_diff > 0: collateral_diff of generation_diff, e.g. siblings of parents, cousins of grandparents

  • when generation_diff < 0: generation_diff of collateral_diff, e.g. children of cousins, grand-children of siblings

This function is a wrapper around traverse().

get_by_degree_ref(indi: fastgedcom.base.IndiRef, degree: int) → list[fastgedcom.base.IndiRef][source]

Return relatives having that degree of kinship with the person.

get_by_degree(indi: fastgedcom.base.IndiRef, degree: int) → list[fastgedcom.base.Record][source]

Return relatives having that degree of kinship with the person.

Previous Next

© Copyright 2025, GatienBouyer.

Built with Sphinx using a theme provided by Read the Docs.