-
Notifications
You must be signed in to change notification settings - Fork 46
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
[Spike] Async execution of rules #1205
Comments
mahalakshme
changed the title
Handle Async fetch of related entities during Rule Evaluation in DEA
[DEA] Handle Async fetch of related entities during Rule Evaluation
Jun 13, 2024
This was referenced Jul 24, 2024
mahalakshme
changed the title
[DEA] Handle Async fetch of related entities during Rule Evaluation
[Spike] Async execution of rules
Dec 10, 2024
@petmongrels comment: not completed the web app part. but i think that should be easier can be done as part of story itself. it is the same concept |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
Motivation
Requirement 1:
For avoiding duplicate phone numbers beyond 5, the idea is to just add an API endpoint and call it from form element rule when user enters the mobile number
Requirement 2:
As part of Epic avniproject/avni-product#1507 and Story #1171, we encountered an issue while evaluating rules for Goonj organisation, for creation of Distribution.
We are linking Activities to a distribution, by doing a search and select of Subject. This is then used within FormElement rule to initialize certain fields. For this purpose, we make use of individualService.getSubjectByUUID() call in the rules.
(on distribution registration, activity's pariticipants will not get immediately populated after selecting an activity.)
RuleEvaluationService in webapp has a problem while fetching a different individual using its uuid.
The rule written for client, assumes that individualServiceFacade will always be able to fetch the individual in a synchronous manner, which works fine there as its connected to the realm DB. But on the web-app, we need to fetch the individual from the backendServer asynchronously as a remote call.
This results in 2 Major behaviourial changes:
Acceptance Criteria
Service Methods
individualService.getSubjectByUUID
individualService.getSubjectsInLocation
addressLevelService.findAddressLevelByUUID
Tech Approach
Needs more Technical evaluation.
Current solutions for each of the above problem:
In this scenario, we could run a string replace query on the rule content to replace all "individualService.getSubjectByUUID(" with "await individualService.getSubjectByUUID(" in webapp at runtime.
Also, we need to make the rule function async by prefixing the keyword "async" only in webapp.
For this, we would prefer to only make the RuleEvaluation related entities data init, update and rule execution to be encapsulated within the FormWizard and run in Asynchronous manner, while rest of the Webapp working as is in a synchronous manner.
Additional Information
The list of impacted Orgs and Elements with rules that need asynchronous api calls is as per below attached file.
InstancesOfRuleInDB.txt
AC:
Figure out the below:
The text was updated successfully, but these errors were encountered: