← Back to team overview

dhis2-users team mailing list archive

Re: Can we select a date range through the Web API

 

Dear Randy,

Please you may need to encode the space as %20 so that Health Center
becomes Health%20Center

The quick fix is to write a simple script (php since iHRIS is based on it
or bash or node.js) that filters only those that are lastupdated>VARIABLE,
then regenerate the xml or deal with every processed entry independently.

Alex


On Tue, Aug 25, 2015 at 7:39 PM, Lars Helge Øverland <larshelge@xxxxxxxxx>
wrote:

> To answer your question, in
>
> criteria=Type:Health
>
> Type refers to the column  name, and Health to the filter value. So you
> need to make sure that the column name in the URL matches exactly the
> column name in the SQL view response. You can find the name in the headers
> part of the response.
>
> regards,
>
> Lars
>
>
>
>
> On Tue, Aug 25, 2015 at 6:02 PM, Lars Helge Øverland <larshelge@xxxxxxxxx>
> wrote:
>
>> Hi Randy,
>>
>> this sounds like a good fit for the new sql view variables feature in
>> 2.20:
>>
>> https://www.dhis2.org/doc/snapshot/en/developer/html/ch01s24.html#d5e3146
>>
>> You can also use criteria (slightly less performant), see documentation
>> on how to define the query + url parameters in the docs:
>>
>> https://www.dhis2.org/doc/snapshot/en/developer/html/ch01s24.html#d5e3139
>>
>>
>> regards,
>>
>> Lars
>>
>>
>>
>>
>> On Tue, Aug 25, 2015 at 5:56 PM, Wilson, Randy <rwilson@xxxxxxx> wrote:
>>
>>> Hi All,
>>>
>>> We're trying to synch facility data between DHIS-2 and a new Provider
>>> Registry linked to iHRIS using the API.  I've created a SQL view that works
>>> nicely to pull all of the data and I am able to filter for exact matches
>>> (e.g.).  (I can't seem to get the FRED API to work in version 2.20).
>>>
>>>
>>> https://hmis.moh.gov.rw/hmis/api/sqlViews/LQ83r2JDHKw/data.xml?criteria=Type:Health
>>> Center
>>>
>>> but we would also like to filter by a date range fore example:
>>> lastupdated>2015-01-01.  This does not seem to work .... not even sure
>>> where to put the > sign, should it be criteria>lastupudated:2015-01-01?
>>>
>>> Also, have we fixed the issue where Analytics tries to drop and rebuild
>>> all resource tables and SQL views before running.  My SQL view refers to
>>> _orgunitstructure in order to select only level 6 facilities.  In the past
>>> it could not drop _orgunitstructure because it was referred to in a view
>>> and analytics failed.
>>>
>>> Any suggestions?
>>>
>>> --
>>> *Randy Wilson*
>>> *Team Leader: **Knowledge Management, Data Use and Research*
>>> Rwanda Health System Strengthening Activity
>>> Management Sciences for Health
>>> Rwanda-Kigali
>>> Direct: +250 788308835
>>> E-mail: rwilson@xxxxxxx
>>> Skype: wilsonrandy_us
>>> <http://www.msh.org/>
>>> Stronger health systems. Greater health impact.
>>> <https://www.facebook.com/ManagementSciencesForHealth>
>>> <https://twitter.com/MSHHealthImpact>
>>> <https://www.youtube.com/user/MSHHealthImpact>
>>> www.msh.org
>>>
>>> *This message and its attachments are confidential and solely for the
>>> intended recipients. If received in error, please delete them and notify
>>> the sender via reply e-mail immediately.*
>>> _______________________________________________
>>> Mailing list: https://launchpad.net/~dhis2-users
>>> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
>>> Unsubscribe : https://launchpad.net/~dhis2-users
>>> More help   : https://help.launchpad.net/ListHelp
>>>
>>>
>>
>>
>> --
>> Lars Helge Øverland
>> Lead developer, DHIS 2
>> University of Oslo
>> Skype: larshelgeoverland
>> http://www.dhis2.org <https://www.dhis2.org>
>>
>>
>
>
> --
> Lars Helge Øverland
> Lead developer, DHIS 2
> University of Oslo
> Skype: larshelgeoverland
> http://www.dhis2.org <https://www.dhis2.org>
>
>
> _______________________________________________
> Mailing list: https://launchpad.net/~dhis2-users
> Post to     : dhis2-users@xxxxxxxxxxxxxxxxxxx
> Unsubscribe : https://launchpad.net/~dhis2-users
> More help   : https://help.launchpad.net/ListHelp
>
>


-- 
Alex Tumwesigye

Technical Advisor - DHIS2 (Consultant),
Ministry of Health/AFENET
Kampala
Uganda

IT Consultant - BarefootPower Uganda Ltd, SmartSolar, Kenya

IT Specialist (Servers, Networks and Security, Health Information Systems -
DHIS2 ) & Solar Consultant

+256 774149 775, + 256 759 800161

"I don't want to be anything other than what I have been - one tree hill "

Follow ups

References