|
From: Tim L. <guy...@gm...> - 2018-01-25 11:33:22
|
Simon C. Tremblay wrote
> ... "lists everyone in a gedcom that should be alive on a census
> at a particular date and for whom you have not yet found a census entry"
I wrote a QuickView report to do exactly that for my own use. I use it in
gramps34, where I have backported the newer 'forms' gramplet. The two
CensusCheckQuickview files need to be in the same directory as the forms
gramplet.
It only checks a person and their spouse and children, because that is
enough to concentrate on at one time to try to find the missing census
entries.
It is so short that I have attached it below in case it is any use.
(provided the mailing list gremlins don't strip it as too long).
Known bugs!
It only works in conjunction with the forms gramplet. It may need some
changes to make it work for gramps4x or gramps5x. It gets a bit confused
sometimes when dates are approximate because probably_alive doesn't always
work right. I have changed ;;date-about-range=50 in gramps.ini from the
default 50 to date-about-range=1, because when I say the date is 'about' I
mean that it is within a year of that date (but now that I check, I haven't
done that for the current gramps.ini I am using, so perhaps that is why
probably_alive sometimes doesn't work for me!). I didn't check whether a
person's parents exist, so it crashes, for example when you run it for a
person with children but no spouse. If you have census sources for more than
one country, it will check them all. It is only the UK 1939 register that
has closed records, but the check applies for all census forms.
Regards,
Tim Lyons
Here are the files.
CensusCheckQuickview.py
#
# Gramps - a GTK+/GNOME based genealogy program
#
# Copyright (C) 2016 Tim G L Lyons
#
# This program is free software; you can redistribute it and/or modify
# it under the terms of the GNU General Public License as published by
# the Free Software Foundation; either version 2 of the License, or
# (at your option) any later version.
#
# This program is distributed in the hope that it will be useful,
# but WITHOUT ANY WARRANTY; without even the implied warranty of
# MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
# GNU General Public License for more details.
#
# You should have received a copy of the GNU General Public License
# along with this program; if not, write to the Free Software
# Foundation, Inc., 59 Temple Place, Suite 330, Boston, MA 02111-1307 USA
#
#
# $Id:
#
#
"""
Display whether census records have been found for a person, their spouse(s)
and
children
"""
from Simple import SimpleAccess, SimpleDoc, SimpleTable
from TransUtils import get_addon_translator
import Relationship
import form
from Utils import probably_alive, probably_alive_range
_ = get_addon_translator(__file__).ugettext
rel_calc = Relationship.get_relationship_calculator()
def process_person(database, sa, stab, person, census_list):
if not person:
return
# Check for any existing census events for the person
found_census = []
for event_ref in person.get_event_ref_list():
event = database.get_event_from_handle(event_ref.ref)
if event:
citation = form.get_form_citation(database, event)
if citation:
source_handle = citation.get_reference_handle()
source = database.get_source_from_handle(source_handle)
if source:
form_id = form.get_form_id(source)
found_census.append(form_id)
# Process all the possible censuses
census_result = ()
for key in sorted(census_list):
if key in found_census:
census_result += ("OK", )
else:
(b, d, ex, rel) = probably_alive_range(person, database)
if probably_alive(person, database, census_list[key]):
# If the person would be less than 100, the record may be
closed
if probably_alive(person, database, max_age_prob_alive=100):
census_result += ("closed", )
else:
census_result += ("miss", )
else:
census_result += ("-", )
# Construct the results line
columns = (sa.name(person), sa.birth_date_obj(person),
sa.death_date_obj(person)) + census_result
stab.row(*columns)
def run(database, document, person):
"""
Display whether census records have been found for a person, their
spouse(s)
and children
"""
# Construct a dictionary of census IDs and date
census_list = {}
for handle in database.get_source_handles():
source = database.get_source_from_handle(handle)
form_id = form.get_form_id(source)
if form_id in form.get_form_ids():
form_type = form.get_form_type(form_id)
if form_type == "Census":
census_list[form_id] = form.get_form_date(form_id)
sa = SimpleAccess(database)
sd = SimpleDoc(document)
sd.title(_("Census Check for %s") % sa.name(person))
sd.paragraph("")
stab = SimpleTable(sa)
columns = (_("Name"), _("Birth date"), _("Death date")) + \
tuple(key for key in sorted(census_list))
stab.columns(*columns)
stab.set_link_col(4)
process_person(database, sa, stab, person, census_list)
for family in sa.parent_in(person):
father = sa.father(family)
mother = sa.mother(family)
if father.handle <> person.handle:
spouse = father
else:
spouse = mother
process_person(database, sa, stab, spouse, census_list)
for child in sa.children(spouse):
process_person(database, sa, stab, child, census_list)
stab.write(sd)
sd.paragraph("")
CensusCheckQuickview.gpr.py
#------------------------------------------------------------------------
#
# Register the report
#
#------------------------------------------------------------------------
register(QUICKREPORT,
id = 'censuscheckquickview',
name = _("CensusCheck"),
description= _("Check whether any Census events are missing for a
person and some of their descendents"),
version = '1.0.1',
gramps_target_version = '3.4',
status = STABLE,
fname = 'CensusCheckQuickviewx.py',
authors = ["Tim Lyons"],
authors_email = ["hidden"],
category = CATEGORY_QR_PERSON,
runfunc = 'run',
)
--
Sent from: http://gramps.1791082.n4.nabble.com/GRAMPS-User-f1807095.html
|