dhis2-devs team mailing list archive
-
dhis2-devs team
-
Mailing list archive
-
Message #34973
[Branch ~dhis2-devs-core/dhis2/trunk] Rev 17941: Script
------------------------------------------------------------
revno: 17941
committer: Lars Helge Overland <larshelge@xxxxxxxxx>
branch nick: dhis2
timestamp: Mon 2015-01-12 12:44:16 +0100
message:
Script
modified:
resources/sql/integritychecks.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/integritychecks.sql'
--- resources/sql/integritychecks.sql 2015-01-07 12:14:33 +0000
+++ resources/sql/integritychecks.sql 2015-01-12 11:44:16 +0000
@@ -105,6 +105,17 @@
create index aggregatedindicatorvalue_index on aggregatedindicatorvalue (indicatorid, periodid, organisationunitid, value);
create index aggregateddatasetcompleteness_index on aggregateddatasetcompleteness (datasetid, periodid, organisationunitid, value);
+-- Get missing items in a list / missing options in a category by looking at the sort_order and the max sort_order value
+
+select * from (
+select generate_series
+from generate_series(1,1634)
+) s
+left join categories_categoryoptions cco on (
+ s.generate_series=cco.sort_order
+ and cco.categoryid=492298)
+where cco.sort_order is null;
+
-- Get category option combos from data values which are not part of the category combo of the data element
select distinct de.name as data_element, dv.dataelementid, de_cc.name as data_element_category_combo, oc_cc.name as option_combo_category_combo, con.categoryoptioncomboname, dv.categoryoptioncomboid