[prev in list] [next in list] [prev in thread] [next in thread]
List: openmrs-implementers
Subject: Re: Groovy Logic Rule with HTML Form
From: Mark Goodrich <mgoodrich () pih ! org>
Date: 2014-10-14 19:09:40
Message-ID: 543D74F4.9060309 () pih ! org
[Download RAW message or body]
Can you deviate from the CIEL standard in this case? :)
Unfortunately, sorting in order of accession number would most likely be
the same level of difficulty as ordering by another characteristic...
sorry for the bad news!
Take care,
Mark
On 10/14/2014 10:59 AM, James Arbaugh wrote:
>
> Dear Mark (and others),
>
> I'm told it's not appropriate to add the coded sequence number to CIEL.
>
> As another "approximation" for getting the items in the fields they
> were originally entered, what if I used the accession number to store
> the dose, and HTML Form Entry returned the obs in order of accession
> number? How hard would that be to do?
>
> Something like this…
>
> <repeat>
>
> <template>
>
> <td class="tg-g902">
>
> <br><obs conceptId="CIEL:984" answerConceptId="CIEL:783"
> answerLabel="" style="checkbox" id="tet{dose}" showDate="true"
> showAccessionNumber="true" /></br>
>
> </td>
>
> </template>
>
> <render dose="1"/>
>
> <render dose="2"/>
>
> <render dose="3"/>
>
> <render dose="4"/>
>
> <render dose="5"/>
>
> </repeat>
>
> I would have to have all of the vaccinations entered the first time
> the form is filled out for this to work. This is no problem.
>
> Because you can't have a null obs_datetime in the database, and HTML
> Form Entry uses the encounter date by default, I can set a fixed
> obsdatetime with JavaScript (something like '0000-00-00' or whatever
> doesn't cause HTML Form entry/OpenMRS to complain) for empty dates on
> form submit, and clear them on form load. I would have to ignore the
> obs that don't have a valid obs_datetime in reporting which would NOT
> be intuitive to the average user doing an ad hock query.
>
> In the end, I wouldn't even show the accession number field on the
> form (so as to confuse the user, and they potentially enter "bad"
> accession numbers), but rather set it with JavaScript for each field.
> HTML-555 <https://issues.openmrs.org/browse/HTML-555>, would need to
> be fixed for that.
>
> Any thoughts or suggestions?
>
> Thanks,
>
> James
>
> *From:*James Arbaugh [mailto:james@haitianhealthfoundation.org
> <mailto:james@haitianhealthfoundation.org>]
> *Sent:* Monday, October 13, 2014 3:31 PM
> *To:* 'implementers@openmrs.org <mailto:implementers@openmrs.org>'
> *Subject:* RE: Groovy Logic Rule with HTML Form
>
> Dear Mark,
>
> Thank you so much for working on this problem with me!
>
> Some GREAT news… Your suggestion to use a coded sequence number
> rather than a numeric one worked! It works perfect; no mixing of the
> dates between the various vaccines, nor the wrong order of the doses.
>
> Now, if Andy can find it in the kindness of his heart to add those
> concepts to CIEL, I will be all set!
>
> Thank you Mark, Darius, and others for your help and suggestions!
>
> Thanks,
>
> James
>
> *From:*implementers@openmrs.org <mailto:implementers@openmrs.org>
> [mailto:implementers@openmrs.org] *On Behalf Of *Mark Goodrich
> *Sent:* Sunday, October 12, 2014 7:43 PM
> *To:* implementers@openmrs.org <mailto:implementers@openmrs.org>
> *Subject:* Re: Groovy Logic Rule with HTML Form
>
> James,
>
> A though--Html Form Entry *should* be able to match obs groups to the
> proper vaccines based on matching the answerConceptIds for the
> "Immunizations" questions to the answer to the corresponding obs. ​
> For better or worse, HFE goes through a lot of hoops to make this kind
> of match (which makes it harder to go and add other logic like
> orderBy, etc). So, if you were able to change the Sequence Number
> from a numeric to a coded (I know this would break the pattern in
> CIEL) and do something like this, it should (fingers crossed) work:
>
> <repeat>
>
> <template>
>
> <td class="tg-g902">
>
> <obsgroup groupingConceptId="CIEL:1441">
>
> <div class="hidden" id="tet_dose_vac"
> sectionTag="section" headerStyle="title" headerLabel="Tet Vaccine and
> Dose">
>
> <obs conceptId="CIEL:984" id="tet{dose}"
> answerConceptId="CIEL:104528" defaultValue="CIEL:104528"
> answerLabel="TETANUS" />
>
> <obs conceptId="CIEL:1418" id="tetdose{dose}"
> answerConceptId="{sequence_concept_id}"
> defaultValue="{sequence_concept_id}" />
>
> </div>
>
> <br><obs conceptId="CIEL:1410" id="tetdate{dose}" /></br>
>
> </obsgroup>
>
> </td>
>
> </template>
>
> <render dose="1" sequence_concept_id="[concept mapping for the
> '1st dose concept you'd need to create']"/>
>
> <render dose="2" sequence_concept_id="[concept mapping for the
> '2nd dose concept']"/>
>
> <render dose="3" sequence_concept_id="[concept mapping for the
> '3rd dose concept']"/>
>
> ------------------------------------------------------------------------
>
> *From:*implementers@openmrs.org <mailto:implementers@openmrs.org>
> <implementers@openmrs.org <mailto:implementers@openmrs.org>> on behalf
> of Mark Goodrich <mgoodrich@pih.org <mailto:mgoodrich@pih.org>>
> *Sent:* Sunday, October 12, 2014 6:40 PM
> *To:* implementers@openmrs.org <mailto:implementers@openmrs.org>
> *Subject:* Re: Groovy Logic Rule with HTML Form
>
> James,
>
> Ugh, Unfortunately, I spent a couple hours today working on
> implementing this but the code around obsgroup matching pretty obtuse
> and all I was doing was making it worse and even less maintainable
> without getting it to work properly... I stashed my changes for now
> just in case I get a chance to come back to it, or come up with a new
> approach, but no promises... :(
>
> Needless to say, what we really need is the form schemas for Html Form
> Entry, but that is a big project in itself...
>
> Take care.
> Mark
>
>
> On 10/08/2014 04:35 PM, James Arbaugh wrote:
>
> Hi Darius and Mark,
>
> Thank you! Thank you! Thank you!
>
> I think I understand how that would work, and I believe it would
> solve my current problem! This might be an even better solution
> than re-creating the obs table to add the field number as this
> could work for data that's already been entered. Would there be
> any possibility for the dates of the various vaccines getting
> mixed up. That happens now too. It's almost like you would need
> to specify the vaccine type in the group, or the concept that must
> match exactly.
>
> E.g. you'd do something like <obsgroup
> groupingConceptId="CIEL:1441" childId="CIEL:104528"
> orderBy="CIEL:1418">.
>
> For this to work in my use-case, I would need to ensure all
> sequence numbers are added to the obs table the first time the
> form is filled out (or when I import my legacy data), even if
> there isn't a date associated with that sequence number.
> Otherwise, if there were gaps in my sequence number; for example
> Polio not starting with dose 0, it would put Dose 1 in the Dose 0
> field.
>
> Is this something that could be done by the Community Development
> Swimlane, within the next couple weeks? How do I make that request?
>
> Thanks,
>
> James
>
> *From:*implementers@openmrs.org <mailto:implementers@openmrs.org>
> [mailto:implementers@openmrs.org
> <mailto:implementers@openmrs.org>] *On Behalf Of *Mark Goodrich
> *Sent:* Wednesday, October 8, 2014 4:12 PM
> *To:* implementers@openmrs.org <mailto:implementers@openmrs.org>;
> dev@openmrs.org <mailto:dev@openmrs.org>
> *Subject:* Re: Groovy Logic Rule with HTML Form
>
> That sounds like a reasonable suggestion.
>
> @James, would this work for your needs (ie, if you were able to
> sort by the "dose" value?)?
>
> Mark
>
>
> On 10/08/2014 03:38 PM, Darius Jazayeri wrote:
>
> Hi James,
>
> Recently I've been thinking that we can handle this sort of
> situation by automatically supporting the idea that repeated
> obs groups should be sorted by a numeric or date obs within
> the group.
>
> E.g. you'd do something like <obsgroup
> groupingConceptId="CIEL:1441" orderBy="CIEL:1418">.
>
> I suspect this is feasible to code, but I haven't looked
> closely. If you can find someone to work on it, Mark or I can
> point them to where they'd need to look.
>
>
> -Darius
>
> On Wed, Oct 8, 2014 at 12:19 PM, James Arbaugh
> <james@haitianhealthfoundation.org
> <mailto:james@haitianhealthfoundation.org>> wrote:
>
> Thank you all (Darius) for your thoughts, concerns and
> considerations.
>
> I have attached a screenshot showing what I'm trying to
> do. I'm patterning after our child consultation form and
> vaccine cards. Eventually it should appear with a date
> only, in each white box. Rows that have strike-through
> will only be displayed if a patient had one of the
> discontinued vaccines. In the screenshot, you see that
> Polio Dose 1 ended up in the Dose 0 box while editing the
> form. This is likely to cause confusion to the provider
> (or data entry clerk), and then in turn they try to change
> the ordering, which will shuffle the date and dose
> number. What's more, I can't do data validation with
> "getValue('tetdate1.value')" because the field "id"
> doesn't correspond with what's being displayed in that
> field anymore.
>
> To store the data, I am using the "CURRENT IMMUNIZATION
> ORDERS" concept set, CIEL:1441
> <http://www.maternalconceptlab.com/search.php?q=id:1441&source=openmrs>,
> which is advertised as best practice. We are not yet
> using manufacturer and lot number.
>
> ·*CURRENT IMMUNIZATION ORDERS* (1441
> <http://www.maternalconceptlab.com/search.php?q=id:1441&source=openmrs>)
>
> oIMMUNIZATIONS (984
> <http://www.maternalconceptlab.com/search.php?q=id:984&source=openmrs>)
>
> oIMMUNIZATION SEQUENCE NUMBER (1418
> <http://www.maternalconceptlab.com/search.php?q=id:1418&source=openmrs>)
>
> oVACCINATION DATE (1410
> <http://www.maternalconceptlab.com/search.php?q=id:1410&source=openmrs>)
>
> oVACCINE MANUFACTURER (1419
> <http://www.maternalconceptlab.com/search.php?q=id:1419&source=openmrs>)
>
> oVACCINE LOT NUMBER (1420
> <http://www.maternalconceptlab.com/search.php?q=id:1420&source=openmrs>)
>
> The code in the form looks something like this…
>
> <tr>
>
> <td class="tg-g902">Tetanus/Diphtheria</td>
>
> <td class="tg-ng6d"></td>
>
> <repeat>
>
> <template>
>
> <td class="tg-g902">
>
> <obsgroup groupingConceptId="CIEL:1441">
>
> <div class="hidden" id="tet_dose_vac" sectionTag="section"
> headerStyle="title" headerLabel="Tet Vaccine and Dose">
>
> <obs conceptId="CIEL:984" id="tet{dose}"
> answerConceptId="CIEL:104528" defaultValue="CIEL:104528"
> answerLabel="TETANUS" />
>
> <obs conceptId="CIEL:1418" id="tetdose{dose}"
> labelText="Dose" defaultValue="{dose}" />
>
> </div>
>
> <br><obs conceptId="CIEL:1410"
> id="tetdate{dose}" /></br>
>
> </obsgroup>
>
> </td>
>
> </template>
>
> <render dose="1"/>
>
> <render dose="2"/>
>
> <render dose="3"/>
>
> <render dose="4"/>
>
> <render dose="5"/>
>
> </repeat>
>
> </tr>
>
> There is enough data being stored in the obs table to be
> able to reconstruct the data into the proper table cells,
> using the sequence numbers. Thus my attempts at "manually"
> setting the values for each field using logic lookup and
> an SQL query.
>
> I would much prefer to see it fixed right rather than some
> "hack", but I need to get this form in use within a couple
> of weeks.
>
> Thanks,
>
> James
>
> *From:*James Arbaugh
> [mailto:james@haitianhealthfoundation.org
> <mailto:james@haitianhealthfoundation.org>]
> *Sent:* Friday, October 3, 2014 3:41 PM
> *To:* 'implementers@openmrs.org
> <mailto:implementers@openmrs.org>'
> *Subject:* RE: Groovy Logic Rule with HTML Form
>
> Dear Darius,
>
> Thanks again for your time and your suggestions.
>
> Option 1:
>
> import org.openmrs.api.context.Context;
>
> Context.getService(org.openmrs.api.AdministrationService.class).executeSql(...)
>
> Gives an error when you try to save it…
>
> startup failed:
>
> script141236435083386203824.groovy: 11: Unknown type:
> IMPORT at line: 11 column: 5. File:
> script141236435083386203824.groovy @ line 11, column 5.
>
> import org.openmrs.api.context.Context;
>
> ^
>
> 1 error
>
> .rule.ruleContent
>
> Option 2:
>
> org.openmrs.api.context.Context.getService(org.openmrs.api.AdministrationService.class).executeSql(...)
>
> Saves, but gives an error when it's executed…
>
> Hl7inQueue.queueList.errorMessage.header:
> groovy.lang.MissingMethodException: No signature of
> method: com.sun.proxy.$Proxy321.executeSql() is applicable
> for argument types: (java.lang.String, java.lang.Boolean)
> values: [select count(*) from users, false] Possible
> solutions: executeSQL(java.lang.String, boolean)
>
> Option 3:
>
> def ctx = new org.openmrs.api.context.Context();
>
> ctx.getService(org.openmrs.api.AdministrationService.class).executeSql(...)
>
> Saves, but gives an error when it's executed…
>
> Hl7inQueue.queueList.errorMessage.header:
> groovy.lang.MissingMethodException: No signature of
> method: com.sun.proxy.$Proxy321.executeSql() is applicable
> for argument types: (java.lang.String, java.lang.Boolean)
> values: [select count(*) from users, false] Possible
> solutions: executeSQL(java.lang.String, boolean)
>
> I assume I'm supposed to be sticking your snippits within
> the definition and replacing the … in executeSQL(…) with
> my values so the script looks like this for example…
>
> def callSql = {
>
> def ctx = new org.openmrs.api.context.Context();
>
> ctx.getService(org.openmrs.api.AdministrationService.class).executeSql(it,
> false)
>
> }
>
> rs = callSql("select count(*) from users")
>
> return new Result(rs)
>
> Is there a 4^th option?
>
> Thanks,
>
> James
>
> *From:*implementers@openmrs.org
> <mailto:implementers@openmrs.org>
> [mailto:implementers@openmrs.org] *On Behalf Of *Darius
> Jazayeri
> *Sent:* Friday, October 3, 2014 3:21 PM
>
>
> *To:* implementers
> *Subject:* Re: Groovy Logic Rule with HTML Form
>
> Ah. So, the groovy within HTML Form Entry doesn't have the
> same variables automatically set up as the groovy module.
> You'll need to do something like one of these three. (I
> don't know which will work offhand):
>
> import org.openmrs.api.context.Context;
>
> Context.getService(org.openmrs.api.AdministrationService.class).executeSql(...)
>
> org.openmrs.api.context.Context.getService(org.openmrs.api.AdministrationService.class).executeSql(...)
>
> def ctx = new org.openmrs.api.context.Context();
>
> ctx.getService(org.openmrs.api.AdministrationService.class).executeSql(...)
>
> -Darius
>
> PS- Again, I'm sure there's a better way to do this, this
> is just an offhand response.
>
> On Fri, Oct 3, 2014 at 3:16 PM, James Arbaugh
> <james@haitianhealthfoundation.org
> <mailto:james@haitianhealthfoundation.org>> wrote:
>
> Dear Darius,
>
> Thanks again for your time and assistance.
>
> Changing my script to match the definition and call…
>
> def callSql = {
>
> admin.executeSQL(it, false)
>
> }
>
> rs = callSql("select count(*) from users")
>
> return new Result(rs)
>
> I get a new error when I run it…
>
> Hl7inQueue.queueList.errorMessage.header:
> groovy.lang.MissingPropertyException: No such
> property: admin for class:
> org.openmrs.module.logic.rule.GroovyRule1
>
> So, taking it the next step further, suppose my query
> was "SELECT count(*) FROM `obs` WHERE `person_id`
> =40967"
>
> And I wanted it to dynamically replace 40967 with the
> patient that the from was run from.
>
> Thanks,
>
> James
>
> P.S. I'm still open to better suggestions!
>
> *From:*implementers@openmrs.org
> <mailto:implementers@openmrs.org>
> [mailto:implementers@openmrs.org
> <mailto:implementers@openmrs.org>] *On Behalf Of
> *Darius Jazayeri
> *Sent:* Friday, October 3, 2014 3:06 PM
>
>
> *To:* implementers
> *Subject:* Re: Groovy Logic Rule with HTML Form
>
> Oops, sorry, I switched the name of the function to
> "callSql", since I was slightly afraid that sql was a
> reserved word somewhere. Make the definition and the
> call match, and it should work.
>
> -Darius
>
> On Fri, Oct 3, 2014 at 3:04 PM, James Arbaugh
> <james@haitianhealthfoundation.org
> <mailto:james@haitianhealthfoundation.org>> wrote:
>
> Dear Darius,
>
> Thanks for your time, and your suggestion. When I
> transform my script to…
>
> def callSql = {
>
> admin.executeSQL(it, false)
>
> }
>
> rs = sql("select count(*) from users")
>
> return new Result(rs)
>
> The Groovy Logic Rule can save properly. When I
> try to run it, I get the error…
>
> Hl7inQueue.queueList.errorMessage.header:
> groovy.lang.MissingMethodException: No signature
> of method:
> org.openmrs.module.logic.rule.GroovyRule1.sql() is
> applicable for argument types: (java.lang.String)
> values: [select count(*) from users] Possible
> solutions: any(), split(groovy.lang.Closure),
> is(java.lang.Object), use([Ljava.lang.Object;),
> any(groovy.lang.Closure), wait()
>
> So, going back to my original question, how do I
> access the current patient in my Groovy script,
> and how do I return the results from my SQL query.
>
> I would be open to better options! Maybe applying
> TRUNK-2069
> <https://issues.openmrs.org/browse/TRUNK-2069> and
> implementing it in HTML Form Entry.
>
> Thanks,
>
> James
>
> *From:*implementers@openmrs.org
> <mailto:implementers@openmrs.org>
> [mailto:implementers@openmrs.org
> <mailto:implementers@openmrs.org>] *On Behalf Of
> *Darius Jazayeri
> *Sent:* Friday, October 3, 2014 11:53 AM
> *To:* implementers
> *Subject:* Re: Groovy Logic Rule with HTML Form
>
> I only skimmed this very quickly, so it's possible
> there are better solutions to the issues at the
> top of the email, but very specifically about
> groovy, try doing:
>
> def callSql = {
>
> admin.executeSQL(it, false)
>
> }
>
> -Darius
>
> On Fri, Oct 3, 2014 at 11:42 AM, James Arbaugh
> <james@haitianhealthfoundation.org
> <mailto:james@haitianhealthfoundation.org>> wrote:
>
> Greetings all.
>
> The short question: How can I run a SQL
> command (accessing the current
> patient) with a Groovy script called through
> an HTML Form Entry logic
> expression?
>
> The long question (and history):
> I am trying to populate my HTML form
> accurately during editing (an attempt
> to manually overcome
> https://issues.openmrs.org/browse/TRUNK-2069)
> for a
> vaccination form that captures the dates of
> vaccinations with the
> vaccination type and dose specified by their
> position in a table. The
> vaccines are stored in a concept set (Current
> Immunizations Orders), so I
> do know all the details and where things
> should be placed. Because it
> re-populates the data in random order I end up
> with "corrupt" information
> which throws off my JavaScript error checking
> rules.
>
> My first attempt was to store the data into an
> array in a lookup
> complexExpression so I can find the actual
> date for that vaccine type and
> sequence number and put it into the field with
> JavaScript with setValue()
> with a statement like this...
>
> Load Vaccine Array: <lookup
> complexExpression="#foreach( $vac in
> $fn.allObs(984) )
> #set($vaccine[$vac.valueCoded] =
> $vac.obsGroup) #end"/>
>
> ...but, I get an error message (which I assume
> is a bug)...
> Velocity Error! Encountered "[" at
> org.openmrs.module.htmlformentry.FormEntrySession[line
> 1, column 50] Was
> expecting one of: ... "=" ... ...
>
> I tried putting the array assignment in
> JavaScript with errors too.
>
> I think I can do exactly what I need to do
> with fn.logic(), but I need to
> know how to tell the Groovy script to use the
> current patient. On the
> HTML Reference page I seen an example like...
> Latest BMI: <lookup
> expression="fn.logic('BMI')"/> <!-- requires
> that you
> have a BMI rule registered -->
> ...but I don't have an example of what is in
> the logic rule, or how the
> current patient is specified. I couldn't find
> anything helpful while
> looking through the Groovy Module examples either.
>
> When I try to run a simple Groovy SQL rule like...
> def sql(s) { admin.executeSQL(s,false) }
> rs = sql("select count(*) from users")
> return new Result(rs),
>
> I get an error like...
> startup failed:
> script14123503865371225136415.groovy: 10:
> Unknown type: METHOD_DEF at
> line: 10 column: 1. File:
> script14123503865371225136415.groovy @ line 10,
> column 1.
> def sql(s) { admin.executeSQL(s,false) }
> ^
> 1 error
> .rule.ruleContent
>
> Hopefully this is a quick easy answer for
> someone smarter than I!
>
> Thanks,
> James
>
> --
> OpenMRS Implementers: http://om.rs/implist
> Post: implementers@openmrs.org | Unsubscribe:
> implementers+unsubscribe@openmrs.org
> Manage your OpenMRS subscriptions at http://om.rs/id
>
> Visit OpenMRS Talk for in-depth & casual conversation:
> https://talk.openmrs.org/
> To unsubscribe from this group and stop receiving emails from it, send
> an email to implementers+unsubscribe@openmrs.org
> <mailto:implementers+unsubscribe@openmrs.org>.
--
OpenMRS Implementers: http://om.rs/implist
Post: implementers@openmrs.org | Unsubscribe: implementers+unsubscribe@openmrs.org
Manage your OpenMRS subscriptions at http://om.rs/id
Visit OpenMRS Talk for in-depth & casual conversation: https://talk.openmrs.org/
To unsubscribe from this group and stop receiving emails from it, send an email to \
implementers+unsubscribe@openmrs.org.
[Attachment #3 (text/html)]
<html>
<head>
<meta content="text/html; charset=utf-8" http-equiv="Content-Type">
</head>
<body bgcolor="#FFFFFF" text="#000000">
<div class="moz-cite-prefix">Can you deviate from the CIEL standard
in this case? :)<br>
<br>
Unfortunately, sorting in order of accession number would most
likely be the same level of difficulty as ordering by another
characteristic... sorry for the bad news!<br>
<br>
Take care,<br>
Mark<br>
<br>
<br>
On 10/14/2014 10:59 AM, James Arbaugh wrote:<br>
</div>
<blockquote
cite="mid:6ec0123191d0e23ecd5c15875a96702b@mail.gmail.com"
type="cite">
<meta http-equiv="Content-Type" content="text/html; charset=utf-8">
<meta name="Generator" content="Microsoft Word 15 (filtered
medium)">
<style><!--
/* Font Definitions */
@font-face
{font-family:"Cambria Math";
panose-1:2 4 5 3 5 4 6 3 2 4;}
@font-face
{font-family:Calibri;
panose-1:2 15 5 2 2 2 4 3 2 4;}
@font-face
{font-family:Verdana;
panose-1:2 11 6 4 3 5 4 4 2 4;}
@font-face
{font-family:"Times New\000D\000A Ro";}
@font-face
{font-family:"Courier New \;color\:black";}
@font-face
{font-family:"Times New";}
@font-face
{font-family:Times;
panose-1:2 2 6 3 5 4 5 2 3 4;}
@font-face
{font-family:"Times New Roman \, serif";
panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:"Times New Roma \, serif";
panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:"Times New Ro \, serif";
panose-1:0 0 0 0 0 0 0 0 0 0;}
@font-face
{font-family:"Times \, serif";
panose-1:0 0 0 0 0 0 0 0 0 0;}
/* Style Definitions */
p.MsoNormal, li.MsoNormal, div.MsoNormal
{margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";
color:black;}
a:link, span.MsoHyperlink
{mso-style-priority:99;
color:blue;
text-decoration:underline;}
a:visited, span.MsoHyperlinkFollowed
{mso-style-priority:99;
color:purple;
text-decoration:underline;}
p
{mso-style-priority:99;
margin:0in;
margin-bottom:.0001pt;
font-size:12.0pt;
font-family:"Times New Roman","serif";}
p.msochpdefault, li.msochpdefault, div.msochpdefault
{mso-style-name:msochpdefault;
mso-style-priority:99;
margin:0in;
margin-bottom:.0001pt;
font-size:10.0pt;
font-family:"Times New Roman","serif";}
span.emailstyle18
{mso-style-name:emailstyle18;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.EmailStyle20
{mso-style-type:personal;
font-family:"Calibri","sans-serif";
color:#1F497D;}
span.EmailStyle21
{mso-style-type:personal-reply;
font-family:"Calibri","sans-serif";
color:#1F497D;}
.MsoChpDefault
{mso-style-type:export-only;
font-size:10.0pt;}
@page WordSection1
{size:8.5in 11.0in;
margin:1.0in 1.0in 1.0in 1.0in;}
div.WordSection1
{page:WordSection1;}
--></style>
<div class="WordSection1">
<p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Dear
Mark (and others),</span></font></p>
<p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I'm
told it's not appropriate to add the coded sequence number
to CIEL. </span></font></p>
<p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">As
another "approximation" for getting the items in the
fields they were originally entered, what if I used the
accession number to store the dose, and HTML Form Entry
returned the obs in order of accession number? How hard
would that be to do?</span></font></p>
<p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Something
like this…</span></font></p>
<p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><repeat></span></font></p>
<p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
<template></span></font></p>
<p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
<td class="tg-g902"></span></font></p>
<p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
<br><obs conceptId="CIEL:984"
answerConceptId="CIEL:783" answerLabel=""
style="checkbox" id="tet{dose}" showDate="true"
showAccessionNumber="true" /></br></span></font></p>
<p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</td></span></font></p>
<p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</template></span></font></p>
<p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
<render dose="1"/></span></font></p>
<p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
<render dose="2"/></span></font></p>
<p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
<render dose="3"/></span></font></p>
<p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
<render dose="4"/></span></font></p>
<p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
<render dose="5"/></span></font></p>
<p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"></repeat></span></font></p>
<p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I
would have to have all of the vaccinations entered the
first time the form is filled out for this to work. This
is no problem. </span></font></p>
<p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Because
you can't have a null obs_datetime in the database, and
HTML Form Entry uses the encounter date by default, I can
set a fixed obsdatetime with JavaScript (something like
'0000-00-00' or whatever doesn't cause HTML Form
entry/OpenMRS to complain) for empty dates on form submit,
and clear them on form load. I would have to ignore the
obs that don't have a valid obs_datetime in reporting
which would NOT be intuitive to the average user doing an
ad hock query.</span></font></p>
<p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">In
the end, I wouldn't even show the accession number field
on the form (so as to confuse the user, and they
potentially enter "bad" accession numbers), but rather set
it with JavaScript for each field. <a
moz-do-not-send="true"
href="https://issues.openmrs.org/browse/HTML-555">HTML-555</a>,
would need to be fixed for that.</span></font></p>
<p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Any
thoughts or suggestions?</span></font></p>
<p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thanks,</span></font></p>
<p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">James</span></font></p>
<p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <div>
<div style="border:none;border-top:solid #e1e1e1
1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><font color="black" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:windowtext;font-weight:bold">From:</span></font></b><font
color="black" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:windowtext">
James Arbaugh [mailto:<a moz-do-not-send="true"
href="mailto:james@haitianhealthfoundation.org">james@haitianhealthfoundation.org</a>]
<br>
<b><span style="font-weight:bold">Sent:</span></b>
Monday, October 13, 2014 3:31 PM<br>
<b><span style="font-weight:bold">To:</span></b> '<a
moz-do-not-send="true"
href="mailto:implementers@openmrs.org">implementers@openmrs.org</a>'<br>
<b><span style="font-weight:bold">Subject:</span></b>
RE: Groovy Logic Rule with HTML Form</span></font></p>
</div>
</div>
<p class="MsoNormal"><font color="black" face="Times New Roman"
size="3"><span style="font-size:12.0pt"> </span></font></p>
<p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Dear
Mark,</span></font></p>
<p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thank
you so much for working on this problem with me!</span></font></p>
<p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Some
GREAT news… Your suggestion to use a coded sequence
number rather than a numeric one worked! It works
perfect; no mixing of the dates between the various
vaccines, nor the wrong order of the doses.</span></font></p>
<p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Now,
if Andy can find it in the kindness of his heart to add
those concepts to CIEL, I will be all set!</span></font></p>
<p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thank
you Mark, Darius, and others for your help and
suggestions!</span></font></p>
<p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thanks,</span></font></p>
<p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">James</span></font></p>
<p class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <div>
<div style="border:none;border-top:solid #e1e1e1
1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><font color="black" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:windowtext;font-weight:bold">From:</span></font></b><font
color="black" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:windowtext">
<a moz-do-not-send="true"
href="mailto:implementers@openmrs.org">implementers@openmrs.org</a>
[<a moz-do-not-send="true"
href="mailto:implementers@openmrs.org">mailto:implementers@openmrs.org</a>]
<b><span style="font-weight:bold">On Behalf Of </span></b>Mark
Goodrich<br>
<b><span style="font-weight:bold">Sent:</span></b>
Sunday, October 12, 2014 7:43 PM<br>
<b><span style="font-weight:bold">To:</span></b> <a
moz-do-not-send="true"
href="mailto:implementers@openmrs.org">implementers@openmrs.org</a><br>
<b><span style="font-weight:bold">Subject:</span></b>
Re: Groovy Logic Rule with HTML Form</span></font></p>
</div>
</div>
<p class="MsoNormal"><font color="black" face="Times New Roman"
size="3"><span style="font-size:12.0pt"> </span></font></p>
<p><font color="black" face="Calibri" size="3"><span
style="font-size:12.0pt;font-family:"Calibri","sans-serif";color:black">James,</span></font></p>
<p><font color="black" face="Calibri" size="3"><span
style="font-size:12.0pt;font-family:"Calibri","sans-serif";color:black"> \
</span></font></p> <p><font color="black" face="Calibri" size="3"><span
style="font-size:12.0pt;font-family:"Calibri","sans-serif";color:black">A
though--Html Form Entry *should* be able to match obs
groups to the proper vaccines based on matching the
answerConceptIds for the "Immunizations" questions to the
answer to the corresponding obs. ​For better or worse,
HFE goes through a lot of hoops to make this kind of match
(which makes it harder to go and add other logic like
orderBy, etc). So, if you were able to change the
Sequence Number from a numeric to a coded (I know this
would break the pattern in CIEL) and do something like
this, it should (fingers crossed) work:</span></font></p>
<p><font color="black" face="Calibri" size="3"><span
style="font-size:12.0pt;font-family:"Calibri","sans-serif";color:black"> \
</span></font></p> <p style="background:white;vertical-align:baseline"><font
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d;border:none
windowtext 1.0pt;padding:0in"><repeat></span></font><font
color="#222222" face="Arial"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222"></span></font></p>
<p style="background:white;vertical-align:baseline"><font
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d;border:none
windowtext 1.0pt;padding:0in"> \
<template></span></font><font color="#222222" face="Arial"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222"></span></font></p>
<p style="background:white;vertical-align:baseline"><font
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d;border:none
windowtext 1.0pt;padding:0in"> <td
class="tg-g902"></span></font><font color="#222222"
face="Arial"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222"></span></font></p>
<p style="background:white;vertical-align:baseline"><font
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d;border:none
windowtext 1.0pt;padding:0in"> <obsgroup
groupingConceptId="CIEL:1441"></span></font><font
color="#222222" face="Arial"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222"></span></font></p>
<p style="background:white;vertical-align:baseline"><font
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d;border:none
windowtext 1.0pt;padding:0in"> <div
class="hidden" id="tet_dose_vac" sectionTag="section"
headerStyle="title" headerLabel="Tet Vaccine and \
Dose"></span></font><font color="#222222" face="Arial"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222"></span></font></p>
<p style="background:white;vertical-align:baseline"><font
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d;border:none
windowtext 1.0pt;padding:0in"> \
<obs conceptId="CIEL:984" id="tet{dose}"
answerConceptId="CIEL:104528" defaultValue="CIEL:104528"
answerLabel="TETANUS" /></span></font><font
color="#222222" face="Arial"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222"></span></font></p>
<p style="background:white;vertical-align:baseline"><font
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d;border:none
windowtext 1.0pt;padding:0in"> \
<obs conceptId="CIEL:1418" id="tetdose{dose}" </span></font><font
color="#1f497d" face="Calibri" size="3"><span
style="font-size:11.5pt;font-family:"Calibri","sans-serif";color:#1f497d;border:none
windowtext \
1.0pt;padding:0in;background:white">answerConceptId="{sequence_concept_id}" \
defaultValue="{sequence_concept_id}" </span></font><font color="#1f497d" \
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d;border:none
windowtext 1.0pt;padding:0in">/></span></font><font
color="#222222" face="Arial"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222"></span></font></p>
<p style="background:white;vertical-align:baseline"><font
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d;border:none
windowtext 1.0pt;padding:0in"> \
</div></span></font><font color="#222222" face="Arial"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222"></span></font></p>
<p style="background:white;vertical-align:baseline"><font
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d;border:none
windowtext 1.0pt;padding:0in"> \
<br><obs
conceptId="CIEL:1410" id="tetdate{dose}" \
/></br></span></font><font color="#222222" face="Arial"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222"></span></font></p>
<p style="background:white;vertical-align:baseline"><font
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d;border:none
windowtext 1.0pt;padding:0in"> \
</obsgroup></span></font><font color="#222222" face="Arial"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222"></span></font></p>
<p style="background:white;vertical-align:baseline"><font
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d;border:none
windowtext 1.0pt;padding:0in"> \
</td></span></font><font color="#222222" face="Arial"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222"></span></font></p>
<p style="background:white;vertical-align:baseline"><font
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d;border:none
windowtext 1.0pt;padding:0in"> \
</template></span></font><font color="#222222" face="Arial"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222"></span></font></p>
<p style="background:white;vertical-align:baseline"><font
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d;border:none
windowtext 1.0pt;padding:0in"> <render dose="1"
sequence_concept_id="[concept mapping for the '1st dose
concept you'd need to create']"/></span></font><font
color="#222222" face="Arial"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222"></span></font></p>
<p style="background:white;vertical-align:baseline"><font
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d;border:none
windowtext 1.0pt;padding:0in"> <render \
dose="2"</span></font><font color="#1f497d" face="Calibri" size="3"><span
style="font-size:11.5pt;font-family:"Calibri","sans-serif";color:#1f497d;border:none
windowtext 1.0pt;padding:0in;background:white"> \
sequence_concept_id="[concept mapping for the '2nd dose \
concept']"/></span></font><font color="#222222" face="Arial"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222"></span></font></p>
<p style="background:white;vertical-align:baseline"><font
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d;border:none
windowtext 1.0pt;padding:0in"> <render \
dose="3"</span></font><font color="#1f497d" face="Calibri" size="3"><span
style="font-size:11.5pt;font-family:"Calibri","sans-serif";color:#1f497d;border:none
windowtext 1.0pt;padding:0in;background:white"> \
sequence_concept_id="[concept mapping for the '3rd dose \
concept']"/></span></font><font color="#222222" face="Arial"><span
style="font-size:10.0pt;font-family:"Arial","sans-serif";color:#222222"></span></font></p>
<p><font color="black" face="Calibri" size="3"><span
style="font-size:12.0pt;font-family:"Calibri","sans-serif";color:black"> \
</span></font></p> <div>
<div class="MsoNormal" style="text-align:center"
align="center"><font color="#212121" face="Calibri" size="3"><span
style="font-size:12.0pt;font-family:"Calibri","sans-serif";color:#212121">
<hr align="center" size="3" width="98%"></span></font></div>
<div id="divRplyFwdMsg">
<p class="MsoNormal"><b><font color="black" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";font-weight:bold">From:</span></font></b><font
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif"">
<a moz-do-not-send="true"
href="mailto:implementers@openmrs.org">implementers@openmrs.org</a>
<<a moz-do-not-send="true"
href="mailto:implementers@openmrs.org">implementers@openmrs.org</a>>
on behalf of Mark Goodrich <<a
moz-do-not-send="true"
href="mailto:mgoodrich@pih.org">mgoodrich@pih.org</a>><br>
<b><span style="font-weight:bold">Sent:</span></b>
Sunday, October 12, 2014 6:40 PM<br>
<b><span style="font-weight:bold">To:</span></b> <a
moz-do-not-send="true"
href="mailto:implementers@openmrs.org">implementers@openmrs.org</a><br>
<b><span style="font-weight:bold">Subject:</span></b>
Re: Groovy Logic Rule with HTML Form</span></font><font
color="#212121" face="Calibri"><span
style="font-family:"Calibri","sans-serif";color:#212121">
</span></font></p>
<div>
<p class="MsoNormal"><font color="#212121" face="Calibri"
size="3"><span
style="font-size:12.0pt;font-family:"Calibri","sans-serif";color:#212121"> \
</span></font></p> </div>
</div>
<div>
<div>
<p class="MsoNormal"><font color="#212121" face="Calibri"
size="3"><span
style="font-size:12.0pt;font-family:"Calibri","sans-serif";color:#212121">James,<br>
<br>
Ugh, Unfortunately, I spent a couple hours today
working on implementing this but the code around
obsgroup matching pretty obtuse and all I was doing
was making it worse and even less maintainable
without getting it to work properly... I stashed my
changes for now just in case I get a chance to come
back to it, or come up with a new approach, but no
promises... :(<br>
<br>
Needless to say, what we really need is the form
schemas for Html Form Entry, but that is a big
project in itself...<br>
<br>
Take care.<br>
Mark<br>
<br>
<br>
On 10/08/2014 04:35 PM, James Arbaugh wrote:</span></font></p>
</div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Hi
Darius and Mark,</span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thank
you! Thank you! Thank you!</span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I
think I understand how that would work, and I
believe it would solve my current problem! This
might be an even better solution than re-creating
the obs table to add the field number as this
could work for data that's already been entered.
Would there be any possibility for the dates of
the various vaccines getting mixed up. That
happens now too. It's almost like you would need
to specify the vaccine type in the group, or the
concept that must match exactly.</span></font></p>
<p class="MsoNormal"><font color="black" face="Times New
Roman" size="3"><span style="font-size:12.0pt"> \
</span></font></p> <p class="MsoNormal"><font color="black" face="Times New
Roman" size="3"><span style="font-size:12.0pt">E.g.
you'd do something like <obsgroup
groupingConceptId="CIEL:1441"
childId="CIEL:104528" \
orderBy="CIEL:1418">.</span></font></p> <p class="MsoNormal"><font \
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">For
this to work in my use-case, I would need to
ensure all sequence numbers are added to the obs
table the first time the form is filled out (or
when I import my legacy data), even if there isn't
a date associated with that sequence number.
Otherwise, if there were gaps in my sequence
number; for example Polio not starting with dose
0, it would put Dose 1 in the Dose 0 field.</span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Is
this something that could be done by the Community
Development Swimlane, within the next couple
weeks? How do I make that request?</span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thanks,</span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">James</span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <div>
<div style="border:none;border-top:solid #e1e1e1
1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><font color="black"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:windowtext;font-weight:bold">From:</span></font></b><font
color="black" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:windowtext">
<a moz-do-not-send="true"
\
href="mailto:implementers@openmrs.org">implementers@openmrs.org</a> [mailto:<a \
moz-do-not-send="true"
\
href="mailto:implementers@openmrs.org">implementers@openmrs.org</a>] <b><span \
style="font-weight:bold">On Behalf Of </span></b>Mark Goodrich<br>
<b><span style="font-weight:bold">Sent:</span></b>
Wednesday, October 8, 2014 4:12 PM<br>
<b><span style="font-weight:bold">To:</span></b>
<a moz-do-not-send="true"
\
href="mailto:implementers@openmrs.org">implementers@openmrs.org</a>; <a \
moz-do-not-send="true"
href="mailto:dev@openmrs.org">dev@openmrs.org</a><br>
<b><span style="font-weight:bold">Subject:</span></b>
Re: Groovy Logic Rule with HTML Form</span></font></p>
</div>
</div>
<p class="MsoNormal"><font color="black" face="Times New
Roman" size="3"><span style="font-size:12.0pt"> \
</span></font></p> <div>
<p class="MsoNormal"><font color="black" face="Times
New Roman , serif" size="3"><span
style="font-size:12.0pt;font-family:"Times
New Roman , serif","serif"">That
sounds like a reasonable suggestion.<br>
<br>
@James, would this work for your needs (ie, if
you were able to sort by the "dose" value?)?<br>
<br>
Mark<br>
<br>
<br>
On 10/08/2014 03:38 PM, Darius Jazayeri \
wrote:</span></font></p> </div>
<blockquote style="margin-top:5.0pt;margin-bottom:5.0pt">
<div>
<p class="MsoNormal"><font color="black" face="Times
New Roma , serif" size="3"><span
style="font-size:12.0pt;font-family:"Times
New Roma , serif","serif"">Hi
James, </span></font></p>
<div>
<p class="MsoNormal"><font color="black"
face="Times New Ro , serif" size="3"><span
style="font-size:12.0pt;font-family:"Times
New Ro , serif","serif""> \
</span></font></p> </div>
<div>
<p class="MsoNormal"><font color="black"
face="Times New Ro , serif" size="3"><span
style="font-size:12.0pt;font-family:"Times
New Ro , serif","serif"">Recently
I've been thinking that we can handle this
sort of situation by automatically
supporting the idea that repeated obs groups
should be sorted by a numeric or date obs
within the group.</span></font></p>
</div>
<div>
<p class="MsoNormal"><font color="black"
face="Times New Ro , serif" size="3"><span
style="font-size:12.0pt;font-family:"Times
New Ro , serif","serif""> \
</span></font></p> </div>
<div>
<p class="MsoNormal"><font color="black"
face="Times New Ro , serif" size="3"><span
style="font-size:12.0pt;font-family:"Times
New Ro , serif","serif"">E.g.
you'd do something like <obsgroup
groupingConceptId="CIEL:1441"
orderBy="CIEL:1418">.</span></font></p>
</div>
<div>
<p class="MsoNormal"><font color="black"
face="Times New Ro , serif" size="3"><span
style="font-size:12.0pt;font-family:"Times
New Ro , serif","serif""> \
</span></font></p> </div>
<div>
<p class="MsoNormal"><font color="black"
face="Times New Ro , serif" size="3"><span
style="font-size:12.0pt;font-family:"Times
New Ro , serif","serif"">I
suspect this is feasible to code, but I
haven't looked closely. If you can find
someone to work on it, Mark or I can point
them to where they'd need to look.</span></font></p>
</div>
<div>
<p class="MsoNormal"><font color="#1f497d"
face="Times New Ro" size="3"><span
style="font-size:12.0pt;font-family:"Times
New\00000a Ro";color:#1f497d"><br>
</span></font>-Darius</p>
</div>
</div>
<div>
<p class="MsoNormal"><font color="black" face="Times
New Roma , serif" size="3"><span
style="font-size:12.0pt;font-family:"Times
New Roma , serif","serif""> \
</span></font></p> <div>
<p class="MsoNormal"><font color="black"
face="Times New Ro , serif" size="3"><span
style="font-size:12.0pt;font-family:"Times
New Ro , serif","serif"">On
Wed, Oct 8, 2014 at 12:19 PM, James Arbaugh
<<a moz-do-not-send="true"
href="mailto:james@haitianhealthfoundation.org"
\
target="_blank">james@haitianhealthfoundation.org</a>> wrote:</span></font></p>
<blockquote style="border:none;border-left:solid
#cccccc 1.0pt;padding:0in 0in 0in
6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thank
you all (Darius) for your thoughts,
concerns and considerations.</span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I
have attached a screenshot showing
what I'm trying to do. I'm patterning
after our child consultation form and
vaccine cards. Eventually it should
appear with a date only, in each white
box. Rows that have strike-through
will only be displayed if a patient
had one of the discontinued vaccines.
In the screenshot, you see that Polio
Dose 1 ended up in the Dose 0 box
while editing the form. This is
likely to cause confusion to the
provider (or data entry clerk), and
then in turn they try to change the
ordering, which will shuffle the date
and dose number. What's more, I can't
do data validation with
"getValue('tetdate1.value')" because
the field "id" doesn't correspond with
what's being displayed in that field
anymore.</span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">To
store the data, I am using the
"CURRENT IMMUNIZATION ORDERS" concept
set, <a moz-do-not-send="true"
href="http://www.maternalconceptlab.com/search.php?q=id:1441&source=openmrs"
target="_blank">CIEL:1441</a>, which
is advertised as best practice. We
are not yet using manufacturer and lot
number.</span></font></p>
<p class="MsoNormal"><font color="black"
face="Symbol"><span
style="font-size:10.0pt;font-family:Symbol"> \
·</span></font><font
size="1"><span style="font-size:7.0pt">
</span></font><b><font face="Arial"
size="1"><span
style="font-size:9.0pt;font-family:"Arial","sans-serif";font-weight:bold">CURRENT
IMMUNIZATION ORDERS</span></font></b><font
face="Arial" size="1"><span
style="font-size:8.0pt;font-family:"Arial","sans-serif""> (<a
moz-do-not-send="true"
href="http://www.maternalconceptlab.com/search.php?q=id:1441&source=openmrs"
target="_blank"><span
\
style="text-decoration:none">1441</span></a>)</span></font></p> <p class="MsoNormal"
style="margin-left:.5in"><font
color="black" face="Courier New
;color:black" size="3"><span
style="font-size:12.0pt;font-family:"Courier
New ;color:black"">o</span></font><font
size="1"><span style="font-size:7.0pt">
</span></font><font face="Arial"
size="1"><span
style="font-size:8.0pt;font-family:"Arial","sans-serif"">IMMUNIZATIONS \
(<a moz-do-not-send="true"
href="http://www.maternalconceptlab.com/search.php?q=id:984&source=openmrs"
target="_blank"><span
\
style="text-decoration:none">984</span></a>)</span></font></p> <p class="MsoNormal"
style="margin-left:.5in"><font
color="black" face="Courier New
;color:black" size="3"><span
style="font-size:12.0pt;font-family:"Courier
New ;color:black"">o</span></font><font
size="1"><span style="font-size:7.0pt">
</span></font><font face="Arial"
size="1"><span
style="font-size:8.0pt;font-family:"Arial","sans-serif"">IMMUNIZATION
SEQUENCE NUMBER (<a
moz-do-not-send="true"
href="http://www.maternalconceptlab.com/search.php?q=id:1418&source=openmrs"
target="_blank"><span
\
style="text-decoration:none">1418</span></a>)</span></font></p> <p class="MsoNormal"
style="margin-left:.5in"><font
color="black" face="Courier New
;color:black" size="3"><span
style="font-size:12.0pt;font-family:"Courier
New ;color:black"">o</span></font><font
size="1"><span style="font-size:7.0pt">
</span></font><font face="Arial"
size="1"><span
style="font-size:8.0pt;font-family:"Arial","sans-serif"">VACCINATION
DATE (<a moz-do-not-send="true"
href="http://www.maternalconceptlab.com/search.php?q=id:1410&source=openmrs"
target="_blank"><span
\
style="text-decoration:none">1410</span></a>)</span></font></p> <p class="MsoNormal"
style="margin-left:.5in"><font
color="black" face="Courier New
;color:black" size="3"><span
style="font-size:12.0pt;font-family:"Courier
New ;color:black"">o</span></font><font
size="1"><span style="font-size:7.0pt">
</span></font><font face="Arial"
size="1"><span
style="font-size:8.0pt;font-family:"Arial","sans-serif"">VACCINE
MANUFACTURER (<a
moz-do-not-send="true"
href="http://www.maternalconceptlab.com/search.php?q=id:1419&source=openmrs"
target="_blank"><span
\
style="text-decoration:none">1419</span></a>)</span></font></p> <p class="MsoNormal"
style="margin-left:.5in"><font
color="black" face="Courier New
;color:black" size="3"><span
style="font-size:12.0pt;font-family:"Courier
New ;color:black"">o</span></font><font
size="1"><span style="font-size:7.0pt">
</span></font><font face="Arial"
size="1"><span
style="font-size:8.0pt;font-family:"Arial","sans-serif"">VACCINE
LOT NUMBER (<a moz-do-not-send="true"
href="http://www.maternalconceptlab.com/search.php?q=id:1420&source=openmrs"
target="_blank"><span
\
style="text-decoration:none">1420</span></a>)</span></font></p> <p \
class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">The
code in the form looks something like
this…</span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
<tr></span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
<td
\
class="tg-g902">Tetanus/Diphtheria</td></span></font></p> <p \
class="MsoNormal"><font color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
<td \
class="tg-ng6d"></td></span></font></p> <p class="MsoNormal"><font \
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"><repeat></span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
<template></span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
<td class="tg-g902"></span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
<obsgroup
groupingConceptId="CIEL:1441"></span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
<div class="hidden"
id="tet_dose_vac" sectionTag="section"
headerStyle="title" headerLabel="Tet
Vaccine and Dose"></span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
<obs conceptId="CIEL:984"
id="tet{dose}"
answerConceptId="CIEL:104528"
defaultValue="CIEL:104528"
answerLabel="TETANUS" /></span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
<obs conceptId="CIEL:1418"
id="tetdose{dose}" labelText="Dose"
defaultValue="{dose}" /></span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</div> </span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
<br><obs conceptId="CIEL:1410"
id="tetdate{dose}" \
/></br></span></font></p> <p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</obsgroup></span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</td></span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</template></span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
<render dose="1"/></span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
<render dose="2"/></span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
<render dose="3"/></span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
<render dose="4"/></span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
<render dose="5"/></span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"></repeat></span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</tr></span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">There
is enough data being stored in the obs
table to be able to reconstruct the
data into the proper table cells,
using the sequence numbers. Thus my
attempts at "manually" setting the
values for each field using logic
lookup and an SQL query.</span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I
would much prefer to see it fixed
right rather than some "hack", but I
need to get this form in use within a
couple of weeks.</span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thanks,</span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">James</span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <div>
<div style="border:none;border-top:solid
#e1e1e1 1.0pt;padding:3.0pt 0in 0in 0in">
<p class="MsoNormal"><b><font
color="black" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";font-weight:bold">From:</span></font></b><font
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif"">
James Arbaugh [mailto:<a
moz-do-not-send="true"
\
href="mailto:james@haitianhealthfoundation.org"
\
target="_blank">james@haitianhealthfoundation.org</a>] <br>
<b><span \
style="font-weight:bold">Sent:</span></b> Friday, October 3, 2014 3:41 PM<br>
<b><span \
style="font-weight:bold">To:</span></b> '<a moz-do-not-send="true"
href="mailto:implementers@openmrs.org"
\
target="_blank">implementers@openmrs.org</a>'<br>
<b><span \
style="font-weight:bold">Subject:</span></b> RE: Groovy Logic Rule with HTML
Form</span></font></p>
</div>
</div>
<p class="MsoNormal"><font color="black"
face="Times New Roman" size="3"><span
style="font-size:12.0pt"> </span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Dear
Darius,</span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thanks
again for your time and your
suggestions.</span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Option
1:</span></font></p>
<p class="MsoNormal"><font color="black"
face="Times New Roman" size="3"><span
style="font-size:12.0pt">import
org.openmrs.api.context.Context;</span></font></p>
<p class="MsoNormal"><font color="black"
face="Times New Roman" size="3"><span
\
style="font-size:12.0pt">Context.getService(org.openmrs.api.AdministrationService.class).executeSql(...)</span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Gives
an error when you try to save \
it…</span></font></p> <p class="MsoNormal"><font color="black"
face="Verdana"><span
style="font-size:11.0pt;font-family:"Verdana","sans-serif"">startup
failed:</span></font></p>
<p class="MsoNormal"><font color="black"
face="Verdana"><span
style="font-size:11.0pt;font-family:"Verdana","sans-serif"">script141236435083386203824.groovy:
11: Unknown type: IMPORT at line: 11
column: 5. File:
script141236435083386203824.groovy @
line 11, column 5.</span></font></p>
<p class="MsoNormal"><font color="black"
face="Verdana"><span
style="font-size:11.0pt;font-family:"Verdana","sans-serif""> \
import
org.openmrs.api.context.Context;</span></font></p>
<p class="MsoNormal"><font color="black"
face="Verdana"><span
style="font-size:11.0pt;font-family:"Verdana","sans-serif""> \
^</span></font></p>
<p class="MsoNormal"><font color="black"
face="Verdana"><span
style="font-size:11.0pt;font-family:"Verdana","sans-serif"">1
error</span></font></p>
<p class="MsoNormal"><font color="black"
face="Verdana"><span
style="font-size:11.0pt;font-family:"Verdana","sans-serif"">.rule.ruleContent</span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Option
2:</span></font></p>
<p class="MsoNormal"><font color="black"
face="Times New Roman" size="3"><span
\
style="font-size:12.0pt">org.openmrs.api.context.Context.getService(org.openmrs.api.AdministrationService.class).executeSql(...)</span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Saves,
but gives an error when it's \
executed…</span></font></p> <p class="MsoNormal"><font color="black"
face="Verdana"><span
style="font-size:11.0pt;font-family:"Verdana","sans-serif";background:white">Hl7inQueue.queueList.errorMessage.header:
groovy.lang.MissingMethodException: No
signature of method:
com.sun.proxy.$Proxy321.executeSql()
is applicable for argument types:
(java.lang.String, java.lang.Boolean)
values: [select count(*) from users,
false] Possible solutions:
executeSQL(java.lang.String, \
boolean)</span></font></p> <p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Option
3:</span></font></p>
<p class="MsoNormal"><font color="black"
face="Times New Roman" size="3"><span
style="font-size:12.0pt">def ctx = new
\
org.openmrs.api.context.Context();</span></font></p> <p class="MsoNormal"><font \
color="black" face="Times New Roman" size="3"><span
\
style="font-size:12.0pt">ctx.getService(org.openmrs.api.AdministrationService.class).executeSql(...)</span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Saves,
but gives an error when it's \
executed…</span></font></p> <p class="MsoNormal"><font color="black"
face="Verdana"><span
style="font-size:11.0pt;font-family:"Verdana","sans-serif";background:white">Hl7inQueue.queueList.errorMessage.header:
groovy.lang.MissingMethodException: No
signature of method:
com.sun.proxy.$Proxy321.executeSql()
is applicable for argument types:
(java.lang.String, java.lang.Boolean)
values: [select count(*) from users,
false] Possible solutions:
executeSQL(java.lang.String, \
boolean)</span></font></p> <p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I
assume I'm supposed to be sticking
your snippits within the definition
and replacing the … in executeSQL(…)
with my values so the script looks
like this for example…</span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">def
callSql = {</span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">def
ctx = new
\
org.openmrs.api.context.Context();</span></font></p> <p class="MsoNormal"><font \
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:# \
1f497d">ctx.getService(org.openmrs.api.AdministrationService.class).executeSql(it, \
false)</span></font></p> <p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">}</span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">rs
= callSql("select count(*) from
users")</span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">return
new Result(rs)</span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Is
there a 4<sup>th</sup> option?</span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thanks,</span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">James</span></font></p>
<p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><b><font color="black"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";font-weight:bold">From:</span></font></b><font
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif"">
<a moz-do-not-send="true"
href="mailto:implementers@openmrs.org"
target="_blank">implementers@openmrs.org</a>
[<a moz-do-not-send="true"
href="mailto:implementers@openmrs.org"
\
target="_blank">mailto:implementers@openmrs.org</a>] <b><span \
style="font-weight:bold">On Behalf Of </span></b>Darius
Jazayeri<br>
<b><span style="font-weight:bold">Sent:</span></b>
Friday, October 3, 2014 3:21 PM</span></font></p>
<div>
<div>
<p class="MsoNormal"><font color="black"
face="Calibri" size="3"><span
style="font-size:12.0pt;font-family:"Calibri","sans-serif""><br>
<b><span \
style="font-weight:bold">To:</span></b> implementers<br>
<b><span \
style="font-weight:bold">Subject:</span></b> Re: Groovy Logic Rule with HTML
Form</span></font></p>
</div>
</div>
<div>
<div>
<p class="MsoNormal"><font color="black"
face="Times New Roman" size="3"><span
style="font-size:12.0pt"> </span></font></p>
<div>
<p class="MsoNormal"><font
color="black" face="Times New
Roman" size="3"><span
style="font-size:12.0pt">Ah. So,
the groovy within HTML Form
Entry doesn't have the same
variables automatically set up
as the groovy module. You'll
need to do something like one of
these three. (I don't know which
will work offhand):</span></font></p>
<div>
<p class="MsoNormal"><font
color="black" face="Times New"
size="3"><span
\
style="font-size:12.0pt;font-family:"Times New""> </span></font></p>
</div>
<div>
<p class="MsoNormal"><font
color="black" face="Times New"
size="3"><span
\
style="font-size:12.0pt;font-family:"Times New"">import
\
org.openmrs.api.context.Context;</span></font></p> </div>
<div>
<p class="MsoNormal"><font
color="black" face="Times New"
size="3"><span
\
style="font-size:12.0pt;font-family:"Times
\
New"">Context.getService(org.openmrs.api.AdministrationService.class).executeSql(...)</span></font></p>
</div>
<div>
<p class="MsoNormal"><font
color="black" face="Times New"
size="3"><span
\
style="font-size:12.0pt;font-family:"Times New""> </span></font></p>
</div>
<div>
<div>
<p class="MsoNormal"><font
color="black" face="Times New"
size="3"><span
\
style="font-size:12.0pt;font-family:"Times \
New"">org.openmrs.api.context.Context.getService(org.openmrs.api.AdministrationService.class).executeSql(...)</span></font></p>
</div>
</div>
<div>
<p class="MsoNormal"><font
color="black" face="Times New"
size="3"><span
\
style="font-size:12.0pt;font-family:"Times New""> </span></font></p>
</div>
<div>
<p class="MsoNormal"><font
color="black" face="Times New"
size="3"><span
\
style="font-size:12.0pt;font-family:"Times New"">def ctx = new
\
org.openmrs.api.context.Context();</span></font></p> </div>
<div>
<p class="MsoNormal"><font
color="black" face="Times New"
size="3"><span
\
style="font-size:12.0pt;font-family:"Times
\
New"">ctx.getService(org.openmrs.api.AdministrationService.class).executeSql(...)</span></font></p>
</div>
<div>
<p class="MsoNormal"><font
color="black" face="Times New"
size="3"><span
\
style="font-size:12.0pt;font-family:"Times New""> </span></font></p>
</div>
<div>
<p class="MsoNormal"><font
color="black" face="Times New"
size="3"><span
\
style="font-size:12.0pt;font-family:"Times
New"">-Darius</span></font></p>
</div>
<div>
<p class="MsoNormal"><font
color="black" face="Times New"
size="3"><span
\
style="font-size:12.0pt;font-family:"Times New""> </span></font></p>
</div>
<div>
<p class="MsoNormal"><font
color="black" face="Times New"
size="3"><span
\
style="font-size:12.0pt;font-family:"Times New"">PS- Again, I'm sure
there's a better way to do
this, this is just an offhand
response.</span></font></p>
</div>
</div>
<div>
<p class="MsoNormal"><font
color="black" face="Times New
Roman" size="3"><span
style="font-size:12.0pt"> </span></font></p>
<div>
<p class="MsoNormal"><font
color="black" face="Times New"
size="3"><span
\
style="font-size:12.0pt;font-family:"Times New"">On Fri, Oct 3, 2014
at 3:16 PM, James Arbaugh <<a
moz-do-not-send="true"
\
href="mailto:james@haitianhealthfoundation.org"
\
target="_blank">james@haitianhealthfoundation.org</a>> wrote:</span></font></p>
<blockquote
style="border:none;border-left:solid
#cccccc 1.0pt;padding:0in 0in 0in
6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<div>
<div>
<p class="MsoNormal"><font
color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Dear
Darius,</span></font></p>
<p class="MsoNormal"><font
color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font
color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thanks
again for your time and
assistance.</span></font></p>
<p class="MsoNormal"><font
color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font
color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Changing
my script to match the
definition and \
call…</span></font></p> <p class="MsoNormal"><font
color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">def
callSql = {</span></font></p>
<p class="MsoNormal"><font
color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
admin.executeSQL(it,
false)</span></font></p>
<p class="MsoNormal"><font
color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">}</span></font></p>
<p class="MsoNormal"><font
color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">rs
= callSql("select
count(*) from \
users")</span></font></p> <p class="MsoNormal"><font
color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">return
new Result(rs)</span></font></p>
<p class="MsoNormal"><font
color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font
color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I
get a new error when I
run it…</span></font></p>
<p class="MsoNormal"><font
color="black"
face="Verdana"><span
style="font-size:11.0pt;font-family:"Verdana","sans-serif";background:white">Hl7inQueue.queueList.errorMessage.header:
groovy.lang.MissingPropertyException:
No such property: admin
for class:
\
org.openmrs.module.logic.rule.GroovyRule1</span></font></p> <p \
class="MsoNormal"><font color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font
color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">So,
taking it the next step
further, suppose my
query was "SELECT
count(*) FROM `obs`
WHERE `person_id`
=40967"</span></font></p>
<p class="MsoNormal"><font
color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">And
I wanted it to
dynamically replace
40967 with the patient
that the from was run
from.</span></font></p>
<p class="MsoNormal"><font
color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font
color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thanks,</span></font></p>
<p class="MsoNormal"><font
color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">James</span></font></p>
<p class="MsoNormal"><font
color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><font
color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">P.S. \
I'm still open to better
suggestions!</span></font></p>
<p class="MsoNormal"><font
color="#1f497d"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p class="MsoNormal"><b><font
color="black"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";font-weight:bold">From:</span></font></b><font
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif"">
<a
moz-do-not-send="true"
href="mailto:implementers@openmrs.org" target="_blank">implementers@openmrs.org</a>
[mailto:<a
moz-do-not-send="true"
href="mailto:implementers@openmrs.org" target="_blank">implementers@openmrs.org</a>]
<b><span
style="font-weight:bold">On
Behalf Of </span></b>Darius
Jazayeri<br>
<b><span
\
style="font-weight:bold">Sent:</span></b> Friday, October 3, 2014
3:06 PM</span></font></p>
<div>
<div>
<p class="MsoNormal"><font
color="black"
face="Calibri"
size="3"><span
style="font-size:12.0pt;font-family:"Calibri","sans-serif""><br>
<b><span
\
style="font-weight:bold">To:</span></b> implementers<br>
<b><span
\
style="font-weight:bold">Subject:</span></b> Re: Groovy Logic
Rule with HTML \
Form</span></font></p> </div>
</div>
<div>
<div>
<p class="MsoNormal"><font
color="black"
face="Times" size="3"><span
style="font-size:12.0pt;font-family:"Times","serif""> \
</span></font></p> <div>
<p class="MsoNormal"><font
color="black"
face="Times , serif"
size="3"><span
\
style="font-size:12.0pt;font-family:"Times ,
\
serif","serif"">Oops, sorry, I switched
the name of the
function to
"callSql", since I
was slightly
afraid that sql
was a reserved
word somewhere.
Make the
definition and the
call match, and it
should work.</span></font></p>
<div>
<p class="MsoNormal"><font
color="black"
face="Times ,
serif" size="3"><span
\
style="font-size:12.0pt;font-family:"Times ,
\
serif","serif""> </span></font></p> </div>
<div>
<p class="MsoNormal"><font
color="black"
face="Times ,
serif" size="3"><span
\
style="font-size:12.0pt;font-family:"Times ,
\
serif","serif"">-Darius</span></font></p> </div>
</div>
<div>
<p class="MsoNormal"><font
color="black"
face="Times , serif"
size="3"><span
\
style="font-size:12.0pt;font-family:"Times ,
serif","serif""> \
</span></font></p> <div>
<p class="MsoNormal"><font
color="black"
face="Times ,
serif" size="3"><span
\
style="font-size:12.0pt;font-family:"Times ,
\
serif","serif"">On Fri, Oct 3, 2014
at 3:04 PM,
James Arbaugh
<<a
moz-do-not-send="true"
href="mailto:james@haitianhealthfoundation.org" \
target="_blank">james@haitianhealthfoundation.org</a>>
wrote:</span></font></p>
<blockquote
\
style="border:none;border-left:solid #cccccc
1.0pt;padding:0in
0in 0in
6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<div>
<div>
<p
class="MsoNormal"><font
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Dear
Darius,</span></font></p>
<p
class="MsoNormal"><font
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p
class="MsoNormal"><font
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thanks
for your time,
and your
suggestion.
When I
transform my
script \
to…</span></font></p> <p
class="MsoNormal"><font
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">def
callSql = \
{</span></font></p> <p
class="MsoNormal"><font
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
admin.executeSQL(it,
false)</span></font></p>
<p
class="MsoNormal"><font
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">}</span></font></p>
<p
class="MsoNormal"><font
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">rs
= sql("select
count(*) from
users")</span></font></p>
<p
class="MsoNormal"><font
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">return
new \
Result(rs)</span></font></p> <p
class="MsoNormal"><font
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p
class="MsoNormal"><font
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">The
Groovy Logic
Rule can save
properly.
When I try to
run it, I get
the \
error…</span></font></p> <p
class="MsoNormal"><font
color="black"
face="Verdana"><span
style="font-size:11.0pt;font-family:"Verdana","sans-serif";background:white">Hl7inQueue.queueList.errorMessage.header:
\
groovy.lang.MissingMethodException: No signature
of method:
\
org.openmrs.module.logic.rule.GroovyRule1.sql() is applicable
for argument
types:
(java.lang.String)
values:
[select
count(*) from
users]
Possible
solutions:
any(),
split(groovy.lang.Closure),
is(java.lang.Object),
use([Ljava.lang.Object;),
any(groovy.lang.Closure),
wait()</span></font></p>
<p
class="MsoNormal"><font
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p
class="MsoNormal"><font
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">So,
going back to
my original
question, how
do I access
the current
patient in my
Groovy script,
and how do I
return the
results from
my SQL \
query.</span></font></p> <p
class="MsoNormal"><font
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p
class="MsoNormal"><font
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">I
would be open
to better
options!
Maybe applying
<a
moz-do-not-send="true"
href="https://issues.openmrs.org/browse/TRUNK-2069" target="_blank">TRUNK-2069</a>
and
implementing
it in HTML
Form \
Entry.</span></font></p> <p
class="MsoNormal"><font
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p
class="MsoNormal"><font
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">Thanks,</span></font></p>
<p
class="MsoNormal"><font
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d">James</span></font></p>
<p
class="MsoNormal"><font
color="#1f497d" face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";color:#1f497d"> \
</span></font></p> <p
class="MsoNormal"><b><font
color="black"
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif";font-weight:bold">From:</span></font></b><font
face="Calibri"><span
style="font-size:11.0pt;font-family:"Calibri","sans-serif"">
<a
moz-do-not-send="true"
href="mailto:implementers@openmrs.org" target="_blank">implementers@openmrs.org</a>
[mailto:<a
moz-do-not-send="true"
href="mailto:implementers@openmrs.org" target="_blank">implementers@openmrs.org</a>]
<b><span
style="font-weight:bold">On
Behalf Of </span></b>Darius
Jazayeri<br>
<b><span
\
style="font-weight:bold">Sent:</span></b> Friday,
October 3,
2014 11:53 AM<br>
<b><span
\
style="font-weight:bold">To:</span></b> implementers<br>
<b><span
\
style="font-weight:bold">Subject:</span></b> Re: Groovy
Logic Rule
with HTML \
Form</span></font></p> <div>
<div>
<p
class="MsoNormal"><font
color="black"
face="Times
New" size="3"><span
\
style="font-size:12.0pt;font-family:"Times
New""> \
</span></font></p> <div>
<p
class="MsoNormal"><font
color="black"
face="Times ,
serif"
size="3"><span
\
style="font-size:12.0pt;font-family:"Times ,
\
serif","serif"">I only skimmed
this very
quickly, so
it's possible
there are
better
solutions to
the issues at
the top of the
email, but
very
specifically
about groovy,
try \
doing:</span></font></p> <blockquote
style="margin-left:30.0pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<div>
<p
class="MsoNormal"><font
color="black"
face="Times"
size="3"><span
style="font-size:12.0pt;font-family:"Times","serif"">def
callSql = \
{</span></font></p> </div>
<div>
<p
class="MsoNormal"><font
color="black"
face="Times"
size="3"><span
style="font-size:12.0pt;font-family:"Times","serif"">
admin.executeSQL(it,
false)</span></font></p>
</div>
<div>
<p
class="MsoNormal"><font
color="black"
face="Times"
size="3"><span
style="font-size:12.0pt;font-family:"Times","serif"">}</span></font></p>
</div>
</blockquote>
<div>
<p
class="MsoNormal"><font
color="black"
face="Times ,
serif"
size="3"><span
\
style="font-size:12.0pt;font-family:"Times ,
\
serif","serif""> </span></font></p> </div>
<p
class="MsoNormal"><font
color="black"
face="Times ,
serif"
size="3"><span
\
style="font-size:12.0pt;font-family:"Times ,
\
serif","serif"">-Darius</span></font></p> <div>
<p
class="MsoNormal"><font
color="black"
face="Times ,
serif"
size="3"><span
\
style="font-size:12.0pt;font-family:"Times ,
\
serif","serif""> </span></font></p> <div>
<p
class="MsoNormal"><font
color="black"
face="Times"
size="3"><span
style="font-size:12.0pt;font-family:"Times","serif"">On
Fri, Oct 3,
2014 at 11:42
AM, James
Arbaugh <<a
moz-do-not-send="true" href="mailto:james@haitianhealthfoundation.org"
\
target="_blank">james@haitianhealthfoundation.org</a>>
wrote:</span></font></p>
<blockquote
\
style="border:none;border-left:solid #cccccc
1.0pt;padding:0in
0in 0in
6.0pt;margin-left:4.8pt;margin-top:5.0pt;margin-right:0in;margin-bottom:5.0pt">
<p
class="MsoNormal"
style="margin-right:1.0in;margin-bottom:12.0pt;margin-left:117.6pt"><font
color="black"
face="Times"
size="3"><span
style="font-size:12.0pt;font-family:"Times","serif"">Greetings
all.<br>
<br>
The short
question: How
can I run a
SQL command
(accessing the
current<br>
patient) with
a Groovy
script called
through an
HTML Form
Entry logic<br>
expression?<br>
<br>
The long
question (and
history):<br>
I am trying to
populate my
HTML form
accurately
during editing
(an attempt<br>
to manually
overcome <a
moz-do-not-send="true"
href="https://issues.openmrs.org/browse/TRUNK-2069" \
target="_blank">https://issues.openmrs.org/browse/TRUNK-2069</a>) for a<br>
vaccination
form that
captures the
dates of
vaccinations
with the<br>
vaccination
type and dose
specified by
their position
in a table.
The<br>
vaccines are
stored in a
concept set
(Current
Immunizations
Orders), so I<br>
do know all
the details
and where
things should
be placed.
Because it<br>
re-populates
the data in
random order I
end up with
"corrupt"
information<br>
which throws
off my
JavaScript
error checking
rules.<br>
<br>
My first
attempt was to
store the data
into an array
in a lookup<br>
complexExpression
so I can find
the actual
date for that
vaccine type
and<br>
sequence
number and put
it into the
field with
JavaScript
with
setValue()<br>
with a
statement like
this...<br>
<br>
Load Vaccine
Array:
<lookup
\
complexExpression="#foreach( $vac in<br>
$fn.allObs(984)
)
\
#set($vaccine[$vac.valueCoded] =
$vac.obsGroup)
#end"/><br>
<br>
...but, I get
an error
message (which
I assume is a
bug)...<br>
Velocity
Error!
Encountered
"[" at<br>
\
org.openmrs.module.htmlformentry.FormEntrySession[line 1, column 50]
Was<br>
expecting one
of: ... "="
... ...<br>
<br>
I tried
putting the
array
assignment in
JavaScript
with errors
too.<br>
<br>
I think I can
do exactly
what I need to
do with
fn.logic(),
but I need to<br>
know how to
tell the
Groovy script
to use the
current
patient. On
the<br>
HTML Reference
page I seen an
example
like...<br>
Latest BMI:
<lookup
\
expression="fn.logic('BMI')"/> <!--
requires that
you<br>
have a BMI
rule
registered
--><br>
...but I don't
have an
example of
what is in the
logic rule, or
how the<br>
current
patient is
specified. I
couldn't find
anything
helpful while<br>
looking
through the
Groovy Module
examples
either.<br>
<br>
When I try to
run a simple
Groovy SQL
rule like...<br>
def sql(s) {
admin.executeSQL(s,false)
}<br>
rs =
sql("select
count(*) from
users")<br>
return new
Result(rs),<br>
<br>
I get an error
like...<br>
startup
failed:<br>
\
script14123503865371225136415.groovy: 10: Unknown
type:
METHOD_DEF at<br>
line: 10
column: 1.
File:
\
script14123503865371225136415.groovy @ line 10,<br>
column 1.<br>
def sql(s)
{
admin.executeSQL(s,false)
}<br>
^<br>
1 error<br>
.rule.ruleContent<br>
<br>
Hopefully this
is a quick
easy answer
for someone
smarter than
I!<br>
<br>
Thanks,<br>
James</span></font><font
color="black"><span
style="color:windowtext"></span></font></p>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</div>
</div>
</div>
</div>
</blockquote>
</div>
</div>
</blockquote>
</div>
</blockquote>
</div>
</div>
</div>
-- <br>
OpenMRS Implementers: <a moz-do-not-send="true"
href="http://om.rs/implist">http://om.rs/implist</a><br>
Post: <a class="moz-txt-link-abbreviated" \
href="mailto:implementers@openmrs.org">implementers@openmrs.org</a> | \
Unsubscribe:
<a class="moz-txt-link-abbreviated" \
href="mailto:implementers+unsubscribe@openmrs.org">implementers+unsubscribe@openmrs.org</a><br>
Manage your OpenMRS subscriptions at <a moz-do-not-send="true"
href="http://om.rs/id">http://om.rs/id</a><br>
<br>
Visit OpenMRS Talk for in-depth & casual conversation: <a
moz-do-not-send="true" \
href="https://talk.openmrs.org/">https://talk.openmrs.org/</a><br> To unsubscribe \
from this group and stop receiving emails from it, send an email to <a \
moz-do-not-send="true"
href="mailto:implementers+unsubscribe@openmrs.org">implementers+unsubscribe@openmrs.org</a>.<br>
</blockquote>
<br>
</body>
</html>
<p></p>
-- <br />
OpenMRS Implementers: <a href="http://om.rs/implist">http://om.rs/implist</a><br />
Post: implementers@openmrs.org | Unsubscribe: implementers+unsubscribe@openmrs.org<br \
/> Manage your OpenMRS subscriptions at <a \
href="http://om.rs/id">http://om.rs/id</a><br /> <br />
Visit OpenMRS Talk for in-depth & casual conversation: <a \
href="https://talk.openmrs.org/">https://talk.openmrs.org/</a><br />
<p></p>
To unsubscribe from this group and stop receiving emails from it, send an email to <a \
href="mailto:implementers+unsubscribe@openmrs.org">implementers+unsubscribe@openmrs.org</a>.<br \
/>
[prev in list] [next in list] [prev in thread] [next in thread]
Configure |
About |
News |
Add a list |
Sponsored by KoreLogic