e42125a417cad5d02ee7bd20527dce4d8fdb0230
[migration-tools.git] / mig-xml / evergreen_staged_report.xml
1 <reports_file>
2     <function>
3         <name>find_cmm</name>
4         <drop>DROP FUNCTION IF EXISTS find_cmm(BIGINT)</drop>
5         <create>
6             CREATE OR REPLACE FUNCTION find_cmm(circ_id BIGINT)
7                 RETURNS SETOF INTEGER[]
8                 LANGUAGE plpgsql
9             AS $function$
10             DECLARE
11                  aou     INTEGER;
12                  ac      INTEGER;
13                  au      INTEGER;
14                  r       INTEGER[];
15             BEGIN
16                 SELECT circ_lib FROM action.circulation WHERE id = circ_id INTO aou;
17                 SELECT target_copy FROM action.circulation WHERE id = circ_id INTO ac;
18                 SELECT usr FROM action.circulation WHERE id = circ_id INTO au;
19
20                 FOR r IN SELECT buildrows FROM action.find_circ_matrix_matchpoint(aou,ac,au,FALSE)
21                     LOOP
22                         RETURN NEXT r;
23                     END LOOP;
24                 RETURN;
25             END
26         $function$</create>
27     </function>
28
29
30 <!-- sample reports entry
31     <report>
32         <name>name of report</name>
33         <iteration value='0' /> which version, the first version to run is 0, first backup is 1, then so on
34         <tag>money</tag>  arbitrary tags, each should go in separate tag
35         <report_title>Migrated Billings</report_title>  title used in the asciidoc output
36         <heading column='1'>Number of Billings.Migrated.Total</heading> period delimited 
37         <query>SELECT COUNT(id),x_migrate::TEXT,SUM(amount) FROM m_money_billing_legacy GROUP BY 2;</query>  query itself, will be replaced
38         <note>Arbitrary note that can be included in the entries.</note>
39     </report>
40 -->
41
42     <!-- CIRC REPORTS -->
43     <report>
44         <name>circ_count</name>
45         <tag>circs</tag>
46         <iteration>0</iteration>
47         <report_title>Migrated Circulations</report_title>
48         <heading>Circulation Status.Count of Circs</heading>
49         <query>SELECT 'Closed Circulations', COUNT(id) FROM m_action_circulation_legacy WHERE xact_finish IS NOT NULL AND x_migrate 
50             UNION ALL SELECT 'Open Circulations', COUNT(id) FROM m_action_circulation_legacy WHERE xact_finish IS NULL AND x_migrate</query>
51     </report>
52
53     <report>
54         <name>circ_count_unmigrated</name>
55         <tag>circs</tag>
56         <iteration>0</iteration>
57         <report_title>Open Un-migrated Circulations</report_title>
58         <heading>Circulation Status.Count of Circs</heading>
59         <query>SELECT 'No Matching User', COUNT(id) FROM m_action_circulation_legacy WHERE xact_finish IS NULL AND x_migrate = FALSE AND usr IS NULL 
60                 UNION ALL SELECT 'No Matching Item', COUNT(id) FROM m_action_circulation_legacy WHERE xact_finish IS NULL AND x_migrate = FALSE AND target_copy IS NULL </query>
61     </report>
62
63     <report>
64         <name>circ_count</name>
65         <tag>circs</tag>
66         <iteration>1</iteration>
67         <report_title>Open Circulations</report_title>
68         <heading>Circulation Status.Count of Circs</heading>
69         <query>SELECT 'Closed Circulations', COUNT(id) FROM m_action_circulation WHERE xact_finish IS NOT NULL UNION ALL SELECT 'Open Circulations', COUNT(id) FROM m_action_circulation WHERE xact_finish IS NULL</query>
70     </report>
71 <!-- intent is to add a report by circulated and item status
72     <report>
73         <name>circ_count_by_item_status</name>
74         <tag>circs</tag>
75         <iteration>0</iteration>
76         <report_title>Open Circulations</report_title>
77         <heading>Circulation Status.Migrated.Count of Circs</heading>
78         <query>SELECT 'Closed Circulations', x_migrate::TEXT, COUNT(id) FROM m_action_circulation_legacy WHERE xact_finish IS NOT NULL GROUP BY 2 UNION ALL SELECT 'Open Circulations', x_migrate::TEXT, COUNT(id) FROM m_action_circulation_legacy WHERE xact_finish IS NULL GROUP BY 2</query>
79     </report>
80 -->
81      <report>
82         <name>circ_by_orgunit</name>
83         <tag>circs</tag>
84         <iteration>0</iteration>
85         <report_title>Circulations by Org Unit</report_title>
86         <heading>Circulations Count.Migrated.Org Unit</heading>
87         <query>SELECT COUNT(acirc.id), acirc.x_migrate::TEXT, aou.name FROM m_action_circulation_legacy acirc JOIN actor.org_unit aou ON aou.id = acirc.circ_lib WHERE acirc.xact_finish IS NULL GROUP BY 2, 3</query>
88     </report>
89
90      <report>
91         <name>circ_by_orgunit</name>
92         <tag>circs</tag>
93         <iteration>1</iteration>
94         <report_title>Circulations by Org Unit</report_title>
95         <heading>Circulations Count.Org Unit</heading>
96         <query>SELECT COUNT(acirc.id), aou.name FROM m_action_circulation acirc JOIN actor.org_unit aou ON aou.id = acirc.circ_lib WHERE acirc.xact_finish IS NULL GROUP BY 2</query>
97     </report>
98
99      <report>
100         <name>circs_by_duration</name>
101         <tag>circs</tag>
102         <iteration>0</iteration>
103         <report_title>Migrated Circulations by Duration, Fine and Max Fine</report_title>
104         <heading>Count of Circs.Duration.Fine.Max Fine.Migrated</heading>
105         <query>SELECT COUNT(id), duration_rule, recurring_fine_rule, max_fine_rule, x_migrate::TEXT FROM m_action_circulation_legacy WHERE x_migrate = TRUE GROUP BY 2, 3, 4, 5</query>
106     </report>
107
108      <report>
109         <name>circs_by_duration</name>
110         <tag>circs</tag>
111         <iteration>1</iteration>
112         <report_title>Circulations by Duration, Fine and Max Fine</report_title>
113         <heading>Count of Circs.Duration.Fine.Max Fine</heading>
114         <query>SELECT COUNT(id), duration_rule, recurring_fine_rule, max_fine_rule FROM m_action_circulation GROUP BY 2, 3, 4 ORDER BY 2, 3, 4</query>
115     </report>
116
117      <report>
118         <name>circs_by_usrgroup</name>
119         <tag>circs</tag>
120         <iteration>0</iteration>
121         <report_title>Circulations by Rules and Patron Group</report_title>
122         <heading>Count of Circs.Duration.Fine.Max Fine.User Group.Matchpoints</heading>
123         <query>SELECT COUNT(acirc.id), acirc.duration_rule, acirc.recurring_fine_rule, acirc.max_fine_rule, pgt.name, x.buildrows FROM m_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 m_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</query>
124     </report>
125
126      <report>
127         <name>circs_by_usrgroup</name>
128         <tag>circs</tag>
129         <iteration>1</iteration>
130         <report_title>Circulations by Rules and Patron Group</report_title>
131         <heading>Count of Circs.Duration.Fine.Max Fine.User Group.Matchpoints</heading>
132         <query>SELECT COUNT(acirc.id), acirc.duration_rule, acirc.recurring_fine_rule, acirc.max_fine_rule, pgt.name, x.buildrows FROM m_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 m_action_circulation acirc) x ON x.id = acirc.id GROUP BY 2, 3, 4, 5, 6 ORDER BY 2, 3, 4, 5, 6</query>
133     </report>
134
135      <report>
136         <name>circs_by_circmod</name>
137         <tag>circs</tag>
138         <iteration>0</iteration>
139         <report_title>Circulations by Rules and Circulation Modifier</report_title>
140         <heading>Count of Circs.Duration.Fine.Max Fine.Circulation Modifier.Matchpoints</heading>
141         <query>SELECT COUNT(acirc.id), acirc.duration_rule, acirc.recurring_fine_rule, acirc.max_fine_rule, ac.circ_modifier, x.buildrows FROM m_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 m_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</query>
142     </report>
143
144      <report>
145         <name>circs_by_circmod</name>
146         <tag>circs</tag>
147         <iteration>1</iteration>
148         <report_title>Circulations by Rules and Circulation Modifier</report_title>
149         <heading>Count of Circs.Duration.Fine.Max Fine.Circulation Modifier.Matchpoints</heading>
150         <query>SELECT COUNT(acirc.id), acirc.duration_rule, acirc.recurring_fine_rule, acirc.max_fine_rule, ac.circ_modifier, x.buildrows FROM m_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 m_action_circulation acirc) x ON x.id = acirc.id
151              GROUP BY 2, 3, 4, 5, 6 ORDER BY 2, 3, 4, 5, 6</query>
152     </report>
153
154      <report>
155         <name>circs_by_orgunit</name>
156         <tag>circs</tag>
157         <iteration>0</iteration>
158         <report_title>Circulations by Rules and Org Unit</report_title>
159         <heading>Count of Circs.Duration.Fine.Max Fine.Library Branch</heading>
160         <query>SELECT COUNT(acirc.id), acirc.duration_rule, acirc.recurring_fine_rule, acirc.max_fine_rule, aou.name FROM m_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</query>
161     </report>
162
163      <report>
164         <name>circs_by_orgunit</name>
165         <tag>circs</tag>
166         <iteration>1</iteration>
167         <report_title>Circulations by Rules and Org Unit</report_title>
168         <heading>Count of Circs.Duration.Fine.Max Fine.Library Branch</heading>
169         <query>SELECT COUNT(acirc.id), acirc.duration_rule, acirc.recurring_fine_rule, acirc.max_fine_rule, aou.name FROM m_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</query>
170     </report>
171
172      <report>
173         <name>non_cat_circs</name>
174         <tag>circs</tag>
175         <iteration>0</iteration>
176         <report_title>Non-Cataloged Circulation</report_title>
177         <heading>Circulations Count.Migrated</heading>
178         <query>SELECT COUNT(id), x_migrate::TEXT FROM m_action_non_cataloged_circulation_legacy GROUP BY 2</query>
179     </report>
180
181      <report>
182         <name>non_cat_circs</name>
183         <tag>circs</tag>
184         <iteration>1</iteration>
185         <report_title>Non-Cataloged Circulation</report_title>
186         <heading>Circulations Count</heading>
187         <query>SELECT COUNT(id) FROM m_action_non_cataloged_circulation</query>
188     </report>
189
190      <report>
191         <name>in_house</name>
192         <tag>circs</tag>
193         <iteration>0</iteration>
194         <report_title>In House Use</report_title>
195         <heading>In House Use Records.Migrated</heading>
196         <query>SELECT COUNT(id), x_migrate::TEXT FROM m_action_in_house_use_legacy GROUP BY 2</query>
197     </report>
198
199      <report>
200         <name>in_house</name>
201         <tag>circs</tag>
202         <iteration>1</iteration>
203         <report_title>In House Use</report_title>
204         <heading>In House Use Records</heading>
205         <query>SELECT COUNT(id) FROM m_action_in_house_use</query>
206     </report>
207
208      <report>
209         <name>circs_missing_rules</name>
210         <tag>circs</tag>
211         <iteration>1</iteration>
212         <report_title>Circs Missing Rules</report_title>
213         <heading>Count.Field Missing</heading>
214         <query>SELECT COUNT(id), 'Duration Rule Value' FROM m_action_circulation WHERE duration IS NULL 
215             UNION ALL SELECT COUNT(id), 'Recurring Fine Rule Value' FROM m_action_circulation WHERE recurring_fine IS NULL 
216             UNION ALL SELECT COUNT(id), 'Max Fine Rule Value' FROM m_action_circulation WHERE max_fine IS NULL
217             UNION ALL SELECT COUNT(id), 'Duration Rule' FROM m_action_circulation WHERE duration_rule IS NULL       
218             UNION ALL SELECT COUNT(id), 'Recurring Fine Rule' FROM m_action_circulation WHERE recurring_fine_rule IS NULL      
219             UNION ALL SELECT COUNT(id), 'Max Fine Rule' FROM m_action_circulation WHERE max_fine_rule IS NULL
220         </query>
221     </report>
222
223      <report>
224         <name>circ_open_by_item_status</name>
225         <tag>circs</tag>
226         <iteration>0</iteration>
227         <report_title>Open Circulation and Status of Linked Items</report_title>
228         <heading>Count.Status</heading>
229         <query>SELECT COUNT(acirc.id), ccs.name FROM action.circulation acirc JOIN asset.copy ac ON ac.id = acirc.target_copy JOIN config.copy_status ccs ON ccs.id = ac.status WHERE acirc.xact_finish IS NULL AND acirc.checkin_time IS NULL AND acirc.id IN (SELECT id FROM m_action_circulation) GROUP BY 2 ORDER BY 2</query>
230     </report>
231
232     <!-- HOLDS REPORTS -->
233
234      <report>
235         <name>holds</name>
236         <tag>holds</tag>
237         <iteration>0</iteration>
238         <report_title>Migrated Holds</report_title>
239         <heading>Hold Type.Hold Count.Migrated</heading>
240         <query>SELECT 'Closed Holds', COUNT(id), x_migrate::TEXT FROM m_action_hold_request_legacy WHERE (expire_time::TIMESTAMP &lt; now()) OR cancel_time IS NOT NULL OR fulfillment_time IS NOT NULL GROUP BY 3 UNION ALL SELECT 'Open Holds', COUNT(id), x_migrate::TEXT FROM m_action_hold_request_legacy WHERE (expire_time IS NULL OR expire_time::TIMESTAMP &gt; now()) AND cancel_time IS NULL AND fulfillment_time IS NULL GROUP BY 3</query>
241     </report>
242
243      <report>
244         <name>holds_bytype</name>
245         <tag>holds</tag>
246         <iteration>0</iteration>
247         <report_title>Migrated Holds By Type</report_title>
248         <heading>Hold Type.Hold Count.Migrated</heading>
249         <query>SELECT hold_type as "Hold Type", COUNT(id), x_migrate::TEXT FROM m_action_hold_request_legacy GROUP BY 1, 3</query>
250     </report>
251
252      <report>
253         <name>transit_open_by_item_status</name>
254         <tag>holds</tag>
255         <iteration>0</iteration>
256         <report_title>Transit Copy Records and Status of Linked Items</report_title>
257         <heading>Count.Status</heading>
258         <query>SELECT COUNT(atc.id), ccs.name FROM action.transit_copy atc JOIN asset.copy ac ON ac.id = atc.target_copy JOIN config.copy_status ccs ON ccs.id = ac.status WHERE atc.id IN (SELECT id FROM m_action_transit_copy) AND atc.dest_recv_time IS NULL GROUP BY 2 ORDER BY 2</query>
259     </report>
260
261      <report>
262         <name>transit_copies_by_status</name>
263         <tag>holds</tag>
264         <iteration>0</iteration>
265         <report_title>Status of Items with Count of Open In Transits</report_title>
266         <heading>Count.Status.Count of Open Transits</heading>
267         <query>SELECT COUNT(ac.id), ccs.name, SUM(CASE WHEN atc.id IS NULL THEN 0 ELSE 1 END) FROM asset.copy ac JOIN config.copy_status ccs ON ccs.id = ac.status LEFT JOIN (SELECT * FROM action.transit_copy WHERE id IN (SELECT id FROM m_action_transit_copy) AND dest_recv_time IS NULL) atc ON atc.target_copy = ac.id WHERE ac.id IN (SELECT id from m_asset_copy) GROUP BY 2 ORDER BY 2</query>
268     </report>
269     
270      <report>
271         <name>hold_copies_by_status</name>
272         <tag>holds</tag>
273         <iteration>0</iteration>
274         <report_title>Captured Holds with Status of Items</report_title>
275         <heading>Count of Captured Hold.Status of Item</heading>
276         <query>SELECT COUNT(ahr.id), ccs.name FROM action.hold_request ahr JOIN asset.copy ac ON ac.id = ahr.current_copy JOIN config.copy_status ccs ON ccs.id = ac.status WHERE ahr.capture_time IS NOT NULL AND ahr.fulfillment_time IS NULL and ahr.cancel_time IS NULL AND ahr.id IN (SELECT id FROM m_action_hold_request) GROUP BY 2 ORDER By 2</query>
277     </report>
278
279       <report>
280         <name>hold_depth</name>
281         <tag>holds</tag>
282         <iteration>0</iteration>
283         <report_title>Depth of Unfilled Holds</report_title>
284         <heading>Count.Depth</heading>
285         <query>SELECT COUNT(ahr.id), ahr.selection_depth FROM action.hold_request ahr WHERE ahr.id IN (SELECT id FROM m_action_hold_request) AND ahr.cancel_time IS NULL AND ahr.capture_time IS NULL AND ahr.fulfillment_time IS NULL GROUP BY 2 ORDER BY 2</query>
286     </report>
287
288     <!-- ASSET REPORTS -->
289     
290     <report>
291         <name>m_asset_copy_count</name>
292         <report_title>Count of Copies by Library</report_title>
293         <tag>assets</tag>
294         <iteration>0</iteration>
295         <heading>Copy Count.Library.Migrated</heading>
296         <query>SELECT COUNT(ac.id), aou.name, ac.x_migrate::TEXT FROM m_asset_copy_legacy ac JOIN actor.org_unit aou ON aou.id = ac.circ_lib GROUP BY 2, 3 ORDER BY 2, 3</query>
297     </report>
298
299     <report>
300         <name>m_asset_deleted_copies</name>
301         <report_title>Deleted Copies</report_title>
302         <tag>assets</tag>
303         <iteration>0</iteration>
304         <heading>Copy Count.Deleted.Migrated</heading>
305         <query>SELECT COUNT(ac.id), ac.deleted::TEXT, ac.x_migrate::TEXT FROM m_asset_copy_legacy ac GROUP BY 2, 3</query>
306     </report>
307
308     <report>
309         <name>m_asset_copies_by_status</name>
310         <report_title>Copies by Status</report_title>
311         <tag>assets</tag>
312         <iteration>0</iteration>
313         <heading>Copy Count.Status.Migrated</heading>
314         <query>SELECT COUNT(ac.id), cs.name, ac.x_migrate::TEXT FROM m_asset_copy_legacy ac JOIN config.copy_status cs ON cs.id = ac.status GROUP BY 2, 3 ORDER BY 2, 3</query>
315     </report>
316
317     <report>
318         <name>m_asset_circ_mod_copies_count</name>
319         <report_title>Copies by Circulation Modifier</report_title>
320         <tag>assets</tag>
321         <iteration>0</iteration>
322         <heading>Copy Count.Circulation Modifier.Migrated</heading>
323         <query>SELECT COUNT(ac.id), ac.circ_modifier, ac.x_migrate::TEXT FROM m_asset_copy_legacy ac GROUP BY 2, 3 ORDER BY 2, 3</query>
324     </report>
325
326     <report>
327         <name>m_asset_copy_notes</name>
328         <report_title>Copy Notes</report_title>
329         <tag>assets</tag>
330         <iteration>0</iteration>
331         <heading>Note Count.Public.Migrated</heading>
332         <query>SELECT COUNT(acnote.id), acnote.pub::TEXT, acnote.x_migrate::TEXT FROM m_asset_copy_note_legacy acnote GROUP BY 2, 3 ORDER BY 2, 3</query>
333     </report>
334
335     <report>
336         <name>m_asset_copy_notes</name>
337         <report_title>Copy Notes</report_title>
338         <tag>assets</tag>
339         <iteration>1</iteration>
340         <heading>Note Count.Public</heading>
341         <query>SELECT COUNT(acnote.id), acnote.pub::TEXT FROM m_asset_copy_note acnote GROUP BY 2 ORDER BY 2</query>
342     </report>
343
344    <report>
345         <name>m_asset_vols_by_lib</name>
346         <report_title>Volumes by Library</report_title>
347         <tag>assets</tag>
348         <iteration>0</iteration>
349         <heading>Volume Count.Library.Migrated</heading>
350         <query>SELECT COUNT(acn.id), aou.name, acn.x_migrate::TEXT FROM m_asset_call_number_legacy acn JOIN m_actor_org_unit_legacy aou ON aou.id = acn.owning_lib GROUP BY 2, 3 ORDER BY 2, 3</query>
351     </report>
352
353    <report>
354         <name>m_asset_vols_by_lib</name>
355         <report_title>Volumes by Library</report_title>
356         <tag>assets</tag>
357         <iteration>1</iteration>
358         <heading>Volume Count.Library</heading>
359         <query>SELECT COUNT(acn.id), aou.name FROM m_asset_call_number acn JOIN actor.org_unit aou ON aou.id = acn.owning_lib GROUP BY 2 ORDER BY 2</query>
360     </report>
361
362    <report>
363         <name>m_asset_cops_by_loc_and_org</name>
364         <report_title>Copies by Location</report_title>
365         <tag>assets</tag>
366         <iteration>0</iteration>
367         <heading>Copy Count.Library.Circ Library.Migrated</heading>
368         <query>SELECT COUNT(ac.id), acl.name, aou.name, ac.x_migrate::TEXT FROM m_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</query>
369     </report>
370
371    <report>
372         <name>m_asset_cops_w_loc_one</name>
373         <report_title>Copies with a Location of Stacks</report_title>
374         <tag>assets</tag>
375         <iteration>0</iteration>
376         <heading>Barcode</heading>
377         <query>SELECT barcode FROM m_asset_copy_legacy WHERE location = 1 AND x_migrate</query>
378     </report>
379
380     <report>
381         <name>m_asset_no_barcode</name>
382         <report_title>Items Without Barcodes</report_title>
383         <tag>assets</tag>
384         <iteration>0</iteration>
385         <heading>Assigned Barcode</heading>
386         <query>SELECT barcode FROM m_asset_copy_legacy WHERE barcode ~* 'no_barocde' AND x_migrate</query>
387     </report>
388
389     <report>
390         <name>m_asset_barcode_patterns</name>
391         <report_title>Common Barcode Starting Patterns</report_title>
392         <tag>assets</tag>
393         <iteration>0</iteration>
394         <heading>Count of Barcodes (greater than 10).Left 60% of Characters</heading>
395         <query>SELECT COUNT(ac.id), LEFT(ac.barcode,(ROUND(LENGTH(ac.barcode)*.6))::INT) FROM m_asset_copy_legacy ac WHERE ac.x_migrate = TRUE GROUP BY 2 HAVING COUNT(ac.id) > 10 ORDER BY 2</query>
396     </report>
397
398     <report>
399         <name>m_asset_barcode_collisions</name>
400         <report_title>Copy Barcode Collisions</report_title>
401         <tag>assets</tag>
402         <iteration>0</iteration>
403         <heading>Collision Count</heading>
404         <query>SELECT COUNT(id) FROM m_asset_copy_legacy WHERE x_migrate = TRUE AND barcode LIKE 'x_%'</query>
405         <note>Incumbent collisions are those where the migrated barcodes collide with existing barcodes in the database.</note>
406     </report>
407
408     <report>
409         <name>m_asset_barcode_collisions</name>
410         <report_title>Copy Barcode Collisions</report_title>
411         <tag>assets</tag>
412         <iteration>1</iteration>
413         <heading>Collision Count</heading>
414         <query>SELECT COUNT(id) FROM m_asset_copy WHERE barcode LIKE 'x_%'</query>
415         <note>Incumbent collisions are those where the migrated barcodes collide with existing barcodes in the database.</note>
416     </report>
417
418     <report>
419         <name>m_asset_barcode_collisions_shortlist</name>
420         <report_title>Copy Barcode Collisions (first 20)</report_title>
421         <tag>assets</tag>
422         <iteration>0</iteration>
423         <heading>Collision List</heading>
424         <query>SELECT ac.barcode FROM m_asset_copy_legacy ac WHERE ac.barcode LIKE 'x_%' ORDER BY 1 LIMIT 20</query>
425         <note>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.</note>
426     </report>
427
428     <report>
429         <name>m_asset_barcode_collisions_shortlist</name>
430         <report_title>Copy Barcode Collisions (first 20)</report_title>
431         <tag>assets</tag>
432         <iteration>1</iteration>
433         <heading>Collision List</heading>
434         <query>SELECT ac.barcode FROM m_asset_copy ac WHERE ac.barcode LIKE 'x_%' ORDER BY 1 LIMIT 20</query>
435         <note>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.</note>
436     </report>
437
438     <report>
439         <name>m_asset_barcode_collision_patterns</name>
440         <report_title>Common Copy Barcode Collision Patterns</report_title>
441         <tag>assets</tag>
442         <iteration>0</iteration>
443         <heading>Number of Barcodes Matching Pattern Greater than 10.Left 60% of Characters</heading>
444         <query>SELECT COUNT(ac.id), LEFT(ac.barcode,(ROUND(LENGTH(ac.barcode)*.6))::INT) FROM m_asset_copy_legacy ac WHERE barcode LIKE 'x_%' GROUP BY 2 HAVING COUNT(ac.id) > 10 ORDER BY 2</query>
445     </report>
446
447     <report>
448         <name>m_asset_barcode_collision_patterns</name>
449         <report_title>Common Copy Barcode Collision Patterns</report_title>
450         <tag>assets</tag>
451         <iteration>1</iteration>
452         <heading>Number of Barcodes Matching Pattern Greater than 10.Left 60% of Characters</heading>
453         <query>SELECT COUNT(ac.id), LEFT(ac.barcode,(ROUND(LENGTH(ac.barcode)*.6))::INT) FROM m_asset_copy ac WHERE barcode LIKE 'x_%' GROUP BY 2 HAVING COUNT(ac.id) > 10 ORDER BY 2</query>
454     </report>
455
456     <report>
457          <name>m_asset_stat_cats</name>
458         <report_title>Copy Statistical Categories</report_title>
459         <tag>assets</tag>
460         <iteration>0</iteration>
461         <heading>Stat Cat Count.Library.Statistical Category</heading>
462         <query>SELECT COUNT(ac_sc.id), aou.name, ac_sc.name FROM m_asset_stat_cat_legacy ac_sc JOIN actor.org_unit aou ON aou.id = ac_sc.owner GROUP BY 2,3 ORDER BY 2,3</query>
463     </report>
464
465     <report>
466          <name>m_asset_stat_cats</name>
467         <report_title>Copy Statistical Categories</report_title>
468         <tag>assets</tag>
469         <iteration>1</iteration>
470         <heading>Stat Cat Count.Library.Statistical Category</heading>
471         <query>SELECT COUNT(ac_sc.id), aou.name, ac_sc.name FROM m_asset_stat_cat ac_sc JOIN actor.org_unit aou ON aou.id = ac_sc.owner GROUP BY 2,3 ORDER BY 2,3</query>
472     </report>
473
474     <report>
475         <name>m_asset_stat_cat_entries</name>
476         <report_title>Copy Stat Cat User Entries</report_title>
477         <tag>assets</tag>
478         <iteration>0</iteration>
479         <heading>Copy Stat Count.Library.Statistical Category</heading>
480         <query>SELECT COUNT(map.id), aou.name, ac_sc.name FROM m_asset_stat_cat_entry_copy_map_legacy map JOIN m_asset_stat_cat_legacy ac_sc ON ac_sc.id = map.stat_cat JOIN actor.org_unit aou ON aou.id = ac_sc.owner GROUP BY 2,3 ORDER BY 2,3</query>
481     </report>
482
483     <report>
484         <name>m_asset_stat_cat_entries</name>
485         <report_title>Copy Stat Cat User Entries</report_title>
486         <tag>assets</tag>
487         <iteration>1</iteration>
488         <heading>Copy Stat Count.Library.Statistical Category</heading>
489         <query>SELECT COUNT(map.id), aou.name, ac_sc.name FROM m_asset_stat_cat_entry_copy_map map JOIN m_asset_stat_cat ac_sc ON ac_sc.id = map.stat_cat JOIN actor.org_unit aou ON aou.
490 id = ac_sc.owner GROUP BY 2,3 ORDER BY 2,3</query>
491     </report>
492
493     <report>
494          <name>m_asset_copy_tags</name>
495         <report_title>Copy Tags</report_title>
496         <tag>assets</tag>
497         <iteration>0</iteration>
498         <heading>Tag Count.Copy Tag Type.Copy Tag Label.Staff Note.Public</heading>
499         <query>SELECT COUNT(map.id), tag.tag_type, tag.label, tag.staff_note, tag.pub FROM m_asset_copy_tag tag JOIN m_asset_copy_tag_copy_map map ON map.tag = tag.id GROUP BY 2,3,4,5 ORDER BY 2,3</query>
500     </report>
501
502     <report>
503          <name>m_asset_copy_alerts</name>
504         <report_title>Copy Alerts</report_title>
505         <tag>assets</tag>
506         <iteration>0</iteration>
507         <heading>Alert Count.Alert Type</heading>
508                 <query>SELECT COUNT(*), cat.name FROM m_asset_copy_alert aca JOIN config.copy_alert_type cat ON cat.id = aca.alert_type GROUP BY 2</query>
509     </report>
510
511     <!-- MONEY REPORTS -->
512
513     <report>
514         <name>m_money_billing_voided</name>
515         <report_title>Bills Voided And Not</report_title>
516         <tag>money</tag>
517         <iteration>0</iteration>
518         <heading>Count.Voided.Sum.Migrated</heading>
519         <query>SELECT COUNT(a.id), a.voided::TEXT, SUM(a.amount), a.x_migrate::TEXT FROM m_money_billing_legacy a GROUP BY 2, 4 ORDER BY 2, 4</query>
520     </report>
521
522     <report>
523         <name>m_money_billing_voided</name>
524         <report_title>Bills Voided And Not</report_title>
525         <tag>money</tag>
526         <iteration>1</iteration>
527         <heading>Count.Voided.Sum</heading>
528         <query>SELECT COUNT(a.id), a.voided::TEXT, SUM(a.amount) FROM m_money_billing a GROUP BY 2 ORDER BY 2, 3</query>
529     </report>
530
531     <report>
532         <name>m_money_billing_by_type</name>
533         <report_title>Bills by Type</report_title>
534         <tag>money</tag>
535         <iteration>0</iteration>
536         <heading>Count.Billing Type.Migrated</heading>
537         <query>SELECT COUNT(a.id), a.billing_type, a.x_migrate::TEXT FROM m_money_billing_legacy a GROUP BY 2, 3 ORDER BY 2, 3</query>
538     </report>
539
540     <report>
541         <name>m_money_billing_by_type</name>
542         <report_title>Bills by Type</report_title>
543         <tag>money</tag>
544         <iteration>1</iteration>
545         <heading>Count.Billing Type</heading>
546         <query>SELECT COUNT(a.id), a.billing_type FROM m_money_billing a GROUP BY 2 ORDER BY 2</query>
547     </report>
548
549     <report>
550         <name>m_money_cash_payment</name>
551         <report_title>Cash Payments</report_title>
552         <tag>money</tag>
553         <iteration>0</iteration>
554         <heading>Count.Voided.Sum.Migrated</heading>
555         <query>SELECT COUNT(a.id), a.voided::TEXT, SUM(a.amount), a.x_migrate::TEXT FROM m_money_cash_payment_legacy a GROUP BY 2, 4 ORDER BY 2, 4</query>
556     </report>
557
558     <report>
559         <name>m_money_cash_payment</name>
560         <report_title>Cash Payments</report_title>
561         <tag>money</tag>
562         <iteration>1</iteration>
563         <heading>Count.Voided.Sum</heading>
564         <query>SELECT COUNT(a.id), a.voided::TEXT, SUM(a.amount) FROM m_money_cash_payment a GROUP BY 2 ORDER BY 2</query>
565     </report>
566
567     <report>
568         <name>m_money_check_payment</name>
569         <report_title>Check Payments</report_title>
570         <tag>money</tag>
571         <iteration>0</iteration>
572         <heading>Count.Voided.Sum.Migrated</heading>
573         <query>SELECT COUNT(a.id), a.voided::TEXT, SUM(a.amount), a.x_migrate::TEXT FROM m_money_check_payment_legacy a GROUP BY 2, 4 ORDER BY 2, 4</query>
574     </report>
575
576     <report>
577         <name>m_money_forgive_payment</name>
578         <report_title>Forgive Payments</report_title>
579         <tag>money</tag>
580         <iteration>0</iteration>
581         <heading>Count.Voided.Sum.Migrated</heading>
582         <query>SELECT COUNT(a.id), a.voided::TEXT, SUM(a.amount), a.x_migrate::TEXT FROM m_money_forgive_payment_legacy a GROUP BY 2, 4 ORDER BY 2, 4</query>
583     </report>
584
585     <report>
586         <name>m_money_forgive_payment</name>
587         <report_title>Forgive Payments</report_title>
588         <tag>money</tag>
589         <iteration>1</iteration>
590         <heading>Count.Voided.Sum</heading>
591         <query>SELECT COUNT(a.id), a.voided::TEXT, SUM(a.amount) FROM m_money_forgive_paymen a GROUP BY 2 ORDER BY 2</query>
592     </report>
593
594     <report>
595         <name>m_money_goods_payment</name>
596         <report_title>Goods Payments</report_title>
597         <tag>money</tag>
598         <iteration>0</iteration>
599         <heading>Count.Voided.Sum.Migrated</heading>
600         <query>SELECT COUNT(a.id), a.voided::TEXT, SUM(a.amount), a.x_migrate::TEXT FROM m_money_goods_payment_legacy a GROUP BY 2, 4 ORDER BY 2, 4</query>
601     </report>
602
603     <report>
604         <name>m_money_work_payment</name>
605         <report_title>Work Payments</report_title>
606         <tag>money</tag>
607         <iteration>0</iteration>
608         <heading>Count.Voided.Sum.Migrated</heading>
609         <query>SELECT COUNT(a.id), a.voided::TEXT, SUM(a.amount), a.x_migrate::TEXT FROM m_money_work_payment_legacy a GROUP BY 2, 4 ORDER BY 2, 4</query>
610     </report>
611
612     <report>
613         <name>m_money_credit_card_payment</name>
614         <report_title>Credit Card Payments</report_title>
615         <tag>money</tag>
616         <iteration>0</iteration>
617         <heading>Count.Voided.Sum.Migrated</heading>
618         <query>SELECT COUNT(a.id), a.voided::TEXT, SUM(a.amount), a.x_migrate::TEXT FROM m_money_credit_card_payment_legacy a GROUP BY 2, 4 ORDER BY 2, 4</query>
619     </report>
620
621     <report>
622         <name>m_money_credit_payment</name>
623         <report_title>Credit Payments</report_title>
624         <tag>money</tag>
625         <iteration>0</iteration>
626         <heading>Count.Voided.Sum.Migrated</heading>
627         <query>SELECT COUNT(a.id), a.voided::TEXT, SUM(a.amount), a.x_migrate::TEXT FROM m_money_credit_payment_legacy a GROUP BY 2, 4 ORDER BY 2, 4</query>
628     </report>
629
630
631     <!-- BIBS REPORTS -->
632
633     <report>
634         <name>bibs_loaded</name>
635         <report_title>Loaded Bibliographic Records</report_title>
636         <tag>bibs</tag>
637         <iteration>0</iteration>
638         <heading>Count</heading>
639         <query>SELECT COUNT(bre.id) FROM m_biblio_record_entry_legacy bre WHERE id IN (SELECT id FROM biblio.record_entry) ORDER BY 1</query>
640     </report>
641
642     <report>
643         <name>bibs_loaded</name>
644         <report_title>Loaded Bibliographic Records</report_title>
645         <tag>bibs</tag>
646         <iteration>1</iteration>
647         <heading>Count</heading>
648         <query>SELECT COUNT(bre.id) FROM m_biblio_record_entry bre WHERE id IN (SELECT id FROM biblio.record_entry) ORDER BY 1</query>
649     </report>
650
651     <report>
652         <name>bibswovolumes</name>
653         <report_title>Bibliographic Records Without Volumes</report_title>
654         <tag>bibs</tag>
655         <iteration>0</iteration>
656         <heading>Count</heading>
657         <query>SELECT COUNT(id) FROM m_biblio_record_entry where id NOT IN (SELECT DISTINCT record FROM m_asset_call_number)</query>
658                 <note>These records would not have been loaded.</note>
659     </report>
660
661     <report>
662         <name>bibswuri</name>
663         <report_title>Bibliographic Records With 856$9s</report_title>
664         <tag>bibs</tag>
665         <iteration>0</iteration>
666         <heading>Count</heading>
667         <query>SELECT COUNT(id) FROM m_biblio_record_entry where id IN (SELECT record FROM asset.call_number WHERE label ~* '##URI##')</query>
668     </report>
669
670         <report>
671                 <name>bibsff</name>
672                 <report_title>Bibliographic Records with Adjusted Fixed Fields</report_title>
673                 <tag>bibs</tag>
674                 <iteration>0</iteration>
675                 <heading>Count.Original Search Format.New Search Format</heading>
676                 <query>SELECT COUNT(*), ARRAY_TO_STRING(x_search_format,','), ARRAY_TO_STRING(x_after_search_format,',') FROM m_biblio_record_entry_legacy WHERE x_migrate AND x_after_search_format IS NOT NULL GROUP BY 2, 3 ORDER BY 3,2</query>
677         </report>
678
679     <report>
680         <name>bibs_notes</name>
681         <report_title>Bib Record Notes</report_title>
682         <tag>bibs</tag>
683         <iteration>0</iteration>
684         <heading>Count.Migrated</heading>
685         <query>SELECT COUNT(b.id), b.x_migrate::TEXT FROM m_biblio_record_note_legacy b GROUP BY 2</query>
686     </report>
687
688     <report>
689         <name>bibs_notes</name>
690         <report_title>Bib Record Notes</report_title>
691         <tag>bibs</tag>
692         <iteration>1</iteration>
693         <heading>Count</heading>
694         <query>SELECT COUNT(b.id) FROM m_biblio_record_note b</query>
695     </report>
696
697     <report>
698         <name>bibs_peers</name>
699         <report_title>Peer Bib Copies</report_title>
700         <tag>bibs</tag>
701         <iteration>0</iteration>
702         <heading>Count.Migrated</heading>
703         <query>SELECT COUNT(b.id), b.x_migrate::TEXT FROM m_biblio_peer_bib_copy_map_legacy b GROUP BY 2</query>
704     </report>
705
706     <report>
707         <name>bibs_peers</name>
708         <report_title>Peer Bib Copies</report_title>
709         <tag>bibs</tag>
710         <iteration>1</iteration>
711         <heading>Count</heading>
712         <query>SELECT COUNT(b.id) FROM m_biblio_peer_bib_copy_map b</query>
713     </report>
714
715     <report>
716         <name>bibs_parts</name>
717         <report_title>Monograph Parts</report_title>
718         <tag>bibs</tag>
719         <iteration>0</iteration>
720         <heading>Count.Migrated</heading>
721         <query>SELECT COUNT(b.id), b.x_migrate::TEXT FROM m_biblio_monograph_part_legacy b GROUP BY 2</query>
722     </report>
723
724     <report>
725         <name>bibs_parts</name>
726         <report_title>Monograph Parts</report_title>
727         <tag>bibs</tag>
728         <iteration>1</iteration>
729         <heading>Count</heading>
730         <query>SELECT COUNT(b.id) FROM m_biblio_monograph_part b</query>
731     </report>
732
733     <report>
734         <name>bib_merges</name>
735         <report_title>Bibliographic Merge Count</report_title>
736         <tag>bibs</tag>
737         <iteration>0</iteration>
738         <heading>Records Merged.Incumbent Records Merged Into</heading>
739         <query>SELECT SUM(array_length(records,1)), COUNT(*) FROM groups</query>
740     </report>
741
742     <!-- ACTORS REPORTS -->
743
744     <report>
745         <name>usrsbyorg</name>
746         <report_title>Patrons by Home Org</report_title>
747         <tag>actors</tag>
748         <iteration>0</iteration>
749         <heading>Count.Library.Deleted.Migrated</heading>
750         <query>SELECT COUNT(au.id), aou.name, au.deleted::TEXT, au.x_migrate::TEXT FROM m_actor_usr_legacy au JOIN actor.org_unit aou ON aou.id = au.home_ou GROUP BY 2, 3, 4 ORDER BY 2, 3, 4</query>
751     </report>
752
753     <report>
754         <name>usrsbypgt</name>
755         <report_title>Patrons by Permission Group</report_title>
756         <tag>actors</tag>
757         <iteration>0</iteration>
758         <heading>Count.Permission Group.Migrated</heading>
759         <query>SELECT COUNT(au.id), pgt.name, au.x_migrate::TEXT FROM m_actor_usr_legacy au JOIN permission.grp_tree pgt ON pgt.id = au.profile GROUP BY 2, 3 ORDER BY 2, 3</query>
760     </report>
761
762     <report>
763         <name>active_usrs</name>
764         <report_title>Patron by Active Status</report_title>
765         <tag>actors</tag>
766         <iteration>0</iteration>
767         <heading>Count of Users.Active.Migrated</heading>
768         <query>SELECT COUNT(id), active::TEXT, x_migrate::TEXT FROM m_actor_usr_legacy GROUP BY 2, 3</query>
769     </report>
770
771     <report>
772         <name>active_usrs</name>
773         <report_title>Patrons by Active Status</report_title>
774         <tag>actors</tag>
775         <iteration>1</iteration>
776         <heading>Count of Users.Active</heading>
777         <query>SELECT COUNT(id), active::TEXT FROM m_actor_usr GROUP BY 2</query>
778     </report>
779
780     <report>
781         <name>active_usr_barcodes</name>
782         <report_title>Patron Barcodes by Active Status</report_title>
783         <tag>actors</tag>
784         <iteration>0</iteration>
785         <heading>Count of Barcodes.Active.Migrated</heading>
786         <query>SELECT COUNT(id), active::TEXT, x_migrate::TEXT FROM m_actor_card_legacy GROUP BY 2, 3</query>
787     </report>
788
789     <report>
790         <name>active_usr_barcodes</name>
791         <report_title>Patron Barcodes by Active Status</report_title>
792         <tag>actors</tag>
793         <iteration>1</iteration>
794         <heading>Count of Barcodes.Active</heading>
795         <query>SELECT COUNT(id), active::TEXT FROM m_actor_card GROUP BY 2</query>
796     </report>
797
798     <report>
799         <name>usr_barcode_patterns</name>
800         <report_title>Common Barcode Starting Patterns</report_title>
801         <tag>actors</tag>
802         <iteration>0</iteration>
803         <heading>Count of Barcodes (greater than 10).Left 60% of Characters</heading>
804         <query>SELECT COUNT(acard.id), LEFT(acard.barcode,(ROUND(LENGTH(acard.barcode)*.6))::INT) FROM m_actor_card_legacy acard WHERE acard.x_migrate = TRUE GROUP BY 2 HAVING COUNT(acard.id) > 10 ORDER BY 2</query>
805     </report>
806
807     <report>
808         <name>usr_barcode_patterns</name>
809         <report_title>Common Barcode Starting Patterns</report_title>
810         <tag>actors</tag>
811         <iteration>1</iteration>
812         <heading>Count of Barcodes (greater than 10).Left 60% of Characters</heading>
813         <query>SELECT COUNT(acard.id), LEFT(acard.barcode,(ROUND(LENGTH(acard.barcode)*.6))::INT) FROM m_actor_card acard GROUP BY 2 HAVING COUNT(acard.id) > 10 ORDER BY 2</query>
814     </report>
815  
816    <report>
817         <name>usr_barcode_collisions</name>
818         <report_title>Patron Barcode Collisions</report_title>
819         <tag>actors</tag>
820         <iteration>0</iteration>
821         <heading>Collision Count</heading>
822         <query>SELECT COUNT(acard.id) FROM m_actor_card_legacy acard WHERE barcode LIKE 'x_%' AND x_migrate = TRUE</query>
823     </report>
824
825     <report>
826         <name>usr_barcode_collisions</name>
827         <report_title>Patron Barcode Collisions</report_title>
828         <tag>actors</tag>
829         <iteration>1</iteration>
830         <heading>Collision Count</heading>
831         <query>SELECT COUNT(acard.id) FROM m_actor_card acard WHERE barcode LIKE 'x_%'</query>
832     </report>
833
834     <report>
835         <name>usr_barcode_collision_shortlist</name>
836         <report_title>Patron Barcode Collisions (first 20)</report_title>
837         <tag>actors</tag>
838         <iteration>0</iteration>
839         <heading>Collision List</heading>
840         <query>SELECT acard.barcode FROM m_actor_card_legacy acard WHERE acard.barcode LIKE 'x_' AND acard.x_migrate = TRUE ORDER BY 1 LIMIT 20</query>
841         <note>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.</note>
842     </report>
843
844     <report>
845         <name>usr_barcode_collision_shortlist</name>
846         <report_title>Patron Barcode Collisions (first 20)</report_title>
847         <tag>actors</tag>
848         <iteration>1</iteration>
849         <heading>Collision List</heading>
850         <query>SELECT acard.barcode FROM m_actor_card acard WHERE acard.barcode LIKE 'x_%' ORDER BY 1 LIMIT 20</query>
851         <note>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.</note>
852     </report>
853
854     <report>
855         <name>usr_barcode_collision_patterns</name>
856         <report_title>Common Patron Barcode Collision Patterns</report_title> a.x_migrate
857         <tag>actors</tag>
858         <iteration>0</iteration>
859         <heading>Number of Barcodes Matching Pattern Greater than 10.Left 60% of Characters</heading>
860         <query>SELECT COUNT(acard.id), LEFT(acard.barcode,(ROUND(LENGTH(acard.barcode)*.6))::INT) FROM m_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</query>
861     </report>
862
863     <report>
864         <name>usr_barcode_collision_patterns</name>
865         <report_title>Common Patron Barcode Collision Patterns</report_title> a.x_migrate
866         <tag>actors</tag>
867         <iteration>1</iteration>
868         <heading>Number of Barcodes Matching Pattern Greater than 10.Left 60% of Characters</heading>
869         <query>SELECT COUNT(acard.id), LEFT(acard.barcode,(ROUND(LENGTH(acard.barcode)*.6))::INT) FROM m_actor_card acard WHERE (acard.barcode ~* 'collision' OR acard.barcode ~* '^x_') GROUP BY 2 HAVING COUNT(acard.id) > 10 ORDER BY 2</query>
870     </report>
871
872     <report>
873         <name>usr_addressses_status</name>
874         <report_title>Patron Addresses by Valid Status</report_title>
875         <tag>actors</tag>
876         <iteration>0</iteration>
877         <heading>Count.Valid.Migrated</heading>
878         <query>SELECT COUNT(aua.id), valid::TEXT, x_migrate::TEXT FROM m_actor_usr_address_legacy aua GROUP BY 2, 3</query>
879     </report>
880
881     <report>
882         <name>usr_addressses_status</name>
883         <report_title>Patron Addresses by Valid Status</report_title>
884         <tag>actors</tag>
885         <iteration>1</iteration>
886         <heading>Count.Valid</heading>
887         <query>SELECT COUNT(aua.id), valid::TEXT FROM m_actor_usr_address aua GROUP BY 2</query>
888     </report>
889
890     <report>
891         <name>usr_addresses_pending</name>
892         <report_title>Patron Addresses by Pending Status</report_title>
893         <tag>actors</tag>
894         <iteration>0</iteration>
895         <heading>Count of Addresses.Pending.Migrated</heading>
896         <query>SELECT COUNT(aua.id), pending::TEXT, x_migrate::TEXT FROM m_actor_usr_address_legacy aua GROUP BY 2, 3</query>
897     </report>
898
899     <report>
900         <name>usr_addresses_pending</name>
901         <report_title>Patron Addresses by Pending Status</report_title>
902         <tag>actors</tag>
903         <iteration>1</iteration>
904         <heading>Count of Addresses.Pending</heading>
905         <query>SELECT COUNT(aua.id), pending::TEXT FROM m_actor_usr_address aua GROUP BY 2</query>
906     </report>
907
908     <report>
909         <name>usr_messages</name>
910         <report_title>Patron Messages</report_title>
911         <tag>actors</tag>
912         <iteration>0</iteration>
913         <heading>Count.Deleted.Migrated</heading>
914         <query>SELECT COUNT(aum.id), deleted::TEXT, x_migrate::TEXT FROM m_actor_usr_message_legacy aum GROUP BY 2, 3</query>
915     </report>
916
917     <report>
918         <name>usr_messages</name>
919         <report_title>Patron Messages</report_title>
920         <tag>actors</tag>
921         <iteration>1</iteration>
922         <heading>Count.Deleted</heading>
923         <query>SELECT COUNT(aum.id), deleted::TEXT FROM m_actor_usr_message_legacy aum GROUP BY 2</query>
924     </report>
925
926     <report>
927         <name>usr_notes</name>
928         <report_title>Patron Notes</report_title>
929         <tag>actors</tag>
930         <iteration>0</iteration>
931         <heading>Count.Public.Migrated</heading>
932         <query>SELECT COUNT(aun.id), pub::TEXT, x_migrate::TEXT FROM m_actor_usr_note_legacy aun GROUP BY 2, 3</query>
933     </report>
934
935     <report>
936         <name>usr_notes</name>
937         <report_title>Patron Notes</report_title>
938         <tag>actors</tag>
939         <iteration>1</iteration>
940         <heading>Count.Public</heading>
941         <query>SELECT COUNT(aun.id), pub::TEXT FROM m_actor_usr_note aun GROUP BY 2</query>
942     </report>
943
944     <report>
945          <name>usr_stat_cats</name>
946         <report_title>Patron Statistical Categories</report_title>
947         <tag>actors</tag>
948         <iteration>0</iteration>
949         <heading>Stat Cat Count.Library.Statistical Category.Migrated</heading>
950         <query>SELECT COUNT(au_sc.id), aou.name, au_sc.name, au_sc.x_migrate::TEXT FROM m_actor_stat_cat_legacy au_sc JOIN actor.org_unit aou ON aou.id = au_sc.owner GROUP BY 2, 3, 4 ORDER BY 2, 3, 4</query>
951     </report>
952
953     <report>
954          <name>usr_stat_cats</name>
955         <report_title>Patron Statistical Categories</report_title>
956         <tag>actors</tag>
957         <iteration>1</iteration>
958         <heading>Stat Cat Count.Library.Statistical Category</heading>
959         <query>SELECT COUNT(au_sc.id), aou.name, au_sc.name FROM m_actor_stat_cat au_sc JOIN actor.org_unit aou ON aou.id = au_sc.owner GROUP BY 2, 3 ORDER BY 2, 3</query>
960     </report>
961
962     <report>
963         <name>usr_stat_cat_entries</name>
964         <report_title>Patron Stat Cat User Entries</report_title>
965         <tag>actors</tag>
966         <iteration>0</iteration>
967         <heading>Patron Stat Count.Library.Statistical Category.Migrated</heading>
968         <query>SELECT COUNT(map.id), aou.name, au_sc.name, map.x_migrate::TEXT FROM m_actor_stat_cat_entry_usr_map_legacy map JOIN m_actor_stat_cat_legacy au_sc ON au_sc.id = map.stat_cat JOIN actor.org_unit aou ON aou.id = au_sc.owner GROUP BY 2, 3, 4 ORDER BY 2,3, 4</query>
969     </report>
970
971     <report>
972         <name>usr_stat_cat_entries</name>
973         <report_title>Patron Stat Cat User Entries</report_title>
974         <tag>actors</tag>
975         <iteration>1</iteration>
976         <heading>Patron Stat Count.Library.Statistical Category</heading>
977         <query>SELECT COUNT(map.id), aou.name, au_sc.name FROM m_actor_stat_cat_entry_usr_map map JOIN m_actor_stat_cat au_sc ON au_sc.id = map.stat_cat JOIN actor.org_unit aou ON aou.id = au_sc.owner GROUP BY 2, 3 ORDER BY 2,3</query>
978     </report>
979
980     <report>
981         <name>usr_thresholds</name>
982         <report_title>Patron Thresholds</report_title>
983         <tag>actors</tag>
984         <iteration>0</iteration>
985         <heading>Pateron Group.Org Unit.Penalty.Threshold</heading>
986         <query>SELECT pgt.name, aou.shortname, sp.name, p.threshold FROM permission_grp_penalty_threshold p 
987                 JOIN actor.org_unit aou ON aou.id = p.org_unit JOIN permission.grp_tree pgt ON pgt.id = p.grp JOIN config.standing_penalty sp ON sp.id = p.penalty
988                 ORDER BY 2, 1, 3</query>
989     </report>
990
991     <report>
992         <name>usr_settings</name>
993         <report_title>Patron Settings</report_title>
994         <tag>actors</tag>
995         <iteration>0</iteration>
996         <heading>Count.Setting.Value</heading>
997         <query>SELECT COUNT(*), name, 'User''s Phone' FROM m_actor_usr_setting WHERE name IN ('opac.default_phone') GROUP BY 2, 3 
998                         UNION ALL SELECT COUNT(*), name, value FROM m_actor_usr_setting WHERE name IN ('opac.hold_notify') GROUP BY 2, 3 
999                         UNION ALL SELECT COUNT(*), a.name, aou.shortname FROM m_actor_usr_setting a JOIN actor.org_unit aou ON aou.id = REPLACE(a.value,'"','')::INTEGER 
1000                                 WHERE a.name IN ('opac.default_pickup_location','opac.default_search_location') GROUP BY 2, 3 ORDER BY 2, 3;</query>
1001     </report>
1002
1003     <!-- ACQUISITIONS REPORTS -->
1004     <report>
1005         <name>fund_count</name>
1006         <iteration>0</iteration>
1007         <tag>acq</tag>
1008         <report_title>Migrated Funds</report_title>
1009         <heading>Number of Funds.Migrated</heading>
1010         <query>SELECT COUNT(id), x_migrate::TEXT FROM m_acq_fund_legacy GROUP BY 2;</query>
1011     </report>
1012
1013     <report>                                                                        
1014         <name>fund_count</name>
1015         <iteration>1</iteration>
1016         <tag>acq</tag>
1017         <report_title>Migrated Funds</report_title>
1018         <heading>Number of Funds</heading>
1019         <query>SELECT COUNT(id) FROM m_acq_fund;</query>
1020     </report>
1021
1022     <report>
1023         <name>invoice_count</name>
1024         <iteration>0</iteration>
1025         <tag>acq</tag>
1026         <report_title>Migrated Invoices</report_title>
1027         <heading>Number of Invoices.Migrated</heading>
1028         <query>SELECT COUNT(id), x_migrate::TEXT FROM m_acq_invoice_legacy GROUP BY 2;</query>
1029     </report>
1030
1031     <report>
1032         <name>invoice_count</name>
1033         <iteration>1</iteration>
1034         <tag>acq</tag>
1035         <report_title>Migrated Invoices</report_title>
1036         <heading>Number of Funds</heading>
1037         <query>SELECT COUNT(id) FROM m_acq_invoice;</query>
1038     </report>    
1039
1040     <!-- SERIALS REPORTS -->
1041     <report>
1042         <name>serials_mfhd_count</name>
1043         <tag>serials</tag>
1044         <iteration>0</iteration>
1045         <report_title>Migrated Serial MFHDs</report_title>
1046         <heading>Number of MFHDs</heading>
1047         <query>SELECT COUNT(id) FROM m_serial_record_entry</query>
1048     </report>
1049
1050     <!-- DEDUPE REPORTS -->
1051
1052     <asset>
1053         <name>dedupe_explain</name>
1054         <tag>dedupe</tag>
1055         <file>dedupe_process.asciidoc</file> 
1056     </asset>
1057
1058     <report>
1059         <name>dedupe_bib_groups</name>
1060         <tag>dedupe</tag>
1061         <iteration>0</iteration>
1062         <report_title>Scoring and Bib Record Groups</report_title>
1063         <heading>Count.Bib Record Groups</heading>
1064         <query>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)
1065           UNION ALL SELECT (COUNT(DISTINCT incoming_bib)), 'Incoming Bibs With Matches Found' FROM bib_matches
1066           UNION ALL SELECT (COUNT(bre.id) - (SELECT COUNT(DISTINCT incoming_bib) FROM bib_matches)), 'Incoming Bibs With No Match' 
1067                 FROM biblio.record_entry bre WHERE bre.deleted IS FALSE AND bre.id IN (SELECT eg::BIGINT FROM bib_id_map)
1068           UNION ALL SELECT COUNT(DISTINCT incoming_bib), 'Incoming Bibs Being Merged into Incumbent' FROM bib_matches WHERE incumbent_bib_score &gt;= incoming_bib_score
1069           UNION ALL SELECT COUNT(id), 'Incumbent Bibs With Higher Scores to Incoming' FROM bib_matches WHERE incumbent_bib_score &gt; incoming_bib_score
1070           UNION ALL SELECT COUNT(id), 'Incumbent Bibs With Equal Scores to Incoming' FROM bib_matches WHERE incumbent_bib_score = incoming_bib_score
1071           UNION ALL SELECT COUNT(id), 'Incumbent Bibs  With Lower Scores to Incoming' FROM bib_matches WHERE incumbent_bib_score &lt; incoming_bib_score
1072           ;</query>
1073     </report>
1074
1075     <report>
1076         <name>dedupe_format_count</name>
1077         <tag>dedupe</tag>
1078         <iteration>0</iteration>
1079         <report_title>Count of Items Matching By Format</report_title>
1080         <heading>Count.Format(s)</heading>
1081         <query>SELECT COUNT(id), search_formats FROM bib_matches GROUP BY 2 ORDER BY 2;</query>
1082     </report>
1083     
1084     <report>
1085         <name>dedupe_score_ranges</name>
1086         <tag>dedupe</tag>
1087         <iteration>0</iteration>
1088         <report_title>Count of Items Matching By Format</report_title>
1089         <heading>Lowest Record Score.Largest Record Score.Record Set</heading>
1090         <query>SELECT MIN(incumbent_bib_score), MAX(incumbent_bib_score), 'Incumbent Records' FROM bib_matches 
1091             UNION ALL SELECT MIN(incoming_bib_score), MAX(incoming_bib_score), 'Incoming Records' FROM bib_matches ;
1092         </query>
1093     </report>
1094     
1095     
1096     <report>
1097         <name>dedupe_sample_set</name>
1098         <tag>dedupe</tag>
1099         <iteration>0</iteration>
1100         <report_title>Sample of 20 Matching Dedupe Record Sets</report_title>
1101         <heading>Bib Being Merged Into.Bib Being Merged</heading>
1102         <query>SELECT incumbent_bib, incoming_bib FROM bib_matches WHERE incumbent_bib_score &gt;= incoming_bib_score LIMIT 20 ;
1103         </query>
1104     </report>
1105
1106     <!-- NOTICES REPORTS -->
1107
1108     <report>
1109         <name>notices_overview</name>
1110         <tag>notices</tag>
1111         <iteration>0</iteration>
1112         <report_title>Action Triggers Setup for Notices</report_title>
1113         <heading>ID.Active.Owner.Name</heading>
1114         <query>SELECT ed.id, ed.active, aou.shortname, ed.name
1115             FROM m_action_trigger.event_definition ed 
1116             JOIN actor.org_unit aou ON aou.id = ed.owner 
1117             WHERE ed.owner IN (SELECT DISTINCT home_ou FROM m_actor_usr)
1118             OR ed.owner IN (SELECT DISTINCT parent_ou FROM actor.org_unit WHERE id in (SELECT DISTINCT home_ou FROM m_actor_usr));
1119         </query>
1120     </report>
1121
1122     <report>
1123         <name>notices_count</name>
1124         <tag>notices</tag>
1125         <iteration>0</iteration>
1126         <report_title>Count of Notices Run with State</report_title>
1127         <heading>Count of Notices.State.ID.Owner.Name</heading>
1128         <query>SELECT COUNT(ate.id), ate.state, ed.id, aou.shortname, ed.name 
1129             FROM m_action_trigger.event_definition ed 
1130             JOIN actor.org_unit aou ON aou.id = ed.owner 
1131             JOIN m_action_trigger.event ate ON ate.event_def = ed.id 
1132             WHERE ed.owner IN (SELECT DISTINCT home_ou FROM m_actor_usr)
1133             OR ed.owner IN (SELECT DISTINCT parent_ou FROM actor.org_unit WHERE id in (SELECT DISTINCT home_ou FROM m_actor_usr))
1134             GROUP BY 2,3,4;
1135         </query>
1136     </report>
1137
1138
1139 </reports_file>
1140