← Back to team overview

dhis2-devs team mailing list archive

Re: Issue with Aprrovals

 

Hi Archana,

Thanks, I see the problem now. The dataset you are viewing, "PMTCT monthly
summary", is configured to use workflow "Mortality < 5 years". This
workflow has a frequency of "Monthly". In the data approval report, you
have selected "Yearly" as the time period. This mismatch is causing the
bug. We will fix it one way or another (perhaps by disallowing the
mismatch.)

Meanwhile, the feature should work as long as you choose the same time
period in the report as the workflow frequency. In this case, since the
workflow frequency is "Monthly", if you select a data approval report of
"Monthly", it should work.

- If you want to do approvals at a different frequency from the dataset,
this is possible. For example, the dataset has an approval frequency of
monthly, but it uses a workflow with frequency "Yearly". So the data can be
approved yearly, and this approves the data for all the months of the year.

- If the data from several datasets should always be approved together,
just assign the datasets to the same workflow. Approving for the workflow
will approve the data in all datasets assigned to that workflow. Note that
the datasets don't all have to have the same frequency as the workflow.
Some period types may be less, some equal, and some even greater. For
example, you could have a workflow with frequency "Quarterly", and assign
to it various datasets with frequencies "Monthly", "Quarterly",
"SixMonthly", and "Yearly". When you approve for 2016Q1, it approves the
monthly data for Jan, Feb, Mar 2016 and the Q1 data. Approving for 2016Q2
approves for Apr, May, Jun, Q2, and the half-year. Q3 approves the three
months in Q3 and any Q3 data. Q4 approves the monthly data for Oct, Nov,
Dec, Q4, half-year 2, and the yearly data. The rule is simply if the
dataset period ends within the workflow approved period, then the data is
approved.

- At the moment, there is no interaction between approvals and data
synchronization. If data is synchronized from one system to another, it is
synchronized regardless of approval status. Future possibilities include
synchronizing approval records between systems as well as data, and/or
synchronizing only data that is approved (at what approval level?) We would
welcome your input as to how you would like approvals and data
synchronization to work together.

Note that the data approval report asks you to select a dataset, as it has
in the past. But starting with version 2.22 what is approved by this report
is actually the workflow associated with that dataset -- so it also
approves data for any other datasets that may be attached to that same
workflow. At some point we will likely be updating the data approval report
so you select a workflow instead of a dataset. We are also in the process
of updating all the user interface to the new app format -- we might do
these two at the same time.

The Web API for data approvals also approves by dataset, but in fact
approves the workflow associated with that dataset (and the data for any
other datasets associated with that workflow.) At some point in the future
we will ad the ability to approve by workflow using the Web API, but for
the moment if you just approve using one of the associated datasets with
the workflow, it will have the same effect.

Cheers,
Jim


On Thu, May 12, 2016 at 9:13 AM, Archana Chillala <archanac@xxxxxxxxxxxxxxxx
> wrote:

> Hi Jim,
>
> Thanks for the response. We were using 2.23 version 22889. Maybe updating
> to a latest version should help. However, we tested the same on the demo
> server as well and there was an exception thrown.
>
> Here's how -
> Added data to in a data set. Logged in as Guest user (by giving data
> approval authorities).
> On the Reports Module, in Data Approvals, we selected data criteria - and
> selected data set and "Yearly" as time period. Data is fetched.
> But when we try to approve by clicking on "Approve" button - an exception
> is thrown.
>
> Here's a snapshot of the exception.
>
>
> [image: Inline image 1]
>
> Could you please let us know the reason?
>
>
> Also, we want to know if we can do approvals for several data sets at a
> time? Is that possible currently?
>
> How do approvals affect data synchronisation? And what are the challenges?
>
>
>
> *Thanks,*
>
> Archana Chillala
> Application Developer
> Email archanac@xxxxxxxxxxxxxxxx
> Telephone +91 9100960533 <+91+9100960533>
> [image: ThoughtWorks]
> <http://www.thoughtworks.com/?utm_campaign=archana-chillala-signature&utm_medium=email&utm_source=thoughtworks-email-signature-generator>
>
> On Wed, May 11, 2016 at 11:37 PM, Jim Grace <jim@xxxxxxxxx> wrote:
>
>> Hi Archana,
>>
>> I'm not sure why this problem is happening for you. I'm not seeing it on
>> my system or on the demo system. But recently I added some extra checks
>> when approving data, and it's possible that this will fix your problem.
>> Please try again with version 2.23 revision 22934 or later.
>>
>> If that doesn't work, please give me some additional guidance as to how I
>> can reproduce the problem. Examples of what might be helpful:
>>
>> - If you can reproduce the problem on play.dhis2.org/demo, tell me how
>> you did it.
>>
>> - Send more information so I can reproduce your setup on my machine.
>>
>> - Give me access to a server where I can see the problem.
>>
>> Cheers,
>> Jim
>>
>>
>> On Wed, May 11, 2016 at 2:17 PM, Archana Chillala <
>> archanac@xxxxxxxxxxxxxxxx> wrote:
>>
>>> Hi,
>>>
>>> We are exploring approvals functionality in DHIS latest revision of
>>> 2.23. We came across an issue with approving data.
>>> We set up two approval levels (say 1 and 2) and added a workflow that
>>> included both. We also created users at those levels giving the right
>>> authorities for approvals. Logged in as user 1 (user at level 1), went to
>>> "Data Approvals" in "Reports module and gave criteria to fetch data. Tables
>>> are generated, but when we click on "Approve" an exception is thrown.
>>>
>>>
>>> Screen shot here shows the exception.
>>>
>>> [image: Inline image 1]
>>>
>>>
>>> And here's the log trace for the same:
>>>
>>> * INFO  2016-05-11 16:26:35,937 Approvals saved: 1
>>> (DefaultDataApprovalService.java [http-bio-8080-exec-6])
>>> * WARN  2016-05-11 16:26:35,945 SQL Error: 0, SQLState: 23505
>>> (SqlExceptionHelper.java [http-bio-8080-exec-6])
>>> * *ERROR 2016-05-11 16:26:35,946 ERROR: duplicate key value violates
>>> unique constraint "dataapproval_unique_key"*
>>> *  Detail: Key (dataapprovallevelid, workflowid, periodid,
>>> organisationunitid, attributeoptioncomboid)=(1319, 1324, 1331, 206, 15)
>>> already exists. (SqlExceptionHelper.java [http-bio-8080-exec-6])*
>>> ** ERROR 2016-05-11 16:26:35,951 Exception happened while trying to
>>> invoke the request URL:/api/dataApprovals (CrudControllerAdvice.java
>>> [http-bio-8080-exec-6])*
>>> *org.springframework.dao.DataIntegrityViolationException: could not
>>> execute statement; SQL [n/a]; constraint [dataapproval_unique_key]; nested
>>> exception is org.hibernate.exception.ConstraintViolationException: could
>>> not execute statement*
>>> at
>>> org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:163)
>>> at
>>> org.springframework.orm.hibernate4.HibernateTransactionManager.convertHibernateAccessException(HibernateTransactionManager.java:730)
>>> at
>>> org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:592)
>>> at
>>> org.springframework.transaction.support.AbstractPlatformTransactionManager.processCommit(AbstractPlatformTransactionManager.java:761)
>>> at
>>> org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:730)
>>> at
>>> org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:485)
>>> at
>>> org.springframework.transaction.interceptor.TransactionAspectSupport.invokeWithinTransaction(TransactionAspectSupport.java:291)
>>> at
>>> org.springframework.transaction.interceptor.TransactionInterceptor.invoke(TransactionInterceptor.java:96)
>>> at
>>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
>>> at
>>> org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:208)
>>> at com.sun.proxy.$Proxy58.approveData(Unknown Source)
>>> at
>>> org.hisp.dhis.webapi.controller.DataApprovalController.saveApproval(DataApprovalController.java:369)
>>> at
>>> org.hisp.dhis.webapi.controller.DataApprovalController$$FastClassBySpringCGLIB$$3201324d.invoke(<generated>)
>>> at
>>> org.springframework.cglib.proxy.MethodProxy.invoke(MethodProxy.java:204)
>>> at
>>> org.springframework.aop.framework.CglibAopProxy$CglibMethodInvocation.invokeJoinpoint(CglibAopProxy.java:720)
>>> at
>>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:157)
>>> at
>>> org.springframework.security.access.intercept.aopalliance.MethodSecurityInterceptor.invoke(MethodSecurityInterceptor.java:64)
>>> at
>>> org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)
>>> at
>>> org.springframework.aop.framework.CglibAopProxy$DynamicAdvisedInterceptor.intercept(CglibAopProxy.java:655)
>>> at
>>> org.hisp.dhis.webapi.controller.DataApprovalController$$EnhancerBySpringCGLIB$$e206e617.saveApproval(<generated>)
>>> at sun.reflect.NativeMethodAccessorImpl.invoke0(Native Method)
>>> at
>>> sun.reflect.NativeMethodAccessorImpl.invoke(NativeMethodAccessorImpl.java:62)
>>> at
>>> sun.reflect.DelegatingMethodAccessorImpl.invoke(DelegatingMethodAccessorImpl.java:43)
>>> at java.lang.reflect.Method.invoke(Method.java:498)
>>>
>>>
>>> Is this a known issue? or are we missing something?
>>> Any help here would be appreciated.
>>>
>>>
>>>
>>> *Cheers*
>>>
>>> Archana Chillala
>>> Application Developer
>>> Email archanac@xxxxxxxxxxxxxxxx
>>> Telephone +91 9100960533 <+91+9100960533>
>>> [image: ThoughtWorks]
>>> <http://www.thoughtworks.com/?utm_campaign=archana-chillala-signature&utm_medium=email&utm_source=thoughtworks-email-signature-generator>
>>>
>>> _______________________________________________
>>> 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
>>>
>>>
>>
>>
>> --
>> Jim Grace
>> Core developer, DHIS 2
>> HISP US Inc.
>> http://www.dhis2.org <https://www.dhis2.org/>
>>
>
>


-- 
Jim Grace
Core developer, DHIS 2
HISP US Inc.
http://www.dhis2.org <https://www.dhis2.org/>

PNG image

PNG image


References