It is also possible to created database functions now as well. It is not totally obvious from the documentation, but you can check out this repo for an example of how you can create database functions and then call them from the API. This works similar to SQL views, but will allow you much greater control over what actually happens, which may be difficult or impossible with a normal SQL view.
···
On Tue, Aug 25, 2015 at 6:51 PM, Alex Tumwesigye atumwesigye@gmail.com wrote:
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
Mailing list: https://launchpad.net/~dhis2-users
Post to : dhis2-users@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-users
More help : https://help.launchpad.net/ListHelp
–
On Tue, Aug 25, 2015 at 7:39 PM, Lars Helge Øverland larshelge@gmail.com 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
Mailing list: https://launchpad.net/~dhis2-users
Post to : dhis2-users@lists.launchpad.net
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 "
On Tue, Aug 25, 2015 at 6:02 PM, Lars Helge Øverland larshelge@gmail.com 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
–
Lars Helge Øverland
Lead developer, DHIS 2
University of Oslo
Skype: larshelgeoverland
http://www.dhis2.org
On Tue, Aug 25, 2015 at 5:56 PM, Wilson, Randy rwilson@msh.org 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@msh.org
Skype: wilsonrandy_us

Stronger health systems. Greater health impact.

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@lists.launchpad.net
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
–
Jason P. Pickering
email: jason.p.pickering@gmail.com
tel:+46764147049