[New Addon] Import DNA Segments — import MyHeritage CSV and create DNA Associations
Good morning.
Recently I had a series of DNA matches on MyHeritage with people already in my family tree. This made me realize how slow it would be to manually import each of these matches and make them compatible with the DNA Segment Map gramplet.
This gave me the idea of creating a plugin to automate the import.
What is ImportDNASegments?
The result is Import DNA Segments, a Gramplet for Gramps 6 that:
Reads DNA segment CSV files from MyHeritage (tested with my own files) and FTDNA (experimental).
Shows a preview of the data before importing
Searches for matching persons in the tree with fuzzy name matching
Creates a Note associated with the CSV file in Media View and bidirectional DNA Associations compatible with DNA Segment Map addon
Optionally marks data as private
How to use
Go to Media View and add your shared segments CSV files.
Make active one of your imported CSV files.
Add ImportDNASegments to the right lateral panel.
Review the data and select:
The kit person (the owner of the DNA test).
The match person (the DNA match from your tree).
Select a Source (the addon will remember it for next time).
Mark as private if desired. If not, the addon will ask for confirmation before importing.
Click Import. The addon will create:
A Citation (linked to the selected Source).
A Note with the segment data.
Bidirectional DNA Associations between the two persons.
Notes
MyHeritage support: Tested with real Shared Segments files.
FTDNA support: The adapter was generated by AI and has not been tested with real data. Use with caution and report any issues.
AI assistance: Parts of this code were developed with assistance from Claude Sonnet 4.6 (Anthropic) and others, as disclosed in the source code headers.
Installation
Status: EXPERIMENTAL — first public release, feedback very welcome.
@GaryGriffin
Will the upcoming DNA Data Model features for 6.2 (6.1?) mean the DNA Segment Map data will need to be migrated from Associations records to somewhere else?
Does @ommrianxo need to expand ImportDNASegments in any way for that to prepare for smoother data migrations?
@ommrianxo
Do you think that your tool might be able to be build a Source for the Import File? Where the import file itself is set as a Media Object and the Source has the Provenance metadata.
Then add Citations with a UUID (Kit# ?) to that Source as a Volume/Page value for each imported?
With that cross-reference, data tools could be modified to dig through previous import files to update the DNA data model record as previously ignored content in Kit Data becomes recognizable. (Rather than importing again with a new version of the tool and then figuring out which DNA records have been obsoleted.
Don’t know why you would need an plugin
Download .csv from MyHeritage (1 click)
Copy Data (CTRL +C)
Paste Data (CTRL+V) into an open (1 Click) existing Spreadsheet which
Concatenates the Data appropriately.
Copy and Paste the Concatenated Data Column into the Note.
I do not know when the DNA Data Model would be released.
Once it is released, then I will release an update of DNA Segment Map to use either the Associations data or the new model. I have a version of each now working, and am waiting for the DNA Model to be finalized.
I posted a quick and dirty converter from Association data to the DNA model. Once the model is finalized, it can be released too.
@emyoulation I am working with Shared Segments MyHeritage files, and they have not any uuid at this moment. So I can not use UUID to identify it.
Shared Segments are suposed that it will not be changed early, so i simply compare text from existant notes with new text (version 0.1.1)
In version 0.1.0, ImportDNASegments simply imports data without any validation.
About gramps 6.2 and any change about DNA Data Model. I did not know about that now.
About building a Source for the import file — it is an interesting idea that I had not considered. I will look into adding Source and Citation support in a future version. For now, the Media object itself serves as the reference to the original file.
DNA Match to John Smith (1854) on (Maternal Side)
DNA cM 41
DNA Segments 3
DNA Relationship 3rd cousin
DNA Largest Segment 2 (MyHeritage only)
DNA Common Ancestor (Male) Alfred Jones 1780
DNA Common Ancestor (Female) Winifred Taylor 1776
DNA Pseudonym User name on website
DNA Source Ancestry or MyHeritage or GEDMATCH
DNA GEDMATCH No xyx1234
I have these as blanks on the Collections Clipboard
As more than 90% of my matches are on Ancestry the usage of DNA Segment
Mapping is very limited with no visible sign of this changing any time soon
phil
I would like to share how ImportDNASegments version 0.1.1 works internally, to get feedback on whether this structure makes sense in Gramps terms.
Workflow:
The user adds the CSV file to the Media view and selects it. The Gramplet reads it and shows a preview: kit name, provider, match name, number of segments, total cM, percentage, longest segment, and chromosomes. A checkbox allows showing the fields that will not be imported (RSIDs), as they are not compatible with DNA Segment Map.
The user selects or creates the two persons in the family tree: the kit owner and the match.
The user selects or creates a Source for the Citation (stored in Gramps config by provider, so it is reused in future imports).
The user can edit the Citation data: current date and CSV filename are filled in by default.
Privacy is offered as an option. Since DNA data is sensitive, when the user clicks Import without marking it as private, the plugin asks for confirmation before proceeding.
On import, the plugin creates the following objects in a single DbTxn:
A Note with the segment data in DNA Segment Map format
A Citation referencing the selected Source, with (real) date and (file name)page
Associate Note and Citation with the Media object
Two reciprocal DNA Associations (PersonRef) between the two persons, each with the Note (for DNA Segment Map) and the Citation (for source tracking)
My question: should the Note also be added in another place inside the Citation, or is it enough to have it directly on the PersonRef?
Thinking about it, since Gramps plans to add native DNA support in a future version, I am inclined to keep the structure as simple as possible. The simpler the data model, the easier it will be to migrate later. So I am leaning towards keeping the Note directly on the PersonRef and Media, and the Citation separately on the PersonRef — without nesting the Note inside the Citation.
Any thoughts on this approach?
TODO:
Follow Gramps standard GUI for person selection buttons (kit and match) and use the Person Editor
Use Gramps standard date widget instead of a free text field
ImportDNASegments is in early development — consider it a concept test. I only tested it on Debian Linux with the Gramps example tree. I have not tested it on Windows at all, so issues on Win 64 are not unexpected at this stage.
The information emyoulation requested (terminal output, exact failure point) would be very helpful to understand what is going wrong.
The Gramps application is not in the command path for MS Windows. So you need to change directories (cd) to the Gramps application folder for gramps to be a recognized command for starting the application. Unfortunately, that path is a bit buried in shortcuts when you’re looking for it from the Windows GUI.
See the section of the wiki about starting Gramps from the Command Line:
Ah. That helps. The bug is in the Addon Manager’s fallback listing system. The locale selection might work differently when served from a Repository not hosted on GitHub.
@ommrianxo
Could you duplicate the English specific listing (https://codeberg.org/ommrianxo/gramps-addons/src/branch/main/addons/gramps60/listings/addons-en.json) to a generic “no language” listing (https://codeberg.org/ommrianxo/gramps-addons/src/branch/main/addons/gramps60/listings/addons.json) to see that makes the fallback work?
Ok. @woody you have a different problem than anything ommrianxo might be doing.
Your Gramps is not connecting to any 3rd party “project”. So it seems likely that your project paths are setup incorrectly or your firewall is prohibiting contact.
@Woody, please post a screenshot (stretch the dialog so the full URL shows) of how the project editors are set for:
I’ve added some ‘validation’ features to the editor in my New Project dialog. The only thing it suggested was a trailing slash for the URL @ommrianxo provided earlier in this thread.