# GSoC 2024 : Validation Rule Builder for the form builder Progress Update

**URL:** <https://talk.openmrs.org/t/gsoc-2024-validation-rule-builder-for-the-form-builder-progress-update/42683>\
**Category:** GSoC\
**Created:** [May 9, 2024, 6:34am UTC](https://talk.openmrs.org/t/gsoc-2024-validation-rule-builder-for-the-form-builder-progress-update/42683 "2024-05-09T06:34:51Z")\
**Posts on this page:** 17\
**Page:** 1

<div class="post-metadata">

**Author:** ![senthilathiban](https://talk.openmrs.org/user_avatar/talk.openmrs.org/senthilathiban/32/19746_2.png) [@senthilathiban](https://talk.openmrs.org/u/senthilathiban)\
**Post date:** [May 9, 2024, 6:34am UTC](https://talk.openmrs.org/t/gsoc-2024-validation-rule-builder-for-the-form-builder-progress-update/42683/1 "2024-05-09T06:34:51Z")

</div>

Hello everyone, I’ve been selected as a GSOC Student for the project Validation Rule Builder for Form Builder. I’ll be using this thread to share my work progress and my blog post.

**Mentors:**

Primary mentor: @dennis

Backup mentor: @hadijah315

**Objectives of the project:**

• Developing an efficient User Interface Validation Rule Builder for the React Form Engine.

• Transitioning to React-hook-form and utilizing its capabilities for validation logic.

• Enabling the Validation rule-builder to accommodate helper functions and JavaScript expressions.

---

<div class="post-metadata">

**Author:** ![senthilathiban](https://talk.openmrs.org/user_avatar/talk.openmrs.org/senthilathiban/32/19746_2.png) [@senthilathiban](https://talk.openmrs.org/u/senthilathiban)\
**Post date:** [May 9, 2024, 6:41am UTC](https://talk.openmrs.org/t/gsoc-2024-validation-rule-builder-for-the-form-builder-progress-update/42683/2 "2024-05-09T06:41:18Z")

</div>

Hello folks,

I’m excited to share my community bonding journey with all of you through this blog. The memory of my first GSoC Orientation program remains vivid, thanks to the incredible session led by @jayasanka and @grace.

> **[My GSoC Journey Begins: Community Bonding](https://medium.com/@senthilathiban0/my-gsoc-journey-begins-community-bonding-17188e7f1c66)**
>
> Hello everyone

---

<div class="post-metadata">

**Author:** ![senthilathiban](https://talk.openmrs.org/user_avatar/talk.openmrs.org/senthilathiban/32/19746_2.png) [@senthilathiban](https://talk.openmrs.org/u/senthilathiban)\
**Post date:** [May 20, 2024, 5:17am UTC](https://talk.openmrs.org/t/gsoc-2024-validation-rule-builder-for-the-form-builder-progress-update/42683/3 "2024-05-20T05:17:49Z")

</div>

Hello forks, Here is the blog post for the second week of my GSoC Journey.

> **[GSoC Journey: 2nd Week of Community Bonding](https://medium.com/@senthilathiban0/gsoc-journey-2nd-week-of-community-bonding-42159ba831db)**
>
> If you don’t know me yet, I’m Senthil Athiban, a final-year undergraduate student at the Madras Institute of Technology. I’m thrilled to be a GSoC student in 2024 at OpenMRS. If you haven’t checked…

---

<div class="post-metadata">

**Author:** ![senthilathiban](https://talk.openmrs.org/user_avatar/talk.openmrs.org/senthilathiban/32/19746_2.png) [@senthilathiban](https://talk.openmrs.org/u/senthilathiban)\
**Post date:** [May 24, 2024, 8:50am UTC](https://talk.openmrs.org/t/gsoc-2024-validation-rule-builder-for-the-form-builder-progress-update/42683/4 "2024-05-24T08:50:57Z")

</div>

Sharing my 3rd blog on community experience.

> **[GSoC Journey: 3rd week of Community Bonding](https://medium.com/@senthilathiban0/gsoc-journey-3rd-week-of-community-bonding-233bfafaaf0f)**
>
> Myself Senthil Athiban, a final year undergraduate student at Madras Institute of Technology. This blog represents a continuous series documenting my journey through GSoC. If you haven’t already, I…

---

<div class="post-metadata">

**Author:** ![senthilathiban](https://talk.openmrs.org/user_avatar/talk.openmrs.org/senthilathiban/32/19746_2.png) [@senthilathiban](https://talk.openmrs.org/u/senthilathiban)\
**Post date:** [May 25, 2024, 7:39am UTC](https://talk.openmrs.org/t/gsoc-2024-validation-rule-builder-for-the-form-builder-progress-update/42683/5 "2024-05-25T07:39:07Z")

</div>

@pauladams @cduffy . Here is the final design of the rule builder for the form builder. Utilized Figma and carbon design system. Adding a small demo also. Your feedback on these would be helpful. cc: @grace , @cduffy , @pauladams , @dennis , @hadijah315

 ![Final UIUX of Rule builder](https://talk.openmrs.org/uploads/default/original/3X/f/5/f533e35821d73a9d8212f8a153e175b9099eb1eb.png)

Demo:https://www.loom.com/embed/3946df798a014697b595ea87140db7cc

Draft PR:

> <https://github.com/openmrs/openmrs-esm-form-builder/pull/279>
>
> \## Requirements
> 
> \- \[x\] This PR has a title that briefly describes the work don…e including the ticket number. If there is a ticket, make sure your PR title includes a \[conventional commit\](https://o3-docs.openmrs.org/docs/frontend-modules/contributing.en-US#contributing-guidelines) label. See existing PR titles for inspiration.
> \- \[x\] My work conforms to the \[OpenMRS 3.0 Styleguide\](https://om.rs/styleguide) and \[design documentation\](https://om.rs/o3ui).
> \- \[x\] 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.
> 
> \## Screenshots
> https://www.loom.com/share/3946df798a014697b595ea87140db7cc
> 
> \## Related Issue
> https://openmrs.atlassian.net/browse/O3-3230
> 
> \## Other
> Figma Design of rule builder:
> !\[Final UIUX of Rule builder\](https://github.com/openmrs/openmrs-esm-form-builder/assets/93466587/ea013ae1-51e1-46db-bd3e-56db3e2de801)

---

<div class="post-metadata">

**Author:** ![senthilathiban](https://talk.openmrs.org/user_avatar/talk.openmrs.org/senthilathiban/32/19746_2.png) [@senthilathiban](https://talk.openmrs.org/u/senthilathiban)\
**Post date:** [May 30, 2024, 7:12am UTC](https://talk.openmrs.org/t/gsoc-2024-validation-rule-builder-for-the-form-builder-progress-update/42683/6 "2024-05-30T07:12:18Z")

</div>

**My Coding Journey:**

**Week 01** : May 27 - June 01, 2024

- Created [EPIC](https://openmrs.atlassian.net/browse/O3-3229) for my project

- Updated Project [Wiki Page](https://openmrs.atlassian.net/wiki/spaces/RES/pages/26278995/Gsoc+2024+Validation+rule+builder+for+the+form+builder)

- Created my first [draft PR](https://github.com/openmrs/openmrs-esm-form-builder/pull/279)

- [Demo](https://www.loom.com/share/4f0a9855b73b4dd28b172c912e06299e) of recent work on my project

- First [blog](https://medium.com/@senthilathiban0/gsoc-journey-week-01-of-coding-period-48727197abf3) post of coding period

**Week 02** : June 03, 2024 - June 08, 2024

- Received feedback on my GSoC progress from my primary mentor, @dennis. Shared a [demo](https://www.loom.com/share/cef02c0d362c4d3f92bc846527329656?sid=d5156068-8bc6-4cf5-b48a-ab3c5e1cc690) of my project.

- Completed the unit test cases for my project to ensure functionality and reliability.

- Published my second [blog post](https://medium.com/@senthilathiban0/gsoc-journey-week-02-of-coding-period-1e36ad6dae36) for the coding period, detailing my progress and experiences.

- Began writing user-friendly documentation to assist users in building conditional logic for forms.

**Week 03:** June 10, 2024 - June 15, 2024

- Developed the feature of [allowing and disallowing the future dates in the date-form field](https://drive.google.com/file/d/1az12SPtKG7yGYXx9v2djZ9PWo9T1h-Ys/view?usp=drive_link) and [decimal values in the number-based form field.](https://drive.google.com/file/d/1YUaq2WCQhrMgeoLczd_QMCY3Ul9wM72S/view?usp=drive_link)

- Developed user-friendly [documentation](https://openmrs.atlassian.net/wiki/spaces/projects/pages/114426045/Validation+Rule+Builder) for my GSoC Project, which gives an overview of the feature, and tutorial guides.

- Published my [third blog post](https://medium.com/@senthilathiban0/gsoc-journey-week-03-of-coding-period-9a563e3df13b) for the coding period, detailed my progress, blockers, and experiences.

**Week 04:** June 17 - June 21

- Developed a calculation expression logic in the rule builder.

- Integrated custom validation logic, including hideWhenExpression, failsWhenExpression, and calculateExpression into the schema.

- Shared my GSoC work with our squad members in squad call with a live [demo](https://www.loom.com/share/28eb61eef1004f69bffe6a144e3479cf?sid=1f9a072d-83c5-45f0-a612-6d5a6cf5be45).

- Published the [Week-04](https://medium.com/@senthilathiban0/gsoc-journey-week-04-of-coding-period-599e1d7a188b) blog post

**Week 05** : June 24 - June 28

- Developing a conditional rule for checking if an array contains selected values by integrating a multi-select component into the rule builder and incorporating the logic into the schema.

- Increasing unit test coverage for existing functions defined in the rule builder.

- Published [Week 05 blog](https://medium.com/@senthilathiban0/gsoc-journey-week-05-of-coding-period-cd8b51406ede)

- [Demo](https://www.loom.com/share/4f021105129048e9b495c043c457db3f?sid=c59c9807-cee0-48f6-82b6-7ce477e03ee9)

cc: @grace , @dennis , @hadijah315 , @jayasanka , @vasharma05

---

<div class="post-metadata">

**Author:** ![grace](https://talk.openmrs.org/user_avatar/talk.openmrs.org/grace/32/16942_2.png) [@grace](https://talk.openmrs.org/u/grace)\
**Post date:** [June 7, 2024, 11:42pm UTC](https://talk.openmrs.org/t/gsoc-2024-validation-rule-builder-for-the-form-builder-progress-update/42683/7 "2024-06-07T23:42:53Z")

</div>

Thanks so much for keeping up this blog, it helps me!! Love how you included a loom video / demo 🤩 Can’t wait to try this out on dev3. Please let me know when it’s ready to try out 🙂 I would especially love @veronica and @wamz 's expert review as they have built mannny forms for OpenMRS over the years and will have great insight. Whenever you’re ready @senthilathiban let us know so we can try it out ourselves and share feedback 🙂

---

<div class="post-metadata">

**Author:** ![senthilathiban](https://talk.openmrs.org/user_avatar/talk.openmrs.org/senthilathiban/32/19746_2.png) [@senthilathiban](https://talk.openmrs.org/u/senthilathiban)\
**Post date:** [June 8, 2024, 5:44am UTC](https://talk.openmrs.org/t/gsoc-2024-validation-rule-builder-for-the-form-builder-progress-update/42683/8 "2024-06-08T05:44:20Z")

</div>

Thank you @grace . Happy to hear that the blog post is helpful for you. 😊

I’ll make sure to keep you updated on the progress and notify you as soon as it’s ready for testing.

---

<div class="post-metadata">

**Author:** ![senthilathiban](https://talk.openmrs.org/user_avatar/talk.openmrs.org/senthilathiban/32/19746_2.png) [@senthilathiban](https://talk.openmrs.org/u/senthilathiban)\
**Post date:** [June 10, 2024, 12:42pm UTC](https://talk.openmrs.org/t/gsoc-2024-validation-rule-builder-for-the-form-builder-progress-update/42683/9 "2024-06-10T12:42:13Z")

</div>

Hello @grace, @dennis

I would like to develop documentation for [the validation rule builder project](https://openmrs.atlassian.net/wiki/spaces/RES/pages/26278995/Gsoc+2024+Validation+rule+builder+for+the+form+builder), which is related to RFE. It would be helpful for me If I could get access to this [wiki page](https://openmrs.atlassian.net/wiki/spaces/projects/pages/68747273/React+Form+Engine) to edit the docs section.

cc: @grace , @dennis.

https://www.loom.com/embed/9f23db0543c5452dbfa7ccfc261956fb?sid=c789fd51-632e-4ca2-8142-83a01a415f6d

---

<div class="post-metadata">

**Author:** ![senthilathiban](https://talk.openmrs.org/user_avatar/talk.openmrs.org/senthilathiban/32/19746_2.png) [@senthilathiban](https://talk.openmrs.org/u/senthilathiban)\
**Post date:** [June 13, 2024, 5:55am UTC](https://talk.openmrs.org/t/gsoc-2024-validation-rule-builder-for-the-form-builder-progress-update/42683/10 "2024-06-13T05:55:05Z")

</div>

Hello [@everyone](https://talk.openmrs.org/groups/everyone),

I have developed the [documentation](https://openmrs.atlassian.net/wiki/spaces/projects/pages/114426045/Validation+Rule+Builder) for my [GSoC project: Validation Rule Builder for the form builder](https://openmrs.atlassian.net/wiki/spaces/RES/pages/26278995/Gsoc+2024+Validation+rule+builder+for+the+form+builder). This [documentation](https://openmrs.atlassian.net/wiki/spaces/projects/pages/114426045/Validation+Rule+Builder) provides a tutorial guide for users on utilizing the validation rule builder to create conditional logic for forms. Please take a look at these [documentation](https://openmrs.atlassian.net/wiki/spaces/projects/pages/114426045/Validation+Rule+Builder) and provide your feedback. Your feedback will be helpful to me.

cc: @grace, @dennis , @hadijah315 , @samuel34 , @vasharma05 , @jayasanka , @eudson, @veronica @wamz.

---

<div class="post-metadata">

**Author:** ![senthilathiban](https://talk.openmrs.org/user_avatar/talk.openmrs.org/senthilathiban/32/19746_2.png) [@senthilathiban](https://talk.openmrs.org/u/senthilathiban)\
**Post date:** [July 5, 2024, 8:17am UTC](https://talk.openmrs.org/t/gsoc-2024-validation-rule-builder-for-the-form-builder-progress-update/42683/11 "2024-07-05T08:17:28Z")

</div>

**Week 06** : July 01 - July 05

- Developing a conditional rule for hiding the pages, and sections. And added new logic for disabling the form field.
- Fixed bugs in editing functionality.
- Increasing unit test coverage for existing functions defined in the rule builder.
- Added new examples and tutorial guides for creating conditional logic in [wiki docs](https://openmrs.atlassian.net/wiki/spaces/projects/pages/114426045/Validation+Rule+Builder).
- Published [Week 06 blog](https://medium.com/@senthilathiban0/gsoc-journey-week-06-of-coding-period-c5d47f879e0d)
- [Demo](https://www.loom.com/share/7b2ff4970ed840b8a8eb9618101a3981?sid=eac0568c-425e-4033-b885-09361afaf70e)

@jayasanka @grace @dennis @hadijah315 @vasharma05

---

<div class="post-metadata">

**Author:** ![senthilathiban](https://talk.openmrs.org/user_avatar/talk.openmrs.org/senthilathiban/32/19746_2.png) [@senthilathiban](https://talk.openmrs.org/u/senthilathiban)\
**Post date:** [July 13, 2024, 12:33pm UTC](https://talk.openmrs.org/t/gsoc-2024-validation-rule-builder-for-the-form-builder-progress-update/42683/12 "2024-07-13T12:33:13Z")

</div>

**Week 07: July 08 - July 13, 2024.**

- Developed a [validation rule for date fields](https://github.com/openmrs/openmrs-esm-form-builder/pull/279/commits/a4164d491915adb5d48de64f8fc513541de9a8c3).

- Added a new [calculation logic](https://github.com/openmrs/openmrs-esm-form-builder/pull/279/commits/71376003e44c4d99309085238383c9454ee19a33) for calculating the time difference in days, weeks, months, and years.

- [Refactored](https://github.com/openmrs/openmrs-esm-form-builder/pull/279/commits/cd7e0aeb326aaa7c74ae13e75241029fc372f04c) the unit test cases.

- Added examples in the [documenation](https://openmrs.atlassian.net/wiki/spaces/projects/pages/114426045/Validation+Rule+Builder) for date validations, and time calculation.

- Published [Week 07 blog](https://medium.com/@senthilathiban0/gsoc-journey-week-07-of-coding-period-396c18832288).

---

<div class="post-metadata">

**Author:** ![senthilathiban](https://talk.openmrs.org/user_avatar/talk.openmrs.org/senthilathiban/32/19746_2.png) [@senthilathiban](https://talk.openmrs.org/u/senthilathiban)\
**Post date:** [July 19, 2024, 1:24pm UTC](https://talk.openmrs.org/t/gsoc-2024-validation-rule-builder-for-the-form-builder-progress-update/42683/13 "2024-07-19T13:24:22Z")

</div>

**Week 8 Progress: July 15 - July 19:**

- Implemented a [streamlined approach](https://github.com/openmrs/openmrs-esm-form-builder/pull/279/commits/6616d72e9ab8c064b03d26f0d700c606f11598b1) for adding calculation functions, enhancing efficiency and maintainability.
- Added new date calculation functions ([calcNextVisitDate](https://github.com/openmrs/openmrs-esm-form-builder/pull/279/commits/79f572727a9d1bf96c14137da5b9487eb1fda68a), [calcTreatmentEndDate](https://github.com/openmrs/openmrs-esm-form-builder/pull/279/commits/3ce175715de40b6109244600ca7bc345accb0b30)) and a helper function ([calcGravida](https://github.com/openmrs/openmrs-esm-form-builder/pull/279/commits/e60a2ca90a7fe122ab0b06129a2ed7f52de913de)).
- Documented the above feature in [wiki page](https://openmrs.atlassian.net/wiki/spaces/projects/pages/114426045/Validation+Rule+Builder) with demo as well.
- Published [Week 08](https://medium.com/@senthilathiban0/gsoc-journey-week-08-of-coding-period-13e4ab391f66) blog post

@grace , @dennis , @hadijah315 , @jayasanka , @piumal1999

---

<div class="post-metadata">

**Author:** ![senthilathiban](https://talk.openmrs.org/user_avatar/talk.openmrs.org/senthilathiban/32/19746_2.png) [@senthilathiban](https://talk.openmrs.org/u/senthilathiban)\
**Post date:** [July 27, 2024, 12:31pm UTC](https://talk.openmrs.org/t/gsoc-2024-validation-rule-builder-for-the-form-builder-progress-update/42683/14 "2024-07-27T12:31:29Z")

</div>

### Week 9 Progress: July 22 - July 27

- Integrated the [historical expression schema](https://github.com/openmrs/openmrs-esm-form-builder/pull/279/commits/371cd7e726544a99f29ef68fdbbf6c8652fde407) into the validation rule builder to retrieve the most recent historical value.
- Added unit test cases.
- [Refactored](https://github.com/openmrs/openmrs-esm-form-builder/pull/279/commits/a7158e45dbf03c3bcd4beddafdd5c932955ee488) the validation rule builder based on mentor feedback.
- Documented the above feature in [wiki page](https://openmrs.atlassian.net/wiki/spaces/projects/pages/114426045/Validation+Rule+Builder)
- Published the [Week 09 blog](https://medium.com/@senthilathiban0/gsoc-journey-week-09-of-coding-period-978cc2641953).

@grace@jayasanka @piumal1999 @dennis @hadijah315

---

<div class="post-metadata">

**Author:** ![senthilathiban](https://talk.openmrs.org/user_avatar/talk.openmrs.org/senthilathiban/32/19746_2.png) [@senthilathiban](https://talk.openmrs.org/u/senthilathiban)\
**Post date:** [August 3, 2024, 9:05am UTC](https://talk.openmrs.org/t/gsoc-2024-validation-rule-builder-for-the-form-builder-progress-update/42683/15 "2024-08-03T09:05:02Z")

</div>

**Week 10 Progress: July 29 - August 03**

- Covered E2E test cases for validation rule builder, which covers validation such `hideWhenExpression`, `failsWhenExpression`, `calculateExpression`.

- Published the [Week 10](https://medium.com/@senthilathiban0/gsoc-journey-week-10-of-coding-period-16f871ea0bb8) blog post

@grace @jayasanka @piumal1999 @dennis @hadijah315

---

<div class="post-metadata">

**Author:** ![senthilathiban](https://talk.openmrs.org/user_avatar/talk.openmrs.org/senthilathiban/32/19746_2.png) [@senthilathiban](https://talk.openmrs.org/u/senthilathiban)\
**Post date:** [August 11, 2024, 12:44pm UTC](https://talk.openmrs.org/t/gsoc-2024-validation-rule-builder-for-the-form-builder-progress-update/42683/16 "2024-08-11T12:44:58Z")

</div>

**Week 11: August 05 - August 10:**

- Refactored the validation rule builder with [descriptive comments](https://github.com/openmrs/openmrs-esm-form-builder/pull/279/commits/22adbb64b45d3439fc6ef0e4947dc11cd6437c8b), and made changes in handler function with [react best practises](https://github.com/openmrs/openmrs-esm-form-builder/pull/279/commits/0896c4ba737d52b4678a44a7dc0247ccbb449a84).
- Developed a Block diagram for better understanding of validation rule builder UI code, which will be helpful for new contributors.
- Published [week 11 blog post](https://medium.com/@senthilathiban0/gsoc-journey-week-11-of-coding-period-70be830a063d).

@grace @jayasanka @piumal1999 @hadijah315 @dennis

 ![Screenshot 2024-08-11 at 5.48.16 PM](https://talk.openmrs.org/uploads/default/original/3X/8/5/8570c4c6aba6a0ad2710243d2eba67905b0db38f.png)

---

<div class="post-metadata">

**Author:** ![senthilathiban](https://talk.openmrs.org/user_avatar/talk.openmrs.org/senthilathiban/32/19746_2.png) [@senthilathiban](https://talk.openmrs.org/u/senthilathiban)\
**Post date:** [August 18, 2024, 5:40pm UTC](https://talk.openmrs.org/t/gsoc-2024-validation-rule-builder-for-the-form-builder-progress-update/42683/17 "2024-08-18T17:40:54Z")

</div>

**Week 12: August 12 - August 17, 2024**

# Tasks Completed:

- Fixes on Editing specific`failsWhenExpression` in Validators: [**Video Walkthrough**](https://www.loom.com/share/f3054b23aca04a35aa7e4fae49983cf3?sid=dffab4cd-a7f9-4e9f-a532-0b59767ca602)
- Fixes on Deleting Specific Conditional Logic: [**Video Walkthrough**](https://www.loom.com/share/52c5dd390bf343cf986d4eee10c6e6c1?sid=3de48a02-69f0-4a5f-b350-973766ed79c1)
- Fixes on Deleting All Conditional Logic Associated with a Specific Condition: [**Video Walkthrough**](https://www.loom.com/share/99a0d334e7fe4dc5898a2f265fcb38f2?sid=5eab1ab2-d960-4a95-b2cf-7a30534638bb)
- Fixes on Deleting a Mistakenly Chosen Condition/Action and Reverting the Schema: [**Video Walkthrough**](https://www.loom.com/share/b578543e95c84eefb45cf3bad8226120?sid=d6ab05c0-b4cc-4c8c-bb0e-f0060ff94b78)

[https://medium.com/@senthilathiban0/gsoc-journey-final-week-of-coding-period-ced0a76bd72c](https://medium.com/@senthilathiban0/gsoc-journey-final-week-of-coding-period-ced0a76bd72c)
