dhis2-users team mailing list archive
-
dhis2-users team
-
Mailing list archive
-
Message #05024
Re: Quick way to add missing ISO weeks going back to 2011?
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
On Tue, Aug 5, 2014 at 1:52 PM, Bob Jolliffe <bobjolliffe@xxxxxxxxx> wrote:
> On 5 August 2014 12:04, Bob Jolliffe <bobjolliffe@xxxxxxxxx> wrote:
>
>> No nothing better but could rattle something off - in something slightly
>> less exotic than R :-)
>>
>> 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 11:49, Jason Pickering <jason.p.pickering@xxxxxxxxx>
>> 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@xxxxxxxxx>
>>> wrote:
>>>
>>>> Randy do you need a script to generate these?
>>>>
>>>>
>>>> On 4 August 2014 17:11, Wilson, Randy <rwilson@xxxxxxx> 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@xxxxxxxxxxxxxxxxxxx
>>>>> Unsubscribe : https://launchpad.net/~dhis2-users
>>>>> More help : https://help.launchpad.net/ListHelp
>>>>>
>>>>>
>>>>
>>>> _______________________________________________
>>>> Mailing list: https://launchpad.net/~dhis2-users
>>>> Post to : dhis2-users@xxxxxxxxxxxxxxxxxxx
>>>> Unsubscribe : https://launchpad.net/~dhis2-users
>>>> More help : https://help.launchpad.net/ListHelp
>>>>
>>>>
>>>
>>
>
--
*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
<http://www.msh.org/?utm_source=2012-10-15+MSH+internal+announce+email+signature&utm_campaign=iemailsig&utm_medium=email>
*Stronger health systems. Greater health impact.*
--
*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.*
Follow ups
References