scouts_training_reports/mogl_groups.py

1462 lines
123 KiB
Python
Raw Permalink Normal View History

#! python3
#mogl_groups.py
#A tool to process output of appointments_training_reports.py into group lists
#Licence: GPL-3.0-or-later
#Written by Stuart Griffiths, stuart.griffiths@birminghamscouts.org.uk
#Started 25/09/2022
#Version:0.2
#Released: 25/09/2022
#Status: Working
#Inputs: CSV
#Outputs: multiple CSV
#Next Steps:
#Issues:
#Background IP: https://automatetheboringstuff.com/, Chapter 16
#Notes - CSV Column Numbers
#Membership_Number = 0
#Known_Name = 1
#Surname = 2
#Email = 3
#Telephone = 4
#Member_Role = 5
#Line_Manager = 6
#Scout_Group = 7
#District = 8
#Safety = 9
#Safeguarding = 10
#First Aid = 11
#Libraries
import os #Enables file IO
from pathlib import Path #to work out current working directory
import csv #required to handle csv files
#1. Set up Output files
CVS_group_list = ['81st Birmingham (1st West Heath)',
'96th Birmingham South (1st Grove)',
'192nd Birmingham (2nd Acocks Green)',
'24th Birmingham (Manor Farm)',
'254th Birmingham (St Peters Church)',
'89th Birmingham (1st Hall Green)',
'220th Birmingham (St Agnes)',
'260th Birmingham',
'100th Birmingham (1st Bournville)',
'219th Birmingham',
'198th Birmingham (1st St.Nicolas)',
'232nd Birmingham (Acocks Green)',
'258th Birmingham St Annes West Heath',
'29th Birmingham (Selly Park)',
'279th Birmingham Hall Green Parish',
'304th Birmingham MAB',
'148th Birmingham (St Dunstans)',
'325th Birmingham (Billesley) Scout Group']
#CSV files
#CVS
_81_late_mandatory_file = open('81_late_mandatory_training.csv', 'w', newline='')
_81_late_mandatory = csv.writer(_81_late_mandatory_file)
_81_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_81_due_mandatory_file = open('81_due_mandatory_training.csv', 'w', newline='')
_81_due_mandatory = csv.writer(_81_due_mandatory_file)
_81_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_96_late_mandatory_file = open('96_late_mandatory_training.csv', 'w', newline='')
_96_late_mandatory = csv.writer(_96_late_mandatory_file)
_96_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_96_due_mandatory_file = open('96_due_mandatory_training.csv', 'w', newline='')
_96_due_mandatory = csv.writer(_96_due_mandatory_file)
_96_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_192_late_mandatory_file = open('192_late_mandatory_training.csv', 'w', newline='')
_192_late_mandatory = csv.writer(_192_late_mandatory_file)
_192_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_192_due_mandatory_file = open('192_due_mandatory_training.csv', 'w', newline='')
_192_due_mandatory = csv.writer(_192_due_mandatory_file)
_192_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_24_late_mandatory_file = open('24_late_mandatory_training.csv', 'w', newline='')
_24_late_mandatory = csv.writer(_24_late_mandatory_file)
_24_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_24_due_mandatory_file = open('24_due_mandatory_training.csv', 'w', newline='')
_24_due_mandatory = csv.writer(_24_due_mandatory_file)
_24_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_254_late_mandatory_file = open('254_late_mandatory_training.csv', 'w', newline='')
_254_late_mandatory = csv.writer(_254_late_mandatory_file)
_254_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_254_due_mandatory_file = open('254_due_mandatory_training.csv', 'w', newline='')
_254_due_mandatory = csv.writer(_254_due_mandatory_file)
_254_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_89_late_mandatory_file = open('89_late_mandatory_training.csv', 'w', newline='')
_89_late_mandatory = csv.writer(_89_late_mandatory_file)
_89_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_89_due_mandatory_file = open('89_due_mandatory_training.csv', 'w', newline='')
_89_due_mandatory = csv.writer(_89_due_mandatory_file)
_89_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_220_late_mandatory_file = open('220_late_mandatory_training.csv', 'w', newline='')
_220_late_mandatory = csv.writer(_220_late_mandatory_file)
_220_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_220_due_mandatory_file = open('220_due_mandatory_training.csv', 'w', newline='')
_220_due_mandatory = csv.writer(_220_due_mandatory_file)
_220_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_260_late_mandatory_file = open('260_late_mandatory_training.csv', 'w', newline='')
_260_late_mandatory = csv.writer(_260_late_mandatory_file)
_260_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_260_due_mandatory_file = open('260_due_mandatory_training.csv', 'w', newline='')
_260_due_mandatory = csv.writer(_260_due_mandatory_file)
_260_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_100_late_mandatory_file = open('100_late_mandatory_training.csv', 'w', newline='')
_100_late_mandatory = csv.writer(_100_late_mandatory_file)
_100_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_100_due_mandatory_file = open('100_due_mandatory_training.csv', 'w', newline='')
_100_due_mandatory = csv.writer(_100_due_mandatory_file)
_100_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_219_late_mandatory_file = open('219_late_mandatory_training.csv', 'w', newline='')
_219_late_mandatory = csv.writer(_219_late_mandatory_file)
_219_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_219_due_mandatory_file = open('219_due_mandatory_training.csv', 'w', newline='')
_219_due_mandatory = csv.writer(_219_due_mandatory_file)
_219_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_198_late_mandatory_file = open('198_late_mandatory_training.csv', 'w', newline='')
_198_late_mandatory = csv.writer(_198_late_mandatory_file)
_198_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_198_due_mandatory_file = open('198_due_mandatory_training.csv', 'w', newline='')
_198_due_mandatory = csv.writer(_198_due_mandatory_file)
_198_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_232_late_mandatory_file = open('232_late_mandatory_training.csv', 'w', newline='')
_232_late_mandatory = csv.writer(_232_late_mandatory_file)
_232_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_232_due_mandatory_file = open('232_due_mandatory_training.csv', 'w', newline='')
_232_due_mandatory = csv.writer(_232_due_mandatory_file)
_232_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_258_late_mandatory_file = open('258_late_mandatory_training.csv', 'w', newline='')
_258_late_mandatory = csv.writer(_258_late_mandatory_file)
_258_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_258_due_mandatory_file = open('258_due_mandatory_training.csv', 'w', newline='')
_258_due_mandatory = csv.writer(_258_due_mandatory_file)
_258_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_29_late_mandatory_file = open('29_late_mandatory_training.csv', 'w', newline='')
_29_late_mandatory = csv.writer(_29_late_mandatory_file)
_29_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_29_due_mandatory_file = open('29_due_mandatory_training.csv', 'w', newline='')
_29_due_mandatory = csv.writer(_29_due_mandatory_file)
_29_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_279_late_mandatory_file = open('279_late_mandatory_training.csv', 'w', newline='')
_279_late_mandatory = csv.writer(_279_late_mandatory_file)
_279_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_279_due_mandatory_file = open('279_due_mandatory_training.csv', 'w', newline='')
_279_due_mandatory = csv.writer(_279_due_mandatory_file)
_279_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_304_late_mandatory_file = open('304_late_mandatory_training.csv', 'w', newline='')
_304_late_mandatory = csv.writer(_304_late_mandatory_file)
_304_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_304_due_mandatory_file = open('304_due_mandatory_training.csv', 'w', newline='')
_304_due_mandatory = csv.writer(_304_due_mandatory_file)
_304_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_148_late_mandatory_file = open('148_late_mandatory_training.csv', 'w', newline='')
_148_late_mandatory = csv.writer(_148_late_mandatory_file)
_148_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_148_due_mandatory_file = open('148_due_mandatory_training.csv', 'w', newline='')
_148_due_mandatory = csv.writer(_148_due_mandatory_file)
_148_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_325_late_mandatory_file = open('325_late_mandatory_training.csv', 'w', newline='')
_325_late_mandatory = csv.writer(_325_late_mandatory_file)
_325_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_325_due_mandatory_file = open('325_due_mandatory_training.csv', 'w', newline='')
_325_due_mandatory = csv.writer(_325_due_mandatory_file)
_325_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
#Rea
_74_late_mandatory_file = open('74_late_mandatory_training.csv', 'w', newline='')
_74_late_mandatory = csv.writer(_74_late_mandatory_file)
_74_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_74_due_mandatory_file = open('74_due_mandatory_training.csv', 'w', newline='')
_74_due_mandatory = csv.writer(_74_due_mandatory_file)
_74_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_191_late_mandatory_file = open('191_late_mandatory_training.csv', 'w', newline='')
_191_late_mandatory = csv.writer(_191_late_mandatory_file)
_191_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_191_due_mandatory_file = open('191_due_mandatory_training.csv', 'w', newline='')
_191_due_mandatory = csv.writer(_191_due_mandatory_file)
_191_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_145_late_mandatory_file = open('145_late_mandatory_training.csv', 'w', newline='')
_145_late_mandatory = csv.writer(_145_late_mandatory_file)
_145_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_145_due_mandatory_file = open('145_due_mandatory_training.csv', 'w', newline='')
_145_due_mandatory = csv.writer(_145_due_mandatory_file)
_145_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_108_late_mandatory_file = open('108_late_mandatory_training.csv', 'w', newline='')
_108_late_mandatory = csv.writer(_108_late_mandatory_file)
_108_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_108_due_mandatory_file = open('108_due_mandatory_training.csv', 'w', newline='')
_108_due_mandatory = csv.writer(_108_due_mandatory_file)
_108_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_169_late_mandatory_file = open('169_late_mandatory_training.csv', 'w', newline='')
_169_late_mandatory = csv.writer(_169_late_mandatory_file)
_169_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_169_due_mandatory_file = open('169_due_mandatory_training.csv', 'w', newline='')
_169_due_mandatory = csv.writer(_169_due_mandatory_file)
_169_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_293_late_mandatory_file = open('293_late_mandatory_training.csv', 'w', newline='')
_293_late_mandatory = csv.writer(_293_late_mandatory_file)
_293_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_293_due_mandatory_file = open('293_due_mandatory_training.csv', 'w', newline='')
_293_due_mandatory = csv.writer(_293_due_mandatory_file)
_293_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_281_late_mandatory_file = open('281_late_mandatory_training.csv', 'w', newline='')
_281_late_mandatory = csv.writer(_281_late_mandatory_file)
_281_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_281_due_mandatory_file = open('281_due_mandatory_training.csv', 'w', newline='')
_281_due_mandatory = csv.writer(_281_due_mandatory_file)
_281_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_277_late_mandatory_file = open('277_late_mandatory_training.csv', 'w', newline='')
_277_late_mandatory = csv.writer(_277_late_mandatory_file)
_277_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_277_due_mandatory_file = open('277_due_mandatory_training.csv', 'w', newline='')
_277_due_mandatory = csv.writer(_277_due_mandatory_file)
_277_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_195_late_mandatory_file = open('195_late_mandatory_training.csv', 'w', newline='')
_195_late_mandatory = csv.writer(_195_late_mandatory_file)
_195_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_195_due_mandatory_file = open('195_due_mandatory_training.csv', 'w', newline='')
_195_due_mandatory = csv.writer(_195_due_mandatory_file)
_195_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_238_late_mandatory_file = open('238_late_mandatory_training.csv', 'w', newline='')
_238_late_mandatory = csv.writer(_238_late_mandatory_file)
_238_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_238_due_mandatory_file = open('238_due_mandatory_training.csv', 'w', newline='')
_238_due_mandatory = csv.writer(_238_due_mandatory_file)
_238_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_206_late_mandatory_file = open('206_late_mandatory_training.csv', 'w', newline='')
_206_late_mandatory = csv.writer(_206_late_mandatory_file)
_206_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_206_due_mandatory_file = open('206_due_mandatory_training.csv', 'w', newline='')
_206_due_mandatory = csv.writer(_206_due_mandatory_file)
_206_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_283_late_mandatory_file = open('283_late_mandatory_training.csv', 'w', newline='')
_283_late_mandatory = csv.writer(_283_late_mandatory_file)
_283_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_283_due_mandatory_file = open('283_due_mandatory_training.csv', 'w', newline='')
_283_due_mandatory = csv.writer(_283_due_mandatory_file)
_283_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_42_late_mandatory_file = open('42_late_mandatory_training.csv', 'w', newline='')
_42_late_mandatory = csv.writer(_42_late_mandatory_file)
_42_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_42_due_mandatory_file = open('42_due_mandatory_training.csv', 'w', newline='')
_42_due_mandatory = csv.writer(_42_due_mandatory_file)
_42_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_95_late_mandatory_file = open('95_late_mandatory_training.csv', 'w', newline='')
_95_late_mandatory = csv.writer(_95_late_mandatory_file)
_95_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_95_due_mandatory_file = open('95_due_mandatory_training.csv', 'w', newline='')
_95_due_mandatory = csv.writer(_95_due_mandatory_file)
_95_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_303_late_mandatory_file = open('303_late_mandatory_training.csv', 'w', newline='')
_303_late_mandatory = csv.writer(_303_late_mandatory_file)
_303_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_303_due_mandatory_file = open('303_due_mandatory_training.csv', 'w', newline='')
_303_due_mandatory = csv.writer(_303_due_mandatory_file)
_303_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_113_late_mandatory_file = open('113_late_mandatory_training.csv', 'w', newline='')
_113_late_mandatory = csv.writer(_113_late_mandatory_file)
_113_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_113_due_mandatory_file = open('113_due_mandatory_training.csv', 'w', newline='')
_113_due_mandatory = csv.writer(_113_due_mandatory_file)
_113_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_218_late_mandatory_file = open('218_late_mandatory_training.csv', 'w', newline='')
_218_late_mandatory = csv.writer(_218_late_mandatory_file)
_218_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_218_due_mandatory_file = open('218_due_mandatory_training.csv', 'w', newline='')
_218_due_mandatory = csv.writer(_218_due_mandatory_file)
_218_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_332_late_mandatory_file = open('332_late_mandatory_training.csv', 'w', newline='')
_332_late_mandatory = csv.writer(_332_late_mandatory_file)
_332_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_332_due_mandatory_file = open('332_due_mandatory_training.csv', 'w', newline='')
_332_due_mandatory = csv.writer(_332_due_mandatory_file)
_332_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
#Spitfire
_298_late_mandatory_file = open('298_late_mandatory_training.csv', 'w', newline='')
_298_late_mandatory = csv.writer(_298_late_mandatory_file)
_298_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_298_due_mandatory_file = open('298_due_mandatory_training.csv', 'w', newline='')
_298_due_mandatory = csv.writer(_298_due_mandatory_file)
_298_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_144_late_mandatory_file = open('144_late_mandatory_training.csv', 'w', newline='')
_144_late_mandatory = csv.writer(_144_late_mandatory_file)
_144_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_144_due_mandatory_file = open('144_due_mandatory_training.csv', 'w', newline='')
_144_due_mandatory = csv.writer(_144_due_mandatory_file)
_144_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_34_late_mandatory_file = open('34_late_mandatory_training.csv', 'w', newline='')
_34_late_mandatory = csv.writer(_34_late_mandatory_file)
_34_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_34_due_mandatory_file = open('34_due_mandatory_training.csv', 'w', newline='')
_34_due_mandatory = csv.writer(_34_due_mandatory_file)
_34_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_234_late_mandatory_file = open('234_late_mandatory_training.csv', 'w', newline='')
_234_late_mandatory = csv.writer(_234_late_mandatory_file)
_234_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_234_due_mandatory_file = open('234_due_mandatory_training.csv', 'w', newline='')
_234_due_mandatory = csv.writer(_234_due_mandatory_file)
_234_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_237_late_mandatory_file = open('237_late_mandatory_training.csv', 'w', newline='')
_237_late_mandatory = csv.writer(_237_late_mandatory_file)
_237_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_237_due_mandatory_file = open('237_due_mandatory_training.csv', 'w', newline='')
_237_due_mandatory = csv.writer(_237_due_mandatory_file)
_237_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_126_late_mandatory_file = open('126_late_mandatory_training.csv', 'w', newline='')
_126_late_mandatory = csv.writer(_126_late_mandatory_file)
_126_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_126_due_mandatory_file = open('126_due_mandatory_training.csv', 'w', newline='')
_126_due_mandatory = csv.writer(_126_due_mandatory_file)
_126_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_87_late_mandatory_file = open('87_late_mandatory_training.csv', 'w', newline='')
_87_late_mandatory = csv.writer(_87_late_mandatory_file)
_87_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_87_due_mandatory_file = open('87_due_mandatory_training.csv', 'w', newline='')
_87_due_mandatory = csv.writer(_87_due_mandatory_file)
_87_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_261_late_mandatory_file = open('261_late_mandatory_training.csv', 'w', newline='')
_261_late_mandatory = csv.writer(_261_late_mandatory_file)
_261_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_261_due_mandatory_file = open('261_due_mandatory_training.csv', 'w', newline='')
_261_due_mandatory = csv.writer(_261_due_mandatory_file)
_261_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_118_late_mandatory_file = open('118_late_mandatory_training.csv', 'w', newline='')
_118_late_mandatory = csv.writer(_118_late_mandatory_file)
_118_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_118_due_mandatory_file = open('118_due_mandatory_training.csv', 'w', newline='')
_118_due_mandatory = csv.writer(_118_due_mandatory_file)
_118_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_184_late_mandatory_file = open('184_late_mandatory_training.csv', 'w', newline='')
_184_late_mandatory = csv.writer(_184_late_mandatory_file)
_184_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_184_due_mandatory_file = open('184_due_mandatory_training.csv', 'w', newline='')
_184_due_mandatory = csv.writer(_184_due_mandatory_file)
_184_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_155_late_mandatory_file = open('155_late_mandatory_training.csv', 'w', newline='')
_155_late_mandatory = csv.writer(_155_late_mandatory_file)
_155_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_155_due_mandatory_file = open('155_due_mandatory_training.csv', 'w', newline='')
_155_due_mandatory = csv.writer(_155_due_mandatory_file)
_155_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_211_late_mandatory_file = open('211_late_mandatory_training.csv', 'w', newline='')
_211_late_mandatory = csv.writer(_211_late_mandatory_file)
_211_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_211_due_mandatory_file = open('211_due_mandatory_training.csv', 'w', newline='')
_211_due_mandatory = csv.writer(_211_due_mandatory_file)
_211_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_309_late_mandatory_file = open('309_late_mandatory_training.csv', 'w', newline='')
_309_late_mandatory = csv.writer(_309_late_mandatory_file)
_309_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_309_due_mandatory_file = open('309_due_mandatory_training.csv', 'w', newline='')
_309_due_mandatory = csv.writer(_309_due_mandatory_file)
_309_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_141_late_mandatory_file = open('141_late_mandatory_training.csv', 'w', newline='')
_141_late_mandatory = csv.writer(_141_late_mandatory_file)
_141_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_141_due_mandatory_file = open('141_due_mandatory_training.csv', 'w', newline='')
_141_due_mandatory = csv.writer(_141_due_mandatory_file)
_141_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_305_late_mandatory_file = open('305_late_mandatory_training.csv', 'w', newline='')
_305_late_mandatory = csv.writer(_305_late_mandatory_file)
_305_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_305_due_mandatory_file = open('305_due_mandatory_training.csv', 'w', newline='')
_305_due_mandatory = csv.writer(_305_due_mandatory_file)
_305_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_330_late_mandatory_file = open('330_late_mandatory_training.csv', 'w', newline='')
_330_late_mandatory = csv.writer(_330_late_mandatory_file)
_330_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_330_due_mandatory_file = open('330_due_mandatory_training.csv', 'w', newline='')
_330_due_mandatory = csv.writer(_330_due_mandatory_file)
_330_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_331_late_mandatory_file = open('331_late_mandatory_training.csv', 'w', newline='')
_331_late_mandatory = csv.writer(_331_late_mandatory_file)
_331_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_331_due_mandatory_file = open('331_due_mandatory_training.csv', 'w', newline='')
_331_due_mandatory = csv.writer(_331_due_mandatory_file)
_331_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
#SCE
_143_late_mandatory_file = open('143_late_mandatory_training.csv', 'w', newline='')
_143_late_mandatory = csv.writer(_143_late_mandatory_file)
_143_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_143_due_mandatory_file = open('143_due_mandatory_training.csv', 'w', newline='')
_143_due_mandatory = csv.writer(_143_due_mandatory_file)
_143_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_21_late_mandatory_file = open('21_late_mandatory_training.csv', 'w', newline='')
_21_late_mandatory = csv.writer(_21_late_mandatory_file)
_21_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_21_due_mandatory_file = open('21_due_mandatory_training.csv', 'w', newline='')
_21_due_mandatory = csv.writer(_21_due_mandatory_file)
_21_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_197_late_mandatory_file = open('197_late_mandatory_training.csv', 'w', newline='')
_197_late_mandatory = csv.writer(_197_late_mandatory_file)
_197_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_197_due_mandatory_file = open('197_due_mandatory_training.csv', 'w', newline='')
_197_due_mandatory = csv.writer(_197_due_mandatory_file)
_197_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_209_late_mandatory_file = open('209_late_mandatory_training.csv', 'w', newline='')
_209_late_mandatory = csv.writer(_209_late_mandatory_file)
_209_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_209_due_mandatory_file = open('209_due_mandatory_training.csv', 'w', newline='')
_209_due_mandatory = csv.writer(_209_due_mandatory_file)
_209_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_167_late_mandatory_file = open('167_late_mandatory_training.csv', 'w', newline='')
_167_late_mandatory = csv.writer(_167_late_mandatory_file)
_167_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_167_due_mandatory_file = open('167_due_mandatory_training.csv', 'w', newline='')
_167_due_mandatory = csv.writer(_167_due_mandatory_file)
_167_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_235_late_mandatory_file = open('235_late_mandatory_training.csv', 'w', newline='')
_235_late_mandatory = csv.writer(_235_late_mandatory_file)
_235_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_235_due_mandatory_file = open('235_due_mandatory_training.csv', 'w', newline='')
_235_due_mandatory = csv.writer(_235_due_mandatory_file)
_235_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_227_late_mandatory_file = open('227_late_mandatory_training.csv', 'w', newline='')
_227_late_mandatory = csv.writer(_227_late_mandatory_file)
_227_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_227_due_mandatory_file = open('227_due_mandatory_training.csv', 'w', newline='')
_227_due_mandatory = csv.writer(_227_due_mandatory_file)
_227_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_172_late_mandatory_file = open('172_late_mandatory_training.csv', 'w', newline='')
_172_late_mandatory = csv.writer(_172_late_mandatory_file)
_172_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_172_due_mandatory_file = open('172_due_mandatory_training.csv', 'w', newline='')
_172_due_mandatory = csv.writer(_172_due_mandatory_file)
_172_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_257_late_mandatory_file = open('257_late_mandatory_training.csv', 'w', newline='')
_257_late_mandatory = csv.writer(_257_late_mandatory_file)
_257_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_257_due_mandatory_file = open('257_due_mandatory_training.csv', 'w', newline='')
_257_due_mandatory = csv.writer(_257_due_mandatory_file)
_257_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_164_late_mandatory_file = open('164_late_mandatory_training.csv', 'w', newline='')
_164_late_mandatory = csv.writer(_164_late_mandatory_file)
_164_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_164_due_mandatory_file = open('164_due_mandatory_training.csv', 'w', newline='')
_164_due_mandatory = csv.writer(_164_due_mandatory_file)
_164_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_326_late_mandatory_file = open('326_late_mandatory_training.csv', 'w', newline='')
_326_late_mandatory = csv.writer(_326_late_mandatory_file)
_326_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_326_due_mandatory_file = open('326_due_mandatory_training.csv', 'w', newline='')
_326_due_mandatory = csv.writer(_326_due_mandatory_file)
_326_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_102_late_mandatory_file = open('102_late_mandatory_training.csv', 'w', newline='')
_102_late_mandatory = csv.writer(_102_late_mandatory_file)
_102_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_102_due_mandatory_file = open('102_due_mandatory_training.csv', 'w', newline='')
_102_due_mandatory = csv.writer(_102_due_mandatory_file)
_102_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
#SCW
_163_late_mandatory_file = open('163_late_mandatory_training.csv', 'w', newline='')
_163_late_mandatory = csv.writer(_163_late_mandatory_file)
_163_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_163_due_mandatory_file = open('163_due_mandatory_training.csv', 'w', newline='')
_163_due_mandatory = csv.writer(_163_due_mandatory_file)
_163_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_31_late_mandatory_file = open('31_late_mandatory_training.csv', 'w', newline='')
_31_late_mandatory = csv.writer(_31_late_mandatory_file)
_31_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_31_due_mandatory_file = open('31_due_mandatory_training.csv', 'w', newline='')
_31_due_mandatory = csv.writer(_31_due_mandatory_file)
_31_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_248_late_mandatory_file = open('248_late_mandatory_training.csv', 'w', newline='')
_248_late_mandatory = csv.writer(_248_late_mandatory_file)
_248_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_248_due_mandatory_file = open('248_due_mandatory_training.csv', 'w', newline='')
_248_due_mandatory = csv.writer(_248_due_mandatory_file)
_248_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_33_late_mandatory_file = open('33_late_mandatory_training.csv', 'w', newline='')
_33_late_mandatory = csv.writer(_33_late_mandatory_file)
_33_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_33_due_mandatory_file = open('33_due_mandatory_training.csv', 'w', newline='')
_33_due_mandatory = csv.writer(_33_due_mandatory_file)
_33_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_13_late_mandatory_file = open('13_late_mandatory_training.csv', 'w', newline='')
_13_late_mandatory = csv.writer(_13_late_mandatory_file)
_13_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_13_due_mandatory_file = open('13_due_mandatory_training.csv', 'w', newline='')
_13_due_mandatory = csv.writer(_13_due_mandatory_file)
_13_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_67_late_mandatory_file = open('67_late_mandatory_training.csv', 'w', newline='')
_67_late_mandatory = csv.writer(_67_late_mandatory_file)
_67_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_67_due_mandatory_file = open('67_due_mandatory_training.csv', 'w', newline='')
_67_due_mandatory = csv.writer(_67_due_mandatory_file)
_67_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_171_late_mandatory_file = open('171_late_mandatory_training.csv', 'w', newline='')
_171_late_mandatory = csv.writer(_171_late_mandatory_file)
_171_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_171_due_mandatory_file = open('171_due_mandatory_training.csv', 'w', newline='')
_171_due_mandatory = csv.writer(_171_due_mandatory_file)
_171_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_242_late_mandatory_file = open('242_late_mandatory_training.csv', 'w', newline='')
_242_late_mandatory = csv.writer(_242_late_mandatory_file)
_242_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_242_due_mandatory_file = open('242_due_mandatory_training.csv', 'w', newline='')
_242_due_mandatory = csv.writer(_242_due_mandatory_file)
_242_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
#tame
_25_late_mandatory_file = open('25_late_mandatory_training.csv', 'w', newline='')
_25_late_mandatory = csv.writer(_25_late_mandatory_file)
_25_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_25_due_mandatory_file = open('25_due_mandatory_training.csv', 'w', newline='')
_25_due_mandatory = csv.writer(_25_due_mandatory_file)
_25_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_114_late_mandatory_file = open('114_late_mandatory_training.csv', 'w', newline='')
_114_late_mandatory = csv.writer(_114_late_mandatory_file)
_114_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_114_due_mandatory_file = open('114_due_mandatory_training.csv', 'w', newline='')
_114_due_mandatory = csv.writer(_114_due_mandatory_file)
_114_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_64_late_mandatory_file = open('64_late_mandatory_training.csv', 'w', newline='')
_64_late_mandatory = csv.writer(_64_late_mandatory_file)
_64_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_64_due_mandatory_file = open('64_due_mandatory_training.csv', 'w', newline='')
_64_due_mandatory = csv.writer(_64_due_mandatory_file)
_64_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_236_late_mandatory_file = open('236_late_mandatory_training.csv', 'w', newline='')
_236_late_mandatory = csv.writer(_236_late_mandatory_file)
_236_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_236_due_mandatory_file = open('236_due_mandatory_training.csv', 'w', newline='')
_236_due_mandatory = csv.writer(_236_due_mandatory_file)
_236_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_177_late_mandatory_file = open('177_late_mandatory_training.csv', 'w', newline='')
_177_late_mandatory = csv.writer(_177_late_mandatory_file)
_177_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_177_due_mandatory_file = open('177_due_mandatory_training.csv', 'w', newline='')
_177_due_mandatory = csv.writer(_177_due_mandatory_file)
_177_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_210_late_mandatory_file = open('210_late_mandatory_training.csv', 'w', newline='')
_210_late_mandatory = csv.writer(_210_late_mandatory_file)
_210_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_210_due_mandatory_file = open('210_due_mandatory_training.csv', 'w', newline='')
_210_due_mandatory = csv.writer(_210_due_mandatory_file)
_210_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_244_late_mandatory_file = open('244_late_mandatory_training.csv', 'w', newline='')
_244_late_mandatory = csv.writer(_244_late_mandatory_file)
_244_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_244_due_mandatory_file = open('244_due_mandatory_training.csv', 'w', newline='')
_244_due_mandatory = csv.writer(_244_due_mandatory_file)
_244_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_213_late_mandatory_file = open('213_late_mandatory_training.csv', 'w', newline='')
_213_late_mandatory = csv.writer(_213_late_mandatory_file)
_213_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_213_due_mandatory_file = open('213_due_mandatory_training.csv', 'w', newline='')
_213_due_mandatory = csv.writer(_213_due_mandatory_file)
_213_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_32_late_mandatory_file = open('32_late_mandatory_training.csv', 'w', newline='')
_32_late_mandatory = csv.writer(_32_late_mandatory_file)
_32_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_32_due_mandatory_file = open('32_due_mandatory_training.csv', 'w', newline='')
_32_due_mandatory = csv.writer(_32_due_mandatory_file)
_32_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_5_late_mandatory_file = open('5_late_mandatory_training.csv', 'w', newline='')
_5_late_mandatory = csv.writer(_5_late_mandatory_file)
_5_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_5_due_mandatory_file = open('5_due_mandatory_training.csv', 'w', newline='')
_5_due_mandatory = csv.writer(_5_due_mandatory_file)
_5_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_222_late_mandatory_file = open('222_late_mandatory_training.csv', 'w', newline='')
_222_late_mandatory = csv.writer(_222_late_mandatory_file)
_222_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_222_due_mandatory_file = open('222_due_mandatory_training.csv', 'w', newline='')
_222_due_mandatory = csv.writer(_222_due_mandatory_file)
_222_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_313_late_mandatory_file = open('313_late_mandatory_training.csv', 'w', newline='')
_313_late_mandatory = csv.writer(_313_late_mandatory_file)
_313_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_313_due_mandatory_file = open('313_due_mandatory_training.csv', 'w', newline='')
_313_due_mandatory = csv.writer(_313_due_mandatory_file)
_313_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_327_late_mandatory_file = open('327_late_mandatory_training.csv', 'w', newline='')
_327_late_mandatory = csv.writer(_327_late_mandatory_file)
_327_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_327_due_mandatory_file = open('327_due_mandatory_training.csv', 'w', newline='')
_327_due_mandatory = csv.writer(_327_due_mandatory_file)
_327_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_333_late_mandatory_file = open('333_late_mandatory_training.csv', 'w', newline='')
_333_late_mandatory = csv.writer(_333_late_mandatory_file)
_333_late_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
_333_due_mandatory_file = open('333_due_mandatory_training.csv', 'w', newline='')
_333_due_mandatory = csv.writer(_333_due_mandatory_file)
_333_due_mandatory.writerow(['Membership Number', 'Known_Name', 'Surname', 'E-Mail', 'Telephone', 'Role', 'Line Manager', 'Group', 'District', 'Safety', 'Safeguarding', 'First Aid'])
#Modules
def CVS():
#1. Open the file
file_name = str(Path.cwd()) + '/' + str('CVS_late_mandatory_training.csv')
input_file = open(file_name) #assumes file is in working directory
#Create a list using the CSV file
input_data_reader = csv.reader(input_file)
input_data = list(input_data_reader)
#2. Process the data
for x in range(len(input_data)):
group_name = input_data[x][7]
if group_name == '81st Birmingham (1st West Heath)':
_81_late_mandatory.writerow([input_data[x][0], input_data[x][1], input_data[x][2], input_data[x][3], input_data[x][4], input_data[x][5], input_data[x][6], input_data[x][7], input_data[x][8], input_data[x][9], input_data[x][10], input_data[x