Compulsory data element not seems to be working

Hi All,
Am try to set certain data element as compulsory or mandatory in data set but some reason the assigned compulsory data element does not seem to have any effect on the data sets or forms. Forms or data sets can be completed even though they contain compulsory data element. Is this a bug or a my doing something wrong? My steps below.

From Data set App

  1. Select Data sets
  2. Left click on the desired Data set
  3. Select “Edit Compulsory Data Element” from the dropdown
  4. From the list of data element double on the desired data element
  5. then click save

From the Date entry App

  1. Select the data set/form you added the compulsory data element
  2. Field other fields in the form except the compulsory data element
  3. then click on “Complete”

Idealy the form should not be completed or submitted if the compulsory data element is not filled, but in my case the form / data set completes even though the compulsory data element was neglected.

Thanks,

Bayoh.

···

Ibrahim Rashid Bayoh
Information Systems Coordinator,

eHealth Africa(Sierra Leone)

117 Wilkinson Rd, Freetown, Sierra Leone

Mobile: +232 88-765-638

ibrahim.bayoh@sl.ehealthafrica.org

http://ehealthafrica.org/

1 Like

Hi Ibra,

thanks for reporting. Yes we are in fact aware of this one and working on it now. Should be fixed soon.

regards,

Lars

···

On Fri, Jun 24, 2016 at 2:00 PM, Ibrahim Bayoh ibrahim.bayoh@sl.ehealthafrica.org wrote:

Hi All,
Am try to set certain data element as compulsory or mandatory in data set but some reason the assigned compulsory data element does not seem to have any effect on the data sets or forms. Forms or data sets can be completed even though they contain compulsory data element. Is this a bug or a my doing something wrong? My steps below.

From Data set App

  1. Select Data sets
  2. Left click on the desired Data set
  3. Select “Edit Compulsory Data Element” from the dropdown
  4. From the list of data element double on the desired data element
  5. then click save

From the Date entry App

  1. Select the data set/form you added the compulsory data element
  2. Field other fields in the form except the compulsory data element
  3. then click on “Complete”

Idealy the form should not be completed or submitted if the compulsory data element is not filled, but in my case the form / data set completes even though the compulsory data element was neglected.

Thanks,

Bayoh.

Ibrahim Rashid Bayoh
Information Systems Coordinator,

eHealth Africa(Sierra Leone)

117 Wilkinson Rd, Freetown, Sierra Leone

Mobile: +232 88-765-638

ibrahim.bayoh@sl.ehealthafrica.org

http://ehealthafrica.org/


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

lars@dhis2.org

http://www.dhis2.org

Hi Lars,
Regarding the Compulsory data element feature, it’s still not been fixed. We’ve tested on 2.22 and 2.23 with almost the result.

  • From the ‘Data Sets’ screen in DHIS2
  • Select a Data Set
  • Right click it and then ‘Edit Compulsory Data Elements’
  • Attempt to add one of the Data Elements to the DataSet
  • Hit ‘Save’.
    The action fails, with a DHIS2 error screen asking you to go back, where the changes aren’t saved.
···

On Fri, Jun 24, 2016 at 12:45 PM, Lars Helge Øverland lars@dhis2.org wrote:

Hi Ibra,

thanks for reporting. Yes we are in fact aware of this one and working on it now. Should be fixed soon.

regards,

Lars

On Fri, Jun 24, 2016 at 2:00 PM, Ibrahim Bayoh ibrahim.bayoh@sl.ehealthafrica.org wrote:

Hi All,
Am try to set certain data element as compulsory or mandatory in data set but some reason the assigned compulsory data element does not seem to have any effect on the data sets or forms. Forms or data sets can be completed even though they contain compulsory data element. Is this a bug or a my doing something wrong? My steps below.

From Data set App

  1. Select Data sets
  2. Left click on the desired Data set
  3. Select “Edit Compulsory Data Element” from the dropdown
  4. From the list of data element double on the desired data element
  5. then click save

From the Date entry App

  1. Select the data set/form you added the compulsory data element
  2. Field other fields in the form except the compulsory data element
  3. then click on “Complete”

Idealy the form should not be completed or submitted if the compulsory data element is not filled, but in my case the form / data set completes even though the compulsory data element was neglected.

Thanks,

Bayoh.

Ibrahim Rashid Bayoh
Information Systems Coordinator,

eHealth Africa(Sierra Leone)

117 Wilkinson Rd, Freetown, Sierra Leone

Mobile: +232 88-765-638

ibrahim.bayoh@sl.ehealthafrica.org

http://ehealthafrica.org/


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

lars@dhis2.org

http://www.dhis2.org

Ibrahim Rashid Bayoh
Software Developer,

eHealth Africa(Sierra Leone)

Mobile: +232 88-765-638

117 Wilkinson Rd, Freetown, Sierra Leone

ibrahim.bayoh@sl.ehealthafrica.org

http://ehealthafrica.org/

1 Like

Hi all,

Any chance we could get a DHIS2 developer to respond to these issues with compulsory data elements?

As I understand then, it seems to be two issues:

1.) Attempting to add data elements as compulsory to certain data sets seems to result in a crash related to a uniqueness constraint being violated: “duplicate key value violates unique constraint “dataelement_operand_unique_key” Detail: Key (dataelementid, categoryoptioncomboid)=(1627, 1596) already exists”

2.) When a data element can be successfully added to a data set as compulsory, it appears it is not checked at all in the data validation within data entry for the data set.

···

Any help with either issue would be great.

Thanks,

  • Jasper

On Fri, Oct 21, 2016 at 10:08 AM, Ibrahim Bayoh ibrahim.bayoh@sl.ehealthafrica.org wrote:

Hi Lars,
Regarding the Compulsory data element feature, it’s still not been fixed. We’ve tested on 2.22 and 2.23 with almost the result.

  • From the ‘Data Sets’ screen in DHIS2
  • Select a Data Set
  • Right click it and then ‘Edit Compulsory Data Elements’
  • Attempt to add one of the Data Elements to the DataSet
  • Hit ‘Save’.
    The action fails, with a DHIS2 error screen asking you to go back, where the changes aren’t saved.

See log below.

From the ‘Data Sets’ screen in DHIS2, select a Data Set, click it and then ‘Edit Compulsory Data Elements’. Attempt to add one of these Data Elements to the Data Set and hit ‘Save’. The action fails, with a DHIS2 error screen asking you to go back, where the changes aren’t saved.

This appears to happen on both our dev server (2.22) and staging (2.21), for all data set and data element combinations.

See log output below:

`* INFO 2016-10-19 12:54:54,425 ‘admin’ update org.hisp.dhis.dataset.DataSet, name: georgeTest, uid: vjAYdNmic8v (AuditLogUtil.java [http-apr-8080-exec-7])

  • WARN 2016-10-19 12:54:54,429 SQL Error: 0, SQLState: 23505 (SqlExceptionHelper.java [http-apr-8080-exec-7])
  • ERROR 2016-10-19 12:54:54,429 ERROR: duplicate key value violates unique constraint “dataelement_operand_unique_key”

Detail: Key (dataelementid, categoryoptioncomboid)=(1627, 1596) already exists. (SqlExceptionHelper.java [http-apr-8080-exec-7])

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:757)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:726)

at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:521)

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.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)

at com.sun.proxy.$Proxy99.updateDataSet(Unknown Source)

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)

at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:450)

at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:289)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:252)

at org.hisp.dhis.webportal.interceptor.XWorkPortalUserInterceptor.intercept(XWorkPortalUserInterceptor.java:85)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.webportal.interceptor.XWorkPortalModuleInterceptor.intercept(XWorkPortalModuleInterceptor.java:91)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.webportal.interceptor.XWorkPortalMenuInterceptor.intercept(XWorkPortalMenuInterceptor.java:94)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.webportal.interceptor.XWorkPortalParamsInterceptor.intercept(XWorkPortalParamsInterceptor.java:149)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.interceptor.ContextInterceptor.intercept(ContextInterceptor.java:83)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.interceptor.UserSettingInterceptor.intercept(UserSettingInterceptor.java:81)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.security.intercept.LoginInterceptor.intercept(LoginInterceptor.java:85)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.security.intercept.XWorkSecurityInterceptor.intercept(XWorkSecurityInterceptor.java:116)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.interceptor.SystemSettingInterceptor.intercept(SystemSettingInterceptor.java:115)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:139)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:254)

at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.interceptor.ExceptionInterceptor.intercept(ExceptionInterceptor.java:113)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)

at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:562)

at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)

at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)

at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)

at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.hisp.dhis.security.filter.CorsFilter.doFilter(CorsFilter.java:123)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.hisp.dhis.security.filter.CustomAuthenticationFilter.doFilter(CustomAuthenticationFilter.java:64)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter.doFilter(OAuth2AuthenticationProcessingFilter.java:140)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.hisp.dhis.security.filter.AutomaticAccessFilter.doFilter(AutomaticAccessFilter.java:115)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:57)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)

at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)

at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)

at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:151)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)

at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:442)

at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1083)

at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:640)

at org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:2454)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Thread.java:745)

Caused by: org.hibernate.exception.ConstraintViolationException: could not execute statement

at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:129)

at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)

at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:124)

at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109)

at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:189)

at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:59)

at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3079)

at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3521)

at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:88)

at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:395)

at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:387)

at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:303)

at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:349)

at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:56)

at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1195)

at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:404)

at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101)

at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:175)

at org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:584)

… 118 more

Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint “dataelement_operand_unique_key”

Detail: Key (dataelementid, categoryoptioncomboid)=(1627, 1596) already exists.

at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2198)

at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1927)

at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)

at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:561)

at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:419)

at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:365)

at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)

at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:186)

… 132

more

at

org.hisp.dhis.dataset.action.compulsory.SaveCompulsoryDataElementsAction.execute(SaveCompulsoryDataElementsAction.java:113)

  • ERROR 2016-10-19 12:54:54,433 Error while executing action (ExceptionInterceptor.java [http-apr-8080-exec-7])

org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [dataelement_operand_unique_key]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute

statement

at

org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:163)`
Thanks,
Bayoh.

On Fri, Jun 24, 2016 at 12:45 PM, Lars Helge Øverland lars@dhis2.org wrote:

Hi Ibra,

thanks for reporting. Yes we are in fact aware of this one and working on it now. Should be fixed soon.

regards,

Lars


Ibrahim Rashid Bayoh
Software Developer,

eHealth Africa(Sierra Leone)

Mobile: +232 88-765-638

117 Wilkinson Rd, Freetown, Sierra Leone

ibrahim.bayoh@sl.ehealthafrica.org

http://ehealthafrica.org/

On Fri, Jun 24, 2016 at 2:00 PM, Ibrahim Bayoh ibrahim.bayoh@sl.ehealthafrica.org wrote:

Hi All,
Am try to set certain data element as compulsory or mandatory in data set but some reason the assigned compulsory data element does not seem to have any effect on the data sets or forms. Forms or data sets can be completed even though they contain compulsory data element. Is this a bug or a my doing something wrong? My steps below.

From Data set App

  1. Select Data sets
  2. Left click on the desired Data set
  3. Select “Edit Compulsory Data Element” from the dropdown
  4. From the list of data element double on the desired data element
  5. then click save

From the Date entry App

  1. Select the data set/form you added the compulsory data element
  2. Field other fields in the form except the compulsory data element
  3. then click on “Complete”

Idealy the form should not be completed or submitted if the compulsory data element is not filled, but in my case the form / data set completes even though the compulsory data element was neglected.

Thanks,

Bayoh.

Ibrahim Rashid Bayoh
Information Systems Coordinator,

eHealth Africa(Sierra Leone)

117 Wilkinson Rd, Freetown, Sierra Leone

Mobile: +232 88-765-638

ibrahim.bayoh@sl.ehealthafrica.org

http://ehealthafrica.org/


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

lars@dhis2.org

http://www.dhis2.org

1 Like

Hi there,

you are right, this was a bug that was fixed in 2.24. The problem is the uniqueness constraint on data element + option combo which simply should not be there.

dataelement_operand_unique_key

I have backported the fix to 2.23 as well now.

Per now, the compulsory elements are only used for reporting rate calculations, not to block completion of forms.

regards,

Lars

···

On Thu, Oct 27, 2016 at 5:43 AM, Jasper Timm jasper.timm@ehealthnigeria.org wrote:

Hi all,

Any chance we could get a DHIS2 developer to respond to these issues with compulsory data elements?

As I understand then, it seems to be two issues:

1.) Attempting to add data elements as compulsory to certain data sets seems to result in a crash related to a uniqueness constraint being violated: “duplicate key value violates unique constraint “dataelement_operand_unique_key” Detail: Key (dataelementid, categoryoptioncomboid)=(1627, 1596) already exists”

2.) When a data element can be successfully added to a data set as compulsory, it appears it is not checked at all in the data validation within data entry for the data set.

Any help with either issue would be great.

Thanks,

  • Jasper

On Fri, Oct 21, 2016 at 10:08 AM, Ibrahim Bayoh ibrahim.bayoh@sl.ehealthafrica.org wrote:

Hi Lars,
Regarding the Compulsory data element feature, it’s still not been fixed. We’ve tested on 2.22 and 2.23 with almost the result.

  • From the ‘Data Sets’ screen in DHIS2
  • Select a Data Set
  • Right click it and then ‘Edit Compulsory Data Elements’
  • Attempt to add one of the Data Elements to the DataSet
  • Hit ‘Save’.
    The action fails, with a DHIS2 error screen asking you to go back, where the changes aren’t saved.

See log below.

From the ‘Data Sets’ screen in DHIS2, select a Data Set, click it and then ‘Edit Compulsory Data Elements’. Attempt to add one of these Data Elements to the Data Set and hit ‘Save’. The action fails, with a DHIS2 error screen asking you to go back, where the changes aren’t saved.

This appears to happen on both our dev server (2.22) and staging (2.21), for all data set and data element combinations.

See log output below:

`* INFO 2016-10-19 12:54:54,425 ‘admin’ update org.hisp.dhis.dataset.DataSet, name: georgeTest, uid: vjAYdNmic8v (AuditLogUtil.java [http-apr-8080-exec-7])

  • WARN 2016-10-19 12:54:54,429 SQL Error: 0, SQLState: 23505 (SqlExceptionHelper.java [http-apr-8080-exec-7])
  • ERROR 2016-10-19 12:54:54,429 ERROR: duplicate key value violates unique constraint “dataelement_operand_unique_key”

Detail: Key (dataelementid, categoryoptioncomboid)=(1627, 1596) already exists. (SqlExceptionHelper.java [http-apr-8080-exec-7])

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:757)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:726)

at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:521)

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.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)

at com.sun.proxy.$Proxy99.updateDataSet(Unknown Source)

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)

at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:450)

at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:289)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:252)

at org.hisp.dhis.webportal.interceptor.XWorkPortalUserInterceptor.intercept(XWorkPortalUserInterceptor.java:85)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.webportal.interceptor.XWorkPortalModuleInterceptor.intercept(XWorkPortalModuleInterceptor.java:91)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.webportal.interceptor.XWorkPortalMenuInterceptor.intercept(XWorkPortalMenuInterceptor.java:94)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.webportal.interceptor.XWorkPortalParamsInterceptor.intercept(XWorkPortalParamsInterceptor.java:149)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.interceptor.ContextInterceptor.intercept(ContextInterceptor.java:83)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.interceptor.UserSettingInterceptor.intercept(UserSettingInterceptor.java:81)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.security.intercept.LoginInterceptor.intercept(LoginInterceptor.java:85)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.security.intercept.XWorkSecurityInterceptor.intercept(XWorkSecurityInterceptor.java:116)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.interceptor.SystemSettingInterceptor.intercept(SystemSettingInterceptor.java:115)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:139)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:254)

at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.interceptor.ExceptionInterceptor.intercept(ExceptionInterceptor.java:113)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)

at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:562)

at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)

at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)

at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)

at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.hisp.dhis.security.filter.CorsFilter.doFilter(CorsFilter.java:123)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.hisp.dhis.security.filter.CustomAuthenticationFilter.doFilter(CustomAuthenticationFilter.java:64)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter.doFilter(OAuth2AuthenticationProcessingFilter.java:140)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.hisp.dhis.security.filter.AutomaticAccessFilter.doFilter(AutomaticAccessFilter.java:115)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:57)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)

at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)

at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)

at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:151)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)

at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:442)

at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1083)

at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:640)

at org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:2454)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Thread.java:745)

Caused by: org.hibernate.exception.ConstraintViolationException: could not execute statement

at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:129)

at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)

at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:124)

at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109)

at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:189)

at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:59)

at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3079)

at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3521)

at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:88)

at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:395)

at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:387)

at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:303)

at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:349)

at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:56)

at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1195)

at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:404)

at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101)

at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:175)

at org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:584)

… 118 more

Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint “dataelement_operand_unique_key”

Detail: Key (dataelementid, categoryoptioncomboid)=(1627, 1596) already exists.

at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2198)

at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1927)

at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)

at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:561)

at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:419)

at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:365)

at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)

at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:186)

… 132

more

at

org.hisp.dhis.dataset.action.compulsory.SaveCompulsoryDataElementsAction.execute(SaveCompulsoryDataElementsAction.java:113)

  • ERROR 2016-10-19 12:54:54,433 Error while executing action (ExceptionInterceptor.java [http-apr-8080-exec-7])

org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [dataelement_operand_unique_key]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute

statement

at

org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:163)`
Thanks,
Bayoh.

On Fri, Jun 24, 2016 at 12:45 PM, Lars Helge Øverland lars@dhis2.org wrote:

Hi Ibra,

thanks for reporting. Yes we are in fact aware of this one and working on it now. Should be fixed soon.

regards,

Lars


Ibrahim Rashid Bayoh
Software Developer,

eHealth Africa(Sierra Leone)

Mobile: +232 88-765-638

117 Wilkinson Rd, Freetown, Sierra Leone

ibrahim.bayoh@sl.ehealthafrica.org

http://ehealthafrica.org/

On Fri, Jun 24, 2016 at 2:00 PM, Ibrahim Bayoh ibrahim.bayoh@sl.ehealthafrica.org wrote:

Hi All,
Am try to set certain data element as compulsory or mandatory in data set but some reason the assigned compulsory data element does not seem to have any effect on the data sets or forms. Forms or data sets can be completed even though they contain compulsory data element. Is this a bug or a my doing something wrong? My steps below.

From Data set App

  1. Select Data sets
  2. Left click on the desired Data set
  3. Select “Edit Compulsory Data Element” from the dropdown
  4. From the list of data element double on the desired data element
  5. then click save

From the Date entry App

  1. Select the data set/form you added the compulsory data element
  2. Field other fields in the form except the compulsory data element
  3. then click on “Complete”

Idealy the form should not be completed or submitted if the compulsory data element is not filled, but in my case the form / data set completes even though the compulsory data element was neglected.

Thanks,

Bayoh.

Ibrahim Rashid Bayoh
Information Systems Coordinator,

eHealth Africa(Sierra Leone)

117 Wilkinson Rd, Freetown, Sierra Leone

Mobile: +232 88-765-638

ibrahim.bayoh@sl.ehealthafrica.org

http://ehealthafrica.org/


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

lars@dhis2.org

http://www.dhis2.org

Lars Helge Øverland

Lead developer, DHIS 2

University of Oslo

Skype: larshelgeoverland

lars@dhis2.org

http://www.dhis2.org

Hey Lars,

Thanks for the quick response!

We’re actually running 2.22 here (as is the production Sierra Leone national instance we’re working in co-operation with I believe).

There seems to be some confusion with the functionality of compulsory data elements though, in this previous thread you seemed to mention it was a known bug that forms could be completed with blank compulsory data elements: https://lists.launchpad.net/dhis2-users/msg10726.html

Was that a misunderstanding?

If so, what would you recommend? A data validation rule for each data element which checks that it is not blank? Can this be done in one rule?

Thanks for your help,

  • Jasper
···

On Thu, Oct 27, 2016 at 1:02 PM, Lars Helge Øverland lars@dhis2.org wrote:

Hi there,

you are right, this was a bug that was fixed in 2.24. The problem is the uniqueness constraint on data element + option combo which simply should not be there.

dataelement_operand_unique_key

I have backported the fix to 2.23 as well now.

Per now, the compulsory elements are only used for reporting rate calculations, not to block completion of forms.

regards,

Lars

On Thu, Oct 27, 2016 at 5:43 AM, Jasper Timm jasper.timm@ehealthnigeria.org wrote:

Hi all,

Any chance we could get a DHIS2 developer to respond to these issues with compulsory data elements?

As I understand then, it seems to be two issues:

1.) Attempting to add data elements as compulsory to certain data sets seems to result in a crash related to a uniqueness constraint being violated: “duplicate key value violates unique constraint “dataelement_operand_unique_key” Detail: Key (dataelementid, categoryoptioncomboid)=(1627, 1596) already exists”

2.) When a data element can be successfully added to a data set as compulsory, it appears it is not checked at all in the data validation within data entry for the data set.


Lars Helge Øverland

Lead developer, DHIS 2

University of Oslo

Skype: larshelgeoverland

lars@dhis2.org

http://www.dhis2.org

Any help with either issue would be great.

Thanks,

  • Jasper

On Fri, Oct 21, 2016 at 10:08 AM, Ibrahim Bayoh ibrahim.bayoh@sl.ehealthafrica.org wrote:

Hi Lars,
Regarding the Compulsory data element feature, it’s still not been fixed. We’ve tested on 2.22 and 2.23 with almost the result.

  • From the ‘Data Sets’ screen in DHIS2
  • Select a Data Set
  • Right click it and then ‘Edit Compulsory Data Elements’
  • Attempt to add one of the Data Elements to the DataSet
  • Hit ‘Save’.
    The action fails, with a DHIS2 error screen asking you to go back, where the changes aren’t saved.

See log below.

From the ‘Data Sets’ screen in DHIS2, select a Data Set, click it and then ‘Edit Compulsory Data Elements’. Attempt to add one of these Data Elements to the Data Set and hit ‘Save’. The action fails, with a DHIS2 error screen asking you to go back, where the changes aren’t saved.

This appears to happen on both our dev server (2.22) and staging (2.21), for all data set and data element combinations.

See log output below:

`* INFO 2016-10-19 12:54:54,425 ‘admin’ update org.hisp.dhis.dataset.DataSet, name: georgeTest, uid: vjAYdNmic8v (AuditLogUtil.java [http-apr-8080-exec-7])

  • WARN 2016-10-19 12:54:54,429 SQL Error: 0, SQLState: 23505 (SqlExceptionHelper.java [http-apr-8080-exec-7])
  • ERROR 2016-10-19 12:54:54,429 ERROR: duplicate key value violates unique constraint “dataelement_operand_unique_key”

Detail: Key (dataelementid, categoryoptioncomboid)=(1627, 1596) already exists. (SqlExceptionHelper.java [http-apr-8080-exec-7])

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:757)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:726)

at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:521)

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.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)

at com.sun.proxy.$Proxy99.updateDataSet(Unknown Source)

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)

at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:450)

at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:289)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:252)

at org.hisp.dhis.webportal.interceptor.XWorkPortalUserInterceptor.intercept(XWorkPortalUserInterceptor.java:85)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.webportal.interceptor.XWorkPortalModuleInterceptor.intercept(XWorkPortalModuleInterceptor.java:91)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.webportal.interceptor.XWorkPortalMenuInterceptor.intercept(XWorkPortalMenuInterceptor.java:94)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.webportal.interceptor.XWorkPortalParamsInterceptor.intercept(XWorkPortalParamsInterceptor.java:149)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.interceptor.ContextInterceptor.intercept(ContextInterceptor.java:83)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.interceptor.UserSettingInterceptor.intercept(UserSettingInterceptor.java:81)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.security.intercept.LoginInterceptor.intercept(LoginInterceptor.java:85)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.security.intercept.XWorkSecurityInterceptor.intercept(XWorkSecurityInterceptor.java:116)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.interceptor.SystemSettingInterceptor.intercept(SystemSettingInterceptor.java:115)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:139)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:254)

at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.interceptor.ExceptionInterceptor.intercept(ExceptionInterceptor.java:113)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)

at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:562)

at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)

at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)

at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)

at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.hisp.dhis.security.filter.CorsFilter.doFilter(CorsFilter.java:123)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.hisp.dhis.security.filter.CustomAuthenticationFilter.doFilter(CustomAuthenticationFilter.java:64)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter.doFilter(OAuth2AuthenticationProcessingFilter.java:140)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.hisp.dhis.security.filter.AutomaticAccessFilter.doFilter(AutomaticAccessFilter.java:115)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:57)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)

at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)

at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)

at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:151)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)

at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:442)

at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1083)

at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:640)

at org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:2454)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Thread.java:745)

Caused by: org.hibernate.exception.ConstraintViolationException: could not execute statement

at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:129)

at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)

at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:124)

at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109)

at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:189)

at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:59)

at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3079)

at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3521)

at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:88)

at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:395)

at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:387)

at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:303)

at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:349)

at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:56)

at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1195)

at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:404)

at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101)

at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:175)

at org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:584)

… 118 more

Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint “dataelement_operand_unique_key”

Detail: Key (dataelementid, categoryoptioncomboid)=(1627, 1596) already exists.

at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2198)

at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1927)

at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)

at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:561)

at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:419)

at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:365)

at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)

at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:186)

… 132

more

at

org.hisp.dhis.dataset.action.compulsory.SaveCompulsoryDataElementsAction.execute(SaveCompulsoryDataElementsAction.java:113)

  • ERROR 2016-10-19 12:54:54,433 Error while executing action (ExceptionInterceptor.java [http-apr-8080-exec-7])

org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [dataelement_operand_unique_key]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute

statement

at

org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:163)`
Thanks,
Bayoh.

On Fri, Jun 24, 2016 at 12:45 PM, Lars Helge Øverland lars@dhis2.org wrote:

Hi Ibra,

thanks for reporting. Yes we are in fact aware of this one and working on it now. Should be fixed soon.

regards,

Lars


Ibrahim Rashid Bayoh
Software Developer,

eHealth Africa(Sierra Leone)

Mobile: +232 88-765-638

117 Wilkinson Rd, Freetown, Sierra Leone

ibrahim.bayoh@sl.ehealthafrica.org

http://ehealthafrica.org/

On Fri, Jun 24, 2016 at 2:00 PM, Ibrahim Bayoh ibrahim.bayoh@sl.ehealthafrica.org wrote:

Hi All,
Am try to set certain data element as compulsory or mandatory in data set but some reason the assigned compulsory data element does not seem to have any effect on the data sets or forms. Forms or data sets can be completed even though they contain compulsory data element. Is this a bug or a my doing something wrong? My steps below.

From Data set App

  1. Select Data sets
  2. Left click on the desired Data set
  3. Select “Edit Compulsory Data Element” from the dropdown
  4. From the list of data element double on the desired data element
  5. then click save

From the Date entry App

  1. Select the data set/form you added the compulsory data element
  2. Field other fields in the form except the compulsory data element
  3. then click on “Complete”

Idealy the form should not be completed or submitted if the compulsory data element is not filled, but in my case the form / data set completes even though the compulsory data element was neglected.

Thanks,

Bayoh.

Ibrahim Rashid Bayoh
Information Systems Coordinator,

eHealth Africa(Sierra Leone)

117 Wilkinson Rd, Freetown, Sierra Leone

Mobile: +232 88-765-638

ibrahim.bayoh@sl.ehealthafrica.org

http://ehealthafrica.org/


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

lars@dhis2.org

http://www.dhis2.org

1 Like

Hi Jasper,

okay. Compulsory data elements are not meant to block data entry form submission.

Yes you could try using a validation rule. E.g. if this is numeric and is supposed to be a positive value, you can create a validation rule saying

#{data element a} > 0

and then select “never skip” in the numerator expression dialog (this setting refers to how to handle cases with missing data values).

best regards,

Lars

···

On Thu, Oct 27, 2016 at 3:34 PM, Jasper Timm jasper.timm@ehealthnigeria.org wrote:

Hey Lars,

Thanks for the quick response!

We’re actually running 2.22 here (as is the production Sierra Leone national instance we’re working in co-operation with I believe).

There seems to be some confusion with the functionality of compulsory data elements though, in this previous thread you seemed to mention it was a known bug that forms could be completed with blank compulsory data elements: https://lists.launchpad.net/dhis2-users/msg10726.html

Was that a misunderstanding?

If so, what would you recommend? A data validation rule for each data element which checks that it is not blank? Can this be done in one rule?

Thanks for your help,

  • Jasper

On Thu, Oct 27, 2016 at 1:02 PM, Lars Helge Øverland lars@dhis2.org wrote:

Hi there,

you are right, this was a bug that was fixed in 2.24. The problem is the uniqueness constraint on data element + option combo which simply should not be there.

dataelement_operand_unique_key

I have backported the fix to 2.23 as well now.

Per now, the compulsory elements are only used for reporting rate calculations, not to block completion of forms.

regards,

Lars

On Thu, Oct 27, 2016 at 5:43 AM, Jasper Timm jasper.timm@ehealthnigeria.org wrote:

Hi all,

Any chance we could get a DHIS2 developer to respond to these issues with compulsory data elements?

As I understand then, it seems to be two issues:

1.) Attempting to add data elements as compulsory to certain data sets seems to result in a crash related to a uniqueness constraint being violated: “duplicate key value violates unique constraint “dataelement_operand_unique_key” Detail: Key (dataelementid, categoryoptioncomboid)=(1627, 1596) already exists”

2.) When a data element can be successfully added to a data set as compulsory, it appears it is not checked at all in the data validation within data entry for the data set.


Lars Helge Øverland

Lead developer, DHIS 2

University of Oslo

Skype: larshelgeoverland

lars@dhis2.org

http://www.dhis2.org

Any help with either issue would be great.

Thanks,

  • Jasper

On Fri, Oct 21, 2016 at 10:08 AM, Ibrahim Bayoh ibrahim.bayoh@sl.ehealthafrica.org wrote:

Hi Lars,
Regarding the Compulsory data element feature, it’s still not been fixed. We’ve tested on 2.22 and 2.23 with almost the result.

  • From the ‘Data Sets’ screen in DHIS2
  • Select a Data Set
  • Right click it and then ‘Edit Compulsory Data Elements’
  • Attempt to add one of the Data Elements to the DataSet
  • Hit ‘Save’.
    The action fails, with a DHIS2 error screen asking you to go back, where the changes aren’t saved.

See log below.

From the ‘Data Sets’ screen in DHIS2, select a Data Set, click it and then ‘Edit Compulsory Data Elements’. Attempt to add one of these Data Elements to the Data Set and hit ‘Save’. The action fails, with a DHIS2 error screen asking you to go back, where the changes aren’t saved.

This appears to happen on both our dev server (2.22) and staging (2.21), for all data set and data element combinations.

See log output below:

`* INFO 2016-10-19 12:54:54,425 ‘admin’ update org.hisp.dhis.dataset.DataSet, name: georgeTest, uid: vjAYdNmic8v (AuditLogUtil.java [http-apr-8080-exec-7])

  • WARN 2016-10-19 12:54:54,429 SQL Error: 0, SQLState: 23505 (SqlExceptionHelper.java [http-apr-8080-exec-7])
  • ERROR 2016-10-19 12:54:54,429 ERROR: duplicate key value violates unique constraint “dataelement_operand_unique_key”

Detail: Key (dataelementid, categoryoptioncomboid)=(1627, 1596) already exists. (SqlExceptionHelper.java [http-apr-8080-exec-7])

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:757)

at org.springframework.transaction.support.AbstractPlatformTransactionManager.commit(AbstractPlatformTransactionManager.java:726)

at org.springframework.transaction.interceptor.TransactionAspectSupport.commitTransactionAfterReturning(TransactionAspectSupport.java:521)

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.interceptor.ExposeInvocationInterceptor.invoke(ExposeInvocationInterceptor.java:92)

at org.springframework.aop.framework.ReflectiveMethodInvocation.proceed(ReflectiveMethodInvocation.java:179)

at org.springframework.aop.framework.JdkDynamicAopProxy.invoke(JdkDynamicAopProxy.java:207)

at com.sun.proxy.$Proxy99.updateDataSet(Unknown Source)

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)

at com.opensymphony.xwork2.DefaultActionInvocation.invokeAction(DefaultActionInvocation.java:450)

at com.opensymphony.xwork2.DefaultActionInvocation.invokeActionOnly(DefaultActionInvocation.java:289)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:252)

at org.hisp.dhis.webportal.interceptor.XWorkPortalUserInterceptor.intercept(XWorkPortalUserInterceptor.java:85)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.webportal.interceptor.XWorkPortalModuleInterceptor.intercept(XWorkPortalModuleInterceptor.java:91)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.webportal.interceptor.XWorkPortalMenuInterceptor.intercept(XWorkPortalMenuInterceptor.java:94)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.webportal.interceptor.XWorkPortalParamsInterceptor.intercept(XWorkPortalParamsInterceptor.java:149)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.interceptor.ContextInterceptor.intercept(ContextInterceptor.java:83)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.interceptor.UserSettingInterceptor.intercept(UserSettingInterceptor.java:81)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.security.intercept.LoginInterceptor.intercept(LoginInterceptor.java:85)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.security.intercept.XWorkSecurityInterceptor.intercept(XWorkSecurityInterceptor.java:116)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.interceptor.SystemSettingInterceptor.intercept(SystemSettingInterceptor.java:115)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.interceptor.I18nInterceptor.intercept(I18nInterceptor.java:139)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at com.opensymphony.xwork2.interceptor.ParametersInterceptor.doIntercept(ParametersInterceptor.java:254)

at com.opensymphony.xwork2.interceptor.MethodFilterInterceptor.intercept(MethodFilterInterceptor.java:98)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at com.opensymphony.xwork2.interceptor.StaticParametersInterceptor.intercept(StaticParametersInterceptor.java:191)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.hisp.dhis.interceptor.ExceptionInterceptor.intercept(ExceptionInterceptor.java:113)

at com.opensymphony.xwork2.DefaultActionInvocation.invoke(DefaultActionInvocation.java:246)

at org.apache.struts2.impl.StrutsActionProxy.execute(StrutsActionProxy.java:54)

at org.apache.struts2.dispatcher.Dispatcher.serviceAction(Dispatcher.java:562)

at org.apache.struts2.dispatcher.ng.ExecuteOperations.executeAction(ExecuteOperations.java:77)

at org.apache.struts2.dispatcher.ng.filter.StrutsPrepareAndExecuteFilter.doFilter(StrutsPrepareAndExecuteFilter.java:99)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:330)

at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.invoke(FilterSecurityInterceptor.java:118)

at org.springframework.security.web.access.intercept.FilterSecurityInterceptor.doFilter(FilterSecurityInterceptor.java:84)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.access.ExceptionTranslationFilter.doFilter(ExceptionTranslationFilter.java:113)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.session.SessionManagementFilter.doFilter(SessionManagementFilter.java:103)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.authentication.AnonymousAuthenticationFilter.doFilter(AnonymousAuthenticationFilter.java:113)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.servletapi.SecurityContextHolderAwareRequestFilter.doFilter(SecurityContextHolderAwareRequestFilter.java:154)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.savedrequest.RequestCacheAwareFilter.doFilter(RequestCacheAwareFilter.java:45)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.authentication.www.BasicAuthenticationFilter.doFilter(BasicAuthenticationFilter.java:150)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.hisp.dhis.security.filter.CorsFilter.doFilter(CorsFilter.java:123)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.authentication.AbstractAuthenticationProcessingFilter.doFilter(AbstractAuthenticationProcessingFilter.java:199)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.hisp.dhis.security.filter.CustomAuthenticationFilter.doFilter(CustomAuthenticationFilter.java:64)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.oauth2.provider.authentication.OAuth2AuthenticationProcessingFilter.doFilter(OAuth2AuthenticationProcessingFilter.java:140)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.authentication.logout.LogoutFilter.doFilter(LogoutFilter.java:110)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.hisp.dhis.security.filter.AutomaticAccessFilter.doFilter(AutomaticAccessFilter.java:115)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.header.HeaderWriterFilter.doFilterInternal(HeaderWriterFilter.java:57)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.context.request.async.WebAsyncManagerIntegrationFilter.doFilterInternal(WebAsyncManagerIntegrationFilter.java:50)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.context.SecurityContextPersistenceFilter.doFilter(SecurityContextPersistenceFilter.java:87)

at org.springframework.security.web.FilterChainProxy$VirtualFilterChain.doFilter(FilterChainProxy.java:342)

at org.springframework.security.web.FilterChainProxy.doFilterInternal(FilterChainProxy.java:192)

at org.springframework.security.web.FilterChainProxy.doFilter(FilterChainProxy.java:160)

at org.springframework.web.filter.DelegatingFilterProxy.invokeDelegate(DelegatingFilterProxy.java:344)

at org.springframework.web.filter.DelegatingFilterProxy.doFilter(DelegatingFilterProxy.java:261)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.springframework.orm.hibernate4.support.OpenSessionInViewFilter.doFilterInternal(OpenSessionInViewFilter.java:151)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.springframework.web.filter.CharacterEncodingFilter.doFilterInternal(CharacterEncodingFilter.java:85)

at org.springframework.web.filter.OncePerRequestFilter.doFilter(OncePerRequestFilter.java:107)

at org.apache.catalina.core.ApplicationFilterChain.internalDoFilter(ApplicationFilterChain.java:241)

at org.apache.catalina.core.ApplicationFilterChain.doFilter(ApplicationFilterChain.java:208)

at org.apache.catalina.core.StandardWrapperValve.invoke(StandardWrapperValve.java:218)

at org.apache.catalina.core.StandardContextValve.invoke(StandardContextValve.java:122)

at org.apache.catalina.authenticator.AuthenticatorBase.invoke(AuthenticatorBase.java:505)

at org.apache.catalina.core.StandardHostValve.invoke(StandardHostValve.java:169)

at org.apache.catalina.valves.ErrorReportValve.invoke(ErrorReportValve.java:103)

at org.apache.catalina.valves.AccessLogValve.invoke(AccessLogValve.java:956)

at org.apache.catalina.core.StandardEngineValve.invoke(StandardEngineValve.java:116)

at org.apache.catalina.connector.CoyoteAdapter.service(CoyoteAdapter.java:442)

at org.apache.coyote.http11.AbstractHttp11Processor.process(AbstractHttp11Processor.java:1083)

at org.apache.coyote.AbstractProtocol$AbstractConnectionHandler.process(AbstractProtocol.java:640)

at org.apache.tomcat.util.net.AprEndpoint$SocketWithOptionsProcessor.run(AprEndpoint.java:2454)

at java.util.concurrent.ThreadPoolExecutor.runWorker(ThreadPoolExecutor.java:1142)

at java.util.concurrent.ThreadPoolExecutor$Worker.run(ThreadPoolExecutor.java:617)

at org.apache.tomcat.util.threads.TaskThread$WrappingRunnable.run(TaskThread.java:61)

at java.lang.Thread.run(Thread.java:745)

Caused by: org.hibernate.exception.ConstraintViolationException: could not execute statement

at org.hibernate.exception.internal.SQLStateConversionDelegate.convert(SQLStateConversionDelegate.java:129)

at org.hibernate.exception.internal.StandardSQLExceptionConverter.convert(StandardSQLExceptionConverter.java:49)

at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:124)

at org.hibernate.engine.jdbc.spi.SqlExceptionHelper.convert(SqlExceptionHelper.java:109)

at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:189)

at org.hibernate.engine.jdbc.batch.internal.NonBatchingBatch.addToBatch(NonBatchingBatch.java:59)

at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3079)

at org.hibernate.persister.entity.AbstractEntityPersister.insert(AbstractEntityPersister.java:3521)

at org.hibernate.action.internal.EntityInsertAction.execute(EntityInsertAction.java:88)

at org.hibernate.engine.spi.ActionQueue.execute(ActionQueue.java:395)

at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:387)

at org.hibernate.engine.spi.ActionQueue.executeActions(ActionQueue.java:303)

at org.hibernate.event.internal.AbstractFlushingEventListener.performExecutions(AbstractFlushingEventListener.java:349)

at org.hibernate.event.internal.DefaultFlushEventListener.onFlush(DefaultFlushEventListener.java:56)

at org.hibernate.internal.SessionImpl.flush(SessionImpl.java:1195)

at org.hibernate.internal.SessionImpl.managedFlush(SessionImpl.java:404)

at org.hibernate.engine.transaction.internal.jdbc.JdbcTransaction.beforeTransactionCommit(JdbcTransaction.java:101)

at org.hibernate.engine.transaction.spi.AbstractTransactionImpl.commit(AbstractTransactionImpl.java:175)

at org.springframework.orm.hibernate4.HibernateTransactionManager.doCommit(HibernateTransactionManager.java:584)

… 118 more

Caused by: org.postgresql.util.PSQLException: ERROR: duplicate key value violates unique constraint “dataelement_operand_unique_key”

Detail: Key (dataelementid, categoryoptioncomboid)=(1627, 1596) already exists.

at org.postgresql.core.v3.QueryExecutorImpl.receiveErrorResponse(QueryExecutorImpl.java:2198)

at org.postgresql.core.v3.QueryExecutorImpl.processResults(QueryExecutorImpl.java:1927)

at org.postgresql.core.v3.QueryExecutorImpl.execute(QueryExecutorImpl.java:255)

at org.postgresql.jdbc2.AbstractJdbc2Statement.execute(AbstractJdbc2Statement.java:561)

at org.postgresql.jdbc2.AbstractJdbc2Statement.executeWithFlags(AbstractJdbc2Statement.java:419)

at org.postgresql.jdbc2.AbstractJdbc2Statement.executeUpdate(AbstractJdbc2Statement.java:365)

at com.mchange.v2.c3p0.impl.NewProxyPreparedStatement.executeUpdate(NewProxyPreparedStatement.java:105)

at org.hibernate.engine.jdbc.internal.ResultSetReturnImpl.executeUpdate(ResultSetReturnImpl.java:186)

… 132

more

at

org.hisp.dhis.dataset.action.compulsory.SaveCompulsoryDataElementsAction.execute(SaveCompulsoryDataElementsAction.java:113)

  • ERROR 2016-10-19 12:54:54,433 Error while executing action (ExceptionInterceptor.java [http-apr-8080-exec-7])

org.springframework.dao.DataIntegrityViolationException: could not execute statement; SQL [n/a]; constraint [dataelement_operand_unique_key]; nested exception is org.hibernate.exception.ConstraintViolationException: could not execute

statement

at

org.springframework.orm.hibernate4.SessionFactoryUtils.convertHibernateAccessException(SessionFactoryUtils.java:163)`
Thanks,
Bayoh.

On Fri, Jun 24, 2016 at 12:45 PM, Lars Helge Øverland lars@dhis2.org wrote:

Hi Ibra,

thanks for reporting. Yes we are in fact aware of this one and working on it now. Should be fixed soon.

regards,

Lars


Ibrahim Rashid Bayoh
Software Developer,

eHealth Africa(Sierra Leone)

Mobile: +232 88-765-638

117 Wilkinson Rd, Freetown, Sierra Leone

ibrahim.bayoh@sl.ehealthafrica.org

http://ehealthafrica.org/

On Fri, Jun 24, 2016 at 2:00 PM, Ibrahim Bayoh ibrahim.bayoh@sl.ehealthafrica.org wrote:

Hi All,
Am try to set certain data element as compulsory or mandatory in data set but some reason the assigned compulsory data element does not seem to have any effect on the data sets or forms. Forms or data sets can be completed even though they contain compulsory data element. Is this a bug or a my doing something wrong? My steps below.

From Data set App

  1. Select Data sets
  2. Left click on the desired Data set
  3. Select “Edit Compulsory Data Element” from the dropdown
  4. From the list of data element double on the desired data element
  5. then click save

From the Date entry App

  1. Select the data set/form you added the compulsory data element
  2. Field other fields in the form except the compulsory data element
  3. then click on “Complete”

Idealy the form should not be completed or submitted if the compulsory data element is not filled, but in my case the form / data set completes even though the compulsory data element was neglected.

Thanks,

Bayoh.

Ibrahim Rashid Bayoh
Information Systems Coordinator,

eHealth Africa(Sierra Leone)

117 Wilkinson Rd, Freetown, Sierra Leone

Mobile: +232 88-765-638

ibrahim.bayoh@sl.ehealthafrica.org

http://ehealthafrica.org/


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

lars@dhis2.org

http://www.dhis2.org

Lars Helge Øverland

Lead developer, DHIS 2

University of Oslo

Skype: larshelgeoverland

lars@dhis2.org

http://www.dhis2.org

1 Like