fastgedcom.family_link ====================== .. py:module:: fastgedcom.family_link .. autoapi-nested-parse:: Define the :py:class:`.FamilyLink` class used to bypass family records and ease the access to relatives. Classes ------- .. autoapisummary:: fastgedcom.family_link.FamilyLink Module Contents --------------- .. py:class:: FamilyLink(document: fastgedcom.base.Document) Class with methods to easily get relatives of someone. Methods ending in _ref (such as :py:meth:`.get_children_ref`) are called by their non-_ref counterparts (such as :py:meth:`.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 doesn't. .. py:attribute:: document .. py:attribute:: parents :type: dict[fastgedcom.base.IndiRef, tuple[fastgedcom.base.Record | fastgedcom.base.FakeLine, fastgedcom.base.Record | fastgedcom.base.FakeLine]] .. py:attribute:: unions :type: collections.defaultdict[fastgedcom.base.IndiRef, list[fastgedcom.base.Record]] .. py:method:: _build_dicts() -> None .. py:method:: get_parent_family_ref(child: fastgedcom.base.TrueLine | fastgedcom.base.FakeLine) -> fastgedcom.base.FamRef | None Return the family reference with the parents of the person. .. py:method:: get_parent_family(child: fastgedcom.base.TrueLine | fastgedcom.base.FakeLine) -> fastgedcom.base.Record | fastgedcom.base.FakeLine Return the family record with the parents of the person. .. py:method:: get_parents(child: fastgedcom.base.IndiRef) -> tuple[fastgedcom.base.Record | fastgedcom.base.FakeLine, fastgedcom.base.Record | fastgedcom.base.FakeLine] Return the father and the mother of the person. .. py:method:: get_unions(spouse: fastgedcom.base.IndiRef) -> list[fastgedcom.base.Record] Return the unions of the person. .. py:method:: get_unions_with(spouse1: fastgedcom.base.IndiRef, spouse2: fastgedcom.base.IndiRef) -> list[fastgedcom.base.Record] 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. .. py:method:: get_children_ref(parent: fastgedcom.base.IndiRef) -> list[fastgedcom.base.IndiRef] Return the children's references of a person. .. py:method:: get_children(parent: fastgedcom.base.IndiRef) -> list[fastgedcom.base.Record] Return the children's records of a person. .. py:method:: get_children_with_ref(spouse1: fastgedcom.base.IndiRef, spouse2: fastgedcom.base.IndiRef) -> list[fastgedcom.base.IndiRef] Return the children's references of the couple. .. py:method:: get_children_with(spouse1: fastgedcom.base.IndiRef, spouse2: fastgedcom.base.IndiRef) -> list[fastgedcom.base.Record] Return the children's records of the couple. .. py:method:: get_spouses_ref(indi: fastgedcom.base.IndiRef) -> list[fastgedcom.base.IndiRef] Return the spouses' references of the person. .. py:method:: get_spouses(indi: fastgedcom.base.IndiRef) -> list[fastgedcom.base.Record] Return the spouses' records of the person. .. py:method:: get_all_siblings_ref(indi: fastgedcom.base.IndiRef) -> list[fastgedcom.base.IndiRef] Return the siblings' references of the person. Stepsiblings included. .. py:method:: get_all_siblings(indi: fastgedcom.base.IndiRef) -> list[fastgedcom.base.Record] Return the siblings' records of the person. Stepsiblings included. .. py:method:: get_siblings_ref(indi: fastgedcom.base.IndiRef) -> list[fastgedcom.base.IndiRef] Return the siblings' references of the person. Stepsiblings excluded. .. py:method:: get_siblings(indi: fastgedcom.base.IndiRef) -> list[fastgedcom.base.Record] Return the siblings' records of the person. Stepsiblings excluded. .. py:method:: get_stepsiblings_ref(indi: fastgedcom.base.IndiRef) -> list[fastgedcom.base.IndiRef] Return the stepsiblings' references of the person. Siblings excluded. .. py:method:: get_stepsiblings(indi: fastgedcom.base.IndiRef) -> list[fastgedcom.base.Record] Return the stepsiblings of the person. Siblings excluded. .. py:method:: get_spouse_in_fam_ref(indi: fastgedcom.base.IndiRef, fam: fastgedcom.base.Record) -> fastgedcom.base.IndiRef | None Return the spouse's reference of the family that is not the person's. .. py:method:: get_spouse_in_fam(indi: fastgedcom.base.IndiRef, fam: fastgedcom.base.Record) -> fastgedcom.base.Record | fastgedcom.base.FakeLine Return the spouse's record of the family that is not the person's. .. py:method:: traverse_ref(indi: fastgedcom.base.IndiRef, ascent: int = 0, descent: int = 0) -> list[fastgedcom.base.IndiRef] Recursively traverse the parents of the person and then their children. The degree of kinship is equal to the sum `ascent` + `descent`. .. py:method:: traverse(indi: fastgedcom.base.IndiRef, ascent: int = 0, descent: int = 0) -> list[fastgedcom.base.Record] Recursively traverse the parents of the person and then their children. The degree of kinship is equal to the sum `ascent` + `descent`. .. py:method:: get_relatives_ref(indi: fastgedcom.base.IndiRef, generation_diff: int = 0, collateral_diff: int = 0) -> list[fastgedcom.base.IndiRef] Return relatives's references of the person. See :py:meth:`get_relatives` for more details. .. py:method:: get_relatives(indi: fastgedcom.base.IndiRef, generation_diff: int = 0, collateral_diff: int = 0) -> list[fastgedcom.base.Record] Return relatives of the person. `generation_diff` stand for generation difference: * 1 parents, 2 grandparents, -1 children, -2 grand-children, ... `collateral_diff` is used for same-generation difference: * 1 sibling, 2 cousins, 3 grand-counsins, ... The combinaison can be read as: * (when generation_diff > 0) `collateral_diff` of `generation_diff` * examples: siblings of parents, cousings of grandparents * (when generation_diff < 0) `generation_diff` of `collateral_diff` * examples: children of cousins, grand-children of siblings The `collateral_diff` must be strictly positive. This function is a wrapper around :py:meth:`traverse`. .. py:method:: get_by_degree_ref(indi: fastgedcom.base.IndiRef, degree: int) -> list[fastgedcom.base.IndiRef] Return relatives having that degree of kinship with the person. .. py:method:: get_by_degree(indi: fastgedcom.base.IndiRef, degree: int) -> list[fastgedcom.base.Record] Return relatives having that degree of kinship with the person.