Question about the Gramps Handle ID

Since the CSV import/export does not support import of Alternative Names for Places, and have some limitations in what is imported/exported, I am looking at creating a xml read/write VBA script in Excel, but to get that to work, I believe I have to generate the Gramps Handle ID… I have tried to find something about the format and how to build it, but can’t find anything…

So my questions is as follow:

  1. is it any limitations of what characters the Handle support, or can I use any character (letter, number, special characters as “.”, “-”, “_”)?
  2. except the “_” in the start, is it any other characters of positions in the string that is locked to the type of entity it is for (i.e. place, person etc.).
1 Like

You can see how it is created in the code. So it will be a minimum of 16 digits of lowercase hex. The underscore is added on export.

The column is defined to have a maximum size of 50 characters in the database.

2 Likes

Thanks, So I can create any squence as long as it is the characters used in HEX, and the underscore are not “needed” for import?

I just need to be sure, because I was thinking of using a combination of PlaceID and som random, so that it would be possible to create a list of both alternative names and “enclosed_by” and that it would be possible for me or any other to just input the PlaceID in any referencing fields/columns…

Internally our handles are just strings. However, they MUST be unique in the db. I think the standard XML import tests this and will create a new handle if there is a conflict in the imported data.

A side note, if the db you are importing to is not empty, the imported data will have all its handles replaced to prevent potential conflicts. So ‘merging’ some bits of data into already present data is not possible with the standard XML import. You can see this if you try to import the same XML file twice; everything is duplicated.

1 Like

Yes, I have noticed that…

I don’t know how to get around this problems when creating a dataset outside Gramps, with alternative Place Names, I was hoping for a change in the CSV, but don’t want to seem demanding, so only way is to tell those who want to use the dataset when I’m finished with it is to import it to a an empty database…
Not many people that want to sit and manually merge thousands of places… But I’m trying to figure out a way to merge places in either Excel or OpenRefine, using the existing ID’s for the places in the existing database and merge them somehow into a new “database” or actually a new xml… its a lot of extra work for most people, so im not sure I ever can be able to share this data for use in Gramps…

Uniqueness is easy, because the PlaceID’s also need to be unique to be able to link the places, and to just add a number of characters to those to generate a Handle ID is easy in any Spreadsheet software…

The problem are to be able to utilize the data in Gramps, how to import it without having to manually merge thousands of places…

PS. I do know that this is outside of the scope how most people use Gramps… but it would be great if it was possible to actually merge datasets created outside Gramps, with data already in a Gramps database without having to manually merge thousands of place names and alternative placenames…
I just cant ask for something I’m the only one using or want…

Well, Jaran, you know I am supporting your efforts and would benefit. I have a long way to go to fix my places. I was thinking if I ever get it done it might be nice to share a place csv file but it sounds like it wouldn’t work well. I wish I would have known when I started building my tree that we are supposed to use enclosures, dates and alternative names. It would be great, although maybe hoping for too much, if there were a place dataset built into gramps, maybe not complete but covering a good chunk. That way we wouldn’t all be repeating the huge amount of time it takes to research each place. But, if we’d have to merge with what we already have then most would avoid it. It would be great when starting fresh though.

May the code angels be with you. :angel: :angel: :angel:

@Connie,

My hope about being able to merge places is that the places and al the data from an imported dataset, would just add to the places already in the database, and that we didnt have to do the merge manually one by one…
It would still be some job for the user, first exporting places to a csv, add that csv to the external dataset, then change the place id for the places they have in so that those records in the dataset has the same ID, and then reimport the whole dataset (thats an “easy job” in a spreadsheet or OpenRefine), even for a few hundred places…

But, its of no point when the csv do not hold all the place data, and in addition overwrite the existing places… then a dataset like the one I’m compiling is only useful for a new database… and of so, pointless to share, because its as easy to make a dataset for Gramps from a geonames csv, both in Excel and in OpenRefine… that can be imported in to a new database…

This topic was automatically closed 30 days after the last reply. New replies are no longer allowed.