laziness idea from rhamby for the win
[migration-tools.git] / mig-xml / excel_mapping_reports.xml
1 <reports_file>
2 <!-- sample reports entry
3     <report>
4         <name>name of report</name>
5         <iteration value='0' /> which version, the first version to run is 0, first backup is 1, then so on
6         <tag>money</tag>  arbitrary tags, each should go in separate tag
7         <report_title>Migrated Billings</report_title>  title used in the asciidoc output
8         <heading column='1'>Number of Billings.Migrated.Total</heading> period delimited 
9         <query>SELECT COUNT(id),x_migrate,SUM(amount) FROM money_billing_legacy GROUP BY 2;</query>  query itself, will be replaced
10         <note>Arbitrary note that can be included in the entries.</note>
11     </report>
12 -->
13
14    <!-- evergreen -->
15
16     <report>
17         <name>evg_asset_copy_statuses</name>
18         <report_title>Statuses</report_title>
19         <tag>evergreen</tag>
20         <iteration>0</iteration>
21         <heading>Copy Count.Migrating Status.New Evergreen Status.Notes</heading>
22         <query>SELECT COUNT(ac.l_id), cs.l_name FROM asset_copy_legacy ac JOIN config_copy_status_legacy cs ON cs.l_id = ac.l_status GROUP BY 2 ORDER BY 2</query>
23         <note>You only need to fill this sheet out if you use custom statuses that need to be migrated.</note>
24     </report>
25
26     <report>
27         <name>evg_asset_circ_mods</name>
28         <report_title>Circulation Modifiers</report_title>
29         <tag>evergreen</tag>
30         <iteration>0</iteration>
31         <heading>Copy Count.Migrating Circ Mod.New Circ Mod.Notes</heading>
32         <query>SELECT COUNT(ac.l_id), ac.l_circ_modifier FROM asset_copy_legacy ac GROUP BY 2 ORDER BY 2</query>
33     </report>
34
35     <report>
36         <name>evg_asset_copy_locs</name>
37         <report_title>Copy Locations</report_title>
38         <tag>evergreen</tag>
39         <iteration>0</iteration>
40         <heading>Count.Library.Migrating Copy Location.New Copy Location.Notes</heading>
41         <query>SELECT COUNT(ac.l_id), aou.l_name, acl.l_name FROM asset_copy_location_legacy acl JOIN actor_org_unit_legacy aou ON aou.l_id = acl.l_owning_lib JOIN asset_copy_legacy ac ON ac.l_location = acl.l_id GROUP BY 2, 3 ORDER BY 2, 3</query>
42         <note>Any locations not mapped can be moved over as their existing locations.</note>
43     </report>
44
45    <report>
46         <name>evg_permission_grps</name>
47         <report_title>Permission Groups</report_title>
48         <tag>evergreen</tag>
49         <iteration>0</iteration>
50         <heading>Count.Migrating Permission Group.New Permission Group.Notes</heading>
51         <query>SELECT COUNT(au.l_id), pgt.l_name FROM actor_usr_legacy au JOIN permission_grp_tree_legacy pgt ON pgt.l_id = au.l_profile GROUP BY 2 ORDER BY 2</query>
52     </report>
53
54     <!-- tlc -->
55     <report>
56         <name>tlc_load_branches_list</name>
57         <tag>tlc</tag>
58         <iteration>0</iteration>
59         <report_title>Branches Present in Extract</report_title>
60         <heading>Name.Evergreen Org Unit.Notes</heading>
61         <query>SELECT l_name FROM ctbranches_tsv_clean ORDER BY 1</query>
62     </report>
63
64     <report>
65         <name>tlc_load_asset_notes</name>
66         <report_title>Item Notes</report_title>
67         <tag>tlc</tag>
68         <iteration>0</iteration>
69         <heading>Count.Note Type.Notes</heading>
70         <query>SELECT COUNT(l_itemcomment)::TEXT, 'Item Comments' FROM ititeminformation_tsv_clean WHERE l_itemcomment IS NOT NULL GROUP BY 2
71                UNION ALL SELECT COUNT(l_physicalcondition)::TEXT, 'Condition Notes' FROM ctlocitem_tsv_clean WHERE l_physicalcondition IS NOT NULL GROUP BY 2
72                UNION ALL SELECT COUNT(l_checkinoutnote)::TEXT, 'Circ Notes' FROM ctlocitem_tsv_clean WHERE l_checkinoutnote IS NOT NULL GROUP BY 2
73                UNION ALL (SELECT DISTINCT 'Sample Item Comment', l_itemcomment FROM ititeminformation_tsv_clean WHERE l_itemcomment IS NOT NULL LIMIT 20)
74                UNION ALL (SELECT DISTINCT 'Sample Physical Condition', l_physicalcondition FROM ctlocitem_tsv_clean WHERE l_physicalcondition IS NOT NULL LIMIT 20)
75                UNION ALL (SELECT DISTINCT 'Sample Circ Note', l_checkinoutnote FROM ctlocitem_tsv_clean WHERE l_checkinoutnote IS NOT NULL LIMIT 20) 
76          </query>
77     </report>
78
79     <report>
80         <name>tlc_load_asset_holdings_codes</name>
81         <report_title>Holdings Codes</report_title>
82         <tag>tlc</tag>
83         <iteration>0</iteration>
84         <heading>Count.Holdings Codes.Evergreen Circulation Modifier.Evergreen Shelving Locatione</heading>
85         <query>SELECT COUNT(l_barcode), l_activeholdingscode FROM ctlocitem_tsv_clean GROUP BY 2 ORDER BY 2</query>
86     </report>
87 <!--
88     <report>
89         <name>tlc_load_asset_callnumbertype</name>
90         <report_title>Call Number Types</report_title>
91         <tag>tlc</tag>
92         <iteration>0</iteration>
93         <heading>Copy Count.Call Number Type.Evergreen Call Number Type.Notes</heading>
94         <query>SELECT COUNT(l_barcode), l_callnumbertype FROM ctlocitem_tsv_clean GROUP BY 2 ORDER BY 2</query>
95         <note>Mappable to generic, LoC and Dewey types in Evergreen.</note>
96     </report>
97 -->
98 <!-- 
99     <report>
100         <name>tlc_load_asset_callnumberparts</name>
101         <report_title>Call Number Parts</report_title>
102         <tag>tlc</tag>
103         <iteration>0</iteration>
104         <heading>Copy Count.Call Number Part.Evergreen Sequence.Evergreen Call Number Part.Delimiter</heading>
105         <query>SELECT COUNT(l_barcode) FROM ctlocitem_tsv_clean, 'Prefixes' WHERE l_callnumberprefix IS NOT NULL GROUP BY 1 UNION ALL SELECT 'Class Label', COUNT(l_barcode) FROM ctlocitem_tsv_clean WHERE l_callnumberclass IS NOT NULL GROUP BY 1 UNION ALL SELECT 'Cutter', COUNT(l_barcode) FROM ctlocitem_tsv_clean WHERE l_callnumbercutter IS NOT NULL GROUP BY 1 UNION ALL SELECT 'Year', COUNT(l_barcode) FROM ctlocitem_tsv_clean WHERE l_year IS NOT NULL GROUP BY 1 UNION ALL SELECT 'Volume', COUNT(l_barcode) FROM ctlocitem_tsv_clean WHERE l_volume IS NOT NULL GROUP BY 1</query>
106     </report>
107 -->
108     <report>
109         <name>tlc_load_money_migrating_bills</name>
110         <report_title>Migrating Bills By Bill Type</report_title>
111         <tag>tlc</tag>
112         <iteration>0</iteration>
113         <heading>Count.Billing Type.Evergreen Bill Type</heading>
114         <query>SELECT COUNT(a.l_chargenumber), b.l_description FROM itpayment_tsv_clean a JOIN itpaymenttype_tsv_clean b ON b.l_paymenttype = a.l_paymenttype WHERE a.l_dueamount::INTEGER - (a.l_waiveamount::INTEGER + a.l_tenderamount::INTEGER) > 0 GROUP BY 2 ORDER BY 2 </query>
115     </report>
116
117     <report>
118         <name>tlc_load_usrs_bygroup</name>
119         <report_title>Patrons by Agency Type</report_title>
120         <tag>tlc</tag>
121         <iteration>0</iteration>
122         <heading>Count.Permission Group.Evergreen Permission Group</heading>
123         <query>SELECT COUNT(l_agencynumber), l_agencytype FROM itagency_tsv_clean GROUP BY 2 ORDER BY 2</query>
124     </report>
125
126     <report>
127         <name>tlc_load_usrs_byexpiration</name>
128         <report_title>Patrons by Expiration Date</report_title>
129         <tag>tlc</tag>
130         <iteration>0</iteration>
131         <heading>Count.Year of Expiration.Do Not Migrate?</heading>
132         <query>SELECT COUNT(l_agencynumber), LEFT(l_expirationdate,4) FROM itagency_tsv_clean GROUP BY 2 ORDER BY 2</query>
133     </report>
134 <!--
135     <report>
136         <name>tlc_load_usrs_bynever</name>
137         <report_title>Patrons With Claims</report_title>
138         <tag>tlc</tag>
139         <iteration>0</iteration>
140         <heading>Count.Claim Type.Do Not Migrate</heading>
141         <query>SELECT COUNT(l_agencynumber) FROM itagency_tsv_clean, 'Never Checked Out' WHERE l_itemsclaimednevercheckedout != '0' GROUP BY 1 UNION ALL SELECT COUNT(l_agencynumber), 'Claims Returned' FROM itagency_tsv_clean WHERE l_itemsclaimedreturned != '0' GROUP BY 1</query>
142     </report>
143 -->
144     <report>
145         <name>tlc_load_usrs_byactive</name>
146         <report_title>Patrons by Last Active Date</report_title>
147         <tag>tlc</tag>
148         <iteration>0</iteration>
149         <heading>Count.Year Last Active.Migrate as Active Flag?</heading>
150         <query>SELECT COUNT(l_agencynumber), LEFT(l_lastactivedate,4) FROM itagency_tsv_clean GROUP BY 2 ORDER BY 2</query>
151         <note>We can set the active flag based on this if desired.</note>
152     </report>
153
154     <report>
155         <name>tlc_load_usrs_blocks</name>
156         <report_title>Patrons by Block Status</report_title>
157         <tag>tlc</tag>
158         <iteration>0</iteration>
159         <heading>Count.Block Status.Migration Note</heading>
160         <query>SELECT COUNT(l_agencynumber), l_blockstatus FROM itagency_tsv_clean GROUP BY 2 ORDER BY 2</query>
161     </report>
162
163     <report>
164         <name>tlc_load_usrs_gender</name>
165         <report_title>Patrons by Gender</report_title>
166         <tag>tlc</tag>
167         <iteration>0</iteration>
168         <heading>Count.Gender.Migrate as Stat Cat</heading>
169         <query>SELECT COUNT(l_agencynumber), l_gender FROM itagency_tsv_clean GROUP BY 2 ORDER BY 2</query>
170         <note>Evergreen can load these as statistical categories</note>
171     </report>
172
173     <report>
174         <name>tlc_load_active_usr_passwords</name>
175         <report_title>Count of Patrons w Passwords</report_title>
176         <tag>tlc</tag>
177         <iteration>0</iteration>
178         <heading>Count of NULL PINs.Default Password</heading>
179         <query>SELECT COUNT(l_agencynumber) FROM itagency_tsv_clean WHERE l_pin IS NULL</query>
180         <note>If any PINS are blank we will have to choose a method to supply them as Evergreen requires passwords.</note>
181     </report>
182
183    <report>
184         <name>tlc_load_usr_notes</name>
185         <report_title>Count of Patron Notes</report_title>
186         <tag>tlc</tag>
187         <iteration>0</iteration>
188         <heading>Count.Note Type.Action</heading>
189         <query>SELECT COUNT(l_agencynumber), 'Patron Note' FROM itagency_tsv_clean WHERE l_agencycomment IS  NOT NULL UNION ALL SELECT COUNT(l_agencynumber), 'Address Comments' FROM itaddress_tsv_clean WHERE l_addresscomment IS NOT NULL</query>
190     </report>
191     
192     <report>
193         <name>tlc_load_usr_balance</name>
194         <report_title>Count and Sum of Balances</report_title>
195         <tag>tlc</tag>
196         <iteration>0</iteration>
197         <heading>Count.SUM in Pennies.Migrate?</heading>
198         <query>SELECT COUNT(l_agencynumber), SUM(l_accountbalance::INTEGER) FROM itagency_tsv_clean WHERE l_accountbalance != '0'</query>
199         <note>If this is being migrated there are a few options of how to do it and each will have different workflows.</note>
200     </report>
201 <!--
202     <report>
203         <name>tlc_load_usr_addresses_phones</name>
204         <report_title>Patron Phones</report_title>
205         <tag>tlc</tag>
206         <iteration>0</iteration>
207         <heading>Count.Phone Type.Phone Type</heading>
208         <query>SELECT COUNT(l_phone1), 'Phone 1' FROM itaddress_tsv_clean WHERE l_phone1 IS NOT NULL GROUP BY 2 UNION ALL SELECT COUNT(l_phone1), 'Phone 2' FROM itaddress_tsv_clean WHERE l_phone2 IS NOT NULL GROUP BY 2</query>
209         <note>These need to be mounted to Evergreen phone fields.</note>
210     </report>
211 -->
212     <report>
213          <name>tlc_load_usr_stat_cats</name>
214         <report_title>Patron Stat Cats and Counts</report_title>
215         <tag>tlc</tag>
216         <iteration>0</iteration>
217         <heading>Patron Count.Stat Cat.Migrate?</heading>
218         <query>SELECT COUNT(b.l_agencynumber), a.l_description FROM itagencyfields_tsv_clean a JOIN itagencydata_tsv_clean b ON b.l_agencyfieldnumber = a.l_agencyfieldnumber GROUP BY 2 ORDER BY 1</query>
219     </report>
220
221 <!-- destiny -->
222
223     <report>
224         <name>destiny_load_usr_by_gradelevel</name>
225         <report_title>Patrons by Destiny Grade Level</report_title>
226         <tag>destiny</tag>
227         <iteration>0</iteration>
228         <heading>Count.Graduation Year</heading>
229         <query>SELECT COUNT(*), grade_level FROM patrons_csv GROUP BY 2 ORDER BY 2</query>
230         <note>Transfer to note or stat cat?</note>
231     </report>
232     
233         <report>
234         <name>destiny_load_usr_by_gender</name>
235         <report_title>Patrons by Destiny Gender</report_title>
236         <tag>destiny</tag>
237         <iteration>0</iteration>
238         <heading>Count.Gender</heading>
239         <query>SELECT COUNT(*), gender FROM patrons_csv GROUP BY 2 ORDER BY 2</query>
240         <note>Transfer to stat cat?</note>
241     </report>
242     
243         <report>
244         <name>destiny_load_usr_by_patrontype</name>
245         <report_title>Patrons by Destiny Patron Type</report_title>
246         <tag>destiny</tag>
247         <iteration>0</iteration>
248         <heading>Count.Patron Type.Permission Group</heading>
249         <query>SELECT COUNT(*), patron_type FROM patrons_csv GROUP BY 2 ORDER BY 2</query>
250     </report>
251     
252     <report>
253         <name>destiny_load_usr_by_status</name>
254         <report_title>Patrons by Destiny Status</report_title>
255         <tag>destiny</tag>
256         <iteration>0</iteration>
257         <heading>Count.Status</heading>
258         <query>SELECT COUNT(*), status FROM patrons_csv GROUP BY 2 ORDER BY 2</query>
259     </report>
260     
261     <report>
262         <name>destiny_load_usr_by_municipality</name>
263         <report_title>Patrons by Municipality</report_title>
264         <tag>destiny</tag>
265         <iteration>0</iteration>
266         <heading>Count.Municipality</heading>
267         <query>SELECT COUNT(*), municipality FROM patrons_csv GROUP BY 2 ORDER BY 2</query>
268         <note>State cat?</note>
269     </report>
270     
271     <report>
272         <name>destiny_load_usr_notes</name>
273         <report_title>Types of and Counts of Notes</report_title>
274         <tag>destiny</tag>
275         <iteration>0</iteration>
276         <heading>Type of Note.Count</heading>
277         <query>SELECT 'General Note', COUNT(*) FROM patrons_csv WHERE note_general IS NOT NULL and note_general != '' UNION ALL SELECT 'Important Note', COUNT(*) FROM patrons_csv WHERE note_important IS NOT NULL and note_important != '' </query>
278         <note>Messsage / alert / note?</note>
279     </report>
280     
281     <report>
282         <name>destiny_load_usr_userdefined5</name>
283         <report_title>User Defined Field 5</report_title>
284         <tag>destiny</tag>
285         <iteration>0</iteration>
286         <heading>Count.Values</heading>
287         <query>SELECT COUNT(*), user_defined_5 FROM patrons_csv GROUP BY 2 ORDER BY 2</query>
288         <note>Retain somewhere?</note>
289     </report>
290     
291     <report>
292         <name>destiny_load_usrs_pswdconfigured</name>
293         <report_title>Patrons by Password Configured</report_title>
294         <tag>destiny</tag>
295         <iteration>0</iteration>
296         <heading>Count.Password Configured</heading>
297         <query>SELECT COUNT(*), password_configured FROM patrons_csv GROUP BY 2 ORDER BY 2</query>
298         <note>Need how they want passwords set since we don't have them to migrate and do they want these that are configured with some special note?</note>
299     </report>
300
301     <report>
302         <name>destiny_load_usrs_phonefields</name>
303         <report_title>Phone Fields</report_title>
304         <tag>destiny</tag>
305         <iteration>0</iteration>
306         <heading>Phone Field.Count.Evergreen Phone Field</heading>
307         <query>SELECT 'Primary Phone 1', COUNT(*) FROM patrons_csv WHERE primary_phone_1 IS NOT NULL AND primary_phone_1 != '' UNION ALL SELECT 'Primary Phone 2', COUNT(*) FROM patrons_csv WHERE primary_phone_2 IS NOT NULL AND primary_phone_2 != '' UNION ALL SELECT 'Secondary Phone 1', COUNT(*) FROM patrons_csv WHERE secondary_phone_1 IS NOT NULL AND secondary_phone_1 != '' UNION ALL SELECT 'Secondary Phone 2', COUNT(*) FROM patrons_csv WHERE secondary_phone_2 IS NOT NULL AND secondary_phone_2 != '' </query>
308     </report>
309     
310     <report>
311         <name>destiny_load_asset_categories</name>
312         <report_title>Count of Categories</report_title>
313         <tag>destiny</tag>
314         <iteration>0</iteration>
315         <heading>Count.Category.Circ Mod?</heading>
316         <query>SELECT COUNT(*), category FROM copies_csv GROUP BY 2 ORDER BY 2</query>
317     </report>
318     
319     <report>
320         <name>destiny_load_asset_notes</name>
321         <report_title>Copies by Note Types</report_title>
322         <tag>destiny</tag>
323         <iteration>0</iteration>
324         <heading>Note Type.Count</heading>
325         <query>SELECT 'General Note', COUNT(*) FROM copies_csv WHERE note_general IS NOT NULL and note_general != '' UNION ALL SELECT 'Important Note', COUNT(*) FROM copies_csv WHERE note_important IS NOT NULL and note_important != ''</query>
326         <note>Retain?</note>
327     </report>
328     
329         <report>
330         <name>destiny_load_asset_sublocation</name>
331         <report_title>Copies by Sub Location</report_title>
332         <tag>destiny</tag>
333         <iteration>0</iteration>
334         <heading>Count.Sub Location.Shelving Location?</heading>
335         <query>SELECT COUNT(*), sublocation FROM copies_csv GROUP BY 2 ORDER BY 2</query>
336     </report>
337     
338     <report>
339         <name>destiny_load_asset_vendor</name>
340         <report_title>Copies by Vendor</report_title>
341         <tag>destiny</tag>
342         <iteration>0</iteration>
343         <heading>Count.Vendor</heading>
344         <query>SELECT COUNT(*), vendor FROM copies_csv GROUP BY 2 ORDER BY 2</query>
345         <note>Retain?</note>
346     </report>
347     
348     <report>
349         <name>destiny_load_asset_descriptions</name>
350         <report_title>Copies with Description Fields</report_title>
351         <tag>destiny</tag>
352         <iteration>0</iteration>
353         <heading>Description Field.Count</heading>
354         <query>SELECT 'Description Field 1', COUNT(*) FROM copies_csv WHERE description_1 IS NOT NULL and description_1 != '' UNION ALL SELECT 'Description Field 2', COUNT(*) FROM copies_csv WHERE description_2 IS NOT NULL and description_2 != '' UNION ALL SELECT 'Description Field 3', COUNT(*) FROM copies_csv WHERE description_3 IS NOT NULL and description_3 != ''</query>
355         <note>Need report?  Retain?</note>
356     </report>
357     
358     <report>
359         <name>destiny_load_fines_byreason</name>
360         <tag>destiny</tag>
361         <iteration>0</iteration>
362         <report_title>Fines by Reason</report_title>
363         <heading>Count.Reason</heading>
364         <query>SELECT COUNT(*), reason FROM fines_csv GROUP BY 2 ORDER BY 2</query>
365     </report>
366
367 <!-- apollo -->
368
369
370     <report>
371         <name>circ_bystatus</name>
372         <report_title>Circulations by Status</report_title>
373         <tag>apollo</tag>
374         <iteration>0</iteration>
375         <heading>Count.Status.Type</heading>
376         <query>SELECT COUNT(id), l_status, l_type FROM action_circulation_legacy GROUP BY 2, 3</query>
377         <note>Circulations will only not be migrated if they can't be attached to a migrated patron and holding.</note>
378     </report>
379
380     <report>
381         <name>hold_bystatus</name>
382         <report_title>Holds by Status</report_title>
383         <tag>apollo</tag>
384         <iteration>0</iteration>
385         <heading>Count.Status</heading>
386         <query> SELECT COUNT(id), l_status FROM action_hold_request_legacy GROUP BY 2</query>
387         <note>Only unfilled holds are being migrated.</note>
388     </report>
389
390     <report>
391         <name>asset_pending_bibs</name>
392         <report_title>Pending Records</report_title>
393         <tag>apollo</tag>
394         <iteration>0</iteration>
395         <heading>Count.Year of Last Edit.Count of Copies Attached</heading>
396         <query>SELECT COUNT(bre.id), CASE WHEN LENGTH(bre.l_edited) > 1 THEN EXTRACT(YEAR FROM bre.l_edited::TIMESTAMP) ELSE '1900' END, COUNT(ac.id) FROM biblio_record_entry_legacy bre LEFT JOIN asset_copy_legacy ac ON ac.l_biblio = bre.l_id WHERE bre.l_status = 'pending' GROUP BY 2 ORDER BY 2
397 </query>
398     </report>
399
400     <report>
401         <name>asset_copies_by_status</name>
402         <report_title>Copies by Status</report_title>
403         <tag>apollo</tag>
404         <iteration>0</iteration>
405         <heading>Count.Status</heading>
406         <query>SELECT COUNT(id), l_status FROM asset_copy_legacy GROUP BY 2 ORDER BY 2</query>
407         <note>Deleted copies with a delete date were not exported additionally those with the deleted status won't get loaded.</note>
408     </report>
409
410     <report>
411         <name>asset_pending_copies</name>
412         <report_title>Pending Copies by Last Edit</report_title>
413         <tag>apollo</tag>
414         <iteration>0</iteration>
415         <heading>Count.Last Edited</heading>
416         <query>SELECT COUNT(id), CASE WHEN LENGTH(l_edited) > 1 THEN EXTRACT(YEAR FROM l_edited::TIMESTAMP) ELSE '1900' END FROM asset_copy_legacy WHERE l_status = 'pending' GROUP BY 2 ORDER BY 2</query>
417     </report>
418
419     <report>
420         <name>assets_by_memberships</name>
421         <report_title>Copies by Memberships</report_title>
422         <tag>apollo</tag>
423         <iteration>0</iteration>
424         <heading>Count.Membership Number.Membership Name</heading>
425         <query>SELECT COUNT(ac.id), acl.l_membership_number, acl.l_membership_name FROM asset_copy_legacy ac JOIN asset_copy_location_legacy acl ON acl.l_membership_name = ac.l_memberships GROUP BY 2,3 ORDER BY 2
426 </query>
427     </report>
428
429    <report>
430         <name>money_bills</name>
431         <report_title>Bills</report_title>
432         <tag>apollo</tag>
433         <iteration>0</iteration>
434         <heading>Count.Status</heading>
435         <query>SELECT COUNT(id), l_status FROM money_billing_legacy GROUP BY 2 ORDER BY 2</query>
436         <note>Unless there is a good reason to do so forgiven and paid bills will not be migrated.</note>
437     </report>
438
439    <report>
440         <name>actor_groups</name>
441         <report_title>Patron Membership Groups</report_title>
442         <tag>apollo</tag>
443         <iteration>0</iteration>
444         <heading>Membership List Name.Membership List ID.Membership Number.Membership Name.Membership Length in Monthst</heading>
445         <query>SELECT l_membership_list_name, l_membership_list_id, l_membership_number, l_membership_name, l_membership_length_months FROM actor_usr_legacy_groups_tsv ORDER BY 1, 3</query>
446         <note>Age looks like a good target for a stat cat and / or juvenile setting while the patron type can map to profiles.</note>
447     </report>
448
449     <report>
450         <name>actor_by_groups</name>
451         <report_title>Patrons by Membership Groups</report_title>
452         <tag>apollo</tag>
453         <iteration>0</iteration>
454         <heading>Count.Membership List Name.Membership Number</heading>
455         <query>SELECT COUNT(*), l_membership_list_name, l_membership_number FROM (SELECT id, UNNEST(STRING_TO_ARRAY(l_memberships,'|')) AS m FROM actor_usr_legacy ) x JOIN actor_usr_legacy_groups_tsv t ON t.l_membership_name = x.m GROUP BY 2, 3 ORDER BY 2, 3</query>
456     </report>
457
458     <report>
459         <name>actor_addresses_nulls</name>
460         <report_title>Patron Addresses</report_title>
461         <tag>apollo</tag>
462         <iteration>0</iteration>
463         <heading>Address Field.Nulls</heading>
464         <query>SELECT 'Street Address', COUNT(id) FROM actor_usr_address_legacy WHERE l_lines IS NULL UNION ALL SELECT 'City', COUNT(id) FROM actor_usr_address_legacy UNION ALL SELECT 'State', COUNT(id) FROM actor_usr_address_legacy WHERE l_country_division IS NULL UNION ALL SELECT 'Postal Code', COUNT(id) FROM actor_usr_address_legacy WHERE l_postal_code IS NULL </query>
465         <note>If any of these fields are null then we need defaults to fill in, note the extract had no city data.</note>
466     </report>
467
468     <report>
469         <name>actor_phones</name>
470         <report_title>Patron Phones</report_title>
471         <tag>apollo</tag>
472         <iteration>0</iteration>
473         <heading>Count.Type</heading>
474         <query>SELECT COUNT(*), l_type FROM actor_usr_phones_tsv GROUP BY 2 ORDER BY 2</query>
475         <note>These need to be mapped to Evergreen phone types.</note>
476     </report>
477
478 <!-- horizon tag = from a sirsi supplied extract -->
479 <!-- horizon2 tag = from direct database tables -->
480
481     <report>
482         <name>hz_borrowersbybtypes</name>
483         <report_title>Borrowers by Borrower Types</report_title>
484         <tag>horizon</tag>
485         <iteration>0</iteration>
486         <heading>Count.Borrower Type</heading>
487         <query>SELECT COUNT(id), l_borrower_btype FROM actor_usr_legacy GROUP BY 2 ORDER BY 2;</query>
488     </report>
489
490     <report>
491         <name>hz_borrowersbybtypes</name>
492         <report_title>Borrowers by Borrower Types</report_title>
493         <tag>horizon2</tag>
494         <iteration>0</iteration>
495         <heading>Count.Borrower Type.Description</heading>
496         <query>SELECT COUNT(*), a.btype, b.descr FROM borrower_csv_clean a JOIN btype_csv_clean b ON b.btype = a.btype  GROUP BY 2, 3 ORDER BY 2;</query>
497     </report>
498
499     <report>
500         <name>hz_borrowerpincount</name>
501         <report_title>Borrower PINs Count</report_title>
502         <tag>horizon</tag>
503         <iteration>0</iteration>
504         <heading>Count of Migratable Passwords / PINs</heading>
505         <query>SELECT COUNT(l_borrower_pin) FROM actor_usr_legacy WHERE LENGTH(l_borrower_pin) > 1;</query>
506     </report>
507
508     <report>
509         <name>hz_borrowerpincount</name>
510         <report_title>Borrower PINs Count</report_title>
511         <tag>horizon2</tag>
512         <iteration>0</iteration>
513         <heading>Count of Migratable Passwords / PINs</heading>
514         <query>SELECT COUNT(pin) FROM borrower_csv_clean WHERE LENGTH(pin) > 1;</query>
515     </report>
516     
517     <report>
518         <name>hz_borrowernotesample</name>
519         <report_title>Borrower Note Field Samples</report_title>
520         <tag>horizon</tag>
521         <iteration>0</iteration>
522         <heading>Sample of Migratable Notes</heading>
523         <query>SELECT l_borrower_borrower_note FROM actor_usr_legacy WHERE LENGTH(l_borrower_borrower_note) > 1 LIMIT 20;</query>
524     </report>
525
526     <report>
527         <name>hz_borrowernotesample</name>
528         <report_title>Borrower Note Field Samples</report_title>
529         <tag>horizon2</tag>
530         <iteration>0</iteration>
531         <heading>Sample of Migratable Notes</heading>
532         <query>SELECT borrower_note FROM borrower_csv_clean WHERE LENGTH(borrower_note) > 1 LIMIT 20;</query>
533     </report>
534
535     <report>
536         <name>hz_borrowernotescount</name>
537         <report_title>Count of Migratable Borrower Notes</report_title>
538         <tag>horizon</tag>
539         <iteration>0</iteration>
540         <heading>Count</heading>
541         <query>SELECT COUNT(l_borrower_borrower_note) FROM actor_usr_legacy WHERE LENGTH(l_borrower_borrower_note) > 1;</query>
542     </report>
543
544     <report>
545         <name>hz_borrowernotescount</name>
546         <report_title>Counnt of Migratable Borrower Notes</report_title>
547         <tag>horizon2</tag>
548         <iteration>0</iteration>
549         <heading>Count</heading>
550         <query>SELECT COUNT(borrower_note) FROM borrower_csv_clean WHERE LENGTH(borrower_note) > 1;</query>
551     </report>
552
553     <report>
554         <name>hz_borrowernotesample2</name>
555         <report_title>Borrower Note Field 2 Samples</report_title>
556         <tag>horizon</tag>
557         <iteration>0</iteration>
558         <heading>Count</heading>
559         <query>SELECT l_borrower_note2 FROM actor_usr_legacy WHERE LENGTH(l_borrower_note2) > 1 LIMIT 20;</query>
560     </report>
561
562     <report>
563         <name>hz_borrowernotesample3</name>
564         <report_title>Borrower Note Field 3 Samples</report_title>
565         <tag>horizon</tag>
566         <iteration>0</iteration>
567         <heading>Count</heading>
568         <query>SELECT l_borrower_note3 FROM actor_usr_legacy WHERE LENGTH(l_borrower_note3) > 1 LIMIT 20;</query>
569     </report>
570
571     <report>
572         <name>hz_phones</name>
573         <report_title>Borrower Phones</report_title>
574         <tag>horizon</tag>
575         <iteration>0</iteration>
576         <heading>Count.Borrower Phone Type</heading>
577         <query>
578         SELECT COUNT(*), b 
579         FROM (SELECT l_borrower_phone_1_phone_type AS b FROM actor_usr_legacy
580         UNION ALL SELECT l_borrower_phone_2_phone_type AS b FROM actor_usr_legacy
581         UNION ALL SELECT l_borrower_phone_3_phone_type AS b FROM actor_usr_legacy
582         UNION ALL SELECT l_borrower_phone_4_phone_type AS b FROM actor_usr_legacy) x 
583         GROUP BY 2 ORDER BY 2
584         </query>
585     </report>
586
587     <report>
588         <name>hz_phones</name>
589         <report_title>Borrower Phones</report_title>
590         <tag>horizon2</tag>
591         <iteration>0</iteration>
592         <heading>Count.Borrower Phone Position</heading>
593         <query>
594         SELECT COUNT(*), '0' FROM borrower_phone_csv_clean WHERE ord = '0'
595         UNION ALL SELECT COUNT(*), '1' FROM borrower_phone_csv_clean WHERE ord = '1'
596         UNION ALL SELECT COUNT(*), '2' FROM borrower_phone_csv_clean WHERE ord = '2'
597         UNION ALL SELECT COUNT(*), '3' FROM borrower_phone_csv_clean WHERE ord = '3'
598                 UNION ALL SELECT COUNT(*), '4' FROM borrower_phone_csv_clean WHERE ord = '4'
599         </query>
600     </report>
601
602     <report>
603         <name>hz_bstats</name>
604         <report_title>Borrower B-Stats</report_title>
605         <tag>horizon</tag>
606         <iteration>0</iteration>
607         <heading>Count.BStat</heading>
608         <query>SELECT COUNT(*), b 
609         FROM (SELECT l_borrower_bstat_1_bstat AS b FROM actor_usr_legacy
610         UNION ALL
611         SELECT l_borrower_bstat_2_bstat AS b FROM actor_usr_legacy
612         UNION ALL
613         SELECT l_borrower_bstat_3_bstat AS b FROM actor_usr_legacy) x
614         GROUP BY 2 ORDER BY 1;
615         </query>
616     </report>
617     
618     <report>
619         <name>hz_bstats</name>
620         <report_title>Borrower B-Stats</report_title>
621         <tag>horizon2</tag>
622         <iteration>0</iteration>
623         <heading>Count.B-Stat.Description</heading>
624         <query>SELECT COUNT(*), a.bstat, b.descr FROM borrower_bstat_csv_clean a JOIN bstat_csv_clean b ON b.bstat = a.bstat GROUP BY 2, 3;
625         </query>
626     </report>
627
628     <report>
629         <name>hz_copybycollection</name>
630         <report_title>Copies by Collection</report_title>
631         <tag>horizon</tag>
632         <iteration>0</iteration>
633         <heading>Count.Collection</heading>
634         <query>SELECT COUNT(id), l_collection FROM asset_copy_legacy GROUP BY 2 ORDER BY 2;</query>
635     </report>
636
637         <report>    
638             <name>hz_copybycollection</name>
639         <report_title>Copies by Collection</report_title>
640         <tag>horizon2</tag>
641         <iteration>0</iteration>
642         <heading>Count.Collection.Description.PAC Description</heading>
643         <query>SELECT COUNT(*), a.collection, c.descr, c.pac_descr FROM item_csv_clean a JOIN collection_csv_clean c ON c.collection = a.collection GROUP BY 2, 3, 4 ORDER BY 2, 3, 4;</query>
644     </report>
645
646     <report>
647         <name>hz_itemsbyitype</name>
648         <report_title>Items by IType</report_title>
649         <tag>horizon</tag>
650         <iteration>0</iteration>
651         <heading>Count.Item Type (itype)</heading>
652         <query>SELECT COUNT(id), l_itype FROM asset_copy_legacy GROUP BY 2 ORDER BY 2;</query>
653     </report>
654   
655     <report>
656         <name>hz_itemsbyitype</name>
657         <report_title>Items by IType</report_title>
658         <tag>horizon2</tag>
659         <iteration>0</iteration>
660         <heading>Count.Item Type (itype).Description</heading>
661         <query>SELECT COUNT(*), a.itype, b.descr FROM item_csv_clean a JOIN itype_csv_clean b ON b.itype = a.itype  GROUP BY 2, 3 ORDER BY 2;</query>
662     </report>
663    
664     <report>
665         <name>hz_internalnotescount</name>
666         <report_title>Internal/Check In Item Notes</report_title>
667         <tag>horizon</tag>
668         <iteration>0</iteration>
669         <heading>Count</heading>
670         <query>SELECT COUNT(l_internal_note) FROM asset_copy_legacy WHERE LENGTH(l_internal_note) > 1;</query>
671     </report>
672
673     <report>
674         <name>hz_internalnotescount</name>
675         <report_title>Internal/Check In Item Notes</report_title>
676         <tag>horizon2</tag>
677         <iteration>0</iteration>
678         <heading>Count</heading>
679         <query>SELECT COUNT(cki_notes) FROM item_csv_clean WHERE LENGTH(cki_notes) > 1;</query>
680     </report>
681     
682     <report>
683         <name>hz_internalnotesample</name>
684         <report_title>Internal/Check In Item Notes Sample</report_title>
685         <tag>horizon</tag>
686         <iteration>0</iteration>
687         <heading>Count</heading>
688         <query>SELECT l_internal_note FROM asset_copy_legacy WHERE LENGTH(l_internal_note) > 1 LIMIT 20;</query>
689     </report>
690
691     <report>
692         <name>hz_internalnotesample</name>
693         <report_title>Internal/Check In Item Notes Sample</report_title>
694         <tag>horizon2</tag>
695         <iteration>0</iteration>
696         <heading>Count</heading>
697         <query>SELECT cki_notes FROM item_csv_clean WHERE LENGTH(cki_notes) > 1 LIMIT 20;</query>
698     </report>
699
700 <!-- resource mate -->
701
702     <report>
703         <name>rm_load_circ_count</name>
704         <tag>rm</tag>
705         <iteration>0</iteration>
706         <report_title>Circs by Status</report_title>
707         <heading>Count of Circs.Status</heading>
708         <query>SELECT COUNT(id), l_is_checked_out FROM asset_copy_legacy GROUP BY 2</query>
709     </report>
710
711    <report>
712         <name>rm_load_asset_by_resource_type</name>
713         <report_title>Resource Type</report_title>
714         <tag>rm</tag>
715         <iteration>0</iteration>
716         <heading>Count.Resource Type</heading>
717         <query>SELECT COUNT(*), l_resource_type FROM asset_copy_legacy GROUP BY 2 ORDER BY 2</query>
718     </report>
719
720    <report>
721         <name>rm_load_asset_by_location</name>
722         <report_title>Copies by Location</report_title>
723         <tag>rm</tag>
724         <iteration>0</iteration>
725         <heading>Count.Location</heading>
726         <query>SELECT COUNT(*), l_location FROM asset_copy_legacy GROUP BY 2 ORDER BY 2</query>
727     </report>
728
729     <report>
730         <name>rm_load_asset_by_category</name>
731         <report_title>Copies by Category</report_title>
732         <tag>rm</tag>
733         <iteration>0</iteration>
734         <heading>Count.Category</heading>
735         <query>SELECT COUNT(*), l_category FROM asset_copy_legacy GROUP BY 2 ORDER BY 2</query>
736     </report>
737    
738     <report>
739         <name>rm_load_asset_by_status</name>
740         <report_title>Copies by Status</report_title>
741         <tag>rm</tag>
742         <iteration>0</iteration>
743         <heading>Count.Status</heading>
744         <query>SELECT COUNT(*), l_status FROM asset_copy_legacy GROUP BY 2 ORDER BY 2</query>
745     </report>
746
747     <report>
748         <name>rm_actor_groups</name>
749         <report_title>Patrons by User Groups</report_title>
750         <tag>rm</tag>
751         <iteration>0</iteration>
752         <heading>Count.Group</heading>
753         <query>SELECT COUNT(id), l_user_group FROM actor_usr_legacy GROUP BY 2 ORDER BY 2;
754         </query>
755     </report>
756
757     <report>
758         <name>rm_actor_access</name>
759         <report_title>Patrons by Access Field</report_title>
760         <tag>rm</tag>
761         <iteration>0</iteration>
762         <heading>Count.Access</heading>
763         <query>SELECT COUNT(id), l_access_if_applicable FROM actor_usr_legacy GROUP BY 2 ORDER BY 2;
764         </query>
765     </report>
766
767     <report>
768         <name>rm_actor_comments</name>
769         <report_title>Patron Comments</report_title>
770         <tag>rm</tag>
771         <iteration>0</iteration>
772         <heading>Count.Sample</heading>
773         <query>SELECT COUNT(id), 'All Comments' FROM actor_usr_legacy WHERE LENGTH(l_comments) > 1
774             UNION ALL SELECT NULL, l_comments FROM  actor_usr_legacy WHERE LENGTH(l_comments) > 1 LIMIT 10
775         </query>
776     </report>
777
778     <report>
779         <name>rm_actor_circulation_note</name>
780         <report_title>Patron Circ Notes</report_title>
781         <tag>rm</tag>
782         <iteration>0</iteration>
783         <heading>Count.Sample</heading>
784         <query>SELECT COUNT(id), 'All Notes' FROM actor_usr_legacy WHERE LENGTH(l_circulation_note) > 1
785             UNION ALL SELECT NULL, l_circulation_note FROM  actor_usr_legacy WHERE LENGTH(l_circulation_note) > 1 LIMIT 10
786         </query>
787     </report>
788
789 <!-- tlc reports 
790
791     <report>
792         <name>tlc_reports_load_asset_holdings_codes</name>
793         <report_title>Holdings Codes</report_title>
794         <tag>tlc_reports</tag>
795         <iteration>0</iteration>
796         <heading>Count.Library.Holdings Codes.Evergreen Circulation Modifier.Evergreen Shelving Locatione</heading>
797         <query>SELECT COUNT(id), x_source, l_holdingscode FROM asset_copy_legacy GROUP BY 2, 3 ORDER BY 2, 3</query>
798     </report>
799
800     <report>
801         <name>tlc_reports_load_usrs_bygroup</name>
802         <report_title>Patrons by Agency Type</report_title>
803         <tag>tlc_reports</tag>
804         <iteration>0</iteration>
805         <heading>Count.Library.Permission Group.Evergreen Permission Group</heading>
806         <query>SELECT COUNT(id), l_location, l_borrower_type FROM actor_usr_legacy GROUP BY 2, 3 ORDER BY 2, 3</query>
807     </report>
808
809     <report>
810         <name>tlc_reports_load_usr_balance</name>
811         <report_title>Count and Sum of Balances</report_title>
812         <tag>tlc_reports</tag>
813         <iteration>0</iteration>
814         <heading>Count.SUM.Migrate?</heading>
815         <query>SELECT COUNT(id), SUM(l_current_fine_balance::NUMERIC(6,2)) FROM actor_usr_address_legacy WHERE l_current_fine_balance != '0' AND l_current_fine_balance IS NOT NULL</query>
816     </report>
817
818     <report>
819         <name>tlc_reports_users_blocked</name>
820         <report_title>Count of Blocked Patrons</report_title>
821         <tag>tlc_reports</tag>
822         <iteration>0</iteration>
823         <heading>Count.Blocked.Migrate?</heading>
824         <query>SELECT COUNT(id), l_blocked FROM actor_usr_address_legacy GROUP BY 2</query>
825     </report>
826
827     <report>
828         <name>tlc_reports_load_usr_addresses_phones</name>
829         <report_title>Patron Phones</report_title>
830         <tag>tlc_reports</tag>
831         <iteration>0</iteration>
832         <heading>Count.Phone Type.Phone Type</heading>
833         <query>SELECT COUNT(id), 'Phone 1' FROM actor_usr_address_legacy WHERE l_phone_1 IS NOT NULL GROUP BY 2 UNION ALL SELECT COUNT(id), 'Phone 2' FROM actor_usr_address_legacy WHERE l_phone_2 IS NOT NULL GROUP BY 2</query>
834     </report>
835 -->
836 </reports_file>