Data_record contact lineage

Hi community,
CHT data_records have à contact json key with the lineage of the contact of this data_record.
For example if I have an offline user, a CHW, that triggers a form in a patient, in the device the CHW has the lineage, A->B->C->D but in the server the contact has been moved to A->E->F->G,

what will happen when the CHW syncs the data_record ?
the sent data_record will be modified to set contact _id lineage to the current one in couchDB (A->E->F->G) or the data record won’t be modified and so contact will have the old lineage A->B->C->D ?

thank you

1 Like

Hi @mrjones, do you have any suggestions?

Thanks for pinging me @niraj! Let me look into it and get back to you both.

1 Like

@bamatic - can you confirm some specifics please:

  • is the contact that is moved the patient or CHW contact?
  • can you confirm this is the order of events?
    • CHW syncs and gets A->B->C->D
    • CHW goes offline and submits a report which is saved only to pouch
    • Contact is moved to A->E->F->G on the server
    • CHW syncs pouch → couch
  • How is the contact moved? Via the CHT web front end or in a CouchDB API call?

thanks!

Hi @bamatic

The contact property in a data_record is the submitter of the report, the CHW or the supervisor that filled the form.
When a contact is moved, using the cht-conf move-contacts action, the contact property of every report submitted by the moved user will be updated to contain the changed lineage. This is, of course, only limited to the data_records that exist on the server at the time of the move-contacts command.
If there are unsynced reports created by these contacts, their lineage will not be changed when they are uploaded, you could call these reports “orphaned”.

1 Like