HTML Form Entry Multiple Numeric Observations

14 views
Skip to first unread message

Steven Githens

unread,
May 15, 2012, 4:04:01 PM5/15/12
to d...@openmrs.org
Hello OpenMRS Dev,

I'm trying to implement part of a paper form that has a "circle all"
type of area that binds to a numeric concept, and haven't found the
right HTML Form Entry tag yet for that.

Essentially, I want:

<obs conceptId="9876" answers="1,2,3" answerLabels="1,2,3"
style="checkbox" />

So that multiple observations can be recorded for it, but it doesn't
look like we accept style="checkbox" yet for numeric obs?

I played with:

<obs conceptId="9876" answers="1" answerLabels="1" style="radio" />
<obs conceptId="9876" answers="2" answerLabels="2" style="radio" />
<obs conceptId="9876" answers="3" answerLabels="3" style="radio" />

Which sort of works, but they should really be checkboxes.

Cheers,
Steve

Darius Jazayeri

unread,
May 15, 2012, 4:43:43 PM5/15/12
to d...@openmrs.org
Hi Steve,

How about
<obs conceptId="9876" answerConceptId="1" style="checkbox" />
<obs conceptId="9876" answerConceptId="2" style="checkbox" />
<obs conceptId="9876" answerConceptId="3" style="checkbox" />

-Darius

_________________________________________

To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to LIST...@LISTSERV.IUPUI.EDU with "SIGNOFF openmrs-devel-l" in the  body (not the subject) of your e-mail.

[mailto:LISTSERV@LISTSERV.IUPUI.EDU?body=SIGNOFF%20openmrs-devel-l]

Steven Githens

unread,
May 16, 2012, 10:40:44 AM5/16/12
to d...@openmrs.org
Hello!

The below doesn't work because it tries to use the answerConceptId too look up a concept rather than use the raw number as an answer.

I did try something simalar and from fiddling with it, and having taken a quick grep through the code, I don't *think* we support style=checkbox for numeric types at all.  If you use checkbox, it switches back to the default single selection combo box.

There are 2 images attached.  The one with CD4 combos is produced from:

<obs conceptId="5497" labelText="CD4" answers="100" answerLabels="100" style="checkbox"/>
<obs conceptId="5497" labelText="CD4" answers="500" answerLabels="500" style="checkbox"/>
<obs conceptId="5497" labelText="CD4" answers="1400" answerLabels="1400" style="checkbox"/>

Also, one interesting thing I've found from trying to use a number of seperate <obs/> tags with type radio, is that it get's a bit confused when it renders the screen to go back and view or edit an existing encounter. The observations are being recorded correctly in the database from the original form submission, but on the rerender, it correctly populates the smallest number in the recorded obs, but adds a decimal to the others and creates extra widgets for them.

For example, given the following markup and submitting a form with 1, 3, and 4 selected:

          <repeat>
            <template>
              <obs conceptId="7481" labelText="" answers="{num}.0" answerLabels="{num}" style="radio" />
            </template>
            <render num="1" /><render num="2" /><render num="3" /><render num="4" /><render num="5" /><render num="6" />
          </repeat>

Results in the other attached image where the 1 radio is refilled, but new entries are created for 3.0 and 4.0 rather than just using 3 and 4.

-Steve
Hi Steve,

-Darius

[mailto:LIST...@LISTSERV.IUPUI.EDU?body=SIGNOFF%20openmrs-devel-l]


Click here to unsubscribe from OpenMRS Developers' mailing list

htmlformentry-radiobuttons.png
htmlformentry-radio-rounding.png

Darius Jazayeri

unread,
May 16, 2012, 11:18:05 AM5/16/12
to d...@openmrs.org
Oh, sorry, I'd misunderstood.

I think you're right that HFE doesn't support having a checkbox for a numeric value.

To me, what you're trying to do sounds like the wrong approach. If you've got distinct values that can be checked, those really should be coded concepts (I'm assuming that 1, 2, 3, 4, 5 are codes in a list...) and not numeric...

-Darius

Mark Goodrich

unread,
May 16, 2012, 2:17:56 PM5/16/12
to d...@openmrs.org

Steven—

 

 

Looks like a typo in our documentation.  Under Obs->Numeric it should read “You can also specify a constrained list of answers, as radio button or a dropdown (Since 1.6.1)”  I corrected this.

 

The radio set issue is a bug… it probably is doing a string comparison when repopulating the radio sets when it really should do a numeric comparison so that 3.0 = 3.  Can you enter a ticket for this?  Go ahead and attach the code snippet and the image to the ticket…

 

Thanks,

Mark

Darius Jazayeri

unread,
May 22, 2012, 1:21:45 AM5/22/12
to d...@openmrs.org
In case anyone has been waiting wondering what was going to happen next...

The problem is that HFE's mechanism for determining whether an existing obs is an "appropriate" match for an <obs .../> tag is only smart enough to look at the question concept, and the coded answer concept. Steven is going to try to augment this logic so that it correctly determines whether an obs with a particular numeric value is appropriate for a tag like <obs conceptId="some-numeric-concept" answers="1,2,3"/>.

-Darius

Mark Goodrich

unread,
May 22, 2012, 10:49:46 AM5/22/12
to d...@openmrs.org

Do we really want to go this route at this point? Doing the matching-on-answers stuff is tricky.

 

If we do something like:

 

<obs conceptId="some-numeric-concept" answers="1,2,3"/>

 

instead of

 

<obs conceptId="some-numeric-concept" answers="1"/>

<obs conceptId="some-numeric-concept" answers="2"/>

<obs conceptId="some-numeric-concept" answers="3"/>

 

It should work currently (but I think there is some sort of bug because of rounding).

 

The issue for Steven here, I assume, is that he wants multi-select checkbox support, when a single radio set only supports selecting a single answer.

 

In this case, we should make sure we support the numeric use case when we expand to allow multi-checkbox support (which should happen as part of GSoC).

 

Mark

-- OpenMRS Developers: http://go.openmrs.org/dev
Post: d...@openmrs.org
Unsubscribe: dev+uns...@openmrs.org

Darius Jazayeri

unread,
May 22, 2012, 11:25:15 AM5/22/12
to d...@openmrs.org
Maybe it's a rounding issue but I thought the problem is that we don't have a variant of FormEntryContext.removeExistingObs that respects a limited set of numeric or text answers. (We only handle "single coded answer" and booleans.) So the first obs tag for the given concept is always going to show a supposedly-but-not-actually-compatible obs just based on its question conceptId.

Personally I think the easier fix would be to allow this:
<obs conceptId="something-numeric" answer="1"/> <!-- singular "answer" instead of the currently-existing "answers" -->

But regardless, if this <obs conceptId="something-numeric" answers="1"/> is showing the value of 3, that's a bug, and I think it's straightforward to fix.

-Darius

Mark Goodrich

unread,
May 22, 2012, 12:27:31 PM5/22/12
to d...@openmrs.org

Yeah, I guess that makes sense… I will update the ticket…

Steven Githens

unread,
Jun 15, 2012, 3:05:06 PM6/15/12
to d...@openmrs.org
A quick update on this.� I think I have a working fix in https://tickets.openmrs.org/browse/HTML-347 .� So it should be fixed in the next release hopefully.

-s


On 05/22/2012 01:21 AM, Darius Jazayeri wrote:
In case anyone has been waiting wondering what was going to happen next...

The problem is that HFE's mechanism for determining whether an existing obs is an "appropriate" match for an <obs .../> tag is only smart enough to look at the question concept, and the coded answer concept. Steven is going to try to augment this logic so that it correctly determines whether an obs with a particular numeric value is appropriate for a tag like <obs conceptId="some-numeric-concept" answers="1,2,3"/>.

-Darius
On Wed, May 16, 2012 at 11:17 AM, Mark Goodrich <mgoo...@pih.org> wrote:

Steven�

�

�

Looks like a typo in our documentation.� Under Obs->Numeric it should read �You can also specify a constrained list of answers, as radio button or a dropdown (Since 1.6.1)�� I corrected this.

�

The radio set issue is a bug� it probably is doing a string comparison when repopulating the radio sets when it really should do a numeric comparison so that 3.0 = 3.� Can you enter a ticket for this?� Go ahead and attach the code snippet and the image to the ticket�

�

Thanks,

Mark

�

From: d...@openmrs.org [mailto:d...@openmrs.org] On Behalf Of Darius Jazayeri
Sent: Wednesday, May 16, 2012 11:18 AM
To: openmrs...@LISTSERV.IUPUI.EDU
Subject: Re: [OPENMRS-DEV] HTML Form Entry Multiple Numeric Observations

�

Oh, sorry, I'd misunderstood.

�

I think you're right that HFE doesn't support having a checkbox for a numeric value.

�

To me, what you're trying to do sounds like the wrong approach. If you've got distinct values that can be checked, those really should be coded concepts (I'm assuming that 1, 2, 3, 4, 5 are codes in a list...) and not numeric...

�

-Darius

�

On Wed, May 16, 2012 at 7:40 AM, Steven Githens <sgit...@iupui.edu> wrote:

Hello!

The below doesn't work because it tries to use the answerConceptId too look up a concept rather than use the raw number as an answer.

I did try something simalar and from fiddling with it, and having taken a quick grep through the code, I don't *think* we support style=checkbox for numeric types at all.� If you use checkbox, it switches back to the default single selection combo box.

There are 2 images attached.� The one with CD4 combos is produced from:



<obs conceptId="5497" labelText="CD4" answers="100" answerLabels="100" style="checkbox"/>
<obs conceptId="5497" labelText="CD4" answers="500" answerLabels="500" style="checkbox"/>
<obs conceptId="5497" labelText="CD4" answers="1400" answerLabels="1400" style="checkbox"/>

Also, one interesting thing I've found from trying to use a number of seperate <obs/> tags with type radio, is that it get's a bit confused when it renders the screen to go back and view or edit an existing encounter. The observations are being recorded correctly in the database from the original form submission, but on the rerender, it correctly populates the smallest number in the recorded obs, but adds a decimal to the others and creates extra widgets for them.

For example, given the following markup and submitting a form with 1, 3, and 4 selected:

��������� <repeat>
����������� <template>
������������� <obs conceptId="7481" labelText="" answers="{num}.0" answerLabels="{num}" style="radio" />
����������� </template>
����������� <render num="1" /><render num="2" /><render num="3" /><render num="4" /><render num="5" /><render num="6" />
��������� </repeat>



Results in the other attached image where the 1 radio is refilled, but new entries are created for 3.0 and 4.0 rather than just using 3 and 4.

-Steve






On 05/15/2012 04:43 PM, Darius Jazayeri wrote:

Hi Steve,

�

How about

<obs conceptId="9876" answerConceptId="1" style="checkbox" />

<obs conceptId="9876" answerConceptId="2" style="checkbox" />

<obs conceptId="9876" answerConceptId="3" style="checkbox" />

�

-Darius

On Tue, May 15, 2012 at 1:04 PM, Steven Githens <sgit...@iupui.edu> wrote:

Hello OpenMRS Dev,

I'm trying to implement part of a paper form that has a "circle all" type of area that binds to a numeric concept, and haven't found the right HTML Form Entry tag yet for that.

Essentially, I want:

<obs conceptId="9876" answers="1,2,3" answerLabels="1,2,3" style="checkbox" />

So that multiple observations can be recorded for it, but it doesn't look like we accept style="checkbox" yet for numeric obs?

I played with:

<obs conceptId="9876" answers="1" answerLabels="1" style="radio" />
<obs conceptId="9876" answers="2" answerLabels="2" style="radio" />
<obs conceptId="9876" answers="3" answerLabels="3" style="radio" />

Which sort of works, but they should really be checkboxes.

Cheers,
Steve

_________________________________________

To unsubscribe from OpenMRS Developers' mailing list, send an e-mail to LIST...@LISTSERV.IUPUI.EDU with "SIGNOFF openmrs-devel-l" in the �body (not the subject) of your e-mail.

[mailto:LIST...@LISTSERV.IUPUI.EDU?body=SIGNOFF%20openmrs-devel-l]

�


Click here to unsubscribe from OpenMRS Developers' mailing list

�


Click here to unsubscribe from OpenMRS Developers' mailing list

�


Click here to unsubscribe from OpenMRS Developers' mailing list


Click here to unsubscribe from OpenMRS Developers' mailing list
Reply all
Reply to author
Forward
0 new messages