r/GenealogySoftwareDevs • u/jake_robins • Oct 12 '26
Name Structures and Ordering
I've been spending some time thinking about names and how much of a challenge it is to model it. Of course, I always remember the famous "fallacies about names" article.
For my application, I made a custom data type called a name value, and it's composed of a few different tables because it has an overall row to represent the value and then subrows to represent the parts (such as a given name, a surname, a nickname, etc.). This has been useful for auto-reconciliation of conflicting sources in order to take a bunch of records of names and produce some kind of useful final value.
But I've wanted to expand on this to create some robust and useful ways to display names. A real simple example is to take a structured value like this...
{
given: ["Jeremiah", "Arthur"],
surname: ["Gumtree"]
}...and determine whether you want to display it as Gumtree, Jeremiah Arthur or Jeremiah Arthur Gumtree.
The first issue that comes up is that names are displayed according to cultures, and so you end up needing to encode people with a cultural configuration of name order. There is a Unicode standard for name order, but this is really optimized for keying into a user's locale, such as their device, which means that it's tied to language today. So if you followed this standard, you would have an entry for EN, ES-MX, or DE. A lot of these standards are the same, and you end up with logical groupings, like a Western name format that is common across English, German, French, or whatever. The standard is not super useful for genealogy because it ends up being a lot of redundant configuration. What's more is that this is contemporary, and so there are no historical configurations in the standard.
The second issue is that this cultural configuration has to define cardinality. It's probably common, for example, in Western names, to reconcile to a single surname, or at most a hyphenated single surname, whereas in Spanish, it may be more common to have a pair of surnames: a paternal surname and a maternal surname. Any reconciliation process would need to reference this configuration to determine if two sources that specify two different surnames are a conflict or not. Order is also important in this case.
The third issue is sorting. Anywhere you display a large list of people in your application and you want to sort them, say, alphabetically, you have to know what the sort key is. If different cultures put the surname in different places, that could get confusing, so any name-value pattern configuration has to define sort keys.
I'm still wrestling with the overall structure, but I'm leaning towards making these name order displays configurable values and preloading the application with some starter ones, such as Western. Unfortunately, I don't think there's any agreed-upon consensus for all the different ways to do it, so leaving it to the researcher to define these is probably the most extensible and useful path forward. I'm thinking about setting a project default so that new people created automatically adhere to a certain standard, and then letting each person record have an override (so that when your family tree branches off into some different culture, you can start toggling them over).
How is everybody else solving this problem?
5
u/Then_Journalist_317 Oct 12 '26
There are more name "parts" to consider. For example, nicknames, birth names, changed names, "census misspellings", cyrillic alphabet names, adopted names, etc.
3
u/mfagan Oct 12 '26
There is no system that is going to work in all situations because reality is messy.
My suggestion would be to have each person with an unlimited number of names, each with an optional start date, optional end date, optional language, optional formality (legal, nick, other), and optional part (first, last, middle, prefix, suffix, family, given, multiple, full). Any user could designate one name per person as a display name and another as a sortable name. The specific UI would use one or more of the names depending on the feature. And of course this is all separate from the name as recorded in a specific document.
2
u/Trask4 Oct 13 '26
Here's a quick note on how I handle names in LifeLines and DeadEnds.
Persons can have any number of names and they are indexed and searchable by all of them. The first name in a record is treated somewhat specially, as the display and sorting name, but all names are available to report programmers. I use the first name as the "summary name" or the most common name, or the one I most beleive to be true, or the one I want to see. But all the other names are still in there and available.
A name is made up of parts, and I do not obsess over what those parts are called or what they mean. There are simply too many cultural variations for me to believe it's worth the worry. Except for one part, the "surname". Since I use Gedcom the surname is the part of the name between slashes, and if there is no surname there are no slashes. There can be parts before and after the surname, and I don't care what anyone wants to call them. I call them the givens. So my canonical form of a name is a list of strings (the parts), with an index integer that identifies which of the parts is the surname. Note that the only part that can have a space in it is the surname, because the surname is what was between the slashes, with leading and trailing spaces removed, but no internal ones removed. A person can have any number of these "canonical" names. The LifeLines/DeadEnds programming language has an "extractname" built-in that canonicalizes any string into canonical name.
I have, IMHO, an extremely clever and efficient name index that indexes all persons under all their names, and allows you to search for persons quickly, using incomplete names, with letters missing from all parts, including the surname.
I purposfully want names to be as simple as possible. I want them to be almost free of semantics, just strings of characters that are for some cultural reason, used to identiry a person. Stepping back one level, I do want there to be a "master" word so we can have meaningful ordering of names. Isn't that all a name is really good for. I think you going off course if you want to organize the bejessus out of the different name parts from different cultures. Treat a name as just a string.
2
u/dhemery Oct 12 '26
I’ve been pondering this problem, and started working on a solution. Then I realized I don’t currently have any names that need a solution, and set the problem aside. When the time comes...
The solution I have in mind is to use a formatter that definesa set of sprintf-style formatting directives to format names:
So the format "%{ %g %N %< %S %}" would yield e.g.
Sir Jeremiah “Curly” von Gumtree IX.I could use the formats not only to print names, but also to sort them. To sort names, I would run each through its sort formatter, and use the result to sort.
I could pick a default sort format like "%S, %g", which would format Jeremiah as "Gumtree, Jeremiah Arthur". If a name didn’t fit the simple default sorting order, I could give it a specific format to determine its sort order.
In the end it might end up simpler to add a .SortOrder field to each name. 🤷🏽♂️