# O3: New Initiative to Automate HFE --\> O3 Forms

**URL:** <https://talk.openmrs.org/t/o3-new-initiative-to-automate-hfe-o3-forms/36825>\
**Category:** Development\
**Tags:** forms, 3x, ohri, o3\
**Created:** [June 7, 2022, 6:44am UTC](https://talk.openmrs.org/t/o3-new-initiative-to-automate-hfe-o3-forms/36825 "2022-06-07T06:44:37Z")\
**Posts on this page:** 19\
**Page:** 1

<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, 2022, 6:44am UTC](https://talk.openmrs.org/t/o3-new-initiative-to-automate-hfe-o3-forms/36825/1 "2022-06-07T06:44:37Z")

</div>

Even though there is [basic support to have an HFE form useable in an O3 interface](https://talk.openmrs.org/t/o3-support-for-html-form-entry-in-3-x/35797/8) (opens the HFE form in a new tab), this was meant to be a temporary measure for orgs who want to start using O3 in production but don’t have time to change their 10’s or 100’s or 1000’s of HFE forms into O3 forms. But, at some point, this work is still needed - so we’ve been wanting to help automate this conversion where possible.

Kudos to @aojwang & @kmakombe at Palladium-Kenya, who as of this week have started planning the script to help convert HFE form schemas to O3 form schemas - at least to some degree. If we can automate even some percentage of the effort, this is still useful for implementers, and is something @eudson and the UCSF [@OHRI](https://talk.openmrs.org/groups/ohri) team were already thinking about.

Let’s track this work here 🙂

---

<div class="post-metadata">

**Author:** ![aojwang](https://talk.openmrs.org/letter_avatar/aojwang/32/5_5575768a8748004e209b776fc1b2916d.png) [@aojwang](https://talk.openmrs.org/u/aojwang)\
**Post date:** [June 7, 2022, 6:53am UTC](https://talk.openmrs.org/t/o3-new-initiative-to-automate-hfe-o3-forms/36825/2 "2022-06-07T06:53:09Z")

</div>

Thanks @grace for this post. We are currently using forms in KenyaEMR to help guide the process. This will limit us, at least in the beginning, to the html tags used in our forms. This can then be expanded to support the common tags supported by html form entry module.

The idea is to have a basic JSON schema for every HTLM form which can then undergo cleanup and proper validation checks.

---

<div class="post-metadata">

**Author:** ![eudson](https://talk.openmrs.org/user_avatar/talk.openmrs.org/eudson/32/16527_2.png) [@eudson](https://talk.openmrs.org/u/eudson)\
**Post date:** [June 7, 2022, 6:13pm UTC](https://talk.openmrs.org/t/o3-new-initiative-to-automate-hfe-o3-forms/36825/3 "2022-06-07T18:13:37Z")

</div>

@aojwang we ([@OHRI](https://talk.openmrs.org/groups/ohri) ) are happy to support you on this, we had an initial discussion internally and we can share our finds with you.

---

<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 10, 2022, 4:41pm UTC](https://talk.openmrs.org/t/o3-new-initiative-to-automate-hfe-o3-forms/36825/4 "2022-06-10T16:41:21Z")

</div>

EXCITING UPDATE! 🎉

Update from @aojwang’s work as of today:  
**The schema migration seems to work! He has done a small prototype for KenyaEMR HFE forms** and below is a sample questions list for the form.

> I am so excited because **what we have already in this prototype relieves us from having to type so much for the question concepts and answers** (for coded obs). We can render date, text, numeric, coded obs. Next I will handle obsGroup which I think is simple right now.

We’ll share more details next week!

Payload example below. Of course it still needs some work and they will continue to iterate.

 ![image](https://talk.openmrs.org/uploads/default/original/3X/2/c/2cd8e9f96630bb6285a91394c731543c63cb9041.png)

CC & FYI: @eudson @mwaririm @icrc.psousa @mksrom @ddesimone @slubwama

---

<div class="post-metadata">

**Author:** ![slubwama](https://talk.openmrs.org/user_avatar/talk.openmrs.org/slubwama/32/8366_2.png) [@slubwama](https://talk.openmrs.org/u/slubwama)\
**Post date:** [June 23, 2022, 1:52pm UTC](https://talk.openmrs.org/t/o3-new-initiative-to-automate-hfe-o3-forms/36825/5 "2022-06-23T13:52:29Z")

</div>

> [@grace](#):
>
> Even though there is [basic support to have an HFE form useable in an O3 interface](https://talk.openmrs.org/t/o3-support-for-html-form-entry-in-3-x/35797/8) (opens the HFE form in a new tab), this was meant to be a temporary measure for orgs who want to start using O3 in production but don’t have time to change their 10’s or 100’s or 1000’s of HFE forms into O3 forms. But, at some point, this work is still needed - so we’ve been wanting to help automate this conversion where possible.
> 
> Kudos to @aojwang & @kmakombe at Palladium-Kenya, who as of this week have started planning the script to help convert HFE form schemas to O3 form schemas - at least to some degree. If we can automate even some percentage of the effort, this is still useful for implementers, and is something @eudson and the UCSF [@OHRI](https://talk.openmrs.org/groups/ohri) team were already thinking about.

@aojwang & @kmakombe This is great work. How do we access this? This could help cut our work by half.

---

<div class="post-metadata">

**Author:** ![aojwang](https://talk.openmrs.org/letter_avatar/aojwang/32/5_5575768a8748004e209b776fc1b2916d.png) [@aojwang](https://talk.openmrs.org/u/aojwang)\
**Post date:** [June 23, 2022, 5:32pm UTC](https://talk.openmrs.org/t/o3-new-initiative-to-automate-hfe-o3-forms/36825/6 "2022-06-23T17:32:32Z")

</div>

Sorry I haven’t updated our progress for a while now. We managed to move over 50 forms last week where the automated schema migration script/code played a key role. Although not perfect, it is able to provide for over 60% of what would have been done manually. The automation is currently able to do the following:

1. Generate appropriate json for obs and obsgroup tags - coded, text(area), date, boolean, diagnosis
2. Repeating groups
3. Group coded obs (checkboxes) defined using same conceptId but different answer concept
4. Extract question labels from inline obs labelText attribute, text before or after obs tag, or any preceding td if obs tag is within a td. This is common in our forms but can be expanded to handle any common practices
5. Extract answer labels from obs answer label(s) or concept names if explicit label(s) are not provided
6. Pick obs id as defined in the schema

We had to modify the html schema to guarantee a complete and well descriptive json schema for certain forms. This was important in cases where the conversion logic couldn’t find appropriate label for a group or obs hence requiring for a manual fix. For a quick turnaround time, we updated the script so that it is able to read html forms from a configurable directory outside of OpenMRS.

@slubwama I am happy to take you through what we have done so far. We can plan with next week if that’s OK with you.

Regards,

---

<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 23, 2022, 5:49pm UTC](https://talk.openmrs.org/t/o3-new-initiative-to-automate-hfe-o3-forms/36825/7 "2022-06-23T17:49:07Z")

</div>

> [@aojwang](#):
>
> it is able to provide for over 60% of what would have been done manually

Wow this is _awesome_ Antony!!

(FYI @mozzy @gcliff @mksrom @rubailly @bistenes @ddesimone

@aojwang / @slubwama can I humbly ask that when you walk through this together, could you use this zoom link, so that it automatically records for others to watch? (If that’s okay w/ you of course): [Launch Meeting - Zoom](https://om.rs/zoomtac)

---

<div class="post-metadata">

**Author:** ![aojwang](https://talk.openmrs.org/letter_avatar/aojwang/32/5_5575768a8748004e209b776fc1b2916d.png) [@aojwang](https://talk.openmrs.org/u/aojwang)\
**Post date:** [June 23, 2022, 5:51pm UTC](https://talk.openmrs.org/t/o3-new-initiative-to-automate-hfe-o3-forms/36825/8 "2022-06-23T17:51:19Z")

</div>

That’s in order, @grace

---

<div class="post-metadata">

**Author:** ![herbert24](https://talk.openmrs.org/user_avatar/talk.openmrs.org/herbert24/32/8178_2.png) [@herbert24](https://talk.openmrs.org/u/herbert24)\
**Post date:** [June 23, 2022, 6:15pm UTC](https://talk.openmrs.org/t/o3-new-initiative-to-automate-hfe-o3-forms/36825/9 "2022-06-23T18:15:18Z")

</div>

> [@grace](#):
>
> @aojwang / @slubwama can I humbly ask that when you walk through this together, could you use this zoom link, so that it automatically records for others to watch? (If that’s okay w/ you of course): [Launch Meeting - Zoom](https://om.rs/zoomtac)

@aojwang will join in too for this cc @mozzy

---

<div class="post-metadata">

**Author:** ![slubwama](https://talk.openmrs.org/user_avatar/talk.openmrs.org/slubwama/32/8366_2.png) [@slubwama](https://talk.openmrs.org/u/slubwama)\
**Post date:** [June 23, 2022, 6:20pm UTC](https://talk.openmrs.org/t/o3-new-initiative-to-automate-hfe-o3-forms/36825/10 "2022-06-23T18:20:32Z")

</div>

@aojwang thanks for the offer for a work through. @grace we could organise this a virtual event that may help all the current implementers who are using html form entry

---

<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 23, 2022, 6:35pm UTC](https://talk.openmrs.org/t/o3-new-initiative-to-automate-hfe-o3-forms/36825/11 "2022-06-23T18:35:55Z")

</div>

I completely agree 😃 Here are some times that would work on the OMRS Community Calendar. **[https://doodle.com/meeting/organize/id/dRgjQQYe](https://doodle.com/meeting/organize/id/dRgjQQYe)**

@aojwang @slubwama @mozzy @herbert24 just indicate which of these would work for you 🙂 (and of course others are welcome too)

---

<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 24, 2022, 10:23pm UTC](https://talk.openmrs.org/t/o3-new-initiative-to-automate-hfe-o3-forms/36825/12 "2022-06-24T22:23:10Z")

</div>

Hey does Thursday June 30 at 3pm EAT work for you @aojwang & @slubwama? Seems like that’s the best time for folks interested in the coaching session too. (Per this [https://doodle.com/meeting/organize/id/dRgjQQYe](https://doodle.com/meeting/organize/id/dRgjQQYe)

---

<div class="post-metadata">

**Author:** ![slubwama](https://talk.openmrs.org/user_avatar/talk.openmrs.org/slubwama/32/8366_2.png) [@slubwama](https://talk.openmrs.org/u/slubwama)\
**Post date:** [June 25, 2022, 4:14am UTC](https://talk.openmrs.org/t/o3-new-initiative-to-automate-hfe-o3-forms/36825/13 "2022-06-25T04:14:00Z")

</div>

@grace That will do. Let me inform my team to be ready

---

<div class="post-metadata">

**Author:** ![aojwang](https://talk.openmrs.org/letter_avatar/aojwang/32/5_5575768a8748004e209b776fc1b2916d.png) [@aojwang](https://talk.openmrs.org/u/aojwang)\
**Post date:** [June 27, 2022, 6:03am UTC](https://talk.openmrs.org/t/o3-new-initiative-to-automate-hfe-o3-forms/36825/14 "2022-06-27T06:03:45Z")

</div>

That is OK with me.

---

<div class="post-metadata">

**Author:** ![eudson](https://talk.openmrs.org/user_avatar/talk.openmrs.org/eudson/32/16527_2.png) [@eudson](https://talk.openmrs.org/u/eudson)\
**Post date:** [June 27, 2022, 9:04am UTC](https://talk.openmrs.org/t/o3-new-initiative-to-automate-hfe-o3-forms/36825/15 "2022-06-27T09:04:52Z")

</div>

@grace when you send the invite please include @samuel34 and @amugume

---

<div class="post-metadata">

**Author:** ![herbert24](https://talk.openmrs.org/user_avatar/talk.openmrs.org/herbert24/32/8178_2.png) [@herbert24](https://talk.openmrs.org/u/herbert24)\
**Post date:** [June 27, 2022, 9:32am UTC](https://talk.openmrs.org/t/o3-new-initiative-to-automate-hfe-o3-forms/36825/16 "2022-06-27T09:32:37Z")

</div>

> [@grace](#):
>
> Thursday June 30 at 3pm EAT

works well for me too cc @mozzy

---

<div class="post-metadata">

**Author:** ![jwnasambu](https://talk.openmrs.org/user_avatar/talk.openmrs.org/jwnasambu/32/13543_2.png) [@jwnasambu](https://talk.openmrs.org/u/jwnasambu)\
**Post date:** [June 27, 2022, 9:55am UTC](https://talk.openmrs.org/t/o3-new-initiative-to-automate-hfe-o3-forms/36825/17 "2022-06-27T09:55:20Z")

</div>

@slubwama kindly don’t forget to invite me please! I haven’t interacted with the forms and I believe this is a golden opportunity.

---

<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:** [August 19, 2023, 12:32am UTC](https://talk.openmrs.org/t/o3-new-initiative-to-automate-hfe-o3-forms/36825/18 "2023-08-19T00:32:12Z")

</div>

In case folks are now trying to better understand or leverage this migration script, here is the video recording from last year where @aojwang gave a helpful deep-dive into this HFE to O3 Schema migration tool:

[https://iu.mediaspace.kaltura.com/media/t/1\_vdwpylj0?st=371](https://iu.mediaspace.kaltura.com/media/t/1_vdwpylj0?st=371)

---

<div class="post-metadata">

**Author:** ![filipelopes](https://talk.openmrs.org/user_avatar/talk.openmrs.org/filipelopes/32/20382_2.png) [@filipelopes](https://talk.openmrs.org/u/filipelopes)\
**Post date:** [December 31, 2024, 2:00pm UTC](https://talk.openmrs.org/t/o3-new-initiative-to-automate-hfe-o3-forms/36825/19 "2024-12-31T14:00:52Z")

</div>

Hi everyone,

I’ve noticed that we can create two types of forms: **JSON forms** and **HTML forms**. While HTML forms allow for greater customization, it seems there’s an effort underway to build functionalities that convert older HTML forms into JSON.

At the same time, I see that the Java package supporting HTML forms ([https://mvnrepository.com/artifact/org.openmrs.module/htmlformentry-api](https://mvnrepository.com/artifact/org.openmrs.module/htmlformentry-api)) is still being updated.

I’m curious—does this mean there’s an intention to eventually deprecate HTML forms in O3, or will we continue to support both approaches moving forward?

Looking forward to learning more about this! 😊 @grace
