[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.
The result is Import DNA Segments, a Gramplet for Gramps 6 that:
Reads DNA segment CSV files from MyHeritage (and FTDNA experimentally). You will need to add your shared segments file to the Media View in Gramps.
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
Optionally marks data as private
Note on MyHeritage support: tested with real Shared Segments files.
Note on FTDNA support: the FTDNA adapter was generated by AI and has not been tested with real data. Use with caution and please report any issues.
Note on AI assistance: parts of this code were developed with assistance from Claude Sonnet 4.6 (Anthropic), as disclosed in the source code headers.
Status: UNSTABLE — 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