Skip to content

Commit

Permalink
Merge branch 'release/v0.2.4dev'
Browse files Browse the repository at this point in the history
  • Loading branch information
Nicklas Reincke authored and Nicklas Reincke committed Dec 11, 2018
2 parents 63a3044 + 2604934 commit def78de
Show file tree
Hide file tree
Showing 3 changed files with 38 additions and 15 deletions.
33 changes: 22 additions & 11 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,10 @@ the GEDCOM 5.5 format which is detailed [here](https://chronoplexsoftware.com/ge

> **NOTE**: This module is currently under development and **should not be used in production**!
> The current development process can be tracked in the ["develop" branch](https://github.com/reynke/python-gedcom/tree/develop).
>
>If you wish to use the pre-production version of the python-gedcom packages, then supply the --pre command line to pip:
>
> pip install python-gedcom --pre
## Installation

Expand Down Expand Up @@ -76,15 +80,16 @@ get_parent_element | none | Element | Returns parent Element
new_child_element | String tag, String pointer, String value | Element | Create a new Element
add_child_element | Element child | Element | Adds the child record
set_parent_element | Element parent| none | Not normally required to be called (add_child_element calls this automatically
is_individual | none | Boolean | Is this record of a person
is_family | none | Boolean |
is_file | none | Boolean |
is_object | none | Boolean |
is_individual | none | Boolean | Returns True if the record is that of a person
is_family | none | Boolean | Returns True if thet record of a family. Family records can be passed to get_family_members()
is_file | none | Boolean | Returns True if the record is a pointer to an external file
is_object | none | Boolean | Returns True if the record is an object (for example multi-media) stored inside the gedcom
is_private | none | Boolean | Returns True if the record is marked Private
is_deceased | none | Boolean | Returns True if the individual is marked deceased
is_child | none | Boolean | Returns True if the individual is a child
criteria_match | colon separated string "surname=[name]:name=[name]:birth][year]:birth_range=[year-to-year]:death=[year]:death_range[year-to-year]"| Boolean | Returns True if the criteria matches
surname_match | String | Boolean | Returns True if substring matches
given_match | String | Boolean | Returns True if substring matches
surname_match | String | Boolean | Returns True if the case insensitive substring matches the supplied string
given_match | String | Boolean | Returns True if the case insensitive substring matches the supplied string
death_range_match | Int from, Int to | Boolean | Returns True if Death Year is in the supplied range
death_year_match | Int | Boolean | Returns True if Death Year equals parameter
birth_range_match | Int from, Int to | Boolean | Returns True if Birth Year is in the supplied range
Expand All @@ -110,11 +115,11 @@ get_root_child_elements | none | List of Element | Returns a List of all Element
get_element_dictionary | none | Dict of Element | Returns a Dict of all Elements
get_element_list | none | List of Element | Returns a List of all Elements
get_marriages | Element individual | List of Marriage ("Date", "Place") | Returns List of Tuples of Marriage data (Date and Place)
find_path_to_ancestors | Element descendant, Element ancestor||
get_family_members | Element individual, optional String members_type - one of "ALL" (default), "PARENTS", "HUSB", "WIFE", "CHIL" | List of Element individuals||
get_parents | Element individual, optional String parent_type - one of "ALL" (default) or "NAT" | List of Element individuals|
get_ancestors | Element individual, optional String ancestor_type - one of "All" (default) or "NAT" ||
get_families | Element individual optional String family_type - one of "FAMS" (default), "FAMC"||
find_path_to_ancestors | Element descendant, Element ancestor| List of Element| Returns list of individuals from the descendant Element to the ancestor Element. Returns None if there is no direct path
get_family_members | Element family, optional String members_type - one of "ALL" (default), "PARENTS", "HUSB", "WIFE", "CHIL" | List of Element individuals | Returns a list of individuals for the supplied family record, filtered by the members_type
get_parents | Element individual, optional String parent_type - one of "ALL" (default) or "NAT" | List of Element individuals | Returns the individual's parents as a List
get_ancestors | Element individual, optional String ancestor_type - one of "All" (default) or "NAT" | List of Element individuals | Recursively retrieves all the parents starting with the supplied individual
get_families | Element individual optional String family_type - one of "FAMS" (default), "FAMC"|List of Family records | Family Records can be used in get_family_members()
marriage_range_match | Element individual, Int from, Int to| Boolean | Check if individual is married within the specified range
marriage_year_match | Element individual, Int year| Boolean | Check if individual is married in the year specified
get_marriage_years | Element individual |List of Int| Returns Marriage event years
Expand Down Expand Up @@ -144,7 +149,13 @@ Further updates by [Nicklas Reincke](https://github.com/nickreynke) and [Damon B

## Changelog

**v0.2.4dev**

- Make surname_match and given_match case insensitive ([#10](https://github.com/nickreynke/python-gedcom/issues/10))
- add new is_child method

**v0.2.3dev**

- Assemble Marriages properly ([#9](https://github.com/nickreynke/python-gedcom/issues/9))
- Return the top NAME record instead of the last one ([#9](https://github.com/nickreynke/python-gedcom/issues/9))

Expand Down
18 changes: 15 additions & 3 deletions gedcom/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -767,6 +767,18 @@ def is_individual(self):
"""
return self.get_tag() == GEDCOM_TAG_INDIVIDUAL

def is_child(self):
"""Check if this element is a child
:rtype: bool
"""
if not self.is_individual():
raise ValueError("Operation only valid for elements with %s tag" % GEDCOM_TAG_INDIVIDUAL)
found_child = False
for child in self.get_child_elements():
if child.get_tag() == GEDCOM_TAG_FAMILY_CHILD:
found_child = True
return found_child

def is_family(self):
"""Check if this element is a family
:rtype: bool
Expand Down Expand Up @@ -863,15 +875,15 @@ def surname_match(self, name):
:rtype: bool
"""
(first, last) = self.get_name()
return last.find(name) >= 0
return regex.search(name, last, regex.IGNORECASE)

def given_match(self, name):
"""Match a string with the given names of an individual
:type name: str
:rtype: bool
"""
(first, last) = self.get_name()
return first.find(name) >= 0
return regex.search(name, first, regex.IGNORECASE)

def birth_year_match(self, year):
"""Match the birth year of an individual
Expand Down Expand Up @@ -919,7 +931,7 @@ def get_name(self):
return first, last

# Return the first GEDCOM_TAG_NAME that is found. Alternatively
# as soon as we have both the GETCOM_TAG_GIVEN_NAME and _SURNAME return those
# as soon as we have both the GEDCOM_TAG_GIVEN_NAME and _SURNAME return those
found_given_name = False
found_surname_name = False
for child in self.get_child_elements():
Expand Down
2 changes: 1 addition & 1 deletion setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

setup(
name='python-gedcom',
version='0.2.3dev',
version='0.2.4dev',
packages=['gedcom', ],
license='GPLv2',
package_dir={'': '.'},
Expand Down

0 comments on commit def78de

Please sign in to comment.