Jump to content
TNG Community
Bill Herndon

Soliciting Suggestions for a Bulk Import Mod With Auto-linking

Recommended Posts

Bill Herndon

Recently on the TNG Users list a member asked if there was any way to automatically link media items to TNG records (individuals in this case) using the filename.  He had gotten into a situation where most of his media had become unlinked and he didn't want to have to re-import, and then manually link, all the items again (there were hundreds or thousands).

Having built a personal mod to do this for sources a few years back (I have thousands and most have images or PDFs), I decided to see if there was a way to leverage my mod in a more general way.

There are two problems that my mod solves:

  1. Going back to at least TNG 11 there's a bug (a feature?) in the media import code that prevents TNG from looking for files more than one level down in a media collection.  So if you are importing from the 'documents' folder, a sub-folder 'documents/sources' would be scanned, but 'documents/sources/census' would not.  My mod solves this by replacing the existing code with recursive code that can search the folder structure to an arbitrary depth.
  2. In order to link media with TNG records there needs to be a system to uniquely identify the records.  In my case, each source record in TNG has a unique custom event, a tag that also happens to be the filename for the document that contains the image, PDF, or text of the source.  So the source custom event with a value of 'Holbrook-1805a' links up to a document like 'documents/sources/marriages/Atwood/Polly/Holbrook-1805a.jpg'. 

Fortunately, although TNG doesn't traverse a hierarchy of folders correctly, it has no problem storing and processing media filenames of arbitrary length.  So the real work for such a mod would be to come up with the features that the mod would support.  I can think of a few variants:

  • Link media to individuals using the full name of the individual.  So Herndon, William Robert (me) would correspond to a file HerndonWilliamRobert.[jpg|png|pdf] in one of the media collections.  And since names would have to be unique, incorporation of prefixes and suffixes might be necessary.
  • Link media to families with some similar naming system.
  • Sources using the tagging system (I need to preserve the functionality that I depend on  :- )  )
  • Individuals or families using a tagging system.  This would mostly be for individuals, like me, who have already developed a way of augmenting their individual or family records with a tag that can be used to do the linking.

Are there other items that TNG users would like to link?  Other systems of associating filenames with TNG records that people can think of.  If I can get a decent list of features I should be able to develop and publish this mod pretty quickly.


Bill Herndon

Lindell-Herndon Genealogy

Share this post

Link to post
Share on other sites

If only every time I looked in the forums for a solution to a minor problem I would stumble across someone offering to solve a much bigger problem for me. . . .

I don't necessarily have specific feature requests, but two observations that you could interpret that way.

1) Everyone has their own filing system.  I have at least three:  some false starts, the one I settled on, and a big one I inherited.  They are all wide, whereas yours is deep.  I don't have a nested file structure; I have long file names, like SurnameGiven_yyyymmdd__Place_Event.  Other people have something else that starts with a place or a date.  If you can't generally handle those and the deep (nested) variants, you'll spend the rest of your life responding to or ignoring pleas to accommodate someone's weird filing system.

2) I might be wrong, but it seems like trying to get all the way to a definite match of media to individual is a problem you don't need to solve.  First you have to decide what's a surname vs a place, given 1), and then it will still be hard to guarantee a unique result.  If you had a mod that guessed right 90% of the time and gave options to choose which John Robert Smith of London I wanted to link to for the other 10%, that seems easier but still incredibly useful.


Share this post

Link to post
Share on other sites

Create an account or sign in to comment

You need to be a member in order to leave a comment

Create an account

Sign up for a new account in our community. It's easy!

Register a new account

Sign in

Already have an account? Sign in here.

Sign In Now