Quick way to add missing ISO weeks going back to 2011?

Hi all,

I thought I saw a posting on inserting periods into the DHIS-2 for earlier periods in time, but can’t seem to find it any longer.

I need ISO weekly periods going back to 2011. I also notice that there are some instances where there are 53 ISO weeks in a year, but that does not appear to be an option in DHIS-2.

Can someone advise?

Thanks,

···


Randy Wilson

This message and its attachments are confidential and solely for the intended recipients. If received in error, please delete them and notify the sender via reply e-mail immediately.

Hi Randy,

at the moment there is no way to do this directly in DHIS 2, sorry. I am sure there is some external way of doing it.

Periods will be generated automatically when data is saved/imported into the system but I guess you knew that already.

regards,

Lars

···

On Mon, Aug 4, 2014 at 6:11 PM, Wilson, Randy rwilson@msh.org wrote:

Hi all,

I thought I saw a posting on inserting periods into the DHIS-2 for earlier periods in time, but can’t seem to find it any longer.

I need ISO weekly periods going back to 2011. I also notice that there are some instances where there are 53 ISO weeks in a year, but that does not appear to be an option in DHIS-2.

Can someone advise?

Randy Wilson

Thanks,

This message and its attachments are confidential and solely for the intended recipients. If received in error, please delete them and notify the sender via reply e-mail immediately.


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

Randy do you need a script to generate these?

···

On 4 August 2014 17:11, Wilson, Randy rwilson@msh.org wrote:

Hi all,

I thought I saw a posting on inserting periods into the DHIS-2 for earlier periods in time, but can’t seem to find it any longer.

I need ISO weekly periods going back to 2011. I also notice that there are some instances where there are 53 ISO weeks in a year, but that does not appear to be an option in DHIS-2.

Can someone advise?

Randy Wilson

Thanks,

This message and its attachments are confidential and solely for the intended recipients. If received in error, please delete them and notify the sender via reply e-mail immediately.


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

Hi Randy,
I see Bob just replied but was about to send this and will go ahead, but would wait for a more authoritative answer.

Here is an R script which I have used in the past. It is very basic and does not take into account weeks which might already exist. It simply creates a lot of INSERT statements. You will get errors for those which already exist. It would be fairly easy to do this, but would require having R connected to your postgres database to filter out periods which already exist.

Use at your own peril and hopefully Bob has something better.

Regards,

Jason

#require(ISOweek)

#Adjust to your needs

week.starts<-seq(ISOdate(2011,1,3), ISOdate(2014,8,3), by = “1 week”)

#Number of seconds in a week

week.ends<-week.starts + 518399

#Get the week names in case you need it

#week.names<-gsub(“-”,“”,substring(date2ISOweek(week.starts),0,8))

sql<-paste0(“INSERT INTO periods (periodid,periodtypeid,startdate,enddate) VALUES(nextval(‘hibernate_sequence’::regclass),2,”,“'”,as.Date(week.starts),“‘,’”,as.Date(week.ends),“');”)

cat(sql,file="insert_periods.sql)

···

On Tue, Aug 5, 2014 at 12:23 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Randy do you need a script to generate these?


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

On 4 August 2014 17:11, Wilson, Randy rwilson@msh.org wrote:

Hi all,

I thought I saw a posting on inserting periods into the DHIS-2 for earlier periods in time, but can’t seem to find it any longer.

I need ISO weekly periods going back to 2011. I also notice that there are some instances where there are 53 ISO weeks in a year, but that does not appear to be an option in DHIS-2.

Can someone advise?

Randy Wilson

Thanks,

This message and its attachments are confidential and solely for the intended recipients. If received in error, please delete them and notify the sender via reply e-mail immediately.


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

No nothing better but could rattle something off - in something slightly less exotic than R :slight_smile:

Two questions mind you (more for developers):

  1. I see we have a period_periodid_seq which doesn’t seem to be used. I wonder is this a relic which needs to be removed? Or does it have some other use?

  2. Its very easy to create duplicate periods which is not nice. Probably we should consider placing a uniqueness constraint on periodtype+startdate

···

On 5 August 2014 11:49, Jason Pickering jason.p.pickering@gmail.com wrote:

Hi Randy,
I see Bob just replied but was about to send this and will go ahead, but would wait for a more authoritative answer.

Here is an R script which I have used in the past. It is very basic and does not take into account weeks which might already exist. It simply creates a lot of INSERT statements. You will get errors for those which already exist. It would be fairly easy to do this, but would require having R connected to your postgres database to filter out periods which already exist.

Use at your own peril and hopefully Bob has something better.

Regards,

Jason

#require(ISOweek)

#Adjust to your needs

week.starts<-seq(ISOdate(2011,1,3), ISOdate(2014,8,3), by = “1 week”)

#Number of seconds in a week

week.ends<-week.starts + 518399

#Get the week names in case you need it

#week.names<-gsub(“-”,“”,substring(date2ISOweek(week.starts),0,8))

sql<-paste0(“INSERT INTO periods (periodid,periodtypeid,startdate,enddate) VALUES(nextval(‘hibernate_sequence’::regclass),2,”,“'”,as.Date(week.starts),“‘,’”,as.Date(week.ends),“');”)

cat(sql,file="insert_periods.sql)

On Tue, Aug 5, 2014 at 12:23 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Randy do you need a script to generate these?


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

On 4 August 2014 17:11, Wilson, Randy rwilson@msh.org wrote:

Hi all,

I thought I saw a posting on inserting periods into the DHIS-2 for earlier periods in time, but can’t seem to find it any longer.

I need ISO weekly periods going back to 2011. I also notice that there are some instances where there are 53 ISO weeks in a year, but that does not appear to be an option in DHIS-2.

Can someone advise?

Randy Wilson

Thanks,

This message and its attachments are confidential and solely for the intended recipients. If received in error, please delete them and notify the sender via reply e-mail immediately.


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

No nothing better but could rattle something off - in something slightly
less exotic than R :slight_smile:

Two questions mind you (more for developers):
1. I see we have a period_periodid_seq which doesn't seem to be used. I
wonder is this a relic which needs to be removed? Or does it have some
other use?
2. Its very easy to create duplicate periods which is not nice. Probably
we should consider placing a uniqueness constraint on periodtype+startdate

To answer my own question, different versions of dhis have treated these
issues differently. So you'd want to be a little careful depending on the
dhis version used.

···

On 5 August 2014 12:04, Bob Jolliffe <bobjolliffe@gmail.com> wrote:

On 5 August 2014 11:49, Jason Pickering <jason.p.pickering@gmail.com> > wrote:

Hi Randy,
I see Bob just replied but was about to send this and will go ahead, but
would wait for a more authoritative answer.

Here is an R script which I have used in the past. It is very basic and
does not take into account weeks which might already exist. It simply
creates a lot of INSERT statements. You will get errors for those which
already exist. It would be fairly easy to do this, but would require having
R connected to your postgres database to filter out periods which already
exist.

Use at your own peril and hopefully Bob has something better.

Regards,
Jason

#require(ISOweek)
#Adjust to your needs
week.starts<-seq(ISOdate(2011,1,3), ISOdate(2014,8,3), by = "1 week")
#Number of seconds in a week
week.ends<-week.starts + 518399
#Get the week names in case you need it
#week.names<-gsub("-","",substring(date2ISOweek(week.starts),0,8))

sql<-paste0("INSERT INTO periods
(periodid,periodtypeid,startdate,enddate)
VALUES(nextval('hibernate_sequence'::regclass),2,","'",as.Date(week.starts),"','",as.Date(week.ends),"');")
cat(sql,file="insert_periods.sql)

On Tue, Aug 5, 2014 at 12:23 PM, Bob Jolliffe <bobjolliffe@gmail.com> >> wrote:

Randy do you need a script to generate these?

On 4 August 2014 17:11, Wilson, Randy <rwilson@msh.org> wrote:

Hi all,

I thought I saw a posting on inserting periods into the DHIS-2 for
earlier periods in time, but can't seem to find it any longer.

I need ISO weekly periods going back to 2011. I also notice that there
are some instances where there are 53 ISO weeks in a year, but that does
not appear to be an option in DHIS-2.

Can someone advise?

Thanks,

--

*Randy Wilson*

*This message and its attachments are confidential and solely for the
intended recipients. If received in error, please delete them and notify
the sender via reply e-mail immediately.*
_______________________________________________
Mailing list: DHIS 2 Users in Launchpad
Post to : dhis2-users@lists.launchpad.net
Unsubscribe : DHIS 2 Users in Launchpad
More help : ListHelp - Launchpad Help

_______________________________________________
Mailing list: DHIS 2 Users in Launchpad
Post to : dhis2-users@lists.launchpad.net
Unsubscribe : DHIS 2 Users in Launchpad
More help : ListHelp - Launchpad Help

Hi Bob and Jason,

Thanks for these quick responses - I also noticed that ISO weeks and Epidemiological weeks are different (the latter start on Sunday and end on Saturday, while the ISO weeks start on Monday). I tried to create a new periodtype 'EPIWeekly" and all new periods which I imported into the period table on my local machine and then restarted tomcat - no luck!

See the error message below. - it seems like my periodtype is unknown to the javascripts that run during startup.

  • INFO 2014-08-05 14:16:48,158 Executing startup routine [2 of 14, runlevel 2]:

PeriodTypePopulator (DefaultStartupRoutineExecutor.java [localhost-startStop-1]

)

  • ERROR 2014-08-05 14:16:48,228 org.hibernate.WrongClassException: Object with i

d: 2627 was not of the specified subclass: org.hisp.dhis.period.PeriodType (Disc

riminator: EPIWeekly)

Now that we are migrating our disease surveillance system to DHIS-2 we are going to need the epidemiological weeks - and I’ve got 3 years of Sunday to Saturday data to import. Ismail, I guess we need to put this into our generic requirements for IDSR- it will have an impact on quite a few things including import/export which looks for ISO dates.

I suppose I can pretend they are the same for the import process and then work out a way to change later. The main issue is that the period selector in data entry displays the Week number as well as the start and end dates, otherwise users would never notice.

Randy

This message and its attachments are confidential and solely for the intended recipients. If received in error, please delete them and notify the sender via reply e-mail immediately.

···

On Tue, Aug 5, 2014 at 1:52 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:


Randy Wilson

Senior HMIS and Data Use Advisor, Ministry of Health/Rwanda

Integrated Health Systems Strengthening Project

Management Sciences for Health, Inc. (MSH)

BP 371

Kigali, Rwanda

+250-788308835

Skype Name (wilsonrandy_us)

www.msh.org

Stronger health systems. Greater health impact.

On 5 August 2014 12:04, Bob Jolliffe bobjolliffe@gmail.com wrote:

No nothing better but could rattle something off - in something slightly less exotic than R :slight_smile:

Two questions mind you (more for developers):

  1. I see we have a period_periodid_seq which doesn’t seem to be used. I wonder is this a relic which needs to be removed? Or does it have some other use?
  1. Its very easy to create duplicate periods which is not nice. Probably we should consider placing a uniqueness constraint on periodtype+startdate

To answer my own question, different versions of dhis have treated these issues differently. So you’d want to be a little careful depending on the dhis version used.

On 5 August 2014 11:49, Jason Pickering jason.p.pickering@gmail.com wrote:

Hi Randy,
I see Bob just replied but was about to send this and will go ahead, but would wait for a more authoritative answer.

Here is an R script which I have used in the past. It is very basic and does not take into account weeks which might already exist. It simply creates a lot of INSERT statements. You will get errors for those which already exist. It would be fairly easy to do this, but would require having R connected to your postgres database to filter out periods which already exist.

Use at your own peril and hopefully Bob has something better.

Regards,

Jason

#require(ISOweek)

#Adjust to your needs

week.starts<-seq(ISOdate(2011,1,3), ISOdate(2014,8,3), by = “1 week”)

#Number of seconds in a week

week.ends<-week.starts + 518399

#Get the week names in case you need it

#week.names<-gsub(“-”,“”,substring(date2ISOweek(week.starts),0,8))

sql<-paste0(“INSERT INTO periods (periodid,periodtypeid,startdate,enddate) VALUES(nextval(‘hibernate_sequence’::regclass),2,”,“'”,as.Date(week.starts),“‘,’”,as.Date(week.ends),“');”)

cat(sql,file="insert_periods.sql)

On Tue, Aug 5, 2014 at 12:23 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Randy do you need a script to generate these?


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

On 4 August 2014 17:11, Wilson, Randy rwilson@msh.org wrote:

Hi all,

I thought I saw a posting on inserting periods into the DHIS-2 for earlier periods in time, but can’t seem to find it any longer.

I need ISO weekly periods going back to 2011. I also notice that there are some instances where there are 53 ISO weeks in a year, but that does not appear to be an option in DHIS-2.

Can someone advise?

Randy Wilson

Thanks,

This message and its attachments are confidential and solely for the intended recipients. If received in error, please delete them and notify the sender via reply e-mail immediately.


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

Hi Randy,

@Bob, yes, Tcl is much more mainstream. :slight_smile: But as Lars points out, there is no need to create these manually if you are just importing data, as they will be created automatically anyway.

@Randy, simply adding a new period type to the periottype table will not work. There is a lot of code behind each period , so if the particular period which you have is not implemented, then it will have to be implemented in Java. Morten has done a lot of work on this lately but this period type is not there yet I think.

I am pretty sure this issue has been discussed before on the list, of so called “Epi weeks”. There have also been requests for other weeks, starting on Wednesday as well. As of now, there is no solution for this.

Best regards,

Jason

···

On Tue, Aug 5, 2014 at 2:21 PM, Wilson, Randy rwilson@msh.org wrote:

Hi Bob and Jason,

Thanks for these quick responses - I also noticed that ISO weeks and Epidemiological weeks are different (the latter start on Sunday and end on Saturday, while the ISO weeks start on Monday). I tried to create a new periodtype 'EPIWeekly" and all new periods which I imported into the period table on my local machine and then restarted tomcat - no luck!

See the error message below. - it seems like my periodtype is unknown to the javascripts that run during startup.

  • INFO 2014-08-05 14:16:48,158 Executing startup routine [2 of 14, runlevel 2]:

PeriodTypePopulator (DefaultStartupRoutineExecutor.java [localhost-startStop-1]

)

  • ERROR 2014-08-05 14:16:48,228 org.hibernate.WrongClassException: Object with i

d: 2627 was not of the specified subclass: org.hisp.dhis.period.PeriodType (Disc

riminator: EPIWeekly)

Now that we are migrating our disease surveillance system to DHIS-2 we are going to need the epidemiological weeks - and I’ve got 3 years of Sunday to Saturday data to import. Ismail, I guess we need to put this into our generic requirements for IDSR- it will have an impact on quite a few things including import/export which looks for ISO dates.

I suppose I can pretend they are the same for the import process and then work out a way to change later. The main issue is that the period selector in data entry displays the Week number as well as the start and end dates, otherwise users would never notice.

Randy

This message and its attachments are confidential and solely for the intended recipients. If received in error, please delete them and notify the sender via reply e-mail immediately.

On Tue, Aug 5, 2014 at 1:52 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:


Randy Wilson

Senior HMIS and Data Use Advisor, Ministry of Health/Rwanda

Integrated Health Systems Strengthening Project

Management Sciences for Health, Inc. (MSH)

BP 371

Kigali, Rwanda

+250-788308835

Skype Name (wilsonrandy_us)

www.msh.org

Stronger health systems. Greater health impact.

On 5 August 2014 12:04, Bob Jolliffe bobjolliffe@gmail.com wrote:

No nothing better but could rattle something off - in something slightly less exotic than R :slight_smile:

Two questions mind you (more for developers):

  1. I see we have a period_periodid_seq which doesn’t seem to be used. I wonder is this a relic which needs to be removed? Or does it have some other use?
  1. Its very easy to create duplicate periods which is not nice. Probably we should consider placing a uniqueness constraint on periodtype+startdate

To answer my own question, different versions of dhis have treated these issues differently. So you’d want to be a little careful depending on the dhis version used.

On 5 August 2014 11:49, Jason Pickering jason.p.pickering@gmail.com wrote:

Hi Randy,
I see Bob just replied but was about to send this and will go ahead, but would wait for a more authoritative answer.

Here is an R script which I have used in the past. It is very basic and does not take into account weeks which might already exist. It simply creates a lot of INSERT statements. You will get errors for those which already exist. It would be fairly easy to do this, but would require having R connected to your postgres database to filter out periods which already exist.

Use at your own peril and hopefully Bob has something better.

Regards,

Jason

#require(ISOweek)

#Adjust to your needs

week.starts<-seq(ISOdate(2011,1,3), ISOdate(2014,8,3), by = “1 week”)

#Number of seconds in a week

week.ends<-week.starts + 518399

#Get the week names in case you need it

#week.names<-gsub(“-”,“”,substring(date2ISOweek(week.starts),0,8))

sql<-paste0(“INSERT INTO periods (periodid,periodtypeid,startdate,enddate) VALUES(nextval(‘hibernate_sequence’::regclass),2,”,“'”,as.Date(week.starts),“‘,’”,as.Date(week.ends),“');”)

cat(sql,file="insert_periods.sql)

On Tue, Aug 5, 2014 at 12:23 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Randy do you need a script to generate these?


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

On 4 August 2014 17:11, Wilson, Randy rwilson@msh.org wrote:

Hi all,

I thought I saw a posting on inserting periods into the DHIS-2 for earlier periods in time, but can’t seem to find it any longer.

I need ISO weekly periods going back to 2011. I also notice that there are some instances where there are 53 ISO weeks in a year, but that does not appear to be an option in DHIS-2.

Can someone advise?

Randy Wilson

Thanks,

This message and its attachments are confidential and solely for the intended recipients. If received in error, please delete them and notify the sender via reply e-mail immediately.


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

We do have a specific version of 2.14 which accommodates weeks starting on Wednesday. However this needs to be aligned with Morten’s work on 2.16

···

On Tue, Aug 5, 2014 at 2:21 PM, Wilson, Randy rwilson@msh.org wrote:

Hi Bob and Jason,

Thanks for these quick responses - I also noticed that ISO weeks and Epidemiological weeks are different (the latter start on Sunday and end on Saturday, while the ISO weeks start on Monday). I tried to create a new periodtype 'EPIWeekly" and all new periods which I imported into the period table on my local machine and then restarted tomcat - no luck!

See the error message below. - it seems like my periodtype is unknown to the javascripts that run during startup.

  • INFO 2014-08-05 14:16:48,158 Executing startup routine [2 of 14, runlevel 2]:

PeriodTypePopulator (DefaultStartupRoutineExecutor.java [localhost-startStop-1]

)

  • ERROR 2014-08-05 14:16:48,228 org.hibernate.WrongClassException: Object with i

d: 2627 was not of the specified subclass: org.hisp.dhis.period.PeriodType (Disc

riminator: EPIWeekly)

Now that we are migrating our disease surveillance system to DHIS-2 we are going to need the epidemiological weeks - and I’ve got 3 years of Sunday to Saturday data to import. Ismail, I guess we need to put this into our generic requirements for IDSR- it will have an impact on quite a few things including import/export which looks for ISO dates.

I suppose I can pretend they are the same for the import process and then work out a way to change later. The main issue is that the period selector in data entry displays the Week number as well as the start and end dates, otherwise users would never notice.

Randy

This message and its attachments are confidential and solely for the intended recipients. If received in error, please delete them and notify the sender via reply e-mail immediately.

On Tue, Aug 5, 2014 at 1:52 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:


Randy Wilson

Senior HMIS and Data Use Advisor, Ministry of Health/Rwanda

Integrated Health Systems Strengthening Project

Management Sciences for Health, Inc. (MSH)

BP 371

Kigali, Rwanda

+250-788308835

Skype Name (wilsonrandy_us)

www.msh.org

Stronger health systems. Greater health impact.

On 5 August 2014 12:04, Bob Jolliffe bobjolliffe@gmail.com wrote:

No nothing better but could rattle something off - in something slightly less exotic than R :slight_smile:

Two questions mind you (more for developers):

  1. I see we have a period_periodid_seq which doesn’t seem to be used. I wonder is this a relic which needs to be removed? Or does it have some other use?
  1. Its very easy to create duplicate periods which is not nice. Probably we should consider placing a uniqueness constraint on periodtype+startdate

To answer my own question, different versions of dhis have treated these issues differently. So you’d want to be a little careful depending on the dhis version used.

On 5 August 2014 11:49, Jason Pickering jason.p.pickering@gmail.com wrote:

Hi Randy,
I see Bob just replied but was about to send this and will go ahead, but would wait for a more authoritative answer.

Here is an R script which I have used in the past. It is very basic and does not take into account weeks which might already exist. It simply creates a lot of INSERT statements. You will get errors for those which already exist. It would be fairly easy to do this, but would require having R connected to your postgres database to filter out periods which already exist.

Use at your own peril and hopefully Bob has something better.

Regards,

Jason

#require(ISOweek)

#Adjust to your needs

week.starts<-seq(ISOdate(2011,1,3), ISOdate(2014,8,3), by = “1 week”)

#Number of seconds in a week

week.ends<-week.starts + 518399

#Get the week names in case you need it

#week.names<-gsub(“-”,“”,substring(date2ISOweek(week.starts),0,8))

sql<-paste0(“INSERT INTO periods (periodid,periodtypeid,startdate,enddate) VALUES(nextval(‘hibernate_sequence’::regclass),2,”,“'”,as.Date(week.starts),“‘,’”,as.Date(week.ends),“');”)

cat(sql,file="insert_periods.sql)

On Tue, Aug 5, 2014 at 12:23 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Randy do you need a script to generate these?


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

On 4 August 2014 17:11, Wilson, Randy rwilson@msh.org wrote:

Hi all,

I thought I saw a posting on inserting periods into the DHIS-2 for earlier periods in time, but can’t seem to find it any longer.

I need ISO weekly periods going back to 2011. I also notice that there are some instances where there are 53 ISO weeks in a year, but that does not appear to be an option in DHIS-2.

Can someone advise?

Randy Wilson

Thanks,

This message and its attachments are confidential and solely for the intended recipients. If received in error, please delete them and notify the sender via reply e-mail immediately.


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

@Jason, no, sadly, I don’t think tcl is more mainstream anymore. Anyway attached php, which I know some of the guys in Rwanda use

weeks.php (944 Bytes)

weeks_2000_2014.sql (68 KB)

···

@Randy, Jason is right about the period type. I think for the moment you are going to have to “pretend” that the iso and epi weeks are the same. We should really solve this.

In case its at all useful I’ve attached sql script that inserts all the weeks from 2000 to 2014 (including 53 week years). You could edit this and cut out the years you are interested in.

Bob

On 6 August 2014 06:54, Jason Pickering jason.p.pickering@gmail.com wrote:

Hi Randy,

@Bob, yes, Tcl is much more mainstream. :slight_smile: But as Lars points out, there is no need to create these manually if you are just importing data, as they will be created automatically anyway.

@Randy, simply adding a new period type to the periottype table will not work. There is a lot of code behind each period , so if the particular period which you have is not implemented, then it will have to be implemented in Java. Morten has done a lot of work on this lately but this period type is not there yet I think.

I am pretty sure this issue has been discussed before on the list, of so called “Epi weeks”. There have also been requests for other weeks, starting on Wednesday as well. As of now, there is no solution for this.

Best regards,

Jason

On Tue, Aug 5, 2014 at 2:21 PM, Wilson, Randy rwilson@msh.org wrote:

Hi Bob and Jason,

Thanks for these quick responses - I also noticed that ISO weeks and Epidemiological weeks are different (the latter start on Sunday and end on Saturday, while the ISO weeks start on Monday). I tried to create a new periodtype 'EPIWeekly" and all new periods which I imported into the period table on my local machine and then restarted tomcat - no luck!

See the error message below. - it seems like my periodtype is unknown to the javascripts that run during startup.

  • INFO 2014-08-05 14:16:48,158 Executing startup routine [2 of 14, runlevel 2]:

PeriodTypePopulator (DefaultStartupRoutineExecutor.java [localhost-startStop-1]

)

  • ERROR 2014-08-05 14:16:48,228 org.hibernate.WrongClassException: Object with i

d: 2627 was not of the specified subclass: org.hisp.dhis.period.PeriodType (Disc

riminator: EPIWeekly)

Now that we are migrating our disease surveillance system to DHIS-2 we are going to need the epidemiological weeks - and I’ve got 3 years of Sunday to Saturday data to import. Ismail, I guess we need to put this into our generic requirements for IDSR- it will have an impact on quite a few things including import/export which looks for ISO dates.

I suppose I can pretend they are the same for the import process and then work out a way to change later. The main issue is that the period selector in data entry displays the Week number as well as the start and end dates, otherwise users would never notice.

Randy

This message and its attachments are confidential and solely for the intended recipients. If received in error, please delete them and notify the sender via reply e-mail immediately.

On Tue, Aug 5, 2014 at 1:52 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:


Randy Wilson

Senior HMIS and Data Use Advisor, Ministry of Health/Rwanda

Integrated Health Systems Strengthening Project

Management Sciences for Health, Inc. (MSH)

BP 371

Kigali, Rwanda

+250-788308835

Skype Name (wilsonrandy_us)

www.msh.org

Stronger health systems. Greater health impact.

On 5 August 2014 12:04, Bob Jolliffe bobjolliffe@gmail.com wrote:

No nothing better but could rattle something off - in something slightly less exotic than R :slight_smile:

Two questions mind you (more for developers):

  1. I see we have a period_periodid_seq which doesn’t seem to be used. I wonder is this a relic which needs to be removed? Or does it have some other use?
  1. Its very easy to create duplicate periods which is not nice. Probably we should consider placing a uniqueness constraint on periodtype+startdate

To answer my own question, different versions of dhis have treated these issues differently. So you’d want to be a little careful depending on the dhis version used.

On 5 August 2014 11:49, Jason Pickering jason.p.pickering@gmail.com wrote:

Hi Randy,
I see Bob just replied but was about to send this and will go ahead, but would wait for a more authoritative answer.

Here is an R script which I have used in the past. It is very basic and does not take into account weeks which might already exist. It simply creates a lot of INSERT statements. You will get errors for those which already exist. It would be fairly easy to do this, but would require having R connected to your postgres database to filter out periods which already exist.

Use at your own peril and hopefully Bob has something better.

Regards,

Jason

#require(ISOweek)

#Adjust to your needs

week.starts<-seq(ISOdate(2011,1,3), ISOdate(2014,8,3), by = “1 week”)

#Number of seconds in a week

week.ends<-week.starts + 518399

#Get the week names in case you need it

#week.names<-gsub(“-”,“”,substring(date2ISOweek(week.starts),0,8))

sql<-paste0(“INSERT INTO periods (periodid,periodtypeid,startdate,enddate) VALUES(nextval(‘hibernate_sequence’::regclass),2,”,“'”,as.Date(week.starts),“‘,’”,as.Date(week.ends),“');”)

cat(sql,file="insert_periods.sql)

On Tue, Aug 5, 2014 at 12:23 PM, Bob Jolliffe bobjolliffe@gmail.com wrote:

Randy do you need a script to generate these?


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

On 4 August 2014 17:11, Wilson, Randy rwilson@msh.org wrote:

Hi all,

I thought I saw a posting on inserting periods into the DHIS-2 for earlier periods in time, but can’t seem to find it any longer.

I need ISO weekly periods going back to 2011. I also notice that there are some instances where there are 53 ISO weeks in a year, but that does not appear to be an option in DHIS-2.

Can someone advise?

Randy Wilson

Thanks,

This message and its attachments are confidential and solely for the intended recipients. If received in error, please delete them and notify the sender via reply e-mail immediately.


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