Way to place constraint in Xform based on OpenMRS concept

I had a question about placing a constraint in an Xform.I know that in the
xform you can place a constraint on a value with the constraint tag in the
bind such as below
<xf:bind id="confirmacion_dia_de_cumpleanos"
nodeset="/form/obs/confirmacion_dia_de_cumpleanos/value" type="xsd:int"
action="enable" constraint=". = 3"/>

However, I would like to know if there's a way to be able to place a concept
value as the constraint instead of an int. i.e. the field would look like
this
<xf:bind id="confirmacion_dia_de_cumpleanos"
nodeset="/form/obs/confirmacion_dia_de_cumpleanos/value" type="xsd:int"
action="enable" constraint=". =
/form/obs/confirmacion_dia_de_cumpleanos/value"
/>

where previously you had defined that concept as such
<confirmacion_dia_de_cumpleanos openmrs_concept="6101^confirmacion dia de
cumpleanos^99DCT" openmrs_datatype="NM">


1
</confirmacion_dia_de_cumpleanos>

The reason is that in ODK-Voice we're passing several values in from OpenMRS
and we want to constrain a question with that value, but we'd like to not
have to modify the bind field every time, but rather have it use the concept
field which we're passing in.

Thanks,

J

··· On Mon, Apr 18, 2011 at 3:34 PM, Adam Lerer wrote:

Yes, I see how this is being caused in widgets/InfoWidget.java, here:

  VxmlSection infoSection = new VxmlSection("<block>" +
           createCompositePrompt(
                   createPrompt(prompt.getQuestionText()),
           createPrompt(true, prompt.getAnswerText())) +
      "</block>");

An easy fix would be to modify InfoWidget.java:35 along these lines:

  VxmlPrompt infoPrompt = prompt.getAnswerText() ?
      createCompositePrompt(
           createPrompt(prompt.getQuestionText()),
           createPrompt(true, prompt.getAnswerText()))
     : createPrompt(true, prompt.getAnswerText()));
  VxmlSection infoSection = new VxmlSection("<block>" + infoPrompt +

"");

Best,
Adam

On Mon, Apr 18, 2011 at 3:18 PM, Joaquín Blaya jblaya@ehealthsystems.clwrote:

Adam,
I think I found the problem. It's when a string question is readonly.
Since there is answer to it appartently ODK-Voice puts a null in the answer
prompt.

So for example, I have a patient's given name, which is filled in
automatically by ODK-Voice.

<xf:bind id="patient.given_name"
nodeset="/form/patient/patient.given_name" type="xsd:string" locked="true()"
jr:preload="patient" xmlns:jr="http://openrosa.org/javarosa"
jr:preloadParams="givenName" readonly="true()"/>

But then the other string questions, don't have an answer (copied below)
and for all of these three, ODK-Voice will say "null" after reading the
text.

  <xf:bind id="felicitaciones_usted_cuida_su_salud"

nodeset="/form/obs/felicitaciones_usted_cuida_su_salud/value"
type="xsd:string"
relevant="/form/obs/en_el_programa_de_salud_cardiovascular_le_ayudarn_a_controlar_su_diabetes._en_su_carnet_de_control_cardiovascular_est_la_fecha_para_tomarse_los_exmenes_y_para_su_prximo_control_mdico./value
= '1' and /form/obs/confirmacion_de_identidad/value = '1'" action="enable"
required="false()" readonly="true()"/>
<xf:bind
id="tmese_los_exmenes_al_menos_7_das_antes_de_ir_a_su_control._si_no_puede_hacerlo_cambie_su_hora."
nodeset="/form/obs/tmese_los_exmenes_al_menos_7_das_antes_de_ir_a_su_control._si_no_puede_hacerlo_cambie_su_hora./value"
type="xsd:string"
relevant="/form/obs/en_el_programa_de_salud_cardiovascular_le_ayudarn_a_controlar_su_diabetes._en_su_carnet_de_control_cardiovascular_est_la_fecha_para_tomarse_los_exmenes_y_para_su_prximo_control_mdico./value
= '2' and /form/obs/confirmacion_de_identidad/value = '1'" action="enable"
required="false()" readonly="true()"/>
<xf:bind id="termino_de_llamada_proyecto_cosmos"
nodeset="/form/obs/termino_de_llamada_proyecto_cosmos/value"
type="xsd:string" readonly="true()"/>

Any idea how to fix this?

Thanks,

Joaquin

2011/4/18 Joaquín Blaya jblaya@ehealthsystems.cl

Hey Adam,
Thanks for the other response about the Audio Codecs, I'm looking into it
right now. I had another thing that I wanted to ask you. For some reason
in two prompts within a call there is a "null" that is pronounced by the TTS
voice of Prophecy and when I look into the Vxml generated by ODK-Voice (by
going to formVxml?sessionid=...) I see that in those prompts there is a null
(i'm copying the text below and highlighting in bold the line. I'm also
attaching the xml here in case you want to look at it. I can't figure out
why this second prompt with "null" appears. It doesn't happen in almost any
other line in this form, but it also happens in all of my other forms, so
there's something here.

I also tried going to the Prompt Recorder to record it as a short silent
wav file, but the Prompt Recorder didn't display "null"

Any suggestions on how I could investigate what is causing this?

Thanks,

J

*

*null*

--


Gerente de Desarrollo, eHealth Systems
Research Fellow, Escuela de Medicina de Harvard
Moderador, GHDOnline.org

--


Gerente de Desarrollo, eHealth Systems
Research Fellow, Escuela de Medicina de Harvard
Moderador, GHDOnline.org

--


Gerente de Desarrollo, eHealth Systems
Research Fellow, Escuela de Medicina de Harvard
Moderador, GHDOnline.org

--


Gerente de Desarrollo, eHealth Systems
Research Fellow, Escuela de Medicina de Harvard
Moderador, GHDOnline.org

my intuition is that having a constraint that references a node should
work, but i haven't tried. maybe you could build a simple form for odk
collect and see if that works...

··· On Mon, Apr 18, 2011 at 16:32, Joaquín Blaya wrote: > I had a question about placing a constraint in an Xform.I know that in the > xform you can place a constraint on a value with the constraint tag in the > bind such as below > nodeset="/form/obs/confirmacion_dia_de_cumpleanos/value" type="xsd:int" > action="enable" constraint=". = 3"/> > > However, I would like to know if there's a way to be able to place a concept > value as the constraint instead of an int. i.e. the field would look like > this > nodeset="/form/obs/confirmacion_dia_de_cumpleanos/value" type="xsd:int" > action="enable" constraint=". = > /form/obs/confirmacion_dia_de_cumpleanos/value"/> > > where previously you had defined that concept as such > > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"/> > xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance">1 > > > The reason is that in ODK-Voice we're passing several values in from OpenMRS > and we want to constrain a question with that value, but we'd like to not > have to modify the bind field every time, but rather have it use the concept > field which we're passing in. > > Thanks, > > J

Thanks Yaw. I actually found the answer which was that you couldn't place
the constraint to the value of the same question i.e. saying
constraint=".=/form/obs/confirmacion_dia_de_cumpleanos/value" is like saying
constraint=".=." So I created another field with the value and wrote the
constraint the following way

<xf:bind id="confirmacion_dia_de_cumpleanos"
nodeset="/form/obs/confirmacion_dia_de_cumpleanos/value" type="xsd:int"
relevant="/form/obs/confirmacion_de_identidad/value = '1'" action="enable"
constraint=". = /form/obs/dia_de_cumpleanos/value" />

where dia_de_cumpleanos is written as
<dia_de_cumpleanos>


1
</dia_de_cumpleanos>

Joaquin

··· On Tue, Apr 19, 2011 at 2:23 PM, Yaw Anokwa wrote:

my intuition is that having a constraint that references a node should
work, but i haven't tried. maybe you could build a simple form for odk
collect and see if that works...

On Mon, Apr 18, 2011 at 16:32, Joaquín Blaya jblaya@ehealthsystems.cl wrote:

I had a question about placing a constraint in an Xform.I know that in
the
xform you can place a constraint on a value with the constraint tag in
the
bind such as below
<xf:bind id="confirmacion_dia_de_cumpleanos"
nodeset="/form/obs/confirmacion_dia_de_cumpleanos/value" type="xsd:int"
action="enable" constraint=". = 3"/>

However, I would like to know if there's a way to be able to place a
concept
value as the constraint instead of an int. i.e. the field would look like
this
<xf:bind id="confirmacion_dia_de_cumpleanos"
nodeset="/form/obs/confirmacion_dia_de_cumpleanos/value" type="xsd:int"
action="enable" constraint=". =
/form/obs/confirmacion_dia_de_cumpleanos/value"/>

where previously you had defined that concept as such
<confirmacion_dia_de_cumpleanos openmrs_concept="6101^confirmacion dia de
cumpleanos^99DCT" openmrs_datatype="NM">


1
</confirmacion_dia_de_cumpleanos>

The reason is that in ODK-Voice we're passing several values in from
OpenMRS
and we want to constrain a question with that value, but we'd like to not
have to modify the bind field every time, but rather have it use the
concept
field which we're passing in.

Thanks,

J

--
Post: opendatakit@googlegroups.com
Unsubscribe: opendatakit+unsubscribe@googlegroups.com
Options: http://groups.google.com/group/opendatakit?hl=en

--


Gerente de Desarrollo, eHealth Systems
Research Fellow, Escuela de Medicina de Harvard
Moderador, GHDOnline.org