Thread Previous • Date Previous • Date Next • Thread Next |
Ahh.. :-) Thanks Caveman Bob Jolliffe wrote:
2009/5/11 Orvalho Joaquim Augusto <orvaquim@xxxxxxxxx>:Thank for this helpfull ofert. I talk within your words. Bob Jolliffe wrote:Hi Orvalho 2009/5/11 Orvalho Joaquim Augusto <orvaquim@xxxxxxxxx>:Well this comment is interesting. And the question raises from my needs here. I am moving data from a not dhis2 system to dhis2. And we must do it weekly because dhis2 is not yet adopted. I noticed that I had weeks changed on dhis2.Do you have some examples? i.e. ones which show that week 1 is indicated as something specific for a particular year which is different to the DHIS2 way. Then maybe we can start thinking about how DHIS2 should best handle. Is your data coming from Excel?It is not Excel. Some physiology of what we have: The System being used now is called Modulo Basico (modbas for now on). That system is in MsAccess. It stores data for each form in one table. The table contains for record identification these fields (all in strings): year (YR), week (MTH, it is no mistake), district code (DC), province code (PC) and health center (HC). The data comens on diferent columns identified by A1, A2 up to An (depending on the form). As this is what Ministry of Health uses and dhis2 is being prepared to be used in large scale we feed dhis2 using some rudimentar steps: 1. There is a scheduled program per day to convert the tables in MDB in modbas to mysql (db2sync instead of mysql migration tool because db2syn exports well the keys) 2. Under the mysql server machine there is a python script that take data feeds dhis2 tables. Step 2 uses periodid generated by dhis2 using the ranges. For the months this is fine. But for weeks we need to know which week is based on the ranges given by periodid. Is this clear enough? And do you need really data to check?No I don't need lots of data. Just something like year 2005 (weeks are ok), 2006 (dhis is one week ahead), 2007 (weeks are ok) .... I am just trying to figure out the problem and what weeknumber system your system (and DHIS2) is using. Empirically like this is the easiest. Cheers BobRegards Bob PS. I see mysql makes use of a mode argument http://dev.mysql.com/doc/refman/5.1/en/date-and-time-functions.html#function_week I guess ISO8601 mode would be mode 3 under this scheme.Thanks. But on dhis2 it seems different isn't that? Regards CavemanPPS. Excel does not have a weeknum function built in. There is an analysis toolpack plugin which implements something non-standard - somteimes described as the US norm - the first week (like other weeks) ends on Sunday. It can be any number of days long from 1 to 7. PPPS. David Wheeler has done some excellent work on the OpenFormula SubCommittee of the ODF OASIS TC on figuring out the differences between all these. It looks like ODF will eventually adopt two functions WEEKNUM (which implements the incorrect Excel algorithm) and ISO_WEEKNUM which implements the correct algorithm.And now to adjust to dhis2 I need to know how dhis2 does. And Bob raises this. What I do? I use the algorithm from that java Class? Caveman Bob Jolliffe wrote:Hi 2009/5/11 Murodullo Latifov <murodlatifov@xxxxxxxxx>:Hi Caveman, ----- Original Message ---- From: Orvalho Joaquim Augusto <orvaquim@xxxxxxxxx> To: dhis2-devs <dhis2-devs@xxxxxxxxxxxxxxxxxxx> Sent: Monday, May 11, 2009 2:57:42 AM Subject: [Dhis2-devs] weeks calculation I could not find on dhis2 docs so I am asking: How dhis2 calculate the weeks? The first week of a year for example. Weekly periods are calculated based on their start date. If start date of the given week is on the previous year, end date of that period is used. Also Saturday is used as first day of the week.The code is here: ./dhis-api/src/main/java/org/hisp/dhis/period/WeeklyPeriodType.java I find it a bit confusing. It seems that we try to define a week as Saturday to Friday, and then say that as long as the endDate is in a different year to the startDate then we are in week 1. So week 1 is the first week in the year with a Friday in it? This doesn't sound right. Also according to documentation on top of class, a weekly period must have a startDate on a Monday and endDate on a Sunday. But week numbers according to ISO8601 are equivalent to the number of Thursdays - ie. first week in the year with a Thursday is week 1. This is the way that, for example the javascript in the calendar.js would calculate it. And presumably any sql week function we might use. Also weeks would start on Monday (which agrees with our class documentation). So for the week of 29/12/2008 to 04/01/2009, by our calculation that would be week 1 of 2009. And it would be week 1 by ISO 8601. But for the week of 28/12/2009 to 3/01/2010 which is coming up, our calculation would have this as week 1 of 2010, whereas ISO8601 would have it as week 52 or 53 of 2010. Week 1 would be the week of 04/01/2010. As I say - its a bit confusing. Though perhaps in the end the actual week number doesn't matter. What might matter most is the convention we consistently adopt and document. Though it would be nice if our conception of week 1 coincided with the ISO8601 conception. But not so nice as to break all the annual reports ... Do we ever exchange a week number with another system? Do we need to be able to define this more flexibly to accomodate different national reporting requirements which might interpret the first week of the year differently? I haven't even begun to think of this in terms of localised calendar systems :-) Regards BobThank you Caveman _______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@xxxxxxxxxxxxxxxxxxx Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp _______________________________________________ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@xxxxxxxxxxxxxxxxxxx Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp
Thread Previous • Date Previous • Date Next • Thread Next |