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

(feat) O3-3230: add rule builder to form builder #279

Open
wants to merge 138 commits into
base: main
Choose a base branch
from

Conversation

senthil-athiban
Copy link
Contributor

@senthil-athiban senthil-athiban commented May 25, 2024

Requirements

  • This PR has a title that briefly describes the work done including the ticket number. If there is a ticket, make sure your PR title includes a conventional commit label. See existing PR titles for inspiration.
  • My work conforms to the OpenMRS 3.0 Styleguide and design documentation.
  • My work includes tests or is validated by existing tests.

Summary

  • This PR integrates rule builder component into form builder, which provides an user-interface rule builder to build conditional logic for the forms in the form builder.
  • This feature is included in the feature flag

Features Included:

  • Added toggle functionality to make a form field as required or not.
  • Added toggle functionality to allow future dates in the date form field.
  • Added toggle functionality to disallow decimal values in numeric form field.
  • Added toggle functionality to enable historical expression for a form field.
  • Ability to add multiple conditional logics for the same question field
  • Ability to add multiple conditions and actions for each conditional logic
  • Ability to edit and delete the conditions and actions
  • Storing the rules in global state for retrieving and updating the fields dynamically
  • Added hideWhenExpression logic to render the form field conditionally
  • Added failsWhenExpression logic with custom error-message, which allow user to define a validation logic in the form field, and throws an custom error-message when condition fails
  • Added disableWhenExpression, which gives ability to disable the form field, if the conditions are not satisfied
  • Added calculateExpression logic, which will perform calculation ( BSA, BMI, EDD, HeightForAgeZscore ) in the form field without require manual effort and minimize the calculation error.
  • Added date validation ( isDateBefore, isDateAfter ), which will compare the base date with target date, and throws an error if the conditions are failed.
  • Introduced a custom ComboBox component, which allow users to search answers from the list items as well as to enter a custom value if the answers are not found in the list items
  • Added unit test cases for rule builder and rule header.
  • Added E2E test for rule-builder and rule-header.
  • Developed a documentation, which contains guides, and tutorials about the validation-rule builder for the form users.

Screen Recorder

https://www.loom.com/share/c892130d32684f739f9b0c7759c033f1?sid=6c9a1da5-7f95-4e33-82de-b37d679080cc

Demo depicts the ability to add multiple rules for same question field dynamically

https://www.loom.com/share/cef02c0d362c4d3f92bc846527329656?sid=d5156068-8bc6-4cf5-b48a-ab3c5e1cc690

Related Issue

O3-3230
O3-3231
O3-3232
O3-3233
O3-3234
O3-3235
O3-3236
O3-3237
O3-3238
O3-3413
O3-3422
O3-3802
O3-3803
O3-3804

Other

Figma Design of rule builder:
Final UIUX of Rule builder

Logged Data

For a specified rule containing multiple conditional logics

isNewRule log

For a specified conditional logic that contains multiple conditions and actions:

Final log cropped

@senthil-athiban senthil-athiban marked this pull request as ready for review June 8, 2024 05:38
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants