← Back to team overview

dhis2-devs team mailing list archive

Re: Web API : Create Favourite

 

Thanx Knut. Will write a blueprint :)

On Sat, Jan 23, 2016 at 3:30 AM, Knut Staring <knutst@xxxxxxxxx> wrote:

> Unfortunately, I think filtering through measureCriteria is currently not
> supported by the Pivot Tables. Sounds like a feature that should be added
> (both in the GUI and in the model). Maybe you could write a Blueprint?
>
> Knut
>
> On Fri, Jan 22, 2016 at 12:02 PM, Pamod Amarakoon <pamodm@xxxxxxxxx>
> wrote:
>
>> Hi,
>> this is the json of analytic table I want to filter data of...
>>
>> {
>>     "lastUpdated": "2016-01-22T08:20:21.575+0000",
>>     "href": "http://xxx.xxx.224.242:3080/ncd/api/reportTables/Fmlq1WIqgeU
>> ",
>>     "id": "Fmlq1WIqgeU",
>>     "created": "2016-01-22T08:20:21.574+0000",
>>     "name": "hlc-bmi_normal_female",
>>     "publicAccess": "rw------",
>>     "userOrganisationUnitChildren": false,
>>     "hideEmptyRows": false,
>>     "parentGraphMap": {
>>         "GYBZ1og9bk7": ""
>>     },
>>     "userOrganisationUnit": false,
>>     "rowSubTotals": true,
>>     "displayDensity": "NORMAL",
>>     "completedOnly": false,
>>     "colTotals": true,
>>     "showDimensionLabels": true,
>>     "sortOrder": ​0,
>>     "fontSize": "NORMAL",
>>     "topLimit": ​0,
>>     "aggregationType": "DEFAULT",
>>     "userOrganisationUnitGrandChildren": false,
>>     "displayName": "hlc-bmi_normal_female",
>>     "externalAccess": false,
>>     "colSubTotals": true,
>>     "showHierarchy": false,
>>     "rowTotals": true,
>>     "cumulative": false,
>>     "digitGroupSeparator": "SPACE",
>>     "regression": false,
>>     "skipRounding": false,
>>     "reportParams": {
>>         "paramGrandParentOrganisationUnit": false,
>>         "paramReportingPeriod": false,
>>         "paramParentOrganisationUnit": true,
>>         "paramOrganisationUnit": false
>>     },
>>     "access": {
>>         "read": true,
>>         "update": true,
>>         "externalize": true,
>>         "delete": true,
>>         "write": true,
>>         "manage": true
>>     },
>>     "relativePeriods": {
>>         "thisYear": false,
>>         "quartersLastYear": false,
>>         "last52Weeks": false,
>>         "thisWeek": false,
>>         "lastMonth": false,
>>         "last2SixMonths": false,
>>         "monthsThisYear": false,
>>         "thisQuarter": false,
>>         "last12Months": true,
>>         "last5FinancialYears": false,
>>         "lastQuarter": false,
>>         "thisSixMonth": false,
>>         "thisFinancialYear": false,
>>         "last4Weeks": false,
>>         "last3Months": false,
>>         "thisMonth": false,
>>         "last5Years": false,
>>         "last6BiMonths": false,
>>         "lastFinancialYear": false,
>>         "last6Months": false,
>>         "quartersThisYear": false,
>>         "monthsLastYear": false,
>>         "lastWeek": false,
>>         "thisBimonth": false,
>>         "lastBimonth": false,
>>         "lastSixMonth": false,
>>         "lastYear": false,
>>         "last12Weeks": false,
>>         "last4Quarters": false
>>     },
>>     "user": {
>>         "id": "n6OIhU7cvg4",
>>         "name": "Pamod Amarakoon",
>>         "created": "2016-01-04T06:10:34.185+0000",
>>         "lastUpdated": "2016-01-04T06:10:34.185+0000",
>>         "href": "http://xxx.xxx.224.242:3080/ncd/api/users/n6OIhU7cvg4";
>>     },
>>     "attributeDimensions": [],
>>     "filterDimensions": [],
>>     "organisationUnitGroups": [],
>>     "itemOrganisationUnitGroups": [],
>>     "userGroupAccesses": [],
>>     "programIndicatorDimensions": [],
>>     "columnDimensions": ["dx"],
>>     "dataDimensionItems": [{
>>         "dataDimensionItemType": "DATA_ELEMENT_OPERAND",
>>         "dataElementOperand": {
>>             "id": "dHqbtLysQz0.fHcQdNbIBwQ",
>>             "name": "HLC-BMI (BMI 18.5-24.9, Female)"
>>         }
>>     }],
>>     "columns": [{
>>         "id": "dx"
>>     }],
>>     "organisationUnitLevels": [],
>>     "dataElementDimensions": [],
>>     "periods": [],
>>     "organisationUnits": [{
>>         "id": "GYBZ1og9bk7",
>>         "name": "Sri Lanka",
>>         "code": "Sri Lanka",
>>         "created": "2015-04-02T01:20:14.000+0000",
>>         "lastUpdated": "2016-01-04T05:41:00.657+0000",
>>         "href": "
>> http://xxx.xxx.224.242:3080/ncd/api/organisationUnits/GYBZ1og9bk7";
>>     }],
>>     "categoryDimensions": [],
>>     "dataElementGroups": [],
>>     "filters": [],
>>     "rows": [{
>>         "id": "pe"
>>     },
>>     {
>>         "id": "ou"
>>     }],
>>     "categoryOptionGroups": [],
>>     "rowDimensions": ["pe",
>>     "ou"]
>> }
>>
>> On Fri, Jan 22, 2016 at 4:19 PM, Knut Staring <knutst@xxxxxxxxx> wrote:
>>
>>> Which is why I thought it might be useful to look at the format for
>>> favorites, like the one I sent you.
>>>
>>> On Fri, Jan 22, 2016 at 11:46 AM, Pamod Amarakoon <pamodm@xxxxxxxxx>
>>> wrote:
>>>
>>>> Formulating this was possible using something like,
>>>>
>>>> http://xxx.xx.xx.xx:xxx
>>>> /x/api/analytics.json?dimension=dx:dHqbtLysQz0.fHcQdNbIBwQ:eq:0&dimension=ou:GYBZ1og9bk7&dimension=pe:LAST_12_MONTHS&displayProperty=NAME&skipMeta=true&measureCriteria=GT:500;LT:1000
>>>>
>>>> but just wanted to create a favorite item so it can be shared among
>>>> user roles, where i ran in to problems.
>>>>
>>>>
>>>> On Fri, Jan 22, 2016 at 4:13 PM, Knut Staring <knutst@xxxxxxxxx> wrote:
>>>>
>>>>> Right - but was your problem how to formulate these, or how to post
>>>>> new favorites into DHIS2?
>>>>>
>>>>> On Fri, Jan 22, 2016 at 11:41 AM, Pamod Amarakoon <pamodm@xxxxxxxxx>
>>>>> wrote:
>>>>>
>>>>>> Thanx. There were in fact 2 scenarios. one example was to identify
>>>>>> org units reporting zero values on a particular data element. The other was
>>>>>> regarding resource allocation where they want to see facilities reporting
>>>>>> values below a certain limit to decide on cutting down resources for coming
>>>>>> years :)
>>>>>>
>>>>>> On Fri, Jan 22, 2016 at 4:07 PM, Knut Staring <knutst@xxxxxxxxx>
>>>>>> wrote:
>>>>>>
>>>>>>> Right, I was just commenting on the format, yours seemed very
>>>>>>> different (how did you come up with it?).
>>>>>>>
>>>>>>> Probably best to wait for Morten to explain.
>>>>>>>
>>>>>>> On Fri, Jan 22, 2016 at 11:32 AM, Pamod Amarakoon <pamodm@xxxxxxxxx>
>>>>>>> wrote:
>>>>>>>
>>>>>>>> Hi Knut,
>>>>>>>>
>>>>>>>> Thanx a lot. but in the above example is it possible to filter out
>>>>>>>> range of data values. For example,
>>>>>>>>
>>>>>>>> In my initial query it would show number of people who have BMI of
>>>>>>>> 18-25 by org unit.
>>>>>>>> What if I want to filter out the list by org units which report
>>>>>>>> values over 500.
>>>>>>>>
>>>>>>>>
>>>>>>>> On Fri, Jan 22, 2016 at 3:40 PM, Knut Staring <knutst@xxxxxxxxx>
>>>>>>>> wrote:
>>>>>>>>
>>>>>>>>> Something like this maybe?
>>>>>>>>>
>>>>>>>>> https://play.dhis2.org/demo/api/reportTables/tWg9OiyV7mu.json
>>>>>>>>>
>>>>>>>>> On Fri, Jan 22, 2016 at 11:00 AM, Pamod Amarakoon <
>>>>>>>>> pamodm@xxxxxxxxx> wrote:
>>>>>>>>>
>>>>>>>>>> Hi,
>>>>>>>>>>
>>>>>>>>>> I wanted to create a new favorite at pivot table that filters the
>>>>>>>>>> date values between a range of 500 to 1000.
>>>>>>>>>>
>>>>>>>>>> I could get the output i needed using
>>>>>>>>>> http://xxx.xx.xx.xx:xxx
>>>>>>>>>> /x/api/analytics.json?dimension=dx:dHqbtLysQz0.fHcQdNbIBwQ:eq:0&dimension=ou:GYBZ1og9bk7&dimension=pe:LAST_12_MONTHS&displayProperty=NAME&skipMeta=true&measureCriteria=GT:500;LT:1000
>>>>>>>>>>
>>>>>>>>>> I wanted to create a favourite for the same. I posted following
>>>>>>>>>> json to
>>>>>>>>>> /api/reportTables/
>>>>>>>>>>
>>>>>>>>>> {
>>>>>>>>>>     "columns": [{
>>>>>>>>>>         "dimension": "dx",
>>>>>>>>>>         "items": [{
>>>>>>>>>>             "id": "dHqbtLysQz0.fHcQdNbIBwQ",
>>>>>>>>>>             "name": "BMI (BMI 18.5-24.9, Female)"
>>>>>>>>>>         }]
>>>>>>>>>>     }],
>>>>>>>>>>     "rows": [{
>>>>>>>>>>         "dimension": "pe",
>>>>>>>>>>         "items": [{
>>>>>>>>>>             "id": "LAST_12_MONTHS",
>>>>>>>>>>             "name": ""
>>>>>>>>>>         }]
>>>>>>>>>>     },
>>>>>>>>>>     {
>>>>>>>>>>         "dimension": "ou",
>>>>>>>>>>         "items": [{
>>>>>>>>>>             "id": "GYBZ1og9bk7"
>>>>>>>>>>         }]
>>>>>>>>>>     }],
>>>>>>>>>>     "filters": [],
>>>>>>>>>>     "showDimensionLabels": true,
>>>>>>>>>>     "hideEmptyRows": false,
>>>>>>>>>>     "skipRounding": false,
>>>>>>>>>>     "aggregationType": "DEFAULT",
>>>>>>>>>>     "dataApprovalLevel": {
>>>>>>>>>>         "id": "DEFAULT"
>>>>>>>>>>     },
>>>>>>>>>>     "showHierarchy": false,
>>>>>>>>>>     "completedOnly": false,
>>>>>>>>>>     "displayDensity": "NORMAL",
>>>>>>>>>>     "fontSize": "NORMAL",
>>>>>>>>>>     "digitGroupSeparator": "SPACE",
>>>>>>>>>>     "legendSet": null,
>>>>>>>>>>     "sorting": null,
>>>>>>>>>>     "regression": false,
>>>>>>>>>>     "measureCriteria": "GT:500;LT:1000",
>>>>>>>>>>     "cumulative": false,
>>>>>>>>>>     "sortOrder": 0,
>>>>>>>>>>     "topLimit": 0,
>>>>>>>>>>     "rowTotals": true,
>>>>>>>>>>     "colTotals": true,
>>>>>>>>>>     "rowSubTotals": true,
>>>>>>>>>>     "colSubTotals": true,
>>>>>>>>>>     "reportParams": {
>>>>>>>>>>         "paramReportingPeriod": false,
>>>>>>>>>>         "paramOrganisationUnit": false,
>>>>>>>>>>         "paramParentOrganisationUnit": true
>>>>>>>>>>     },
>>>>>>>>>>     "name": "bmi_normal_female_w_LTGT"
>>>>>>>>>> }
>>>>>>>>>>
>>>>>>>>>> But this doesn't seem to work. what's the dimension/criteria I
>>>>>>>>>> should use to get this done.
>>>>>>>>>>
>>>>>>>>>> Thank you
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> --
>>>>>>>>>> Regards,
>>>>>>>>>> Pamod Amarakoon
>>>>>>>>>>
>>>>>>>>>> Confidentiality Notice: the information contained in this email
>>>>>>>>>> and any attachments may be legally privileged and confidential. If you are
>>>>>>>>>> not an intended recipient, you are hereby notified that any dissemination,
>>>>>>>>>> distribution, or copying of this e-mail is strictly prohibited. If you have
>>>>>>>>>> received this e-mail in error, please notify the sender and permanently
>>>>>>>>>> delete the e-mail and any attachments immediately. You should not retain,
>>>>>>>>>> copy or use this e-mail or any attachments for any purpose, nor disclose
>>>>>>>>>> all or any part of the contents to any other person.
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>>
>>>>>>>>>> _______________________________________________
>>>>>>>>>> Mailing list: https://launchpad.net/~dhis2-devs
>>>>>>>>>> Post to     : dhis2-devs@xxxxxxxxxxxxxxxxxxx
>>>>>>>>>> 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
>>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> --
>>>>>>>> Regards,
>>>>>>>> Pamod Amarakoon
>>>>>>>>
>>>>>>>> Confidentiality Notice: the information contained in this email and
>>>>>>>> any attachments may be legally privileged and confidential. If you are not
>>>>>>>> an intended recipient, you are hereby notified that any dissemination,
>>>>>>>> distribution, or copying of this e-mail is strictly prohibited. If you have
>>>>>>>> received this e-mail in error, please notify the sender and permanently
>>>>>>>> delete the e-mail and any attachments immediately. You should not retain,
>>>>>>>> copy or use this e-mail or any attachments for any purpose, nor disclose
>>>>>>>> all or any part of the contents to any other person.
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Knut Staring
>>>>>>> Dept. of Informatics, University of Oslo
>>>>>>> Norway: +4791880522
>>>>>>> Skype: knutstar
>>>>>>> http://dhis2.org
>>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>> --
>>>>>> Regards,
>>>>>> Pamod Amarakoon
>>>>>>
>>>>>> Confidentiality Notice: the information contained in this email and
>>>>>> any attachments may be legally privileged and confidential. If you are not
>>>>>> an intended recipient, you are hereby notified that any dissemination,
>>>>>> distribution, or copying of this e-mail is strictly prohibited. If you have
>>>>>> received this e-mail in error, please notify the sender and permanently
>>>>>> delete the e-mail and any attachments immediately. You should not retain,
>>>>>> copy or use this e-mail or any attachments for any purpose, nor disclose
>>>>>> all or any part of the contents to any other person.
>>>>>>
>>>>>>
>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Knut Staring
>>>>> Dept. of Informatics, University of Oslo
>>>>> Norway: +4791880522
>>>>> Skype: knutstar
>>>>> http://dhis2.org
>>>>>
>>>>
>>>>
>>>>
>>>> --
>>>> Regards,
>>>> Pamod Amarakoon
>>>>
>>>> Confidentiality Notice: the information contained in this email and any
>>>> attachments may be legally privileged and confidential. If you are not an
>>>> intended recipient, you are hereby notified that any dissemination,
>>>> distribution, or copying of this e-mail is strictly prohibited. If you have
>>>> received this e-mail in error, please notify the sender and permanently
>>>> delete the e-mail and any attachments immediately. You should not retain,
>>>> copy or use this e-mail or any attachments for any purpose, nor disclose
>>>> all or any part of the contents to any other person.
>>>>
>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Knut Staring
>>> Dept. of Informatics, University of Oslo
>>> Norway: +4791880522
>>> Skype: knutstar
>>> http://dhis2.org
>>>
>>
>>
>>
>> --
>> Regards,
>> Pamod Amarakoon
>>
>> Confidentiality Notice: the information contained in this email and any
>> attachments may be legally privileged and confidential. If you are not an
>> intended recipient, you are hereby notified that any dissemination,
>> distribution, or copying of this e-mail is strictly prohibited. If you have
>> received this e-mail in error, please notify the sender and permanently
>> delete the e-mail and any attachments immediately. You should not retain,
>> copy or use this e-mail or any attachments for any purpose, nor disclose
>> all or any part of the contents to any other person.
>>
>>
>>
>>
>
>
> --
> Knut Staring
> Dept. of Informatics, University of Oslo
> Norway: +4791880522
> Skype: knutstar
> http://dhis2.org
>



-- 
Regards,
Pamod Amarakoon

Confidentiality Notice: the information contained in this email and any
attachments may be legally privileged and confidential. If you are not an
intended recipient, you are hereby notified that any dissemination,
distribution, or copying of this e-mail is strictly prohibited. If you have
received this e-mail in error, please notify the sender and permanently
delete the e-mail and any attachments immediately. You should not retain,
copy or use this e-mail or any attachments for any purpose, nor disclose
all or any part of the contents to any other person.

References