geneweb icon indicating copy to clipboard operation
geneweb copied to clipboard

[BUG] Same sex couple disappear in gw file after import-export

Open olivierberten opened this issue 3 years ago • 30 comments

Describe the bug / Description du bogue

Not sure this is a Geneweb or Geneanet bug but if I add a male-male couple, it exports as

fam Nom_1 Prénom_1 0 + #nsck mm Nom_2 Prénom_2 0

If I reimport this into Geneanet, it still shows a male-male couple but if I reexport it then, #nsck mm becomes #nm

Expected behavior / Comportement attendu

Safe roundtripping: same export as import.

Versions

Geneanet

olivierberten avatar May 22 '21 09:05 olivierberten

If you do changes to the family after import, #nsck comes back on export

olivierberten avatar May 23 '21 07:05 olivierberten

I could not reproduce the bug! 1/ export base to GED format 2/ import GED to new base 3/ export new base to .gw #nsck mm is ok

Can you restate the exact sequence you performed.

hgouraud avatar Jun 12 '21 07:06 hgouraud

Sorry for the late answer...

I export to gw, not GED.

So the sequence is: 1/ export base to gw format (=> fam Nom_1 Prénom_1 0 + #nsck mm Nom_2 Prénom_2 0) 2/ import gw file into same base, replaceing the current one (might be the same when importing into a new one but I didn't try) 3/ export base to gw format (=> fam Nom_1 Prénom_1 0 + #nm Nom_2 Prénom_2 0) even though it still shows as same sex couple in the web interface.

The reason I tried this is I was wondering whether I could periodically run my geneanet base through a script then reimport it. But it seems that currently means I'd lose some informations...

olivierberten avatar Jun 27 '21 12:06 olivierberten

Ok. The problem seems to be more severe that what you mention. Here is a diff between two .gw files. HenriP1 was created from HenriP.gw

MacAir-H:GeneWeb-Bases Henri$ diff HenriP.gw HenriP1.gw
11911c11911
< fam Gouraud Henri_Marie +2000 #contract mf #ms source_u7 Test Test8
---
> fam Gouraud Henri_Marie +~2000 #ms source_u7 Test Test8
11918c11918
< fam Gouraud Henri_Marie +2014 #pacs mf #mp Issy-Ies-Moulineaux,_Hauts-de-Seine #ms Source_u4 Test Alice
---
> fam Gouraud Henri_Marie +2014 #noment mf #mp Issy-Ies-Moulineaux,_Hauts-de-Seine #ms Source_u4 Test Alice
13324c13324
< fam Delsol Jean_Pierre.4 +1/9/1791 #mp Puivert_(Aude) Roques Bathilde.1 0 12/12/1834 #dp Puivert_(Aude)
---
> fam Delsol Jean_Pierre.4 + Roques Bathilde.1 0 12/12/1834 #dp Puivert_(Aude)
59199c59199
< fam Létard Erwan + #pacs mf Marion Pauline #src Xavier
---
> fam Létard Erwan + #noment mf Marion Pauline #src Xavier
MacAir-H:GeneWeb-Bases Henri$ 

Note that the mariage place of Jean Pierre Delsol has been lost in the process!!

hgouraud avatar Jun 27 '21 13:06 hgouraud

These lines seem wrong: image (from https://github.com/geneweb/geneweb/commit/56b629c533a635f54d8dc6347cea0968da4c357f)

Probably should be

-        | "#noment" :: c :: l ->
-          decode_sex MarriageLicense c l
+        | "#noment" :: c :: l when String.length c = 2 ->
+          decode_sex NoMention c l

sagotch avatar Jun 28 '21 08:06 sagotch

A hint:

fam Delsol Jean_Pierre.4 + Roques Bathilde.1 0 12/12/1834 #dp Puivert_(Aude)
fevt
#marr 1/9/1791 #p Puivert_(Aude)
#marr 
end fevt

The code says:

    begin
      Printf.ksprintf (oc opts) "fevt\n";
      List.iter (print_fevent opts base gen false) (get_fevents fam);
      Printf.ksprintf (oc opts) "end fevt\n"
    end;

Is there a duplicate in family events?

hgouraud avatar Jun 28 '21 08:06 hgouraud

If I reimport this into Geneanet, it still shows a male-male couple but if I reexport it then, #nsck mm becomes #nm

I need to double check, but I think that it is not a bug, "nosexcheck" variant are not useful an then are meant to be replaced by regular versions.

Is there a duplicate in family events?

Is there?

sagotch avatar Jun 28 '21 08:06 sagotch

Is there a duplicate in family events? I will explore further!!

My last find:

fam Gouraud Henri_Marie +2014 #noment mf #mp Issy-Ies-Moulineaux,_Hauts-de-Seine #ms Source_u4 Test Alice
wit: Camus Albert 0
wit m: Vasseur Christian
src Invention_personnelle_(alice),_Source_famille_Henri/test
comm Commentaire sur la famille avec Alice Test
fevt
#pacs 2014 #p Issy-Ies-Moulineaux,_Hauts-de-Seine #s Source_u4
wit: Camus Albert
wit m: Vasseur Christian
note Commentaire sur mariage avec Alice Test
end fevt

The original .gw file did show #pacs mf in the fam line!!

We need to suppress this duplicate information between the fam line and the fevt section!! Doing it in gwuLib.ml would be a first step?

hgouraud avatar Jun 28 '21 09:06 hgouraud

Duplicate information might be a problem, but it should not turn #pacs into #noment, do you say that it is linked to the issue, or is it a note aside this issue?

sagotch avatar Jun 28 '21 11:06 sagotch

I don't know if this the same issue. Possibly another. I am continuing investigations and tests.

hgouraud avatar Jun 28 '21 11:06 hgouraud

I need to double check, but I think that it is not a bug, "nosexcheck" variant are not useful an then are meant to be replaced by regular versions.

gwc does not seem to verify sex at family creation time.

fam Gouraud Henri_Marie +1970 Test Test7
src test
fevt
#marr 1970
end fevt

is correctly treated by gwc even though both members are male. When displaying this union, the "no sex check" tick box is unchecked, and further modification of this family yells "test7 should be female"!! Should the "no sexes check" property be maintained in the .gw file? But this complicated things: we already have NoSexesCheckMarried and NoSexesCheckNotMarried, but are missing NoSexesCheckPacs and others. From a GUI standpoint, and if "no sexes check" is not kept in the .gw file, then we should check/uncheck the "no sexes check" tickbox on the basis of an explicit comparison of sexes rather than on the test mrel = #nsck. We possibly could add a new function %same_sex; for this kind of test.

hgouraud avatar Jun 28 '21 11:06 hgouraud

Should the "no sexes check" property be maintained in the .gw file?

You do not have to multiply internal representation with "same sex" variant.

You should check the box if both persons are of the same sex. I think it is not possible with current template engine.

We possibly could add a new function %same_sex; for this kind of test.

Yes indeed.

sagotch avatar Jun 28 '21 12:06 sagotch

The current template (updfam.txt) has the "no sexes check" tick box.

You do not have to multiply internal representation with "same sex" variant.

We should in fact suppress the current variant and just keep Married, NotMarried It is probably good to keep the "no sexes check" verification in updateFamOk.ml (when it is not performed in gwc)

hgouraud avatar Jun 28 '21 12:06 hgouraud

We should in fact suppress the current variant and just keep Married, NotMarried It is probably good to keep the "no sexes check" verification in updateFamOk.ml (when it is not performed in gwc)

It is exactly what I meant :+1: (cf https://github.com/geneweb/geneweb/issues/828)

sagotch avatar Jun 28 '21 12:06 sagotch

Note that if you remove it from def.ml, gwdb-legacy must operate a conversion between its type and the new one so it would be compatible with existing databases. It needs to be benchmarked but it may be a good thing to do.

sagotch avatar Jun 28 '21 14:06 sagotch

Why not keep it in def.ml, but ensure that gwu does not record it in the .gw file.

hgouraud avatar Jun 28 '21 14:06 hgouraud

Closing this one, because I see no bug here.

sagotch avatar Jul 03 '21 16:07 sagotch

If I reimport this into Geneanet, it still shows a male-male couple but if I reexport it then, #nsck mm becomes #nm

I need to double check, but I think that it is not a bug, "nosexcheck" variant are not useful an then are meant to be replaced by regular versions.

Do you actually mean you'd expect a male-male couple to get exported as male-female? or did I misunderstood? Because if I reimport the last one, that's what happens: Nom_2 Prénom_2 becomes female. Just by exporting-importing twice.

olivierberten avatar Jul 03 '21 17:07 olivierberten

As far as I could verify, gwc does not verify the sex of a couple, so I am surprised that you see Nom_2 Prénom_2 changing sex!! I am preparing a PR suppressing #nsck and #nsckm. In gwc, no sex verification is done. In updateFam and updateInd, sex verification happen, and whether it is performed is controlled by some "no sexes check" button. The initial setting of this button in the update family template is currently controlled by the presence of #nsck or #nsckm. This will be replaced by an explicit comparison of the sexes to the two members of the couple with a new function %same_sex; returning true or false.

hgouraud avatar Jul 03 '21 18:07 hgouraud

Nom_2 Prénom_2 doesn't have parents in the database so the only way to know his gender is with #nsck mm. If that one disappears, he becomes she.

olivierberten avatar Jul 03 '21 19:07 olivierberten

Excellente remarque!! La suppression de #nsck passe par la mémorisation du sexe du couple (mm, ff) dans le cas "same sex". Reste à définir comment!!

hgouraud avatar Jul 03 '21 20:07 hgouraud

Et ça n'explique pas non plus pourquoi l'export après importation n'est pas le même que le premier export...

olivierberten avatar Jul 03 '21 20:07 olivierberten

@sagotch devrait ré-ouvrir cette issue!

hgouraud avatar Jul 03 '21 21:07 hgouraud

@olivierberten, peux tu tester la PR #1190? Merci

hgouraud avatar Jul 04 '21 06:07 hgouraud

Reste un problème, aussi présent dans le master :

fam Xxxx Henri +2014 #pacs mf #mp Issy-Ies-Moulineaux,_Hauts-de-Seine #ms Source_u4 Test Alice 1/1/1950 ?
fevt
#pacs 2014 #p Issy-Ies-Moulineaux,_Hauts-de-Seine #s Source_u4
end fevt

devient

fam Xxxx Henri +2014 #noment mf #mp Issy-Ies-Moulineaux,_Hauts-de-Seine #ms Source_u4 Test Alice 1/1/1950 ?
fevt
#pacs 2014 #p Issy-Ies-Moulineaux,_Hauts-de-Seine #s Source_u4
end fevt

après un cycle gwc/gwu

hgouraud avatar Jul 04 '21 11:07 hgouraud

Première fois que j'utilise Geneweb tel quel... et je n'ai pas réussi à créer un couple homosexuel... En cochant la case Relation homosexuelle (pas de vérification des sexes), la 2e personne est créée avec un sexe inconnu, et il est impossible de modifier le sexe d'une personne mariée, ce qui est un peu absurde lorsqu'il s'agit d'un sexe inconnu, et qui par ailleurs ne correspond pas à la réalité puisqu'il est de nos jours possible de changer de sexe, tant physiologique que légal, même en étant marié...

Je suis donc parti d'un fichier gw créé sur Geneanet:

encoding: utf-8
gwplus
fam Nom_1 Père 0 + Nom_1 Mère 0
fevt
#marr 
end fevt
beg
- h Prénom_1
end
fam Nom_1 Prénom_1 + #nsckm mm Nom_2 Prénom_2 0
fevt
#marr 
end fevt

Et tant avec la PR #1190 qu'avec le master, l'export est identique (à part un saut de ligne supplémentaire avant chaque fam) alors que sur Geneanet le réexport supprime le #nsckm mm

olivierberten avatar Jul 05 '21 09:07 olivierberten

En cochant la case Relation homosexuelle (pas de vérification des sexes), la 2e personne est créée avec un sexe inconnu, et il est impossible de modifier le sexe d'une personne mariée, ce qui est un peu absurde lorsqu'il s'agit d'un sexe inconnu, et qui par ailleurs ne correspond pas à la réalité puisqu'il est de nos jours possible de changer de sexe, tant physiologique que légal, même en étant marié...

Bonne remarque. Le formulaire de saisie actuel ne permet pas de préciser le sexe en cas de "création"! A corriger. Peut être aussi supprimer l'interdiction de changement de sexe d'un membre d'un couple.

Et tant avec la PR #1190 qu'avec le master, l'export est identique (à part un saut de ligne supplémentaire avant chaque fam)

A vérifier si le saut de ligne supplémentaire est utile? Par contre, je suis surpris que #nsck continue a apparaître dans le fichier .gw produit pas la #1190! Ce ne devrait pas être le cas et devenir #m ff|mm ou #nm ff|mm.

hgouraud avatar Jul 05 '21 14:07 hgouraud

Oups... j'avais oublié de choisir la branche...

Maintenant, il y a effectivement #m mm mais curieusement, si l'import est fait avec le master et l'export avec #1190, #m mm est dupliqué à l'export. Il ne s'y trouve qu'une fois si l'import est fait avec #1190.

encoding: utf-8
gwplus

fam Nom_1 Père 0 + Nom_1 Mère 0
fevt
#marr 
end fevt
beg
- h Prénom_1
end

fam Nom_1 Prénom_1 + #m mm #m mm Nom_2 Prénom_2 0
fevt
#marr 
end fevt

olivierberten avatar Jul 05 '21 20:07 olivierberten

Corrigé (sans que je comprenne vraiment pourquoi ca doublonnait!!). Mais il faut noter qu'avec cette modification, on définit un nouveau format "gwplus-1". Master (actuel) ne sais pas relire un fichier produit par #1190 !! Il va ignorer les familles homosexuelles et laisser une trace dans comm.log. Problème classique de compatibilité ascendante!

hgouraud avatar Jul 06 '21 04:07 hgouraud

Il semblerait que j'ai mal compris le problème, désolé.

sagotch avatar Jul 06 '21 20:07 sagotch