revision-diff.txt (2.11 KB)
What about allowing for population growth according to government estimates, e.g. 2% ?
···
On Feb 9, 2012 7:17 PM, noreply@launchpad.net wrote:
revno: 5902
committer: Lars Helge Overland larshelge@gmail.com
branch nick: dhis2
timestamp: Thu 2012-02-09 19:15:43 +0100
message:
Copydata script update
modified:
resources/sql/copydata.sql
–
lp:dhis2
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
=== modified file ‘resources/sql/copydata.sql’
— resources/sql/copydata.sql 2011-03-19 22:37:57 +0000
+++ resources/sql/copydata.sql 2012-02-09 18:15:43 +0000
@@ -1,17 +1,28 @@
– Move population data from last year to this year
— Replace first periodid with current year, replace second periodid with last year, replace dataset.name with population dataset name
-delete from datavalue where periodid=43668 and dataelementid in (
-select dataelementid from datasetmembers
-join dataset using(datasetid)
-where dataset.name=‘Population estimates’ );
±- If specific data level is required update the _orgunitstructure resource table
±- Replace first periodid with current year, replace second periodid with last year, replace dataset.name with population dataset name, replace data level as required
+delete from datavalue where periodid=112482 and dataelementid in (
select dataelementid from datasetmembers
join dataset using(datasetid)
where dataset.name=‘Population estimates’ )
+and sourceid in (
select os.organisationunitid from organisationunit ou
join _orgunitstructure os using(organisationunitid)
where os.level = 4);
insert into datavalue(dataelementid,periodid,sourceid,categoryoptioncomboid,value,storedby,lastupdated,comment,followup)
-select dataelementid,43668 as periodid,sourceid,categoryoptioncomboid,ceil(cast(value as double precision)*1.029) as value,storedby,lastupdated,comment,followup
+select dataelementid,112482 as periodid,sourceid,categoryoptioncomboid,ceil(cast(value as double precision)*1.029) as value,storedby,lastupdated,null,false
from datavalue
-where periodid=21011 and dataelementid in (
-select dataelementid from datasetmembers
-join dataset using(datasetid)
-where dataset.name=‘Population estimates’ );
+where periodid=43668 and dataelementid in (
select dataelementid from datasetmembers
join dataset using(datasetid)
where dataset.name=‘Population estimates’ )
+and sourceid in (
select os.organisationunitid from organisationunit ou
join _orgunitstructure os using(organisationunitid)
where os.level = 4);
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