betty icon indicating copy to clipboard operation
betty copied to clipboard

recognize more than betty:privacy attribute

Open emyoulation opened this issue 4 years ago • 3 comments

The privacy feature that filters records with betty:privacy attribute is too limited. It only allows persistent privacy settings for only 1 website to be generated per Tree. If I was generating separate websites for my maternal 2nd cousins and my paternal 3rd cousins, I'd have a big challenge. I'd have to mass clear & reset the Attributes every time I switched which website to update.

Could you have it default to look for the current Attribute flag .... but allow an override comparison value?

Reference from [https://pypi.org/project/betty/#gramps](https://pypi.org/project/betty/#gramps) 

Gramps has limited built-in support for people's privacy. To fully control privacy for people, as well as events, files, sources, and citations, add a betty:privacy attribute to any of these types, with a value of private to explicitly declare the data always private or public to declare the data always public. Any other value will leave the privacy undecided, as well as person records marked public using Gramps' built-in privacy selector.

emyoulation avatar Dec 21 '20 18:12 emyoulation

The betty:privacy attribute mimics Gramps' existing public/private functionality for resource types that don't have such a privacy setting in Gramps. Additionally it allows for a third option (if the attribute isn't set at all) where it lets extensions such as Privatizer decide if the resource must be private or not.

This means that you can always write your own extension that mimics the Privatizer extension, but determines privacy based on your own criteria. This would happen as follows:

  1. The Gramps extension imports all resources. Any person that is explicitly marked private in Gramps, will be marked private in Betty.
  2. For all resources of types that have a privacy setting in Betty, the Gramps extension will look for the betty:privacy attribute. If the attribute is not set, or it is set but with a different value than 'private' or 'public', the resource's privacy remains undetermined (None). If the attribute exists and its value is private, the resource is marked private. If the attribute exists and its value is public, the resource is marked public.
  3. If you enable the Privatizer extension, it will determine the privacy for each person whose privacy is still undetermined. It does this by reasoning if the person will be dead by now, in a pessimistic way: if it cannot reason the person is dead, the extension will consider them alive, and therefore private. Additionally, events, sources, and citations are privatized by the Privatizer extension as well, depending on whether any of their associated people are private or not.

Your own extension can work instead of the Privatizer, or in addition to. It can also leverage the APIs from the extensions that are shipped with Betty, which is what I do to prevent a handful of living people from being marked private, but to anonymize them (source).

bartfeenstra avatar Dec 21 '20 21:12 bartfeenstra

One idea is that we can extend these attributes with a tag specified in Betty's Gramps extension's configuration, so that if an attribute includes an additional tag, it's only parsed if that tag is also specified in the configuration. If it's not, then the entire attribute is ignored. Example bety.yaml:

output: /var/www/betty
base_url: https://ancestry.example.com
root_path: /betty
extensions:
  betty.extension.gramps.Gramps:
    file: ./gramps.gpkg
    tag: maternal2ndcousins

Adding a betty-maternal2ndcousins:privacy attribute to a resource would make that attribute parsed (imported) by Betty using the above configuration, but the betty-paternal3rdcousins:privacy tag on the same resource would be ignored. If the Gramps extension configuration does not specify a tag at all, all attributes are imported, whether or not they contain a tag.

bartfeenstra avatar Dec 23 '20 11:12 bartfeenstra

Now that we have introduced project IDs we could use those to parse attributes tagged with them. That would allow each attribute to be applied either for all Betty projects or for a single one.

bartfeenstra avatar Jan 18 '24 01:01 bartfeenstra