Followup question: If a dataset is required, what if the datavalue/dataelement isn’t in any dataset?
An Aside: Why are datasets required at all in this api call? The datavalue table makes no references/foreign keys to the dataset table (i.e. if multiple datasets have the same dataelement, DHIS2 would have no idea which dataset was used to create a given value).
···
On Wed, Aug 12, 2015 at 7:17 AM, Alex Tumwesigye atumwesigye@gmail.com wrote:
Dear Timothy,
The dataSet query parameter is required.
Try something like
api/dataValueSets?orgUnit=“KQfLafniynG”&dataSet=‘dataSetUID’
Note that datavalues are related to a period, orgunit and dataset.
Ideally, a set of values (dataValueSet) may not appear in multiple datasets, thus there is need to indicate which dataset.
Alex
Timothy Harding
RPCV Vanuatu
Skype: hardingt@gmail.com
+1 (541) 632-6623
On Wed, Aug 12, 2015 at 5:05 PM, Timothy Harding hardingt@gmail.com wrote:
Thanks Knut,
That sounds like a great option! I fear, in this case, it may not help as this instance is running 2.17, I think that parameterized SQL View was introduced in 2.19 (please correct me though)? For instances on 2.19 and above though, that sounds like it would be perfect.
Without this approach, am I stuck using SQL to get all the datavalues associated with a particular OU (without knowing where exactly all of them are)?
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
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 "
Timothy Harding
RPCV Vanuatu
Skype: hardingt@gmail.com
+1 (541) 632-6623
On Wed, Aug 12, 2015 at 7:03 AM, Knut Staring knutst@gmail.com wrote:
You could do a mix of those approaches - create a parametrised SQL view that is available through the API.
On Wed, Aug 12, 2015 at 3:33 PM, Timothy Harding hardingt@gmail.com wrote:
Hello Dev Group,
Is it possible to get all the datavalues associated with an OU out of the API?
I’m getting the need more and more to remove org units which will randomly have dependencies. I know the official position of DHIS2 is “don’t ever remove org units” but I’m embarking on this quest all the same :).
So, I’m wondering about data values today. I started here:
https://www.dhis2.org/doc/snapshot/en/developer/html/dhis2_developer_manual_full.html#d5232e1433
There is a phrase:
“The following query parameters are required” and a giant table, but even the examples don’t use more than 3 of the parameters from the table.
I tried:
api/dataValueSets?orgUnit=“KQfLafniynG”
but received an error:
“Required Set parameter ‘dataSet’ is not present”
What if the there are many, many datasets to go through, or the dataelement/datavalue in question is no longer associated with a dataset?
In the meantime, I will probably need to crack open PgAdmin to get this done, but I prefer to use the API if I can. Thanks!
Timothy Harding
RPCV Vanuatu
Skype: hardingt@gmail.com
+1 (541) 632-6623
Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net
Unsubscribe : https://launchpad.net/~dhis2-devs
More help : https://help.launchpad.net/ListHelp
–
Knut Staring
Dept. of Informatics, University of Oslo
Norway: +4791880522
Skype: knutstar
http://dhis2.org