X-Git-Url: http://git.equinoxoli.org/?p=migration-tools.git;a=blobdiff_plain;f=mig-xml%2Fevergreen_staged_report.xml;h=92c723684a30c12a08904ab6022f6492c44c44cb;hp=3cc0c12110a9e9b1d724c34a11a80c5296cef86c;hb=73d5fd17efb5b98b42e37325cbcfafe5de3190ca;hpb=404fba950704f6ed408e0018435d9036c2b8cf80
diff --git a/mig-xml/evergreen_staged_report.xml b/mig-xml/evergreen_staged_report.xml
index 3cc0c12..92c7236 100644
--- a/mig-xml/evergreen_staged_report.xml
+++ b/mig-xml/evergreen_staged_report.xml
@@ -44,9 +44,20 @@
circ_count
circs
0
- Open Circulations
- Circulation Status.Migrated.Count of Circs
- SELECT 'Closed Circulations', x_migrate::TEXT, COUNT(id) FROM action_circulation_legacy WHERE xact_finish IS NOT NULL GROUP BY 2 UNION ALL SELECT 'Open Circulations', x_migrate::TEXT, COUNT(id) FROM action_circulation_legacy WHERE xact_finish IS NULL GROUP BY 2
+ Migrated Circulations
+ Circulation Status.Count of Circs
+ SELECT 'Closed Circulations', COUNT(id) FROM action_circulation_legacy WHERE xact_finish IS NOT NULL AND x_migrate
+ UNION ALL SELECT 'Open Circulations', COUNT(id) FROM action_circulation_legacy WHERE xact_finish IS NULL AND x_migrate
+
+
+
+ circ_count_unmigrated
+ circs
+ 0
+ Open Un-migrated Circulations
+ Circulation Status.Count of Circs
+ SELECT 'No Matching User', COUNT(id) FROM action_circulation_legacy WHERE xact_finish IS NULL AND x_migrate = FALSE AND usr IS NULL
+ UNION ALL SELECT 'No Matching Item', COUNT(id) FROM action_circulation_legacy WHERE xact_finish IS NULL AND x_migrate = FALSE AND target_copy IS NULL
@@ -91,7 +102,7 @@
0
Migrated Circulations by Duration, Fine and Max Fine
Count of Circs.Duration.Fine.Max Fine.Migrated
- SELECT COUNT(id), duration, recurring_fine, max_fine, x_migrate::TEXT FROM action_circulation_legacy WHERE x_migrate = TRUE GROUP BY 2, 3, 4, 5
+ SELECT COUNT(id), duration_rule, recurring_fine_rule, max_fine_rule, x_migrate::TEXT FROM action_circulation_legacy WHERE x_migrate = TRUE GROUP BY 2, 3, 4, 5
@@ -100,7 +111,7 @@
1
Circulations by Duration, Fine and Max Fine
Count of Circs.Duration.Fine.Max Fine
- SELECT COUNT(id), duration, recurring_fine, max_fine FROM action_circulation GROUP BY 2, 3, 4 ORDER BY 2, 3, 4
+ SELECT COUNT(id), duration_rule, recurring_fine_rule, max_fine_rule FROM action_circulation GROUP BY 2, 3, 4 ORDER BY 2, 3, 4
@@ -109,7 +120,7 @@
0
Circulations by Rules and Patron Group
Count of Circs.Duration.Fine.Max Fine.User Group.Matchpoints
- SELECT COUNT(acirc.id), acirc.duration, acirc.recurring_fine, acirc.max_fine, pgt.name, x.buildrows FROM action_circulation_legacy acirc JOIN actor.usr au ON au.id = acirc.usr JOIN permission.grp_tree pgt ON pgt.id = au.profile JOIN (SELECT acirc.id, ARRAY_TO_STRING(find_cmm(acirc.id),',') AS buildrows FROM action_circulation_legacy acirc WHERE acirc.x_migrate = TRUE) x ON x.id = acirc.id WHERE acirc.x_migrate = TRUE GROUP BY 2, 3, 4, 5, 6 ORDER BY 2, 3, 4, 5, 6
+ SELECT COUNT(acirc.id), acirc.duration_rule, acirc.recurring_fine_rule, acirc.max_fine_rule, pgt.name, x.buildrows FROM action_circulation_legacy acirc JOIN actor.usr au ON au.id = acirc.usr JOIN permission.grp_tree pgt ON pgt.id = au.profile JOIN (SELECT acirc.id, ARRAY_TO_STRING(find_cmm(acirc.id),',') AS buildrows FROM action_circulation_legacy acirc WHERE acirc.x_migrate = TRUE) x ON x.id = acirc.id WHERE acirc.x_migrate = TRUE GROUP BY 2, 3, 4, 5, 6 ORDER BY 2, 3, 4, 5, 6
@@ -118,7 +129,7 @@
1
Circulations by Rules and Patron Group
Count of Circs.Duration.Fine.Max Fine.User Group.Matchpoints
- SELECT COUNT(acirc.id), acirc.duration, acirc.recurring_fine, acirc.max_fine, pgt.name, x.buildrows FROM action_circulation acirc JOIN actor.usr au ON au.id = acirc.usr JOIN permission.grp_tree pgt ON pgt.id = au.profile JOIN (SELECT acirc.id, ARRAY_TO_STRING(find_cmm(acirc.id),',') AS buildrows FROM action_circulation acirc) x ON x.id = acirc.id GROUP BY 2, 3, 4, 5, 6 ORDER BY 2, 3, 4, 5, 6
+ SELECT COUNT(acirc.id), acirc.duration_rule, acirc.recurring_fine_rule, acirc.max_fine_rule, pgt.name, x.buildrows FROM action_circulation acirc JOIN actor.usr au ON au.id = acirc.usr JOIN permission.grp_tree pgt ON pgt.id = au.profile JOIN (SELECT acirc.id, ARRAY_TO_STRING(find_cmm(acirc.id),',') AS buildrows FROM action_circulation acirc) x ON x.id = acirc.id GROUP BY 2, 3, 4, 5, 6 ORDER BY 2, 3, 4, 5, 6
@@ -127,7 +138,7 @@
0
Circulations by Rules and Circulation Modifier
Count of Circs.Duration.Fine.Max Fine.Circulation Modifier.Matchpoints
- SELECT COUNT(acirc.id), acirc.duration, acirc.recurring_fine, acirc.max_fine, ac.circ_modifier, x.buildrows FROM action_circulation_legacy acirc JOIN asset.copy ac ON ac.id = acirc.target_copy JOIN (SELECT acirc.id, ARRAY_TO_STRING(find_cmm(acirc.id),',') AS buildrows FROM action_circulation_legacy acirc WHERE acirc.x_migrate = TRUE) x ON x.id = acirc.id WHERE acirc.x_migrate = TRUE GROUP BY 2, 3, 4, 5, 6 ORDER BY 2, 3, 4, 5, 6
+ SELECT COUNT(acirc.id), acirc.duration_rule, acirc.recurring_fine_rule, acirc.max_fine_rule, ac.circ_modifier, x.buildrows FROM action_circulation_legacy acirc JOIN asset.copy ac ON ac.id = acirc.target_copy JOIN (SELECT acirc.id, ARRAY_TO_STRING(find_cmm(acirc.id),',') AS buildrows FROM action_circulation_legacy acirc WHERE acirc.x_migrate = TRUE) x ON x.id = acirc.id WHERE acirc.x_migrate = TRUE GROUP BY 2, 3, 4, 5, 6 ORDER BY 2, 3, 4, 5, 6
@@ -136,7 +147,7 @@
1
Circulations by Rules and Circulation Modifier
Count of Circs.Duration.Fine.Max Fine.Circulation Modifier.Matchpoints
- SELECT COUNT(acirc.id), acirc.duration, acirc.recurring_fine, acirc.max_fine, ac.circ_modifier, x.buildrows FROM action_circulation acirc JOIN asset.copy ac ON ac.id = acirc.target_copy JOIN (SELECT acirc.id, ARRAY_TO_STRING(find_cmm(acirc.id),',') AS buildrows FROM action_circulation acirc) x ON x.id = acirc.id
+ SELECT COUNT(acirc.id), acirc.duration_rule, acirc.recurring_fine_rule, acirc.max_fine_rule, ac.circ_modifier, x.buildrows FROM action_circulation acirc JOIN asset.copy ac ON ac.id = acirc.target_copy JOIN (SELECT acirc.id, ARRAY_TO_STRING(find_cmm(acirc.id),',') AS buildrows FROM action_circulation acirc) x ON x.id = acirc.id
GROUP BY 2, 3, 4, 5, 6 ORDER BY 2, 3, 4, 5, 6
@@ -146,7 +157,7 @@
0
Circulations by Rules and Org Unit
Count of Circs.Duration.Fine.Max Fine.Library Branch
- SELECT COUNT(acirc.id), acirc.duration, acirc.recurring_fine, acirc.max_fine, aou.name FROM action_circulation_legacy acirc JOIN actor.org_unit aou ON aou.id = acirc.circ_lib WHERE acirc.x_migrate = TRUE GROUP BY 2, 3, 4, 5 ORDER BY 2, 3, 4, 5
+ SELECT COUNT(acirc.id), acirc.duration_rule, acirc.recurring_fine_rule, acirc.max_fine_rule, aou.name FROM action_circulation_legacy acirc JOIN actor.org_unit aou ON aou.id = acirc.circ_lib WHERE acirc.x_migrate = TRUE GROUP BY 2, 3, 4, 5 ORDER BY 2, 3, 4, 5
@@ -155,7 +166,7 @@
1
Circulations by Rules and Org Unit
Count of Circs.Duration.Fine.Max Fine.Library Branch
- SELECT COUNT(acirc.id), acirc.duration, acirc.recurring_fine, acirc.max_fine, aou.name FROM action_circulation acirc JOIN actor.org_unit aou ON aou.id = acirc.circ_lib GROUP BY 2, 3, 4, 5 ORDER BY 2, 3, 4, 5
+ SELECT COUNT(acirc.id), acirc.duration_rule, acirc.recurring_fine_rule, acirc.max_fine_rule, aou.name FROM action_circulation acirc JOIN actor.org_unit aou ON aou.id = acirc.circ_lib GROUP BY 2, 3, 4, 5 ORDER BY 2, 3, 4, 5
@@ -304,6 +315,15 @@
+ asset_precat
+ Precats (AKA Copies Without Bibs)
+ assets
+ 0
+ Copy Count.Migating
+ SELECT COUNT(ac.id), ac.x_migrate::TEXT FROM asset_copy_legacy ac WHERE ac.x_bre_id = -1 GROUP BY 2
+
+
+
asset_circ_mod_copies_count
Copies by Circulation Modifier
assets
@@ -366,14 +386,14 @@
SELECT COUNT(ac.id), acl.name, aou.name, ac.x_migrate::TEXT FROM asset_copy_legacy ac JOIN asset.copy_location acl ON acl.id = ac.location JOIN actor.org_unit aou ON aou.id = ac.circ_lib GROUP BY 2, 3, 4 ORDER BY 2, 3, 4
-
+
asset_barcode_patterns
@@ -431,7 +451,7 @@
0
Collision List
SELECT ac.barcode FROM asset_copy_legacy ac WHERE ac.barcode ~* 'collision' ORDER BY 1 LIMIT 20
- This is a shortlist of patron barcode collisions that maxes out at 20. If there are more collisions we will need to run a custom report.
+ This is a shortlist of copy barcode collisions that maxes out at 20. If there are more collisions we will need to run a custom report.
@@ -508,6 +528,15 @@ id = ac_sc.owner GROUP BY 2,3 ORDER BY 2,3
SELECT COUNT(map.id), tag.tag_type, tag.label, tag.staff_note, tag.pub FROM asset_copy_tag tag JOIN asset_copy_tag_copy_map map ON map.tag = tag.id GROUP BY 2,3,4,5 ORDER BY 2,3
+
+ asset_copy_alerts
+ Copy Alerts
+ assets
+ 0
+ Alert Count.Alert Type
+ SELECT COUNT(*), cat.name FROM asset_copy_alert aca JOIN config.copy_alert_type cat ON cat.id = aca.alert_type GROUP BY 2
+
+
@@ -631,22 +660,21 @@ id = ac_sc.owner GROUP BY 2,3 ORDER BY 2,3
- bibs
- Extracted Bibliographic Records
+ bibs_loaded
+ Loaded Bibliographic Records
bibs
0
- Count.Deleted.Migrated
- SELECT COUNT(bre.id), bre.deleted::TEXT, bre.x_migrate::TEXT FROM biblio_record_entry_legacy bre GROUP BY 2, 3 ORDER BY 2, 3
- False means the records are not deleted.
+ Count
+ SELECT COUNT(bre.id) FROM biblio_record_entry_legacy bre WHERE id IN (SELECT id FROM biblio.record_entry) ORDER BY 1
- bibs
- Extracted Bibliographic Records
+ bibs_loaded
+ Loaded Bibliographic Records
bibs
1
Count
- SELECT COUNT(eg) FROM bib_id_map
+ SELECT COUNT(bre.id) FROM biblio_record_entry bre WHERE id IN (SELECT id FROM biblio.record_entry) ORDER BY 1
@@ -655,7 +683,17 @@ id = ac_sc.owner GROUP BY 2,3 ORDER BY 2,3
bibs
0
Count
- SELECT COUNT(eg) FROM bib_id_map where eg::INTEGER NOT IN (SELECT DISTINCT record FROM asset_call_number)
+ SELECT COUNT(id) FROM biblio_record_entry where id NOT IN (SELECT DISTINCT record FROM asset_call_number)
+ These records would not have been loaded.
+
+
+
+ bibswuri
+ Bibliographic Records With 856$9s
+ bibs
+ 0
+ Count
+ SELECT COUNT(id) FROM biblio_record_entry where id IN (SELECT record FROM asset.call_number WHERE label ~* '##URI##')
@@ -712,6 +750,38 @@ id = ac_sc.owner GROUP BY 2,3 ORDER BY 2,3
SELECT COUNT(b.id) FROM biblio_monograph_part b
+
+ bib_merges
+ Bibliographic Merge Count
+ bibs
+ 0
+ Records Merged.Incumbent Records Merged Into
+ SELECT SUM(array_length(records,1)), COUNT(*) FROM groups
+
+
+
+ bib_merges_searchformat
+ Bibliographic Merges By Search Format
+ bibs
+ 0
+ Count.Item Type
+ DROP TABLE IF EXISTS temp_unnest; CREATE TABLE temp_unnest AS (SELECT UNNEST(records) FROM groups); SELECT COUNT(record), search_format_str FROM dedupe_batch WHERE record IN (SELECT * FROM temp_unnest) GROUP BY 2 ORDER BY 2
+
+
+
+ bibs_not_loaded
+ Bibliographic Records That Failed to Load
+ bibs
+ 0
+ Title.Author.Control Number
+ SELECT LEFT(ARRAY_TO_STRING(oils_xpath( '//*[@tag="245"]/*[@code="a"]/text()', a.marc),''),50) AS "Title",
+ LEFT(ARRAY_TO_STRING(oils_xpath( '//*[@tag="100"]/*[@code="a"]/text()', a.marc),''),50) AS "Author",
+ ARRAY_TO_STRING(oils_xpath( '//*[@tag="001"]/text()', a.marc),'') AS "001"
+ FROM biblio_record_entry a LEFT JOIN biblio.record_entry b ON b.id = a.id WHERE b.id IS NULL AND a.x_migrate
+
+
+
+
@@ -768,23 +838,23 @@ id = ac_sc.owner GROUP BY 2,3 ORDER BY 2,3
SELECT COUNT(id), active::TEXT FROM actor_card GROUP BY 2
-
+
-
+
usr_barcode_patterns
@@ -803,10 +873,10 @@ id = ac_sc.owner GROUP BY 2,3 ORDER BY 2,3
Count of Barcodes (greater than 10).Left 60% of Characters
SELECT COUNT(acard.id), LEFT(acard.barcode,(ROUND(LENGTH(acard.barcode)*.6))::INT) FROM actor_card acard GROUP BY 2 HAVING COUNT(acard.id) > 10 ORDER BY 2
-
-
- usr_barcode_collisions
- Patron Barcode Collisions
+
+
+ usr_barcode_incoming_collisions
+ Incoming Patron Barcode Collisions
actors
0
Collision Count
@@ -814,21 +884,39 @@ id = ac_sc.owner GROUP BY 2,3 ORDER BY 2,3
- usr_barcode_collisions
- Patron Barcode Collisions
+ usr_barcode_incoming_collisions
+ Incoming Patron Barcode Collisions
actors
1
Collision Count
SELECT COUNT(acard.id) FROM actor_card acard WHERE barcode ~* 'collision'
+
+ usr_barcode_incumbent_collisions
+ Incumbent Patron Barcode Collisions
+ actors
+ 0
+ Collision Count
+ SELECT COUNT(acard.id) FROM actor_card_legacy acard WHERE barcode ~* '^x_' AND x_migrate = TRUE
+
+
+
+ usr_barcode_incumbent_collisions
+ Incumbent Patron Barcode Collisions
+ actors
+ 1
+ Collision Count
+ SELECT COUNT(acard.id) FROM actor_card acard WHERE barcode ~* '^x_'
+
+
usr_barcode_collision_shortlist
Patron Barcode Collisions (first 20)
actors
0
Collision List
- SELECT acard.barcode FROM actor_card_legacy acard WHERE acard.barcode ~* 'collision' AND acard.x_migrate = TRUE ORDER BY 1 LIMIT 20
+ SELECT acard.barcode FROM actor_card_legacy acard WHERE (acard.barcode ~* 'collision' OR acard.barcode ~* '^x_') AND acard.x_migrate = TRUE ORDER BY 1 LIMIT 20
This is a shortlist of patron barcode collisions that maxes out at 20. If there are more collisions we will need to run a custom report. In some cases we may flag individual accounts to not migrate.
@@ -838,7 +926,7 @@ id = ac_sc.owner GROUP BY 2,3 ORDER BY 2,3
actors
1
Collision List
- SELECT acard.barcode FROM actor_card acard WHERE acard.barcode ~* 'collision' ORDER BY 1 LIMIT 20
+ SELECT acard.barcode FROM actor_card acard WHERE (acard.barcode ~* 'collision' OR acard.barcode ~* '^x_') ORDER BY 1 LIMIT 20
This is a shortlist of patron barcode collisions that maxes out at 20. If there are more collisions we will need to run a custom report. In some cases we may flag individual accounts to not migrate.
@@ -848,7 +936,7 @@ id = ac_sc.owner GROUP BY 2,3 ORDER BY 2,3
actors
0
Number of Barcodes Matching Pattern Greater than 10.Left 60% of Characters
- SELECT COUNT(acard.id), LEFT(acard.barcode,(ROUND(LENGTH(acard.barcode)*.6))::INT) FROM actor_card_legacy acard WHERE acard.barcode ~* 'collision' AND acard.x_migrate = TRUE GROUP BY 2 HAVING COUNT(acard.id) > 10 ORDER BY 2
+ SELECT COUNT(acard.id), LEFT(acard.barcode,(ROUND(LENGTH(acard.barcode)*.6))::INT) FROM actor_card_legacy acard WHERE (acard.barcode ~* 'collision' OR acard.barcode ~* '^x_') AND acard.x_migrate = TRUE GROUP BY 2 HAVING COUNT(acard.id) > 10 ORDER BY 2
@@ -857,7 +945,7 @@ id = ac_sc.owner GROUP BY 2,3 ORDER BY 2,3
actors
1
Number of Barcodes Matching Pattern Greater than 10.Left 60% of Characters
- SELECT COUNT(acard.id), LEFT(acard.barcode,(ROUND(LENGTH(acard.barcode)*.6))::INT) FROM actor_card acard WHERE acard.barcode ~* 'collision' GROUP BY 2 HAVING COUNT(acard.id) > 10 ORDER BY 2
+ SELECT COUNT(acard.id), LEFT(acard.barcode,(ROUND(LENGTH(acard.barcode)*.6))::INT) FROM actor_card acard WHERE (acard.barcode ~* 'collision' OR acard.barcode ~* '^x_') GROUP BY 2 HAVING COUNT(acard.id) > 10 ORDER BY 2
@@ -979,6 +1067,17 @@ id = ac_sc.owner GROUP BY 2,3 ORDER BY 2,3
ORDER BY 2, 1, 3
+
+ usr_settings
+ Patron Settings
+ actors
+ 0
+ Count.Setting.Value
+ SELECT COUNT(*), name, 'User''s Phone' FROM actor_usr_setting WHERE name IN ('opac.default_phone') GROUP BY 2, 3
+ UNION ALL SELECT COUNT(*), name, value FROM actor_usr_setting WHERE name IN ('opac.hold_notify') GROUP BY 2, 3
+ UNION ALL SELECT COUNT(*), a.name, aou.shortname FROM actor_usr_setting a JOIN actor.org_unit aou ON aou.id = REPLACE(a.value,'"','')::INTEGER
+ WHERE a.name IN ('opac.default_pickup_location','opac.default_search_location') GROUP BY 2, 3 ORDER BY 2, 3;
+
@@ -1024,8 +1123,97 @@ id = ac_sc.owner GROUP BY 2,3 ORDER BY 2,3
0
Migrated Serial MFHDs
Number of MFHDs
- SELECT COUNT(id) FROM seriarecord_entry
+ SELECT COUNT(id) FROM serial_record_entry
+
+
+
+
+
+ dedupe_explain
+ dedupe
+ dedupe_process.asciidoc
+
+
+
+ dedupe_bib_groups
+ dedupe
+ 0
+ Scoring and Bib Record Groups
+ Count.Bib Record Groups
+ SELECT COUNT(id), 'Total Bibs Being Evaluated' FROM biblio.record_entry WHERE deleted IS FALSE AND id IN (SELECT eg::BIGINT FROM bib_id_map)
+ UNION ALL SELECT (COUNT(DISTINCT incoming_bib)), 'Incoming Bibs With Matches Found' FROM bib_matches
+ UNION ALL SELECT (COUNT(bre.id) - (SELECT COUNT(DISTINCT incoming_bib) FROM bib_matches)), 'Incoming Bibs With No Match'
+ FROM biblio.record_entry bre WHERE bre.deleted IS FALSE AND bre.id IN (SELECT eg::BIGINT FROM bib_id_map)
+ UNION ALL SELECT COUNT(DISTINCT incoming_bib), 'Incoming Bibs Being Merged into Incumbent' FROM bib_matches WHERE incumbent_bib_score >= incoming_bib_score
+ UNION ALL SELECT COUNT(id), 'Incumbent Bibs With Higher Scores to Incoming' FROM bib_matches WHERE incumbent_bib_score > incoming_bib_score
+ UNION ALL SELECT COUNT(id), 'Incumbent Bibs With Equal Scores to Incoming' FROM bib_matches WHERE incumbent_bib_score = incoming_bib_score
+ UNION ALL SELECT COUNT(id), 'Incumbent Bibs With Lower Scores to Incoming' FROM bib_matches WHERE incumbent_bib_score < incoming_bib_score
+ ;
+
+
+
+ dedupe_format_count
+ dedupe
+ 0
+ Count of Items Matching By Format
+ Count.Format(s)
+ SELECT COUNT(id), search_formats FROM bib_matches GROUP BY 2 ORDER BY 2;
+
+
+ dedupe_score_ranges
+ dedupe
+ 0
+ Count of Items Matching By Format
+ Lowest Record Score.Largest Record Score.Record Set
+ SELECT MIN(incumbent_bib_score), MAX(incumbent_bib_score), 'Incumbent Records' FROM bib_matches
+ UNION ALL SELECT MIN(incoming_bib_score), MAX(incoming_bib_score), 'Incoming Records' FROM bib_matches ;
+
+
+
+
+
+ dedupe_sample_set
+ dedupe
+ 0
+ Sample of 20 Matching Dedupe Record Sets
+ Bib Being Merged Into.Bib Being Merged
+ SELECT incumbent_bib, incoming_bib FROM bib_matches WHERE incumbent_bib_score >= incoming_bib_score LIMIT 20 ;
+
+
+
+
+
+
+ notices_overview
+ notices
+ 0
+ Action Triggers Setup for Notices
+ ID.Active.Owner.Name
+ SELECT ed.id, ed.active, aou.shortname, ed.name
+ FROM action_trigger.event_definition ed
+ JOIN actor.org_unit aou ON aou.id = ed.owner
+ WHERE ed.owner IN (SELECT DISTINCT home_ou FROM actor_usr)
+ OR ed.owner IN (SELECT DISTINCT parent_ou FROM actor.org_unit WHERE id in (SELECT DISTINCT home_ou FROM actor_usr));
+
+
+
+
+ notices_count
+ notices
+ 0
+ Count of Notices Run with State
+ Count of Notices.State.ID.Owner.Name
+ SELECT COUNT(ate.id), ate.state, ed.id, aou.shortname, ed.name
+ FROM action_trigger.event_definition ed
+ JOIN actor.org_unit aou ON aou.id = ed.owner
+ JOIN action_trigger.event ate ON ate.event_def = ed.id
+ WHERE ed.owner IN (SELECT DISTINCT home_ou FROM actor_usr)
+ OR ed.owner IN (SELECT DISTINCT parent_ou FROM actor.org_unit WHERE id in (SELECT DISTINCT home_ou FROM actor_usr))
+ GROUP BY 2,3,4;
+
+
+