Re: [Dhis2-devs] weeks calculation
Hi Caveman, - Original Message From: Orvalho Joaquim Augusto To: dhis2-devs 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. Thank you Caveman ___ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp ___ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp
Re: [Dhis2-devs] weeks calculation
Thanks! That is really usefull. Caveman Murodullo Latifov wrote: Hi Caveman, - Original Message From: Orvalho Joaquim Augusto To: dhis2-devs 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. Thank you Caveman ___ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp ___ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp
Re: [Dhis2-devs] weeks calculation
Hi 2009/5/11 Murodullo Latifov : > > Hi Caveman, > > > > - Original Message > From: Orvalho Joaquim Augusto > To: dhis2-devs > 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 Bob > > Thank you > Caveman > > > > ___ > Mailing list: https://launchpad.net/~dhis2-devs > Post to : dhis2-devs@lists.launchpad.net > Unsubscribe : https://launchpad.net/~dhis2-devs > More help : https://help.launchpad.net/ListHelp > > > > > > ___ > Mailing list: https://launchpad.net/~dhis2-devs > Post to : dhis2-devs@lists.launchpad.net > Unsubscribe : https://launchpad.net/~dhis2-devs > More help : https://help.launchpad.net/ListHelp > ___ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp
[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 283: Added GetMapsByTypeAction class.
revno: 283 committer: Jan Henrik Overland janhenrik.overl...@gmail.com branch nick: trunk timestamp: Mon 2009-05-11 14:56:56 +0200 message: Added GetMapsByTypeAction class. added: dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLegendSet.hbm.xml gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapsByTypeAction.java modified: dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingStore.java dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMappingStore.java gis/dhis-web-mapping/src/main/resources/META-INF/dhis/beans.xml gis/dhis-web-mapping/src/main/resources/xwork.xml === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java 2009-04-28 14:23:39 + +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingService.java 2009-05-11 12:56:56 + @@ -123,6 +123,14 @@ * @return a Map. */ Map getMapByMapLayerPath( String mapLayerPath ); + +/** + * Returns a Collection of maps with the right type. + * + * @param type, the map type. + * @return a Collection. + */ +Collection getMapsByType( String type ); /** * Returns a Collection of all Maps. === modified file 'dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingStore.java' --- dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingStore.java 2009-04-24 10:20:52 + +++ dhis-2/dhis-api/src/main/java/org/hisp/dhis/mapping/MappingStore.java 2009-05-11 12:56:56 + @@ -81,6 +81,14 @@ * @return a Map. */ Map getMapByMapLayerPath( String mapLayerPath ); + +/** + * Returns a Collection of maps with the right type. + * + * @param type, the map type. + * @return a Collection. + */ +Collection getMapsByType( String type ); /** * Returns a Collection of all Maps. === modified file 'dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java' --- dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java 2009-04-28 14:23:39 + +++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/DefaultMappingService.java 2009-05-11 12:56:56 + @@ -154,6 +154,11 @@ { return mappingStore.getMapByMapLayerPath( mapLayerPath ); } + +public Collection getMapsByType( String type ) +{ +return mappingStore.getMapsByType( type ); +} public Collection getAllMaps() { === modified file 'dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMappingStore.java' --- dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMappingStore.java 2009-04-24 10:20:52 + +++ dhis-2/dhis-services/dhis-service-mapping/src/main/java/org/hisp/dhis/mapping/hibernate/HibernateMappingStore.java 2009-05-11 12:56:56 + @@ -101,6 +101,18 @@ return (Map) criteria.uniqueResult(); } + +@SuppressWarnings("unchecked") +public Collection getMapsByType( String type ) +{ +Session session = sessionManager.getCurrentSession(); + +Criteria criteria = session.createCriteria( Map.class ); + +criteria.add( Restrictions.eq( "type", type ) ); + +return criteria.list(); +} @SuppressWarnings( "unchecked" ) public Collection getAllMaps() === added file 'dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLegendSet.hbm.xml' --- dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLegendSet.hbm.xml 1970-01-01 00:00:00 + +++ dhis-2/dhis-services/dhis-service-mapping/src/main/resources/org/hisp/dhis/mapping/hibernate/MapLegendSet.hbm.xml 2009-05-11 12:56:56 + @@ -0,0 +1,27 @@ + +http://hibernate.sourceforge.net/hibernate-mapping-3.0.dtd";> + + + + + + + + + + + + + + + + + + + + + + + \ No newline at end of file === added file 'gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapsByTypeAction.java' --- gis/dhis-web-mapping/src/main/java/org/hisp/dhis/mapping/action/GetMapsByTypeAction.java 1970-01-01 00:00:00 + +++ gis/dhis-web-mapping/
[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 284: Reduced the number of webwork actions defined in the config files which are inherited, to avoid r...
revno: 284 committer: Lars Helge Oeverland larshe...@gmail.com branch nick: trunk timestamp: Mon 2009-05-11 15:32:24 +0200 message: Reduced the number of webwork actions defined in the config files which are inherited, to avoid repetion when running as portal. Unluckily this didn't help much on startup time, but committing now and will investigate further renamed: dhis-2/dhis-web/dhis-web-commons/src/main/resources/dhis-web-commons.xml => dhis-2/dhis-web/dhis-web-commons/src/main/resources/xwork.xml modified: dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/customvalue/DefaultCustomValueService.java dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/customvalue/hibernate/HibernateCustomValueStore.java dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/customvalue/hibernate/CustomValue.hbm.xml dhis-2/dhis-support/dhis-support-webwork/src/main/resources/dhis-support-webwork.xml dhis-2/dhis-web/dhis-web-dashboard-integration/src/main/resources/xwork.xml dhis-2/dhis-web/dhis-web-dataentry/src/main/resources/xwork.xml dhis-2/dhis-web/dhis-web-datamart/src/main/resources/xwork.xml dhis-2/dhis-web/dhis-web-gis/src/main/resources/xwork.xml dhis-2/dhis-web/dhis-web-importexport/src/main/resources/xwork.xml dhis-2/dhis-web/dhis-web-jforum-integration/src/main/resources/xwork.xml dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataadmin/src/main/resources/xwork.xml dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-datadictionary/src/main/resources/xwork.xml dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-dataset/src/main/resources/xwork.xml dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-organisationunit/src/main/resources/xwork.xml dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-settings/src/main/resources/xwork.xml dhis-2/dhis-web/dhis-web-maintenance/dhis-web-maintenance-user/src/main/resources/xwork.xml dhis-2/dhis-web/dhis-web-openhealth-integration/src/main/resources/xwork.xml dhis-2/dhis-web/dhis-web-portal/src/main/resources/xwork.xml dhis-2/dhis-web/dhis-web-reporting/src/main/resources/xwork.xml dhis-2/dhis-web/dhis-web-validationrule/src/main/resources/xwork.xml gis/dhis-web-mapping/src/main/resources/xwork.xml dhis-2/dhis-web/dhis-web-commons/src/main/resources/xwork.xml === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/customvalue/DefaultCustomValueService.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/customvalue/DefaultCustomValueService.java 2009-05-04 12:51:33 + +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/customvalue/DefaultCustomValueService.java 2009-05-11 13:32:24 + @@ -48,15 +48,14 @@ private CustomValueStore customValueStore; -public CustomValueStore getCustomValueStore() -{ -return customValueStore; -} - public void setCustomValueStore( CustomValueStore customValueStore ) { this.customValueStore = customValueStore; } + +// - +// CustomValueService implementation +// - public int addCustomValue( CustomValue customValue ) { === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/customvalue/hibernate/HibernateCustomValueStore.java' --- dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/customvalue/hibernate/HibernateCustomValueStore.java 2009-05-04 12:51:33 + +++ dhis-2/dhis-services/dhis-service-core/src/main/java/org/hisp/dhis/customvalue/hibernate/HibernateCustomValueStore.java 2009-05-11 13:32:24 + @@ -58,6 +58,10 @@ { this.sessionManager = sessionManager; } + +// - +// CustomValueStore implementation +// - public int addCustomValue( CustomValue customValue ) { === modified file 'dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/customvalue/hibernate/CustomValue.hbm.xml' --- dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/customvalue/hibernate/CustomValue.hbm.xml 2009-05-03 23:04:13 + +++ dhis-2/dhis-services/dhis-service-core/src/main/resources/org/hisp/dhis/customvalue/hibernate/CustomValue.hbm.xml 2009-05-11 13:32:24 + @@ -6,8 +6,6 @@ - - === modified file 'dhis-2/dhis-support/dhis-support-webwork/src/main/resources/dhis-support-webwork.xml' --- dhis-2/dhis-support/dhis-support-webwork/src/main/resources/dhis-support-webwork.xml 2009-03-03 16:46:36 + +++ d
[Dhis2-devs] [Branch ~dhis2-devs-core/dhis2/trunk] Rev 285: Updated local xwork config files
revno: 285 committer: Lars Helge Oeverland larshe...@gmail.com branch nick: trunk timestamp: Mon 2009-05-11 16:38:29 +0200 message: Updated local xwork config files modified: local/et/dhis-web-ethiopia/src/main/resources/xwork.xml local/in/dhis-web-dashboard/src/main/resources/xwork.xml local/in/dhis-web-dataentry-linelisting/src/main/resources/xwork.xml local/in/dhis-web-mobile/src/main/resources/xwork.xml local/in/dhis-web-reports-national/src/main/resources/xwork.xml local/in/dhis-web-validationrule/src/main/resources/xwork.xml local/vn/dhis-web-hcmc-reporttool/src/main/resources/xwork.xml local/vn/dhis-web-hue-reporttool/src/main/resources/xwork.xml === modified file 'local/et/dhis-web-ethiopia/src/main/resources/xwork.xml' --- local/et/dhis-web-ethiopia/src/main/resources/xwork.xml 2009-03-03 16:46:36 + +++ local/et/dhis-web-ethiopia/src/main/resources/xwork.xml 2009-05-11 14:38:29 + @@ -1,8 +1,7 @@ http://www.opensymphony.com/xwork/xwork-1.0.dtd";> - - + === modified file 'local/in/dhis-web-dashboard/src/main/resources/xwork.xml' --- local/in/dhis-web-dashboard/src/main/resources/xwork.xml2009-03-10 06:15:33 + +++ local/in/dhis-web-dashboard/src/main/resources/xwork.xml2009-05-11 14:38:29 + @@ -1,7 +1,7 @@ http://www.opensymphony.com/xwork/xwork-1.0.dtd";> - + === modified file 'local/in/dhis-web-dataentry-linelisting/src/main/resources/xwork.xml' --- local/in/dhis-web-dataentry-linelisting/src/main/resources/xwork.xml 2009-03-10 06:15:33 + +++ local/in/dhis-web-dataentry-linelisting/src/main/resources/xwork.xml 2009-05-11 14:38:29 + @@ -2,7 +2,7 @@ http://www.opensymphony.com/xwork/xwork-1.0.dtd";> - + === modified file 'local/in/dhis-web-mobile/src/main/resources/xwork.xml' --- local/in/dhis-web-mobile/src/main/resources/xwork.xml 2009-04-08 06:02:36 + +++ local/in/dhis-web-mobile/src/main/resources/xwork.xml 2009-05-11 14:38:29 + @@ -1,8 +1,7 @@ http://www.opensymphony.com/xwork/xwork-1.0.dtd";> - - + === modified file 'local/in/dhis-web-reports-national/src/main/resources/xwork.xml' --- local/in/dhis-web-reports-national/src/main/resources/xwork.xml 2009-04-08 06:02:36 + +++ local/in/dhis-web-reports-national/src/main/resources/xwork.xml 2009-05-11 14:38:29 + @@ -1,8 +1,7 @@ http://www.opensymphony.com/xwork/xwork-1.0.dtd";> - - + === modified file 'local/in/dhis-web-validationrule/src/main/resources/xwork.xml' --- local/in/dhis-web-validationrule/src/main/resources/xwork.xml 2009-03-10 06:15:33 + +++ local/in/dhis-web-validationrule/src/main/resources/xwork.xml 2009-05-11 14:38:29 + @@ -2,7 +2,7 @@ http://www.opensymphony.com/xwork/xwork-1.0.dtd";> - + === modified file 'local/vn/dhis-web-hcmc-reporttool/src/main/resources/xwork.xml' --- local/vn/dhis-web-hcmc-reporttool/src/main/resources/xwork.xml 2009-03-03 16:46:36 + +++ local/vn/dhis-web-hcmc-reporttool/src/main/resources/xwork.xml 2009-05-11 14:38:29 + @@ -1,7 +1,7 @@ http://www.opensymphony.com/xwork/xwork-1.0.dtd";> - + === modified file 'local/vn/dhis-web-hue-reporttool/src/main/resources/xwork.xml' --- local/vn/dhis-web-hue-reporttool/src/main/resources/xwork.xml 2009-03-03 16:46:36 + +++ local/vn/dhis-web-hue-reporttool/src/main/resources/xwork.xml 2009-05-11 14:38:29 + @@ -1,7 +1,7 @@ http://www.opensymphony.com/xwork/xwork-1.0.dtd";> - + -- Trunk https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk Your team DHIS 2 developers is subscribed to branch lp:dhis2. To unsubscribe from this branch go to https://code.launchpad.net/~dhis2-devs-core/dhis2/trunk/+edit-subscription. ___ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp
Re: [Dhis2-devs] weeks calculation
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. 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 : Hi Caveman, - Original Message From: Orvalho Joaquim Augusto To: dhis2-devs 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 Bob Thank you Caveman ___ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp ___ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp ___ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp
Re: [Dhis2-devs] weeks calculation
Hi Orvalho 2009/5/11 Orvalho Joaquim Augusto : > 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? Regards 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. PPS. 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 : >>> >>> Hi Caveman, >>> >>> >>> >>> - Original Message >>> From: Orvalho Joaquim Augusto >>> To: dhis2-devs >>> 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 >> Bob >> >>> Thank you >>> Caveman >>> >>> >>> >>> ___ >>> Mailing list: https://launchpad.net/~dhis2-devs >>> Post to : dhis2-devs@lists.launchpad.net >>> Unsubscribe : https://launchpad.net/~dhis2-devs >>> More help : https://help.launchpad.net/ListHelp >>> >>> >>> >>> >>> >>> ___ >>> Mailing list: https://launchpad.net/~dhis2-devs >>> Post to : dhis2-devs@lists.launchpad.net >>> Unsubscribe : https://launchpad.net/~dhis2-devs >>> More help : https://help.launchpad.net/ListHelp >>> >> > > ___ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp
Re: [Dhis2-devs] weeks calculation
Thank for this helpfull ofert. I talk within your words. Bob Jolliffe wrote: Hi Orvalho 2009/5/11 Orvalho Joaquim Augusto : 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? Regards 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 Caveman PPS. 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 : Hi Caveman, - Original Message From: Orvalho Joaquim Augusto To: dhis2-devs 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
Re: [Dhis2-devs] weeks calculation
2009/5/11 Orvalho Joaquim Augusto : > Thank for this helpfull ofert. > > I talk within your words. > > Bob Jolliffe wrote: >> >> Hi Orvalho >> >> 2009/5/11 Orvalho Joaquim Augusto : >>> >>> 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 Bob >> Regards >> 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 > Caveman > > >> PPS. 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 : > > Hi Caveman, > > > > - Original Message > From: Orvalho Joaquim Augusto > To: dhis2-devs > 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
Re: [Dhis2-devs] weeks calculation
Ahh.. :-) Thanks Caveman Bob Jolliffe wrote: 2009/5/11 Orvalho Joaquim Augusto : Thank for this helpfull ofert. I talk within your words. Bob Jolliffe wrote: Hi Orvalho 2009/5/11 Orvalho Joaquim Augusto : 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 Bob Regards 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 Caveman PPS. 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 : Hi Caveman, - Original Message From: Orvalho Joaquim Augusto To: dhis2-devs 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 consiste
[Dhis2-devs] Errors on Dataentry
I have data on datavalue table tha is mannually filled - I have no way to avoid it. And I keep having this error on catalina log: May 12, 2009 1:27:24 AM org.apache.velocity.runtime.log.JdkLogChute log SEVERE: Right side ($encoder.htmlEncode( $dataValue.comment )) of '==' operation has null value. If a reference, it may not be in the context. Operation not possible. /dhis-web-dataentry/form.vm [line 132, column 120] And I can not see my data on the form. Can someone help? Caveman ___ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp
Re: [Dhis2-devs] Errors on Dataentry
Hi, The problem you are pointing is a bug, when you try to comment on dataelement, which has no value assigned, this error will be thrown. It seems you have no value assigned for that dataelement/combo for that org unit for that period. regards, murod - Original Message From: Orvalho Joaquim Augusto To: dhis2-devs Sent: Tuesday, May 12, 2009 1:29:44 AM Subject: [Dhis2-devs] Errors on Dataentry I have data on datavalue table tha is mannually filled - I have no way to avoid it. And I keep having this error on catalina log: May 12, 2009 1:27:24 AM org.apache.velocity.runtime.log.JdkLogChute log SEVERE: Right side ($encoder.htmlEncode( $dataValue.comment )) of '==' operation has null value. If a reference, it may not be in the context. Operation not possible. /dhis-web-dataentry/form.vm [line 132, column 120] And I can not see my data on the form. Can someone help? Caveman ___ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp ___ Mailing list: https://launchpad.net/~dhis2-devs Post to : dhis2-devs@lists.launchpad.net Unsubscribe : https://launchpad.net/~dhis2-devs More help : https://help.launchpad.net/ListHelp