Giter Club home page Giter Club logo

gedcom's Introduction

Tweet

gedcom

A general purpose utility for gedcom files. This program does a lot of different things with a gedcom file.

Print today's family anniversaries

Given your family tree as a gedcom, gedcom will tell you whose birthday it is and who died on this day. Although primarily a tool for genealogy, the -l flag tells gedcom to include matches for family members that are still alive.

The -d flag will give you a short biography of each person.

Try adding this to your crontab, it will give you a daily e-mail of your relative's birthdays and the anniversaries of their death along with information about their life.

3 5 * * * gedcom -dl gedcom-file.ged

or

22 5 * * * gedcom -dth 'Your Full Name' gedcom-file.ged

Gedcom validation

Gedcom also includes sanity checking of your Gedcom file, including missing, impossible and inconsistent information. You can enable this mode with -w, which will print warnings of anything it finds. It's a sort of lint for Gedcom files.

For example:

gedcom -dAwWl gedcom-file.ged > /dev/null

Adding the -c option will add the checking of missing citations.

To sort by error type:

gedcom -dAwWl gedcom-file.ged > /dev/null 2> /tmp/errs
sort -t: -k2 /tmp/errs

Genealogy Calendar

You can create a month-to-a-page genealogical calendar of your ancestors:

for i in 1 2 3 4 5 6 7 8 9 10 11 12
do
    gedcom -dwHm $i -y $(date +%Y) gedcom-file.ged > $i.html
done

To print a month-to-a-page calendar of all the Smiths in your tree as a present, choose any Smith in your tree as a home person so that the -s option works:

for i in 1 2 3 4 5 6 7 8 9 10 11 12
do
    gedcom -dwHlm $i -y $(date +%Y) -h 'John Smith' -s gedcom-file.ged > $i.html
done

Alternatively you can create an ICS file to import to Google Calendar:

gedcom -i /tmp/ics.ics gedcom-file.ged

Produce a Google Map

You can produce a map of locations of all Smiths in your tree with

gedcom -xsh Smith gedcom-file-ged > smith.csv
  • Upload the csv file to Google Drive
  • Visit google.com/maps, on the 3 horizontal lines choose "your places" ("Vos adresses"), then "maps" ("Cartes")
  • Click "create map", choose "import" and upload your file, choose "Location" as the position column and "People" as the title column
  • You may see that a number of rows can't be seen in the map, this is an opportunity to find locations in your map that are incorrect

Family History Book

You can create a genealogy book as a PDF of your family history and research to give to your dad on father's day:

# Note that this will only print people related to your father, even if you give -a
# yum install gd-devel ImageMagick-devel
gedcom -B family-history.pdf -dh "Your Father's Full Name" gedcom-file.ged

You can create a book of your family name based on the descendants of John Smith:

gedcom -GB smith.pdf -dsh 'John Smith' gedcom-file.ged

If you enable the -w flag with the -B option, warnings will appear in red in the book.

Environment Variables

For compatibility with other code, these environment variables are honoured:

BMAP_KEY: Bing (virtualearth.net) API Key
GEONAMES_USE: geonames.org registered username
GMAP_KEY: Google Places (maps.googleapis.com) API Key
LANG: some handling of en_GB and en_US translating between then, fr_FR is a work in progress
OPENADDR_HOME: directory of data from http://results.openaddresses.io/
REDIS_SERVER: ip:port pair of where to cache geo-coding data

Reference

The options are:

-a: all days otherwise just today
-A: print everyone, in alphabetical order
-b: only print birthdays
-B: create a genealogy book
-c: give citations on detailed listing
-C: print birth dates of children
-d: show the detailed lifetime information about the person
-D: only print anniversaries of deaths
-e: external website to use for the -L option
-f: treat warnings as fatals, implies -w
-F: create a forefathers book
-G: print everyone, in generation order
-g: prints a GML of the locations
-H: Print an HTML calendar of this month
-h: set the home person - useful for calculating relationships with -d
-i: creates an ICS file
-l: include living people
-L: include ged2site hyperlinks with -H
-m: month for -H calendar
-M: produce a map of a place (currently only Kent is supported) as
an animated gif of births into $surname.gif
-O: print a list of occupations, useful for finding typoes and inconsistencies
-p: print the biography of the given person
-P: print a list of places, useful for finding typoes of inconsistencies
-r: print a list of residences, useful for finding typos and inconsistencies
-t: print tomorrow's information, don't use with -a
-s: only print entries matching the home person's surname
-S: create an SQLite database from a Gedcom
-v: verbose - for debugging
-w: print warning about inconsistent data - a sort of lint for Gedcom files
-W: don't colorize warning output
-x: prints a list of towns in a format suitable to import into a google map
-y: year for -H calendar, or -T to give a list of places for a specific year

Running on Windows

  • Firstly, if you're running Windows 10, install Ubuntu or install Perl directly, either ActiveState or Strawberry should work fine. I have also had success using Cygwin's Perl.

  • Next follow the instructions at local::lib.

  • Load in all the CPAN modules that gedcom uses. If you're not sure, run gedcom with no arguments and the program will install its core modules to get started.

Bugs

There will be numerous strange handling of Gedcoms since it's not that tightly observed by websites. If you see lumpy English text in the output, or just plain mistakes, please e-mail me or add a bug report to github.com/nigelhorne/gedcom.

I've tested against a number of Gedcoms including the Torture Tests at https://www.tamurajones.net/DownloadTortureTests.xhtml and gedcoms from gedcomlibrary.com.

With the -T option, countries and counties can be optimized out. That will be fixed.

Pre-Requisites

Gedcom uses many CPAN modules which it will try to install if they are not on your system. If it doesn't have the necessary privilege to install the modules it will fail on starting up with "permission denied" errors. This is most likely because you're not running as root (which is of course how it should be) and you're not using local::lib, or Perlbrew.

Running the program for the first time with no arguments should install them, of course that will fail if you don't have the privilege, in which case you'll need to add them by hand. To install by hand you'll either have to use local::lib or perlbrew. Of course you could also run gedcom as root, but I strongly advise you don't do that.

Library - library of code common with ged2site.

To use the -B option on FreeBSD you'll need to "sudo pkg install pkgconf gdlib ImageMagick7; cd /usr/local/lib; sudo ln -s libMagick++-7.so libMagickCore-7.Q16HDRI.so"

To use the -M option on FreeBSD you'll need to "sudo pkg install apngasm"

Acknowledgements

So many Perl CPAN modules that if I list them all I'll miss one, but special mention goes to the Gedcom module.

See Also

  • ged2site - create a website from a Gedcom file
  • gedcmp - compare two Gedcoms
  • lib - library of routines used by this package

LICENSE AND COPYRIGHT

Copyright 2015-2024 Nigel Horne.

This program is released under the following licence: GPL for personal use on a single computer. All other users (including Commercial, Charity, Educational, Government) must apply in writing for a licence for use from Nigel Horne at <njh at nigelhorne.com>.

gedcom's People

Contributors

dependabot[bot] avatar nigelhorne avatar

Stargazers

 avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar  avatar

Watchers

 avatar  avatar  avatar  avatar

gedcom's Issues

Feature request: Add localisation support

I’d be nice if we could localise the strings. I could add Slovak, Hungarian, Czech (and possible British English) strings, but for that we need to have some the L10N tool.

Improve parsing of names that include diacritics

As we talked in #95 (from which I simply copied portions to this issue), we should improve the parsing of names that include diacritics (like ľščťžýáíéúäôňďěŕĺöüűő).

As we talked there, Lingua::EN::NameParse (which you use for parsing names) currently does not support parsing names with diacritics. However, Lingua::EN::NameParse has the following notes in its perlpod docs:

FUTURE DIRECTIONS

Define grammar for other languages. Hopefully, all that would be needed is to specify a new module with its own grammar, and inherit all the existing methods. I don't have the knowledge of the naming conventions for non-english languages.

BUGS

Names with accented characters (acute, circumfelx etc) will not be parsed correctly. A work around is to replace the character class [a-z] with \w in the appropriate rules in the grammar tree, but this could lower the accuracy of names based purely on ASCII text.

So, I think for now it would be good enough to use that workaround, but it would be nice (if it is possible) to re-replace the names with their original spelling after parsing, that is:

  • remove the diacritics (MáriaMaria),
  • parse the names as usual,
  • replace the parsed names with their original form (MariaMária).

However, it would be much better to implement Lingua::SK::NameParse as it is written in the _Future directions. I’d like to contact Kim Ryan (the dev of Lingua::En::NameParse) if he is interested. Although I can code in Perl a bit, I am not a pro programmer. I could mainly assist in the liguist/algorithm part. Are you willing to help with the coding of this parser? Or you are busy enough with other stuff? :)

Feature request: Add option to get any dates

I’d like to use your gedcom utility to get all dates from my .ged file and then create an .ical file which I’d import into my calendar.

By all dates I mean:

  • birth dates,
  • baptism dates,
  • marriage dates,
  • start and end of education at particular school (not needed for my current purpose),
  • start and end of work at particular company/position (not needed for my current purpose),
  • death dates,
  • funeral dates,
  • dates based on custom tag (like confirmation dates).

I would be nice to be able to get:

  • all of these dates at once,
  • select dates (one could select one or more of these dates).

`BEGIN` section does not install dependencies

BEGIN section does not install dependencies, at least not on CentOS 7 x86_64.

  • What is eval 'use Geo::Coder::List 0.26'; for? Why do you check if a single module is available? What if the eval is true, but not all dependencies are installed? I think this is why it does not install the dependencies on my non-clean system.

  • Is there any reason to install the dependencies in separate cpan processes? Why don’t you use one cpan command?

All in all, I would do this:

  1. First check if all dependecies (one by one) are present.

  2. If one or more dependencies are missing, run cpan with the them only.

  3. If there is non-zero return code, die (or warn if you wish).

As for the implementation of my proposal:

  • What is requirements.txt used for? I would suggest to list there all dependencies, one on a line (space-separated if you wish), sorted and unique. Then, the ./gedcom could read this file and check each module if it is installed; if not, add it to a variable. After the checks, check if the variable is not empty and only then run cpan and evaluate its return code. And because of F/FR/FRIFFIN/Geo-Coder-PlaceFinder-0.1.tar.gz (which is not the module’s name), we might need to have two values per line unless we somehow extract the usable (by use) module name from this kind of syntax/path. For now, I only include the module name.

  • In requirements.txt, there are some extra modules in comparison to those listed in the BEGIN section. Currently, it is not clear if all the modules from requirements.txt are really required or not.

Here is an example, how it could look like. I have tested it after uninstalling all the dependencies (except for Date::Parse and IPC::System::Simple, which cpanm could not find—aren’t they part of another module?) using cpanm -U. I see only one problem: We cannot determine which module was not installed in case of error. I could create a PR, but first I’d like to hear from you.

BEGIN {
	# Read requirements.txt
	# We might want to check if there are errors on open or close, but I think it might not be necessary
	# In case of error, we might download the requirements.txt from GitHub
	my ($fh, @deps, $i, $cpan_ret_val);
	my $deps_to_install = '';
	open $fh, '<', 'blib/requirements.txt';
	chomp(@deps = <$fh>);
	close $fh;

	# Check if dependencies are installed
	for ($i=0; $i < scalar(@deps); $i++) {
		if (! eval "use $deps[$i]; 1;") {
			# The particular dependency is not installed, therefore we need to install it
			if ($deps_to_install eq '') {
				$deps_to_install = $deps[$i];
			} else {
				$deps_to_install = $deps_to_install . ' ' . $deps[$i];
			}
		}
	}

	# Install any missing dependencies
	if ($deps_to_install ne '') {
		warn "INFO: Installing dependencies ...\n";
		my $cpan_ret_val = system("cpan $deps_to_install &>/dev/null");
		if ($cpan_ret_val > 0) {
			die "ERROR: There was a problem with installing the dependencies.\n";
		}
	}
}

`Gedcom::Individual::relationship`: Add step-relationships

In Gedcom::Individual::relationship, you missed step-brother and step-sister. Difference between half-sibling and step-sibling is that half-siblings have one common parent, where step-siblings none.

I could create a PR with the following code added:

if(($self->mother() ne $other->mother()) && ($self->father() ne $other->father())) {
  return ($sex eq 'M') ? 'step-brother' : 'step-sister';
}

but when is the following code used?

return $self->relationship_down($other) || $self->relationship_up($other);

Improve help/usage text

I really miss the -h/--help option. You have already implemented -h for different purpose, so at least --help should be implemented.

Also, I think that usage output should be a separate function (e.g. usage()). For now, it could accept one parameter, either short (short usage help text when the program dies) or full (full help text when issued with --help (then it should return 0 as it is a success).

The full help text should include all options with there definitions (just like it is currently in the README.md.

The full help text should also include examples.

Building dependencies for `carton install` fails

I have troubles building gedcom dependencies.

Platform info

os   : CentOS 7 x86_64
perl : 5.16.3
cpan : 1.64

❗ Note that I have not tested it on clean CentOS 7, therefore there might be other packages that need to be installed, but currently I have no time to setup up a test OS.

What have I done

  1. Clone the repo.
git clone [email protected]:nigelhorne/gedcom.git ~/gedcom_util
cd ~/gedcom_util
  1. Install carton
cpan Carton
  1. I tried to run carton install, but it failed installing GD module:
! Installing the dependencies failed: Module 'GD' is not installed, Module 'Geo::Coder::Free' is not installed, Module 'Image::Resize' is not installed
  1. So I examined the issue and I needed to install gd-devel, but until I nailed the issue, I have installed php-gd and perl-GD packages too which are probably not necessary, but I list them anyway.
sudo yum -y install php-gd perl-GD gd-devel
sudo systemctl restart httpd  # Restart needed only because of `php-gd`
  1. I tried to run carton install again, which tried to install Geo::Coder::Free, but failed to download http://download.maxmind.com/download/worldcities/worldcitiespop.txt.gz and therefore failed installing Geo::Coder::Free module altogether:
# some lines removed
Downloading http://download.maxmind.com/download/worldcities/worldcitiespop.txt.gz
Fetch failed! HTTP response: 404 Not Found [404 Not Found] at Makefile.PL line 38.
Fetch failed! HTTP response: 404 [Not Found] at Makefile.PL line 38.
Command failed:  at Makefile.PL line 38.
Command failed:  at Makefile.PL line 38.
Command failed: get: Access failed: 404 Not Found (/download/worldcities/worldcitiespop.txt.gz)
 at Makefile.PL line 38.
Command failed: HTTP/1.1 404 Not Found
# some lines removed
 at Makefile.PL line 38.
Got a '404' from 'download.maxmind.com' expected '200' at Makefile.PL line 38.
Got a '404' from 'download.maxmind.com' expected '200' at /home/ts/perl5/lib/perl5/File/Fetch.pm line 812.
	File::Fetch::_iosock_fetch('File::Fetch=HASH(0x17ad248)', 'to', '/home/ts/.cpanm/work/1571219763.9427/Geo-Coder-Free-0.12/worl...') called at /home/ts/perl5/lib/perl5/File/Fetch.pm line 507
	File::Fetch::fetch('File::Fetch=HASH(0x17ad248)', 'http://download.maxmind.com/download/worldcities/worldcitiesp...') called at Makefile.PL line 38
-> N/A
-> FAIL No MYMETA file is found after configure. Your toolchain is too old?
-> FAIL Configure failed for Geo-Coder-Free-0.12. See /home/ts/.cpanm/work/1571219763.9427/build.log for details.
-> FAIL Installing the dependencies failed: Module 'Geo::Coder::Free' is not installed
-> FAIL Bailing out the installation for /home/ts/git/others/gedcom_util/.
  1. So I tried to install Geo::Coder::Free free manually. It required and/or suggested to install some additional modules, so I’ve ended up with installation of the following modules:
# Note that CGI::Lingua failed 2/451 subtests without IP::Country
# But before installing IP::Country, I installed Geo::IP, but then CGI::Lingua complained that it `Can't find your GeoIP.dat file for Geo::IP`
cpan GD Geo::Coder::Free Image::Resize YAML File::Fetch CGI::Lingua DBD::SQLite IP::Country

# I have also added this (it was suggested at the time of installation of some modules)
cpan Log::Log4perl
  1. Third try of running carton install: it fails to detect that Geo::Coder::Free is installed and tries to install it again, which fails (cf step 5). But now I noticed in the ~/.cpanm/work/[some_numbers]/build.log that it tries to install v0.12 (from here), but I have installed (using cpan Geo::Coder::Free) v0.22. So the issue is probably in the carton install script, but I am not a pro programmer and I have never used carton, so I have no idea where to look for the script.

  2. As a last resort, I removed local/ folder, installed the modules from requirements.txt and re-run carton install and it worked!

  3. But running carton exec ./gedcom produced the following warning (right at the beginning of the output) about App::Cpan version, but it is not true as cpan App:Cpanoutputs the curretly installed version asv1.675`.

WARNING: your version of App::Cpan is 1.5701 while we would expect at least 1.64 at /home/ts/perl5/bin/cpan line 11.
  1. But the output of carton exec ./gedcom ends with the following error:
"cpan -i Gedcom Genealogy::Gedcom::Date Date::Parse Geo::Coder::List Geo::Coder::Free IPC::System::Simple Geo::Coder::Ovi CHI String::Compare" unexpectedly returned exit value 1 at (eval 100) line 13.
 at ./gedcom line 30
BEGIN failed--compilation aborted at ./gedcom line 36.
  1. I tried to issue that cpan command and its output looks good to me:
Reading '/home/ts/.cpan/Metadata'
  Database was generated on Tue, 15 Oct 2019 15:17:03 GMT
Gedcom is up to date (1.20).
Genealogy::Gedcom::Date is up to date (2.10).
Date::Parse is up to date (2.30).
Geo::Coder::List is up to date (0.26).
Geo::Coder::Free is up to date (0.22).
IPC::System::Simple is up to date (1.25).
Geo::Coder::Ovi is up to date (0.03).
CHI is up to date (0.60).
String::Compare is up to date (undef).

I have no idea how to solve this problem.

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.