In [ ]:
#import pandas as pd
#import xlwings as xw
In [ ]:
import cyautomation.cyschoolhouse as cysh
In [ ]:
#import pickle
#import selenium.webdriver
#
#from cyautomation.cyschoolhouse.cyschoolhousesuite import *
#
#driver = get_driver()
#driver = open_cyschoolhouse(driver)
#
#pickle.dump( driver.get_cookies() , open("cookies.pkl","wb"))
#
#import pickle
#import selenium.webdriver
#
#driver = get_driver()
#open_cyschoolhouse(driver)
#cookies = pickle.load(open("cookies.pkl", "rb"))
#for cookie in cookies:
# driver.add_cookie(cookie)
In [ ]:
## Associate TLs with their ACMs' SEL sections
# section_df = cysh.get_object_df('Section__c')
# section_df = section_df.loc[section_df['Name'].str.contains('SEL')]
#
# staff_df = cysh.get_object_df('Staff__c', ['Id', 'Name', 'Role__c', 'Organization__c'])
# staff_df = staff_df.loc[staff_df['Role__c'].str.contains('Team Lead')==True]
#
# staff_section_df = cysh.get_object_df('Staff_Section__c')
#
# results = []
# for index, row in section_df.iterrows():
# if len(staff_section_df.loc[staff_section_df['Section__c']==row['Id']]) > 1:
# print(f"ERROR: Section: {row['Id']} already has more than 1 staff associated")
# continue
# staff = staff_df.loc[staff_df['Organization__c']==row['School__c'], 'Id']
# if len(staff) != 1:
# print(f"ERROR: 0 or many Team Leaders associated with school: {row['School__c']}")
# continue
# staff_section_dict = {}
# staff_section_dict['Account__c'] = row['School__c']
# staff_section_dict['Section__c'] = row['Id']
# staff_section_dict['Staff__c'] = staff.values[0]
# staff_section_dict['Intervention_Primary_Staff__c'] = False
#
# result = cysh.sf.Staff_Section__c.create(staff_section_dict)
# results.append(result)
In [ ]:
# sch_ref_df = pd.read_excel(r'Z:\ChiPrivate\Chicago Data and Evaluation\SY19\SY19 School Reference.xlsx')
#
# tracker.fill_all_coaching_log_acm_rollup(sch_ref_df.loc[sch_ref_df['Informal Name']=='Chicago Academy'])
In [ ]:
cysh.get_object_df(object_name='', field_list=)
In [ ]:
## Get mid-years
#import pandas as pd
#
#df = cysh.get_object_df('Staff__c', ['Individual__c', 'Name', 'CreatedDate', 'Reference_Id__c', 'Site__c'])
#df = df.loc[df['Site__c']=='Chicago']
#
#df['CreatedDate'] = pd.to_datetime(df['CreatedDate'])
#df = df.sort_values('CreatedDate', ascending=False)
#df = df.loc[df['CreatedDate']>='2018-11-06']
#df
In [ ]:
## sync enrollment in DESSA sections
results1 = cysh.student_section.enrollment_sync(
source_section = 'Tutoring: Math',
destination_section = 'DESSA',
enrollment_start_date = '2018-09-05',
ACM_to_TL = True
)
results2 = cysh.student_section.enrollment_sync(
source_section = 'Tutoring: Literacy',
destination_section = 'DESSA',
enrollment_start_date = '2018-09-05',
ACM_to_TL = True
)
## sync enrollment in MIRI sections
results3 = cysh.student_section.enrollment_sync(
source_section = 'Tutoring: Math',
destination_section = 'Math Inventory',
enrollment_start_date = '2018-09-05'
)
results4 = cysh.student_section.enrollment_sync(
source_section = 'Tutoring: Literacy',
destination_section = 'Reading Inventory',
enrollment_start_date = '2018-09-05'
)
In [ ]:
## Add New Students to cyschoolhouse
cysh.student.upload_all(
xlsx_dir = 'Z:\\ChiPrivate\\Chicago Data and Evaluation\\SY19',
xlsx_name = 'SY19 New Students for cyschoolhouse.xlsx',
enrollment_date='8/3/2018',
)
#from time import sleep
#sleep(60)
In [ ]:
result = cysh.student.update_student_External_Id()
In [ ]:
# cysh.tracker_mgmt.unprotect_ACM_validation_sheet(resource_type='SY19 Leadership Tracker', containing_folder='Leadership Team Documents')
# cysh.tracker_mgmt.unprotect_ACM_validation_sheet(resource_type='SY19 Coaching Log', containing_folder='Leadership Team Documents')
In [ ]:
# Run when new ACMs start
cysh.tracker_mgmt.update_all_validation_sheets(
resource_type='SY19 Coaching Log', containing_folder='Leadership Team Documents'
)
cysh.tracker_mgmt.update_all_validation_sheets(
resource_type='SY19 Leadership Tracker', containing_folder='Leadership Team Documents'
)
In [ ]:
# Run when new ACMs start or students enrolled in attendance
cysh.tracker_mgmt.update_all_validation_sheets(
resource_type='SY19 Attendance Tracker', containing_folder='Team Documents'
)
In [ ]:
## ToT Audit -- could be a Power BI report, but would need ACM access
result = cysh.tot_audit.fix_T1T2ELT()
tot_error_df = cysh.tot_audit.get_error_table()
cysh.tot_audit.write_error_tables_to_cyconnect(tot_error_df)
counts = tot_error_df.groupby(['School', 'Error'])['ACM'].count().reset_index(level='Error').rename(columns={'ACM':'Count'})
counts.to_excel(r'Z:\Impact Analytics Team\SY19 ToT Audit Error Counts.xlsx')
In [ ]:
## Service Trackers, fails during Herzl, restart at 9, 18
#Writing Service Tracker: Schurz High School
#Error filling template or saving pdf for D L: (-2147417851, 'The server threw an exception.', None, None)
cysh.servicetrackers.update_service_trackers(start_row=18)
In [ ]:
## Create Sections
In [ ]:
df = cysh.section_creation_chi.academic_sections_to_create()
cysh.section_creation.section_creation()
In [ ]:
df = cysh.section_creation_chi.non_CP_sections_to_create()
In [ ]:
cysh.section_creation.section_creation()
In [ ]:
df = cysh.section_creation_chi.MIRI_sections_to_create()
cysh.section_creation.section_creation()
In [ ]:
cysh.section_creation_chi.deactivate_all_sections(section_type='50 Acts of Greatness')
In [ ]:
cysh.tracker_mgmt.deploy_tracker(resource_type='SY19 Attendance Tracker', containing_folder='Team Documents')
In [ ]:
## Distribute Trackers
In [ ]:
## Export salesforce Objects
## Exit all student_sections