Skip to content
Snippets Groups Projects

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:

Merge request reports

Loading
Loading

Activity

Filter activity
  • Approvals
  • Assignees & reviewers
  • Comments (from bots)
  • Comments (from users)
  • Commits & branches
  • Edits
  • Labels
  • Lock status
  • Mentions
  • Merge request status
  • Tracking
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",
  • I found a bug:

    • Track a bleeding which marks a first cycle day, e.g. on "Today"
    • Import data that includes a bleeding value that is exlcuded also for "Today" aka the same day

    Screenshot_1712750169 Screenshot_1712750425

  • We would love to implement this feature, however this bug needs to be fixed. I think this could help to recalculate correct cycle starts: maybeSetNewCycleStart!

  • d2weber mentioned in issue #727

    mentioned in issue #727

  • Please register or sign in to reply
    Loading