From d45466a511da5976367c2d7192ddcd360490478d Mon Sep 17 00:00:00 2001 From: Joey Aurel Date: Wed, 17 Jan 2024 13:46:39 +0100 Subject: [PATCH 1/9] Delete CNAME --- docs/CNAME | 1 - 1 file changed, 1 deletion(-) delete mode 100644 docs/CNAME diff --git a/docs/CNAME b/docs/CNAME deleted file mode 100644 index 8f78040..0000000 --- a/docs/CNAME +++ /dev/null @@ -1 +0,0 @@ -gedcom.nickreynke.dev \ No newline at end of file From e1bf51583b8155760e96ef510d08fb36346af8eb Mon Sep 17 00:00:00 2001 From: Joey Aurel Date: Wed, 17 Jan 2024 13:47:17 +0100 Subject: [PATCH 2/9] Create CNAME --- docs/CNAME | 1 + 1 file changed, 1 insertion(+) create mode 100644 docs/CNAME diff --git a/docs/CNAME b/docs/CNAME new file mode 100644 index 0000000..5c209e2 --- /dev/null +++ b/docs/CNAME @@ -0,0 +1 @@ +gedcom.joeyaurel.dev \ No newline at end of file From 0e8db4e86ccd878789ab76680e15a966fcef62c5 Mon Sep 17 00:00:00 2001 From: Joey Aurel Date: Wed, 17 Jan 2024 13:47:50 +0100 Subject: [PATCH 3/9] Delete CNAME --- docs/CNAME | 1 - 1 file changed, 1 deletion(-) delete mode 100644 docs/CNAME diff --git a/docs/CNAME b/docs/CNAME deleted file mode 100644 index 5c209e2..0000000 --- a/docs/CNAME +++ /dev/null @@ -1 +0,0 @@ -gedcom.joeyaurel.dev \ No newline at end of file From d3597d5b44677566e4141ca18c1823d6721ae453 Mon Sep 17 00:00:00 2001 From: Joey Aurel Date: Wed, 17 Jan 2024 13:51:55 +0100 Subject: [PATCH 4/9] docs: update docs deployment --- docs/.nojekyll | 0 docs/CNAME | 1 + 2 files changed, 1 insertion(+) create mode 100644 docs/.nojekyll create mode 100644 docs/CNAME diff --git a/docs/.nojekyll b/docs/.nojekyll new file mode 100644 index 0000000..e69de29 diff --git a/docs/CNAME b/docs/CNAME new file mode 100644 index 0000000..5c209e2 --- /dev/null +++ b/docs/CNAME @@ -0,0 +1 @@ +gedcom.joeyaurel.dev \ No newline at end of file From 3656f18da2e1cbf030f1d3d67b944ce292d71be2 Mon Sep 17 00:00:00 2001 From: Joey Aurel Date: Wed, 17 Jan 2024 13:53:34 +0100 Subject: [PATCH 5/9] Delete CNAME --- docs/CNAME | 1 - 1 file changed, 1 deletion(-) delete mode 100644 docs/CNAME diff --git a/docs/CNAME b/docs/CNAME deleted file mode 100644 index 5c209e2..0000000 --- a/docs/CNAME +++ /dev/null @@ -1 +0,0 @@ -gedcom.joeyaurel.dev \ No newline at end of file From f0cbb5620731cda51b5f14c24f578b4b61ce2c27 Mon Sep 17 00:00:00 2001 From: Joey Aurel Date: Wed, 17 Jan 2024 13:58:41 +0100 Subject: [PATCH 6/9] docs: update project links --- README.md | 14 ++++++-------- 1 file changed, 6 insertions(+), 8 deletions(-) diff --git a/README.md b/README.md index fca4721..dd140f4 100644 --- a/README.md +++ b/README.md @@ -4,8 +4,8 @@

PyPI - GitHub release - Build Status + GitHub release + Build Status GEDCOM format version 5.5 Python versions 3.5 to 3.8

@@ -21,19 +21,19 @@ ## Documentation -Documentation can be found here: https://nickreynke.github.io/python-gedcom/gedcom/index.html +Documentation can be found here: https://joeyaurel.github.io/python-gedcom/gedcom/index.html ## Changelog For the latest changes please have a look at the [`CHANGELOG.md`](CHANGELOG.md) file. -The current development process can be tracked in the [develop branch](https://github.com/nickreynke/python-gedcom/tree/develop). +The current development process can be tracked in the [develop branch](https://github.com/joeyaurel/python-gedcom/tree/develop). ## Common problems * When you name your script `gedcom.py`, and import the `gedcom` module from this package, running your script won't work because Python will try to resolve imports like `gedcom.element.individual` from within your `gedcom.py` but - not from within the module from this package. Rename your file in this case. ([#26](https://github.com/nickreynke/python-gedcom/issues/26)) + not from within the module from this package. Rename your file in this case. ([#26](https://github.com/joeyaurel/python-gedcom/issues/26)) ## Local development @@ -75,14 +75,12 @@ Daniel Zappala at Brigham Young University (Copyright (C) 2005) which was licensed under the GPL v2 and then continued by [Mad Price Ball](https://github.com/madprime) in 2012. -The project was taken over by [Nicklas Reincke](https://github.com/nickreynke) in 2018. -Together with [Damon Brodie](https://github.com/nomadyow) a lot of changes were made and the parser was optimized. - ## License Licensed under the [GNU General Public License v2](http://www.gnu.org/licenses/gpl-2.0.html) **Python GEDCOM Parser** +
Copyright (C) 2024 Joey Aurel (hi at joeyaurel.dev)
Copyright (C) 2018 Damon Brodie (damon.brodie at gmail.com)
Copyright (C) 2018-2019 Nicklas Reincke (contact at reynke.com)
Copyright (C) 2016 Andreas Oberritter From 3b8830657661cf40327b4ec2efe3446b037d33d8 Mon Sep 17 00:00:00 2001 From: julien123-fr <193784745+Julien123-fr@users.noreply.github.com> Date: Sun, 5 Jan 2025 20:08:12 +0100 Subject: [PATCH 7/9] Add get_occupations in individual.py --- gedcom/element/individual.py | 25 +++++++++++++++++++++++++ 1 file changed, 25 insertions(+) diff --git a/gedcom/element/individual.py b/gedcom/element/individual.py index da61d08..fb65e7d 100644 --- a/gedcom/element/individual.py +++ b/gedcom/element/individual.py @@ -334,6 +334,31 @@ def get_occupation(self): return occupation + def get_occupations(self): + """Returns a list of occupation of a person individual formatted as tuples: (`str` date, `strĀ“ place, `str` occu) + :rtype: list of tuple + """ + occupations = [] + + for child in self.get_child_elements(): + if child.get_tag() == gedcom.tags.GEDCOM_TAG_OCCUPATION: + + date = '' + place = '' + occupation = child.get_value() + + for childOfChild in child.get_child_elements(): + + if childOfChild.get_tag() == gedcom.tags.GEDCOM_TAG_DATE: + date = childOfChild.get_value() + + if childOfChild.get_tag() == gedcom.tags.GEDCOM_TAG_PLACE: + place = childOfChild.get_value() + + occupations.append((date, place, occupation)) + + return occupations + def birth_year_match(self, year): """Returns `True` if the given year matches the birth year of this person :type year: int From 764eb322e74134a3d06069d0747bc193ad6da526 Mon Sep 17 00:00:00 2001 From: julien123-fr <193784745+Julien123-fr@users.noreply.github.com> Date: Sun, 5 Jan 2025 22:47:38 +0100 Subject: [PATCH 8/9] Add get_marriage in parser.py --- gedcom/parser.py | 22 ++++++++++++++++++++++ 1 file changed, 22 insertions(+) diff --git a/gedcom/parser.py b/gedcom/parser.py index 74f40c7..904510a 100644 --- a/gedcom/parser.py +++ b/gedcom/parser.py @@ -276,6 +276,28 @@ def __build_list(self, element, element_list): self.__build_list(child, element_list) # Methods for analyzing individuals and relationships between individuals + def get_marriage(self, family:FamilyElement): + """Returns a marriage of a family formatted as a tuple (`str` date, `str` place) + :type family: FamilyElement + :rtype: tuple + """ + if not isinstance(family, FamilyElement): + raise NotAnActualFamilyError( + "Operation only valid for element with %s tag." % gedcom.tags.GEDCOM_TAG_FAMILY + ) + # Get and analyze family. + for family_data in family.get_child_elements(): + if family_data.get_tag() == gedcom.tags.GEDCOM_TAG_MARRIAGE: + date = '' + place = '' + for marriage_data in family_data.get_child_elements(): + if marriage_data.get_tag() == gedcom.tags.GEDCOM_TAG_DATE: + date = marriage_data.get_value() + if marriage_data.get_tag() == gedcom.tags.GEDCOM_TAG_PLACE: + place = marriage_data.get_value() + return ((date,place)) + return None + def get_marriages(self, individual): """Returns a list of marriages of an individual formatted as a tuple (`str` date, `str` place) From 16e9e9887496234598831e7701adbae5b782f2e6 Mon Sep 17 00:00:00 2001 From: julien123-fr <193784745+Julien123-fr@users.noreply.github.com> Date: Mon, 6 Jan 2025 22:15:59 +0100 Subject: [PATCH 9/9] add get_sosadaboville() in individual.py --- gedcom/element/individual.py | 41 ++++++++++++++++++++++++------------ 1 file changed, 28 insertions(+), 13 deletions(-) diff --git a/gedcom/element/individual.py b/gedcom/element/individual.py index fb65e7d..709a63d 100644 --- a/gedcom/element/individual.py +++ b/gedcom/element/individual.py @@ -71,7 +71,7 @@ def is_private(self): for child in self.get_child_elements(): if child.get_tag() == gedcom.tags.GEDCOM_TAG_PRIVATE: private = child.get_value() - if private == 'Y': + if private == "Y": return True return False @@ -93,7 +93,7 @@ def get_name(self): # Some GEDCOM files don't use child tags but instead # place the name in the value of the NAME tag. if child.get_value() != "": - name = child.get_value().split('/') + name = child.get_value().split("/") if len(name) > 0: given_name = name[0].strip() @@ -119,7 +119,11 @@ def get_name(self): return given_name, surname def get_all_names(self): - return [a.get_value() for a in self.get_child_elements() if a.get_tag() == gedcom.tags.GEDCOM_TAG_NAME] + return [ + a.get_value() + for a in self.get_child_elements() + if a.get_tag() == gedcom.tags.GEDCOM_TAG_NAME + ] def surname_match(self, surname_to_match): """Matches a string with the surname of an individual @@ -158,6 +162,17 @@ def get_gender(self): return gender + def get_sosadaboville(self): + """Returns the sosa daboville of a person in string format + :rtype: str + """ + # L'ajout du _SOSADABOVILLE est propre au logiciel Ancestris + sosadaboville = "" + for child in self.get_child_elements(): + if child.get_tag() == "_SOSADABOVILLE": + sosadaboville = child.get_value() + return sosadaboville + def get_birth_data(self): """Returns the birth data of a person formatted as a tuple: (`str` date, `str` place, `list` sources) :rtype: tuple @@ -289,8 +304,8 @@ def get_census_data(self): for child in self.get_child_elements(): if child.get_tag() == gedcom.tags.GEDCOM_TAG_CENSUS: - date = '' - place = '' + date = "" + place = "" sources = [] for childOfChild in child.get_child_elements(): @@ -343,8 +358,8 @@ def get_occupations(self): for child in self.get_child_elements(): if child.get_tag() == gedcom.tags.GEDCOM_TAG_OCCUPATION: - date = '' - place = '' + date = "" + place = "" occupation = child.get_value() for childOfChild in child.get_child_elements(): @@ -421,15 +436,15 @@ def criteria_match(self, criteria): # Check if criteria is a valid criteria and can be split by `:` and `=` characters try: - for criterion in criteria.split(':'): - criterion.split('=') + for criterion in criteria.split(":"): + criterion.split("=") except ValueError: return False match = True - for criterion in criteria.split(':'): - key, value = criterion.split('=') + for criterion in criteria.split(":"): + key, value = criterion.split("=") if key == "surname" and not self.surname_match(value): match = False @@ -447,7 +462,7 @@ def criteria_match(self, criteria): elif key == "birth_range": try: - from_year, to_year = value.split('-') + from_year, to_year = value.split("-") from_year = int(from_year) to_year = int(to_year) if not self.birth_range_match(from_year, to_year): @@ -467,7 +482,7 @@ def criteria_match(self, criteria): elif key == "death_range": try: - from_year, to_year = value.split('-') + from_year, to_year = value.split("-") from_year = int(from_year) to_year = int(to_year) if not self.death_range_match(from_year, to_year):