No limits on identical Relationships - design or accident?

Hi,

The “https://idsr.dev.hisp.org/api/relationships/” resource when used with POST do not verify if the posted relationship(s) already exist or not. Or in other words, it you run any POST command repeatedly, it will keep on creating multiple identical relationships.

The relationship/item/type collection of tables also do not provide any constraints that will block such multiples (obviously), which is understandable given the structure of those tables.

Is this by design, or is it a design flaw?

(Multiple identical relationships, like

  • Bianca is the mother of Lesego
  • Bianca is the mother of Lesego
  • Bianca is the mother of Lesego
    does not make sense to me, conceptually - and I cannot see any usage scenario where creating such identical relationship would fulfil some purpose.)

Regards
Calle

1 Like

@Stian

I understand you are the “prime” core team member when it comes to relationships - can you cast any light on whether this is by design, or a bug/flaw?

If a bug, I’ll write a jira issue for it.

calle

1 Like

Hey @Calle_Hedberg
We havent documented/designed this and there is no specific reason why the endpoint behaves as it does today. We agree with your point that there is probably no use case for several identical links between two TEIs or entities - and for the new tracker importer being developed now, we want to make sure only one relationship exists for one relationship type between the same from and to objects:
https://jira.dhis2.org/browse/DHIS2-8140

Please weigh in on the issue with your use case and how it affected you(why this was a problem in your setting)

1 Like

@Markus

I thought that might be the case, and note that I had opened a JIRA issue already (8137) so I guess they are duplicated now.
Will add some use case info, although I guess it does not matter much - duplicated relationships make no sense from any perspective I can fathom.

New tracker importer: I was not aware that this was being worked on, beyond the Tracker Import Wizard beta from Hisp-UG. What is the timeline for this?

Unless it is imminent (2.34), I would suggest that the current end-point behaviour is modified to abort the POST if an identical relationship already exist.

Regards
Calle

1 Like