Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Need params.entityContext available in old style rule #1234

Closed
nupoorkhandelwal opened this issue Dec 19, 2023 · 7 comments
Closed

Need params.entityContext available in old style rule #1234

nupoorkhandelwal opened this issue Dec 19, 2023 · 7 comments
Assignees

Comments

@nupoorkhandelwal
Copy link
Collaborator

nupoorkhandelwal commented Dec 19, 2023

Currently, in one of the old rule implementation we need to access the Household's observations ie. Group information during the registration of a member registration, in order to achieve this we need to access entityContext in the rule.

Background context:

entityContext was introduced an year ago to make groups of individual available in rules. Looks like it is not available/accessible for old rules.

@nupoorkhandelwal nupoorkhandelwal moved this to New Issues in Avni Product Dec 19, 2023
@mahalakshme mahalakshme moved this from New Issues to In Analysis Review in Avni Product Dec 19, 2023
@vinayvenu vinayvenu moved this from In Analysis Review to Analysis Complete in Avni Product Dec 19, 2023
@mahalakshme mahalakshme moved this from Analysis Complete to Ready in Avni Product Dec 19, 2023
@petmongrels
Copy link
Contributor

@nupoorkhandelwal
instead of entityContext have you tried using individual.groupSubjects[x].groupSubject.observations or individual.groupSubjects[x].memberSubject.observations?

@mahalakshme

@himeshr
Copy link
Contributor

himeshr commented Dec 22, 2023

@nupoorkhandelwal instead of entityContext have you tried using individual.groupSubjects[x].groupSubject.observations or individual.groupSubjects[x].memberSubject.observations?

@mahalakshme

@petmongrels
This will only work after the individual is saved, so during updates. But for creates, individual.groupSubjects[x]wont have the link as the individual hasn't been persisted to realm. I.e why, we need to use entityContext, which has the groupSubject available for Create as well as update scenarios.

@mahalakshme mahalakshme moved this from Ready to In Progress in Avni Product Dec 22, 2023
@petmongrels petmongrels moved this from In Progress to Code Review Ready in Avni Product Dec 22, 2023
@1t5j0y 1t5j0y moved this from Code Review Ready to In Code Review in Avni Product Dec 26, 2023
@1t5j0y 1t5j0y moved this from In Code Review to QA Ready in Avni Product Dec 26, 2023
@vinayvenu vinayvenu moved this from QA Ready to In QA in Avni Product Dec 28, 2023
@vinayvenu
Copy link
Member

EntityContext not available when adding a member to a group.

https://github.com/avniproject/ihmp/blob/master/registration/rules/registrationHandler.js#L29

Change method to

    @WithStatusBuilder
    maritalStatus([entity, ruleTypeValue, context, config, entityContext], statusBuilder){
        console.log('Checking status of entityContext')
        console.log('entityContext', _.keys(entityContext));
        console.log('Still waiting for the entity context to come in')
        statusBuilder.skipAnswers('Remarried', 'Other');
    }

make deploy-staging-rules

Use ihmp on staging, go to a group and try to add an member. Variable is empty

@vinayvenu vinayvenu moved this from In QA to QA Failed in Avni Product Dec 28, 2023
@petmongrels petmongrels moved this from QA Failed to In Progress in Avni Product Dec 28, 2023
@petmongrels
Copy link
Contributor

  • added one commit
  • but in rule to get the params, exec method of the class in the rule has to be changed

@petmongrels petmongrels moved this from In Progress to Code Review Ready in Avni Product Dec 28, 2023
@vinayvenu vinayvenu moved this from Code Review Ready to In Code Review in Avni Product Jan 9, 2024
@vinayvenu vinayvenu moved this from In Code Review to QA Ready in Avni Product Jan 9, 2024
@vinayvenu vinayvenu moved this from QA Ready to In QA in Avni Product Jan 11, 2024
@vinayvenu vinayvenu moved this from In QA to QA Ready in Avni Product Jan 11, 2024
@vinayvenu vinayvenu moved this from QA Ready to In QA in Avni Product Jan 11, 2024
@mahalakshme
Copy link
Contributor

mahalakshme commented Jan 15, 2024

@petmongrels we need not do this until implementation team gets back after trying with new rules. We can discuss in standup what to do with the code change

@mahalakshme mahalakshme moved this from In QA to Done in Avni Product Jan 15, 2024
@mahalakshme mahalakshme moved this from Done to In QA in Avni Product Jan 15, 2024
@mahalakshme
Copy link
Contributor

@vinayvenu you mentioned you will check something on this. continuing to release since not a blocker

@AchalaBelokar AchalaBelokar moved this from In QA to QA Ready in Avni Product Jan 23, 2024
@mahalakshme mahalakshme moved this from QA Ready to Done in Avni Product Jan 24, 2024
@mahalakshme
Copy link
Contributor

since this is complex to implement, we decided to write via new rules when such a usecase comes up

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
Archived in project
Development

No branches or pull requests

5 participants