Implement cardinality in application building

Hi @Norman_Hooper,

In database basics, we learn about cardinality. How can we implement the following types of relationships in commcare when building application not as a developer because I am a non-programmer who is learning to build application in commcare hq

  • One-to-one relationships

  • One-to-many or many-to-one relationships (e.g. 1-to-2; 1-to-5; 1-to-∞)

  • Many-to-many relationships: multiple records in a table are associated with

multiple records in another table

Thanks in advance

Hi @hernandezmachava

Relationships in CommCare are achieved using Child Cases. This is an advanced feature in CommCare.

If your CommCare app limits the number of child cases to one, then you have a one-to-one relationship. Otherwise you have a one-to-many / many-to-one relationship. And if one case type has two one-to-many relationships, then it effectively functions as a link in a many-to-many relationship.

You can find more about Child Cases here: https://dimagi.atlassian.net/wiki/spaces/commcarepublic/pages/2143956726/Child+Cases

Thanks,

Norman

Hi @Norman_Hooper,

I have opened the link read the contents, but it seems very technical for me.
I want to register Households, which have the following attributes: Household ID
GPS Coordinates, I also want to register household members as beneficiaries. So, the scenario will be as follows:

Entity: Household
Attributes:
Household ID
GPS Coordinates

Household members
-Member 1: Name, DOB, etc
-Member 2: Name, DOB, etc

So here I have a parent (household) and child(beneficiary) relationship. would creating two modules with the same case type (household) be the correct configuration? As for registering a beneficiary, I must first select a household.

Thanks