James,
What you're actually trying to do is to call this method:

List<Obs> getObservations(List<Person> whom, List<Encounter> encounters,
List<Concept> questions, List<Concept> answers, List<PERSON_TYPE>
personTypes, List<Location> locations, List<String> sort, Integer
mostRecentN, Integer obsGroupId, Date fromDate, Date toDate, boolean
includeVoidedObs)

So the call should be:
def concept = org.openmrs.api.Context.getConceptService().getConcept(6047);
def obs = getObservations(
    null, // all patients
    null, // all encounters
    java.util.Collections.singletonList(concept), // just this one concept
as question
    null, // don't specify any coded answers

java.util.Collections.singletonList(org.openmrs.util.PERSON_TYPE.PATIENT),
// only obs belonging to patients
    null, // all locations
    java.util.Collections.singletonList("valueNumeric desc"), // sort order
    1, // just one
    null, // don't specify any obs group
    null, // don't specify date range
    null, // don't specify date range
    false)
return new Result(obs[0])

-Darius

On Mon, Sep 19, 2011 at 8:14 AM, James Arbaugh <[email protected]>wrote:

> Darius,****
>
> ** **
>
> You’re correct, it required org.openmrs.api.ObsService.****
>
> ** **
>
> Now, when I try the following groovy code…****
>
> return new
> Result(org.openmrs.api.ObsService.getObservations(6407,"mostRecentN=1
> sort="valueNumeric desc""))****
>
> ** **
>
> I get…****
>
> Hl7inQueue.queueList.errorMessage.header: Invalid Logic Rule. ****
>
> Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException:
> startup failed:****
>
> script13164429085571793441641.groovy: 10: expecting ')', found
> 'valueNumeric' @ line 10, column 88.****
>
>    ons(6407,"mostRecentN=1 sort="valueNumer****
>
> ** **
>
> When I try the following groovy code…****
>
> return new
> Result(org.openmrs.api.ObsService.getObservations(6407,"mostRecentN=1
> sort="desc""))****
>
> ** **
>
> I get…****
>
> Hl7inQueue.queueList.errorMessage.header: Invalid Logic Rule. ****
>
> Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException:
> startup failed:****
>
> script13164431339642031039791.groovy: 10: expecting ')', found 'desc' @
> line 10, column 88.****
>
>    ons(6407,"mostRecentN=1 sort="desc""))****
>
> ** **
>
> When I try the following groovy code…****
>
> return new
> Result(org.openmrs.api.ObsService.getObservations(6407,"mostRecentN=1 and
> sort="valueNumeric desc""))****
>
> ** **
>
> I get…****
>
> Hl7inQueue.queueList.errorMessage.header: Invalid Logic Rule. ****
>
> Caused by: org.codehaus.groovy.control.MultipleCompilationErrorsException:
> startup failed:****
>
> script13164431339642031039791.groovy: 10: expecting ')', found 'desc' @
> line 10, column 88.****
>
>    ons(6407,"mostRecentN=1 sort="desc""))****
>
> ** **
>
> WhenI try the following groovy code…****
>
> return new
> Result(org.openmrs.api.ObsService.getObservations(6407,"mostRecentN=1 and
> sort=valueNumeric desc"))****
>
> ** **
>
> I get…****
>
> Hl7inQueue.queueList.errorMessage.header:
> groovy.lang.MissingMethodException: No signature of method: static
> org.openmrs.api.ObsService.getObservations() is applicable for argument
> types: (java.lang.Integer, java.lang.String) values: [6407, mostRecentN=1
> and sort=valueNumeric desc]****
>
> ** **
>
> What am I doing wrong with the getObservations()? Any idea why the SQL
> Groovy code doesn’t work?****
>
> ** **
>
> Roger and Darius,****
>
> Thanks for your concerns on blood banking standards.  I took up your
> suggestions with our medical director concerning the abnormal usage of a
> serial number for blood bank baggies.  She said “We shouldn't change the
> coding system, as it is done like this in every blood bank in Haiti.” If we
> used a different serial number system, it would confuse them when we send
> the blood to Port-au-Prince (I initially suggested using the encounter_id).
> The Red Cross is implementing a software system in Haiti, but it doesn't
> have a registry for our donors in it, it is essentially to find out where
> what kind of blood is in stock, so that it can be ordered from this hospital
> if needed. Your concerns on standard practice should to be taken up at a
> higher level.****
>
> ** **
>
> Thanks,****
>
> James****
>
> ** **
>
> *From:* [email protected] [mailto:[email protected]] *On
> Behalf Of *Darius Jazayeri
> *Sent:* Friday, September 16, 2011 11:25 AM
>
> *To:* [email protected]
> *Subject:* Re: [OPENMRS-IMPLEMENTERS] Auto-Incrementing Numeric
> Observation****
>
> ** **
>
> James,****
>
> You need to do org.openmrs.api.ObsService I think.****
>
> -Darius (by phone)****
>
> On Sep 16, 2011 8:20 AM, "Friedman, Roger (CDC/CGH/DGHA) (CTR)" <
> [email protected]> wrote:****
>
> James --****
>
>                 Because of the criticality of blood tracking, it's
> important that there be a check digit on your blood bag ID.  So maybe you
> should use the algorithm from ID generation rather than just a sequence
> number.  ****
>
>                 Also I don't know if you are tracking the blood after it's
> processed into different products and then into the patient, but that's the
> standard of care for blood.  Certainly it would be good at least to check
> the blood against your testing records before use, that's where
> discrepancies would appear.  You'd be better off printing barcodes and avoid
> rewriting.  There are also standards for that.****
>
>                 I know that we here at CDC are doing blood bank system
> strengthening in Haiti and that hospital-based collection and processing is
> not the international norm, especially when presence of transmissible
> disease is high.  Rather, collection efforts are based around community
> drives, particularly where young as-yet-uninfected people can be found, with
> processing at high-volume centers which warehouse the products and
> distribute them to hospitals, with only a few days supply stored at the
> hospital.  ****
>
>                 In short, there are lots of international standards around
> bloodbanking that are important and which I can send if you're interested.
> There are also commercial solutions which might do the job cheaper, faster
> and with better compliance with international standards than you can. ****
>
> Saludos, Roger****
>
>  ****
>
> *From:* [email protected] [mailto:[email protected]] *On
> Behalf Of *James Arbaugh
> *Sent:* Thursday, September 15, 2011 11:20 PM****
>
>
> To: [email protected]
> Subject: Re: [OPENMRS-IMPLEMENTERS] Auto-Incrementing Nu...****
>
>
>
>
>
> Thanks Darius (and Daniel)!
>
>
>
> I’m trying to write my Groovy rule, and it’s not working like I...****
>
>
>
> ________________________________
> Click here to unsubscribe from OpenMRS Implementers' mailing list****
>
> ------------------------------
>
> Click here to 
> unsubscribe<[email protected]?body=SIGNOFF%20openmrs-implement-l>from
>  OpenMRS Implementers' mailing list
> ****
>  ------------------------------
> Click here to 
> unsubscribe<[email protected]?body=SIGNOFF%20openmrs-implement-l>from
>  OpenMRS Implementers' mailing list
>

_________________________________________

To unsubscribe from OpenMRS Implementers' mailing list, send an e-mail to 
[email protected] with "SIGNOFF openmrs-implement-l" in the  body 
(not the subject) of your e-mail.

[mailto:[email protected]?body=SIGNOFF%20openmrs-implement-l]

Reply via email to