dhis2-users team mailing list archive
-
dhis2-users team
-
Mailing list archive
-
Message #02436
Re: Define week start day for Weekly periods
Dear All,
How I have solved the issue in another application, also used for Cambodia,
is that I'm allowing to define the start day of the week e.g. Monday,
Tuesday, Wednesday .... as well as how many days "touching the new year"
are needed to qualify a week to be counted as week 1 of the new year. This
is part of the setting of the application and is used to calculate it on
the fly e.g. for data entry date / week selection. I have written the code
for this in R (bad code... but it is working). This allows to deal with a
lot of countries.
For ISO it is 4 days to qualify for the new year and the start day depends
on the country,
For Cambodia it is 1 day and start day is Wednesday.
As in DHIS I'm storing the period type daily weekly monthly ....
And for the actual date I'm storing always start date, end date of the
period and in addition the Year and the TIme unit..
For weekly data: start date, end date, Week Number, Year of the week (which
might be of course be different from the Year of the first day of the week
for the first and last week of the year).
For daily data: start date, end date (which is of course the same), day
number in year, Year
For monthly data: start date, end date, month number, Year
....
In this case one has all freedom to combine data sets from different "week
definitions" as one can decide later on which week calculation to be
applied across the piece based on the start date of the week knowing that
the week counting might be off for some of the countries for a few days.
But this is the best what we can do I assume ...
Best regards,
Johannes
On 14 June 2013 19:08, Knut Staring <knutst@xxxxxxxxx> wrote:
> Will have to investigate and get back to you
>
> Sent from my mobile
> On Jun 14, 2013 6:06 PM, "Bob Jolliffe" <bobjolliffe@xxxxxxxxx> wrote:
>
>> how do they determine which day is day 1 of week 1?
>>
>>
>> On 14 June 2013 17:52, Knut Staring <knutst@xxxxxxxxx> wrote:
>>
>>> For my purposes, that's really all I know, and for my requirements it
>>> will be exactly parallel to countries that require Monday instead of Sunday.
>>>
>>> But certainly the Nepali, Ethiopian and several others have more complex
>>> requirements, which I think partly must be treated as separate cases.
>>>
>>>
>>> On Fri, Jun 14, 2013 at 5:42 PM, Bob Jolliffe <bobjolliffe@xxxxxxxxx>wrote:
>>>
>>>> Explain the Cambodian calendar a bit more. I am sure there is more to
>>>> it than when the weeks start. Or is that it?
>>>>
>>>>
>>>> On 14 June 2013 17:35, Knut Staring <knutst@xxxxxxxxx> wrote:
>>>>
>>>>> Thanks Jason and Bob.
>>>>>
>>>>> Unfortunately, this seems to be a pressing requirement in several
>>>>> countries
>>>>>
>>>>> I think one simplification that could be justified would be to have
>>>>> only one week type in one DHIS2 instance. Thus, the exact meaning of
>>>>> 2012W25 is defined by looking at the FIRSTDAYOFWEEK setting in the
>>>>> particular db (which probably should be displayed on the About DHIS 2 page.
>>>>>
>>>>> Of course, that does not solve interoperability issues (but rather it
>>>>> deteriorate through obfuscation), but I think it is reasonable to think
>>>>> that everyone in Cambodia uses weeks starting on Wednesdays.
>>>>>
>>>>>
>>>>>
>>>>>
>>>>> On Fri, Jun 14, 2013 at 5:29 PM, Bob Jolliffe <bobjolliffe@xxxxxxxxx>wrote:
>>>>>
>>>>>> Weeks are as we all know something of a headache. What we have
>>>>>> defined currently in DHIS2, as Jason points out, is the ISO standard week,
>>>>>> which even itself is something of a headache.
>>>>>>
>>>>>> I suspect that to incorporate all the variety which is called for
>>>>>> (Wednesday week starts is the most exotic I've seen to date! But there are
>>>>>> also Islamic calendar issues, Ethiopian/Amharic calendar, Monday vs Sunday
>>>>>> starts etc) we might need to zoom right out to define a generic repeating
>>>>>> period with rules around starting and stopping. But it could get quite
>>>>>> complicated. Two immediate issues which come to mind
>>>>>> (i) we need a string representation of periods. So 2010W23 has a
>>>>>> particular meaning in terms of the ISO week number. How to differentiate
>>>>>> this from a week which starts on a Wednesday (and which day of the year
>>>>>> would be day 1 of week 1?);
>>>>>> (ii) how to aggregate along the time axis ie, weeks->months->years
>>>>>>
>>>>>> Its something which needs to be done, but I am not at all clear what
>>>>>> the correct design approach would be. Would be interested to hear people's
>>>>>> thoughts.
>>>>>>
>>>>>> Bob
>>>>>>
>>>>>>
>>>>>> On 14 June 2013 17:12, Knut Staring <knutst@xxxxxxxxx> wrote:
>>>>>>
>>>>>>> Devs: Is this something which could be targeted for 2.13?
>>>>>>>
>>>>>>> Knut
>>>>>>>
>>>>>>>
>>>>>>> On Mon, May 13, 2013 at 6:18 PM, Jason Pickering <
>>>>>>> jason.p.pickering@xxxxxxxxx> wrote:
>>>>>>>
>>>>>>>> Currently not. This has come up before, but for now, ISO weeks are
>>>>>>>> what has been implemented.
>>>>>>>>
>>>>>>>> http://en.wikipedia.org/wiki/ISO_week_date
>>>>>>>>
>>>>>>>> Regards,
>>>>>>>> Jason
>>>>>>>>
>>>>>>>>
>>>>>>>>
>>>>>>>> On Mon, May 13, 2013 at 6:54 PM, Paulo Grácio <
>>>>>>>> pgracio@xxxxxxxxxxxxxxxxxxxx> wrote:
>>>>>>>>
>>>>>>>>> Hi, ****
>>>>>>>>>
>>>>>>>>> ** **
>>>>>>>>>
>>>>>>>>> Is there a way to define week start day for Weekly periods?****
>>>>>>>>>
>>>>>>>>> ** **
>>>>>>>>>
>>>>>>>>> Regards,****
>>>>>>>>>
>>>>>>>>> Paulo Grácio****
>>>>>>>>>
>>>>>>>>> _______________________________________________
>>>>>>>>> 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
>>>>>>>>
>>>>>>>>
>>>>>>>
>>>>>>>
>>>>>>> --
>>>>>>> Knut Staring
>>>>>>> Dept. of Informatics, University of Oslo
>>>>>>> +4791880522
>>>>>>> http://dhis2.org
>>>>>>>
>>>>>>> _______________________________________________
>>>>>>> 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
>>>>>>>
>>>>>>>
>>>>>>
>>>>>
>>>>>
>>>>> --
>>>>> Knut Staring
>>>>> Dept. of Informatics, University of Oslo
>>>>> +4791880522
>>>>> http://dhis2.org
>>>>>
>>>>
>>>>
>>>
>>>
>>> --
>>> Knut Staring
>>> Dept. of Informatics, University of Oslo
>>> +4791880522
>>> http://dhis2.org
>>>
>>
>>
> _______________________________________________
> 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
>
>
Follow ups
References