Skip to content

Commit

Permalink
Improved algorithm to see if living with a parent
Browse files Browse the repository at this point in the history
  • Loading branch information
nigelhorne committed May 23, 2024
1 parent fdbf33a commit e728298
Showing 1 changed file with 29 additions and 24 deletions.
53 changes: 29 additions & 24 deletions gedcom
Original file line number Diff line number Diff line change
Expand Up @@ -4988,7 +4988,9 @@ sub print_person
if(1) {
my $with_mother;
my $same_road_as_mother = 0;
my $road = $residence->address();
my $address = $residence->address();
my $road = $address;

if($road) {
if($road =~ /,\s*(.+)/) {
$road = $1;
Expand All @@ -5006,20 +5008,10 @@ sub print_person

my $p = place({ person => $mother, record => $mr, nopreposition => 1 });
next unless($p);
# if(($p =~ /^\s\d/) && ($p eq $place)) {
if($p eq $place) {
if($mdate eq $rdate) {
$with_mother++;
$living_alone = 0;
last;
} elsif(!$printed_mother_same_place) {
$mother_date = $mdate;
}
}

if(($rdate eq $mdate) && $road && ($mr->place() eq $residence->place())) {
if(my $mroad = $mr->address()) {
if($mroad eq $road) {
if($mroad eq $address) {
$living_with{'mother'} = $mother;
}
if($mroad =~ /,\s*(.+)/) {
Expand All @@ -5033,6 +5025,17 @@ sub print_person
}
}
}

# if(($p =~ /^\s\d/) && ($p eq $place)) {
if($p eq $place) {
if($mdate eq $rdate) {
$with_mother++;
$living_alone = 0;
last;
} elsif(!$printed_mother_same_place) {
$mother_date = $mdate;
}
}
}
if($with_mother && !$living_with{'mother'}) {
complain({ person => $person, warning => "May have been living with mother on $rdate, but the addresses don't match or aren't detailed enough to be sure" });
Expand All @@ -5049,20 +5052,10 @@ sub print_person

my $p = place({ person => $father, record => $fr, nopreposition => 1 });
next unless($p);
# if(($p =~ /^\s\d/) && ($p eq $place)) {
if($p eq $place) {
if($fdate eq $rdate) {
$with_father++;
$living_alone = 0;
last;
} elsif(!$printed_father_same_place) {
$father_date = $fdate;
}
}

if(($rdate eq $fdate) && $road && ($fr->place() eq $residence->place())) {
if(my $froad = $fr->address()) {
if($froad eq $road) {
if($froad eq $address) {
$living_with{'father'} = $father;
}
if($froad =~ /,\s*(.+)/) {
Expand All @@ -5076,6 +5069,18 @@ sub print_person
}
}
}

# if(($p =~ /^\s\d/) && ($p eq $place)) {
if($p eq $place) {
if($fdate eq $rdate) {
$with_father++;
$living_alone = 0;
last;
} elsif(!$printed_father_same_place) {
$father_date = $fdate;
}
}

}
if($with_father && !$living_with{'father'}) {
complain({ person => $person, warning => "May have been living with father on $rdate, but the addresses don't match or aren't detailed enough to be sure" });
Expand Down Expand Up @@ -5158,7 +5163,7 @@ sub print_person
}
} elsif(($mother || $father) && ($bdiff->in_units('years') < 16)) {
if(!($with_mother || $with_father)) {
complain({ person => $person, warning => [ 'Not living with either parent in childhood when aged ', $bdiff->in_units('years') ] });
complain({ person => $person, warning => [ "$rdate: Not living with either parent in childhood when aged ", $bdiff->in_units('years') ] });
}
$living_alone = 0;
} elsif($father_date && (datecmp($rdate, $father_date) >= 0)) {
Expand Down

0 comments on commit e728298

Please sign in to comment.