Do Importers have fallbacks?

While looking at the Importer built-ins and add-ons, I wondered how Gramps selected which importer to use for a particular file? Is it by File extension?

The vCard add-on only support v3.0 but every .vcf I have exported from a modern smart phone has been 2.1 version. Tweaking the version inside the .vcf to 3.0 imports part of the data. But what if someone writes a real 2.1 importer? Would the built-in importer keep it from working? And since there is now a 4.0 vCard, how could that importer be added?

GEDCOM is the same issue. The 5.5 and 5.5.1 and 7.0 all use the .ged extension.

The importer is selected by file extension. The version is read by the importer which will be in a format specified by the file format.

For example, in VCard format:


and in Gedcom format:

2 VERS 7.0.1

I suggest enhancing the existing code rather than writing a new importer.

The existing Gedcom importer will try to import any version together with custom tags the best it can. For Gedcom 7.0 we may decide to use a new parser, but some common code will be needed to detect the version.

Perhaps another Importer Wizard shell could be a add-on Tool? Where users could select alternative Importer plug-ins and/or option?

For example, it is sometime more convenient to import just the .gramps file’s Tree data from a .gpkg archive without the media objects. Or somtimes just the Sources & Repositories… or just the Places.

If that’s posdible, the standard basic Import GUI could remain streamlined and intuitive. But an advanced option could be installed without waiting for a major revision.

One can also write an “importer” as a Tool instead of an actual import plugin.

For example, I needed to import sources from a csv file. The builtin csv import does not support sources so I wrote a small tool to do that:

1 Like

This is a nice expansion. (Although it doesn’t solve the lack of Headers for Citation record creation and the Objects having SourceID instead of CitationID.)

Do you think that this Source field parsing code could be rolled into the built-in importer fairly easily?

After setting the delimiter configuration from comma to tab (in the CSVdialect option that Serge added to the parser), it becomes seamless to use the OS clipboard to copy from a spreadsheet and pipe the data into the Import Text gramplet.

To import a series of Sources would no longer require the tedious saving and then File Choosing of external files. You would just copy the cells (with Headers) in the spreadsheet, past into the Import Text gramplet and press the Import button.

Bulk entry is fairly familiar to spreadsheet users. Gramps would just need to distribute a spreadsheet workbook with the basic keywords headers laid out. And maybe have some example data.