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

Edit Rule #1273

Closed
Tracked by #1465
mahalakshme opened this issue Jan 10, 2024 · 11 comments
Closed
Tracked by #1465

Edit Rule #1273

mahalakshme opened this issue Jan 10, 2024 · 11 comments
Assignees
Labels

Comments

@mahalakshme
Copy link
Contributor

mahalakshme commented Jan 10, 2024

Need:

  • Frequently usecase appears where beyond a point, say after collected data is audited, org dont want the users to anymore edit the observations

Acceptance criteria:

  • Have a Edit rule above Decision rule at form level.
  • Shape of params object:
{
  entity: {}, //it could be one of Individual, ProgramEncounter, ProgramEnrolment, Encounter and ChecklistItem depending on what type of form is this rule attached to
  form: {}, //form to which the rule is attached to, it should ve form name and uuid, others are not necessarily needed, just pass whatever is available
  services,
  entityContext,
  userGroups // details from MyGroups from realmdb
}
  • Output: by default allow edit.
{
      editable : {
       value: true/false
       message: 'custom message'
     } 
}
  • Default sample rule:
//SAMPLE RULE EXAMPLE
  "use strict";
({params, imports}) => {
    const individual = params.entity;
    // refer <readme link> to know more
    return {
       editable: {
          value: true
        }
   }
};
  • On click on Edit button when the rule returns false, show the translation of the message returned by the rule as a toast message in the bottom. If translation not available should show the message returned by rule itself
  • Applicable for allowing/disallowing edit of registeration/encounter/program encounter/enrolment
  • Scope of this card is to add the rule in app designer and restrict in android app
  • Restriction can be based on value on the entity or independent.
  • Case to add to make sure it works: After 90 days of entering the details(enrolmentDateTime for program enrolment, encounterDateTime for encounter/program encounters, createdDateTime for registeration), for AP Teach users belonging to Users group should not be able to anymore edit.

One of the test cases:

Disable edit of subject, encounter, and enrolment after 24 hours of encounterDateTime in TeachAP app.

@mahalakshme mahalakshme converted this from a draft issue Jan 10, 2024
@mahalakshme mahalakshme changed the title Time based edit of observations Edit Eligibility Rule Feb 1, 2024
@mahalakshme mahalakshme moved this from In Analysis to In Analysis Review in Avni Product Feb 1, 2024
@vinayvenu vinayvenu changed the title Edit Eligibility Rule Allow Edit Rule Feb 2, 2024
@vinayvenu vinayvenu changed the title Allow Edit Rule Edit Hook Feb 2, 2024
@vinayvenu vinayvenu changed the title Edit Hook Edit Rule Feb 2, 2024
@mahalakshme
Copy link
Contributor Author

@vinayvenu final review this also

@mahalakshme mahalakshme moved this from In Analysis Review to Ready in Avni Product Feb 6, 2024
@petmongrels petmongrels moved this from Ready to In Progress in Avni Product Feb 7, 2024
@petmongrels petmongrels self-assigned this Feb 7, 2024
@petmongrels
Copy link
Contributor

Not Implemented

  • as a server side rule
  • declarative rule

petmongrels added a commit to avniproject/avni-server that referenced this issue Feb 8, 2024
petmongrels added a commit to avniproject/avni-webapp that referenced this issue Feb 8, 2024
petmongrels added a commit to avniproject/rules-config that referenced this issue Feb 13, 2024
petmongrels added a commit to avniproject/avni-models that referenced this issue Feb 13, 2024
@petmongrels
Copy link
Contributor

petmongrels commented Feb 22, 2024

Scope:

Different places where from edit form can be launched

  1. Registration
  2. Enrolment
  3. Enrolment Exit
  4. Program Encounter
  5. Program Encounter Cancel
  6. General Encounter
  7. General Encounter Cancel
  8. Group Subject Registration
  9. Form Element Group Edit
  10. Checklist Item

Out of scope

  1. Location (as it is not transaction data)
  2. Task (there is no edit screen for it)
  3. BeneficiaryIdentification (not clear what this is for)
  4. SubjectEnrolmentEligibility
  5. ManualProgramEnrolmentEligibility
  6. Encounter Drafts (Should always be editable)
  7. Scheduled Encounters (Should always be doable)

Additional Acceptance Criteria

  • Rule Failure Telemetry Failure should be saved correctly.

For testing - Valid Disallow Rule

"use strict"; ({params, imports}) => { const {entity, form, services, entityContext, myUserGroups, userInfo} = params; const output = { editable: { value: false, messageKey: "foo" } }; return output; };

For testing - Valid Allow Rule

"use strict"; ({params, imports}) => { const {entity, form, services, entityContext, myUserGroups, userInfo} = params; const output = { editable: { value: true } }; return output; };

For testing - Invalid Rule (should create rule failure telemetry record in the database

"use strict"; ({params, imports}) => { undefined.foo(); };

petmongrels added a commit to avniproject/avni-server that referenced this issue Feb 23, 2024
petmongrels added a commit that referenced this issue Feb 27, 2024
… element group edit for program encounter and general encounter.
@petmongrels
Copy link
Contributor

Screen.Recording.2024-02-27.at.3.31.23.PM.mov
Screen.Recording.2024-02-27.at.3.32.06.PM.mov

@petmongrels petmongrels moved this from In Progress to Code Review Ready in Avni Product Feb 27, 2024
himeshr added a commit that referenced this issue Feb 28, 2024
… "Draft/Scheduled" encounters "Do" button.
@petmongrels
Copy link
Contributor

petmongrels commented Mar 6, 2024 via email

@AchalaBelokar AchalaBelokar moved this from QA Ready to In QA in Avni Product Mar 14, 2024
@AchalaBelokar
Copy link

AchalaBelokar commented Mar 14, 2024

  • [] I tried edit registration decision rule maha@calcutta_kids in the registration edit form rule I write this

  • ({params, imports}) => {
    const {entity, form, services, entityContext, myUserGroups, userInfo} = params;
    const output = {
    editable: {
    value: false,
    messagekey: "Not editable"
    }
    }; // https://avni.readme.io/docs/writing-rules#16-edit-form-rule
    return output;
    };
    still I am able to edit the registration .

  • Same happen with encounter type

@AchalaBelokar AchalaBelokar moved this from In QA to QA Failed in Avni Product Mar 14, 2024
@petmongrels petmongrels moved this from QA Failed to In Progress in Avni Product Mar 14, 2024
petmongrels added a commit to avniproject/avni-models that referenced this issue Mar 14, 2024
petmongrels added a commit that referenced this issue Mar 14, 2024
@petmongrels
Copy link
Contributor

  • missing models commit fixed
  • take new build and reinstall app or modify rule once
  • the messagekey should be messageKey

@petmongrels petmongrels moved this from In Progress to Code Review Ready in Avni Product Mar 14, 2024
@petmongrels petmongrels moved this from Code Review Ready to QA Ready in Avni Product Mar 14, 2024
@AchalaBelokar AchalaBelokar moved this from QA Ready to In QA in Avni Product Mar 15, 2024
@AchalaBelokar
Copy link

AchalaBelokar commented Mar 15, 2024

  • Created individual and tried to edit with edit decision rule true /false
  • Tried with edit program enrolment with edit decision rule true/false
  • Tried with edit Enrolment exit with edit decision rule true/false
  • Tried with edit Program encounter with edit decision rule true/ false
  • Tried with edit cancel encounter with edit decision rule true/ false
  • Tried with edit general encounter with edit decision rule true/ false
  • Tried with Group Subject Registration with edit decision rule true/ false
  • Form Element Group Edit with edit decision rule true/false

@AchalaBelokar AchalaBelokar moved this from In QA to Test cases review in Avni Product Mar 18, 2024
@mahalakshme
Copy link
Contributor Author

@AchalaBelokar its not decision rule, its edit form rule

  • Did you check if translation of message is displaying, it translation uploaded?
  • How does it work with form element group - where should be the rule? on form element group or on form will suffice? What do you think is the expected thing?
  • Checklist Item form tested? Asking since its not mentioned in the test cases.

@mahalakshme mahalakshme moved this from Test cases review to Test cases review with comments in Avni Product Mar 26, 2024
@AchalaBelokar AchalaBelokar moved this from Test cases review with comments to In QA in Avni Product Apr 5, 2024
@AchalaBelokar AchalaBelokar moved this from In QA to Test cases review with comments in Avni Product Apr 8, 2024
@mahalakshme mahalakshme moved this from Test cases review with comments to In QA in Avni Product Apr 8, 2024
@AchalaBelokar AchalaBelokar moved this from In QA to QA Ready in Avni Product Apr 12, 2024
@AchalaBelokar AchalaBelokar moved this from QA Ready to In QA in Avni Product Apr 15, 2024
@AchalaBelokar AchalaBelokar moved this from In QA to QA Ready in Avni Product Apr 15, 2024
@AchalaBelokar AchalaBelokar moved this from QA Ready to Done in Avni Product Apr 15, 2024
@AchalaBelokar AchalaBelokar moved this from Done to In QA in Avni Product Apr 15, 2024
@AchalaBelokar AchalaBelokar moved this from In QA to QA Ready in Avni Product Apr 15, 2024
@AchalaBelokar AchalaBelokar moved this from QA Ready to In QA in Avni Product Apr 16, 2024
@AchalaBelokar AchalaBelokar moved this from In QA to QA Ready in Avni Product Apr 16, 2024
@AchalaBelokar AchalaBelokar moved this from QA Ready to In QA in Avni Product Apr 23, 2024
@AchalaBelokar
Copy link

AchalaBelokar commented Apr 24, 2024

Checklist item is out of scope.

@AchalaBelokar AchalaBelokar moved this from In QA to Done in Avni Product Apr 25, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
Archived in project
Development

No branches or pull requests

5 participants