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 <bobjolli...@gmail.com> wrote: > Randy do you need a script to generate these? > > > On 4 August 2014 17:11, Wilson, Randy <rwil...@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: 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 >> >> > > _______________________________________________ > 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 > >
_______________________________________________ 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