Open uladkasach opened 7 years ago
Currently,
Each Relationship is a single row in the database with both Person A's and Person B's side relationship share type is stored. This helps in having a single relationship between two people that can control what they share and either can remove the relationship and either should share something with each other. The record would look something similar to -
Person A - Person B - Person A shares X - Person B shares Y
Person A - Person C - Person A shares X - Person C Shares X
Person B - Person C - Person B Shares X - Person C Shares X
Shares X = Shares Posts and Medical
Shares Y = Shares Medical
Shares Z = Shares Posts
This was created as earlier everyone had the ability to create a new post on the wall. Now only the patients have the ability to create new posts. So this model only makes sense for patient to patient model and is not relevant for Patient-Caretaker and Patient-Doctor.
After discussing with @bmamlin going forward the following model makes more sense for multi-select relationships that can accommodate more share types going forward.
There will be different share types - Share Posts, Share Medical, Share Healthy Behavior For each share type granted by Person A to Person B there will be a relationship record. The above example would translate to -
Person A - Person B - Shares Posts
Person A - Person B - Shares Medical
Person B - Person A - Shares Medical
Person A - Person C - Shares Posts
Person A - Person C - Shares Medical
Person C - Person A - Shares Posts
Person C - Person A - Shares Medical
Person C - Person B - Shares Posts
Person C - Person B - Shares Medical
Person B - Person C - Shares Posts
Person B - Person C - Shares Medical
So when a relationship is removed - we need to find and retire all the records in the database that correspond to both the persons.
@maurya is this ticket ready to be closed?
also ensure that thopse prvledges translate to health behavior buddies.
https://github.com/personalcancertoolkit/openmrs-module-healthybehaviors/issues/65