Resource table Erro after Manual Aggregation

Dear all,

I have customized dhis2 for mental health requirement.

After data element ,org unit, attribute creation Resources table generation work well and resource table generated at 2014-06-09 00:43:02

Then follow these steps to aggregate data from tracke

  1. Develop aggregate query builder
  2. enter one patient data for 2014 June
  3. Manual aggregate data - ( success and show data in database )
  4. Try to generate Resource table - fail and give erro massage at 2014-06-09 00:47:49 as follow
  5. I try this in demo site but it is not authorize to generate resource table
    Process failed: PreparedStatementCallback; SQL [insert into _periodstructure values (?,?,?,?,?,?,?,?,?,?,?,?,?,?)]; Duplicate entry ‘201406’ for key ‘in_periodstructure_iso’; nested exception is java.sql.BatchUpdateException: Duplicate entry ‘201406’ for key ‘in_periodstructure_iso’

I will attach my log file and screen shot.

I am using
dhis 2.15

Build revision: 15123
Database type: Mysql

OS name:Windows 7
OS architecture:x86

Can any one help to come out from this?

resource table.txt (19.2 KB)

image

Hi Sumudu,

my guess is that someone has done manual inserts of periods in the period table, and that you have a mismatch between the period (start / end date) and the period type. E.g. you have periods which are days but has the monthly period type. Please investigate this. This SQL will give you the overview:

select * from period p join periodtype pt on p.periodtypeid=pt.periodtypeid;

This sql will set daily period type on day periods:

update period set periodtypeid=1 where startdate=enddate;

regards,

Lars

···

On Mon, Jun 9, 2014 at 4:30 AM, sumudu weerasinghe sumuduw00@gmail.com wrote:

Dear all,

I have customized dhis2 for mental health requirement.

After data element ,org unit, attribute creation Resources table generation work well and resource table generated at 2014-06-09 00:43:02

Then follow these steps to aggregate data from tracke

  1. Develop aggregate query builder
  2. enter one patient data for 2014 June
  3. Manual aggregate data - ( success and show data in database )
  4. Try to generate Resource table - fail and give erro massage at 2014-06-09 00:47:49 as follow
  5. I try this in demo site but it is not authorize to generate resource table
    Process failed: PreparedStatementCallback; SQL [insert into _periodstructure values (?,?,?,?,?,?,?,?,?,?,?,?,?,?)]; Duplicate entry ‘201406’ for key ‘in_periodstructure_iso’; nested exception is java.sql.BatchUpdateException: Duplicate entry ‘201406’ for key ‘in_periodstructure_iso’

I will attach my log file and screen shot.

I am using
dhis 2.15

Build revision: 15123
Database type: Mysql

OS name:Windows 7
OS architecture:x86

Can any one help to come out from this?


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Hi Lars,

I also reported this problem on the Bug list here: https://bugs.launchpad.net/dhis2/+bug/1313954.

It happens either when you import from another system so you have period type id = 3 both end dates in year 9999. Another scenario is when you run the manual aggregate query and choose a non-full month e.g 1 Feb 2013 to 16 June 2014. This always inserts an additional monthly period into the table with start date 16-June and end date 16-June. I suspect that this will happen if you are aggregating for a monthly period data set.

Regards,

Busoye

···

On Mon, Jun 9, 2014 at 4:30 AM, sumudu weerasinghe sumuduw00@gmail.com wrote:

Dear all,

I have customized dhis2 for mental health requirement.

After data element ,org unit, attribute creation Resources table generation work well and resource table generated at 2014-06-09 00:43:02

Then follow these steps to aggregate data from tracke

  1. Develop aggregate query builder
  2. enter one patient data for 2014 June
  3. Manual aggregate data - ( success and show data in database )
  4. Try to generate Resource table - fail and give erro massage at 2014-06-09 00:47:49 as follow
  5. I try this in demo site but it is not authorize to generate resource table
    Process failed: PreparedStatementCallback; SQL [insert into _periodstructure values (?,?,?,?,?,?,?,?,?,?,?,?,?,?)]; Duplicate entry ‘201406’ for key ‘in_periodstructure_iso’; nested exception is java.sql.BatchUpdateException: Duplicate entry ‘201406’ for key ‘in_periodstructure_iso’

I will attach my log file and screen shot.

I am using
dhis 2.15

Build revision: 15123
Database type: Mysql

OS name:Windows 7
OS architecture:x86

Can any one help to come out from this?


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Hi Sumudu,

To get past this quickly, you need to check your period table and filter by Periodtypeid 3. Have a look at all any start date that does not begin on the 1st. Delete this from the table. Clear system cache and run analytics again. This should work.

The Devs have to think of a more long-term solution though.

Cheers.

Busoye

···

On Mon, Jun 9, 2014 at 4:30 AM, sumudu weerasinghe sumuduw00@gmail.com wrote:

Dear all,

I have customized dhis2 for mental health requirement.

After data element ,org unit, attribute creation Resources table generation work well and resource table generated at 2014-06-09 00:43:02

Then follow these steps to aggregate data from tracke

  1. Develop aggregate query builder
  2. enter one patient data for 2014 June
  3. Manual aggregate data - ( success and show data in database )
  4. Try to generate Resource table - fail and give erro massage at 2014-06-09 00:47:49 as follow
  5. I try this in demo site but it is not authorize to generate resource table
    Process failed: PreparedStatementCallback; SQL [insert into _periodstructure values (?,?,?,?,?,?,?,?,?,?,?,?,?,?)]; Duplicate entry ‘201406’ for key ‘in_periodstructure_iso’; nested exception is java.sql.BatchUpdateException: Duplicate entry ‘201406’ for key ‘in_periodstructure_iso’

I will attach my log file and screen shot.

I am using
dhis 2.15

Build revision: 15123
Database type: Mysql

OS name:Windows 7
OS architecture:x86

Can any one help to come out from this?


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Hi Adebusoye,

that sounds quite likely.

Tran can you please check that the aggregation queries produce valid periods (start / end dates are in sync with the period type) ?

···

On Mon, Jun 16, 2014 at 5:00 PM, Adebusoye Anifalaje busoye@hisp.org wrote:

Hi Sumudu,

To get past this quickly, you need to check your period table and filter by Periodtypeid 3. Have a look at all any start date that does not begin on the 1st. Delete this from the table. Clear system cache and run analytics again. This should work.

The Devs have to think of a more long-term solution though.

Cheers.

Busoye

On 16 Jun 2014, at 15:39, Lars Helge Øverland larshelge@gmail.com wrote:

Hi Sumudu,

my guess is that someone has done manual inserts of periods in the period table, and that you have a mismatch between the period (start / end date) and the period type. E.g. you have periods which are days but has the monthly period type. Please investigate this. This SQL will give you the overview:

select * from period p join periodtype pt on p.periodtypeid=pt.periodtypeid;

This sql will set daily period type on day periods:

update period set periodtypeid=1 where startdate=enddate;

regards,

Lars


Mailing list: https://launchpad.net/~dhis2-devs
Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs
More help : https://help.launchpad.net/ListHelp

On Mon, Jun 9, 2014 at 4:30 AM, sumudu weerasinghe sumuduw00@gmail.com wrote:

Dear all,

I have customized dhis2 for mental health requirement.

After data element ,org unit, attribute creation Resources table generation work well and resource table generated at 2014-06-09 00:43:02

Then follow these steps to aggregate data from tracke

  1. Develop aggregate query builder
  2. enter one patient data for 2014 June
  3. Manual aggregate data - ( success and show data in database )
  4. Try to generate Resource table - fail and give erro massage at 2014-06-09 00:47:49 as follow
  5. I try this in demo site but it is not authorize to generate resource table
    Process failed: PreparedStatementCallback; SQL [insert into _periodstructure values (?,?,?,?,?,?,?,?,?,?,?,?,?,?)]; Duplicate entry ‘201406’ for key ‘in_periodstructure_iso’; nested exception is java.sql.BatchUpdateException: Duplicate entry ‘201406’ for key ‘in_periodstructure_iso’

I will attach my log file and screen shot.

I am using
dhis 2.15

Build revision: 15123
Database type: Mysql

OS name:Windows 7
OS architecture:x86

Can any one help to come out from this?


Mailing list: https://launchpad.net/~dhis2-devs

Post to : dhis2-devs@lists.launchpad.net

Unsubscribe : https://launchpad.net/~dhis2-devs

More help : https://help.launchpad.net/ListHelp

Thanks Lars and Adebusoye!

Yes, your guess is correct i have done the thing wrong way

  • during manual aggregation i have selected start date 1/5/2014 and end date as 16/6/2014
  • then my database period table shows two monthly period for June
  • now i have remove the extra one from period table and clear the analytic table from maintenance
  • Manual aggregation done with start date 1/5/2014 and end date as 30/6/2014
  • YES NOW IT WORKS RESOURCE TABLE GENERATED AND AGGREGATE DATA WITHOUT A PROBLEM
    Thanks for your help.
···

Sumudu

Thanks Sumudo, glad it works. Mind you this might still be a bug with the aggregation queries, we are working it.

Lars

···

On Mon, Jun 16, 2014 at 8:23 PM, sumudu weerasinghe sumuduw00@gmail.com wrote:

Thanks Lars and Adebusoye!

Yes, your guess is correct i have done the thing wrong way

  • during manual aggregation i have selected start date 1/5/2014 and end date as 16/6/2014
  • then my database period table shows two monthly period for June
  • now i have remove the extra one from period table and clear the analytic table from maintenance
  • Manual aggregation done with start date 1/5/2014 and end date as 30/6/2014
  • YES NOW IT WORKS RESOURCE TABLE GENERATED AND AGGREGATE DATA WITHOUT A PROBLEM
    Thanks for your help.

Sumudu