Feature: Merge two datasets when importing
Why this change?
When importing, the user currently has two options - start from scratch ("delete all") or delete only the days from the database for which both files have entries. That means that even if day 1 in the import file only has a note entry, all previous information from day 1 would be lost. Especially since I'm currently working on making third-party data easier to import, it seems like a sensible option to allow for merging of the two datasets.
Description
When importing the user can choose between "Merge" or "Delete existing". The "Merge" option tries to incorporate both data sets into a unified one.
If only one dataset contains an entry for a specific day, this is obviously kept/copied.
In case of a conflict, we look at each symptom separately.
If only one of the datasets contains an entry for this symptom, this is copied.
If both datasets have an entry for the same day and the same symptom, the action depends on which symptom is concerned. Some are easily mergeable and some cannot reasonably be merged. For those where merging does not make sense, the imported value overwrites the existing value.
(e.g. Sex: if the existing data contains {condom: true} and the import data contains {pill:true}, we can simply combine these to {condom:true, pill:true}. For temperature, this does not make sense, neither does it for bleeding)
I have tested this MR:
-
tested this PR on iOS simulator/physical device, -
tested this PR on Android simulator/physical device, -
ran e2e tests.
I implemented this merge functionality that changes depending on the symptoms concerned to preserve the most of both datasets. I also changed the order of the "Import" buttons in iOS.
Steps to Test or Reproduce
Put some dummy data - hit export.
Change data in app - go to Import -> Merge -> Look at changes!
Reviewing
Here's what I am looking for feedback on in particular:
- Word choice regarding the description/ buttons. I think the "Delete existing"-option could be worded even stronger. Is "merging" the appropriate word for the functionality that I am introducing?
- Are there symptoms that should be merged in a different way?
In addition:
- Closes #688 (closed) (see screenshot regarding buttons there)
Merge request reports
Activity
added import-export label
mentioned in merge request !632 (closed)
Hey
🌞 thank you for this work!!I would love to merge your super cool and super quick fix on the import buttons order depending on the OS and would love to ask you to put this commit fe011ffe in a single MR. We could then release an update for iOS to ensure everybody is pressing buttons they want to press :)!
mentioned in merge request !646 (closed)
requested review from @bl00dymarie and @tintenfisch
92 92 "dialog": { 93 93 "cancel": "Cancel", 94 94 "delete": "Import and delete existing", 95 "message": "There are two options for the import:\n\n1. Keep existing cycle days and replace only the ones in the import file.\n\n2. Delete all existing cycle days and import cycle days from file", 96 "replace": "Import and replace", 95 "message": "There are two options for the import:\n\n1. Keep existing cycle days and try merging with cycle days from import file.\n\n2. Delete all existing cycle days and import cycle days from file", mentioned in issue #727