class SectionFactory(APIFactory): educationalEnvironmentDescriptor = build_descriptor( "EducationalEnvironment", "Classroom") sectionIdentifier = RandomSuffixAttribute("ELA012017RM555") availableCredits = 1 sequenceOfCourse = 1 classPeriods = factory.List([ factory.Dict( dict( classPeriodReference=factory.Dict( dict(classPeriodName=None # Must be entered by client )), ), ), ]) courseOfferingReference = factory.Dict( dict( localCourseCode= "ELA-01", # Will need to override this with reference value schoolId=SchoolClient.shared_elementary_school_id(), schoolYear=2014, sessionName= "2016-2017 Fall Semester", # Will need to override this with reference value )) locationReference = factory.Dict( dict( schoolId=SchoolClient.shared_elementary_school_id(), classroomIdentificationCode= "501", # Will need to override this with reference value ))
class DisciplineActionFactory(APIFactory): disciplineActionIdentifier = UniqueIdAttribute(num_chars=20) disciplineDate = formatted_date(9, 20) disciplines = factory.List([ factory.Dict( dict(disciplineDescriptor=build_descriptor( 'Discipline', 'Out of School Suspension'))), ]) studentReference = factory.Dict(dict( studentUniqueId=111111)) # Default value for scenarios, but not in DB actualDisciplineActionLength = 2 studentDisciplineIncidentAssociations = factory.List([ factory.Dict( dict( studentDisciplineIncidentAssociationReference=factory.Dict( dict( incidentIdentifier=None, # Must be entered by user schoolId=SchoolClient.shared_elementary_school_id( ), # Prepopulated school studentUniqueId= 111111, # Default value for scenarios, but not in DB )), ), ), ]) responsibilitySchoolReference = factory.Dict( dict(schoolId=SchoolClient.shared_elementary_school_id()) ) # Prepopulated school
class CourseOfferingFactory(APIFactory): localCourseCode = RandomSuffixAttribute('ELA-01') localCourseTitle = 'English Language Arts GB Elementary' courseReference = factory.Dict( dict( courseCode="ELA-01", educationOrganizationId=SchoolClient.shared_elementary_school_id(), )) schoolReference = factory.Dict( dict(schoolId=SchoolClient.shared_elementary_school_id())) sessionReference = factory.Dict( dict( schoolId=SchoolClient.shared_elementary_school_id(), schoolYear=2014, ))
def create_with_dependencies(self, **kwargs): school_id = kwargs.pop('schoolId', SchoolClient.shared_elementary_school_id()) # Create enrolled student student_reference = self.student_client.create_with_dependencies( schoolId=school_id) # Create session session_reference = self.session_client.create_with_dependencies( schoolId=school_id) # Create student school attendance event return self.create_using_dependencies( [{ 'session_client': session_reference }, { 'student_client': student_reference }], studentReference__studentUniqueId=student_reference['attributes'] ['studentUniqueId'], sessionReference__sessionName=session_reference['attributes'] ['sessionName'], schoolReference__schoolId=school_id, sessionReference__schoolId=school_id, **kwargs)
def create_with_dependencies(self, **kwargs): school_id = kwargs.pop('schoolId', SchoolClient.shared_elementary_school_id()) # Create enrolled student student_reference = self.student_client.create_with_dependencies( schoolId=school_id) # Create discipline incident incident_reference = self.incident_client.create_with_dependencies( schoolId=school_id) # Create student incident association return self.create_using_dependencies( [{ 'incident_client': incident_reference }, { 'student_client': student_reference }], studentReference__studentUniqueId=student_reference['attributes'] ['studentUniqueId'], disciplineIncidentReference__schoolId=school_id, disciplineIncidentReference__incidentIdentifier=incident_reference[ 'attributes']['incidentIdentifier'], **kwargs)
def create_with_dependencies(self, **kwargs): school_id = kwargs.pop('schoolId', SchoolClient.shared_elementary_school_id()) # Create parent parent_attrs = self.factory.build_dict(**kwargs) parent_unique_id = parent_attrs['parentUniqueId'] parent_id = self.create(**parent_attrs) # Create enrolled student student_reference = self.student_client.create_with_dependencies(schoolId=school_id) # Associate parent with student to allow updates assoc_id = self.parent_assoc_client.create( parentReference__parentUniqueId=parent_unique_id, studentReference__studentUniqueId=student_reference['attributes']['studentUniqueId'] ) return { 'resource_id': parent_id, 'dependency_ids': { 'assoc_id': assoc_id, 'student_reference': student_reference, }, 'attributes': parent_attrs, }
def run_transcript_scenarios(self): self.run_scenario('finalNumericGradeEarned', 87) self.run_scenario('finalNumericGradeEarned', 100, schoolId=SchoolClient.shared_high_school_id(), courseReference__courseCode='ALG-2', finalLetterGradeEarned='A', finalNumericGradEarned=98)
def create_with_dependencies(self, **kwargs): school_id = kwargs.pop('schoolId', SchoolClient.shared_elementary_school_id()) # Create enrolled student student_reference = self.student_client.create_with_dependencies( schoolId=school_id) # Create a cohort cohort_reference = self.cohort_client.create_with_dependencies( educationOrganizationReference__educationOrganizationId=school_id) # Create the cohort - student association return self.create_using_dependencies( [{ 'cohort_client': cohort_reference }, { 'student_client': student_reference }], studentReference__studentUniqueId=student_reference['attributes'] ['studentUniqueId'], cohortReference__cohortIdentifier=cohort_reference['attributes'] ['cohortIdentifier'], cohortReference__educationOrganizationId=school_id, **kwargs)
def create_with_dependencies(self, **kwargs): school_id = kwargs.pop('schoolId', SchoolClient.shared_elementary_school_id()) course_code = kwargs.pop('courseCode', "ELA-01") # Create section and staff section_reference = self.section_client.create_with_dependencies( schoolId=school_id, courseCode=course_code, sectionIdentifier=RandomSuffixAttribute(course_code + "2017RM555")) staff_reference = self.staff_client.create_with_dependencies( schoolId=school_id) # Create association between staff and section sec_attrs = section_reference['attributes'] return self.create_using_dependencies( [{ 'section_client': section_reference }, { 'staff_client': staff_reference }], staffReference__staffUniqueId=staff_reference['attributes'] ['staffUniqueId'], sectionReference__sectionIdentifier=sec_attrs['sectionIdentifier'], sectionReference__localCourseCode=sec_attrs[ 'courseOfferingReference']['localCourseCode'], sectionReference__schoolId=sec_attrs['courseOfferingReference'] ['schoolId'], sectionReference__schoolYear=sec_attrs['courseOfferingReference'] ['schoolYear'], sectionReference__sessionName=sec_attrs['courseOfferingReference'] ['sessionName'], )
class RestraintEventFactory(APIFactory): restraintEventIdentifier = UniqueIdAttribute(num_chars=20) schoolReference = factory.Dict( dict(schoolId=SchoolClient.shared_elementary_school_id())) studentReference = factory.Dict( dict(studentUniqueId=StudentClient.shared_student_id())) eventDate = formatted_date(2, 14)
def create_with_dependencies(self, **kwargs): school_id = kwargs.pop('schoolId', SchoolClient.shared_elementary_school_id()) course_code = kwargs.pop('courseCode', 'ELA-01') assoc_reference = self.section_assoc_client.create_with_dependencies(schoolId=school_id, courseCode=course_code) grade_period = \ assoc_reference['dependency_ids']['section_client']['gradingPeriods'][0]['gradingPeriodReference'] section_reference = assoc_reference['attributes']['sectionReference'] return self.create_using_dependencies( assoc_reference, gradingPeriodReference__schoolId=school_id, gradingPeriodReference__periodSequence=grade_period['periodSequence'], gradingPeriodReference__gradingPeriodDescriptor=grade_period['gradingPeriodDescriptor'], gradingPeriodReference__schoolYear=section_reference['schoolYear'], studentSectionAssociationReference__sectionIdentifier=section_reference['sectionIdentifier'], studentSectionAssociationReference__beginDate=assoc_reference['attributes']['beginDate'], studentSectionAssociationReference__studentUniqueId= assoc_reference['attributes']['studentReference']['studentUniqueId'], studentSectionAssociationReference__localCourseCode=section_reference['localCourseCode'], studentSectionAssociationReference__schoolId=section_reference['schoolId'], studentSectionAssociationReference__schoolYear=section_reference['schoolYear'], studentSectionAssociationReference__sessionName=section_reference['sessionName'], **kwargs )
class SessionFactory(APIFactory): schoolReference = factory.Dict(dict(schoolId=SchoolClient.shared_elementary_school_id())) # Prepopulated school schoolYearTypeReference = factory.Dict(dict(schoolYear=2014)) sessionName = RandomSuffixAttribute("2016-2017 Fall Semester") gradingPeriods = factory.List([ factory.Dict( dict( gradingPeriodReference=factory.Dict(dict( gradingPeriodDescriptor=build_descriptor("GradingPeriod", "First Six Weeks"), periodSequence=None # Must be entered by client )), ), ), factory.Dict( dict( gradingPeriodReference=factory.Dict(dict( gradingPeriodDescriptor=build_descriptor("GradingPeriod", "Second Six Weeks"), periodSequence=None # Must be entered by client )), ), ) ]) beginDate = "2014-08-23" endDate = "2014-12-15" termDescriptor = build_descriptor('Term', 'Fall Semester') totalInstructionalDays = 88
def create_with_dependencies(self, **kwargs): school_id = kwargs.pop('schoolId', SchoolClient.shared_elementary_school_id()) calendar_date_reference = self.calendar_date_client.create_with_dependencies( schoolId=school_id, ) calendar_date_attrs = calendar_date_reference['attributes'] section_reference = self.section_client.create_with_dependencies( schoolId=school_id, ) section_attrs = section_reference['attributes'] return self.create_using_dependencies( [{ 'calendar_date_client': calendar_date_reference }, { 'section_client': section_reference }], calendarDateReference__schoolId=school_id, calendarDateReference__calendarCode=calendar_date_attrs[ 'calendarReference']['calendarCode'], sectionReference__sectionIdentifier=section_attrs[ 'sectionIdentifier'], sectionReference__localCourseCode=section_attrs[ 'courseOfferingReference']['localCourseCode'], sectionReference__schoolId=section_attrs['courseOfferingReference'] ['schoolId'], sectionReference__schoolYear=section_attrs[ 'courseOfferingReference']['schoolYear'], sectionReference__sessionName=section_attrs[ 'courseOfferingReference']['sessionName'], )
def create_with_dependencies(self, **kwargs): school_id = kwargs.pop('schoolId', SchoolClient.shared_elementary_school_id()) # Create cohort cohort_reference = self.cohort_client.create_with_dependencies( educationOrganizationReference__educationOrganizationId=school_id, ) # Create staff staff_reference = self.staff_client.create_with_dependencies( schoolId=school_id) # Create association between new staff and new cohort return self.create_using_dependencies( [{ 'cohort_client': cohort_reference }, { 'staff_client': staff_reference }], staffReference__staffUniqueId=staff_reference['attributes'] ['staffUniqueId'], cohortReference__cohortIdentifier=cohort_reference['attributes'] ['cohortIdentifier'], cohortReference__educationOrganizationId=school_id, **kwargs)
def create_with_dependencies(self, **kwargs): school_id = kwargs.get('schoolId', SchoolClient.shared_elementary_school_id()) custom_course_code = kwargs.pop('courseCode', 'ELA-01') # Create a course offering and its dependencies course_offering_reference = self.course_offering_client.create_with_dependencies( schoolId=school_id, courseReference__courseCode=custom_course_code, courseReference__educationOrganizationId=school_id, schoolReference__schoolId=school_id) course_offering_attrs = course_offering_reference['attributes'] # Create a class period class_period_reference = self.class_period_client.create_with_dependencies( schoolReference__schoolId=school_id, ) # Create a location location_reference = self.location_client.create_with_dependencies( schoolReference__schoolId=school_id, ) # Create a section section_attrs = self.factory.build_dict( classPeriods__0__classPeriodReference__classPeriodName= class_period_reference['attributes']['classPeriodName'], courseOfferingReference__localCourseCode=course_offering_attrs[ 'localCourseCode'], courseOfferingReference__schoolId=school_id, courseOfferingReference__sessionName=course_offering_attrs[ 'sessionReference']['sessionName'], locationReference__classroomIdentificationCode=location_reference[ 'attributes']['classroomIdentificationCode'], locationReference__schoolId=school_id, **kwargs) section_id = self.create(**section_attrs) return { 'resource_id': section_id, 'dependency_ids': { 'location_reference': location_reference, 'class_period_reference': class_period_reference, 'course_offering_reference': course_offering_reference, }, 'attributes': section_attrs, 'localCourseCode': course_offering_attrs['localCourseCode'], 'schoolId': school_id, 'schoolYear': 2014, 'sectionIdentifier': section_attrs['sectionIdentifier'], 'sessionName': course_offering_attrs['sessionReference']['sessionName'], 'gradingPeriods': course_offering_reference['dependency_ids']['dependency_reference'] ['attributes']['gradingPeriods'], }
class CalendarFactory(APIFactory): schoolYearTypeReference = factory.Dict({ 'schoolYear': 2014, }) calendarTypeDescriptor = build_descriptor("CalendarType", "IEP") calendarCode = RandomSuffixAttribute("107SS111111") schoolReference = factory.Dict( {"schoolId": SchoolClient.shared_elementary_school_id()})
class StudentSchoolAttendanceEventFactory(APIFactory): schoolReference = factory.Dict( dict(schoolId=SchoolClient.shared_elementary_school_id()) ) # Prepopulated school sessionReference = factory.Dict( dict( schoolId=SchoolClient.shared_elementary_school_id( ), # Prepopulated school schoolYear=2014, # Prepopulated schoolYear sessionName= "2016-2017 Fall Semester" # Default value for scenarios, but not in the DB )) studentReference = factory.Dict(dict( studentUniqueId=111111)) # Default value for scenarios, but not in DB attendanceEventCategoryDescriptor = build_descriptor( 'AttendanceEventCategory', 'Tardy') eventDate = formatted_date(9, 16)
def run_grade_scenarios(self): self.run_scenario('numericGradeEarned', 83) self.run_scenario('numericGradeEarned', 97, schoolId=SchoolClient.shared_high_school_id(), courseCode='ALG-2', letterGradeEarned='A', numericGradeEarned=94)
class SectionAttendanceTakenEventFactory(APIFactory): calendarDateReference = factory.Dict( dict( calendarCode="107SS111111", schoolId=SchoolClient.shared_elementary_school_id(), schoolYear=2014, date=formatted_date(9, 16, 2014), )) sectionReference = factory.Dict( dict( sectionIdentifier=None, # Must be created localCourseCode="ELA-01", schoolId=SchoolClient.shared_elementary_school_id(), schoolYear=2014, sessionName="2016-2017 Fall Semester", )) eventDate = formatted_date(9, 9)
def run_association_scenarios(self): self.run_scenario( 'classroomPositionDescriptor', build_descriptor('ClassroomPosition', 'Assistant Teacher')) self.run_scenario('endDate', formatted_date(9, 1), schoolId=SchoolClient.shared_high_school_id(), courseCode="ALG-2")
def run_section_scenarios(self): self.run_scenario('availableCredits', 2) self.run_scenario( 'availableCredits', 3, schoolId=SchoolClient.shared_high_school_id(), sectionIdentifier=RandomSuffixAttribute("ALG12017RM901"), courseCode="ALG-2")
class CohortFactory(APIFactory): cohortIdentifier = RandomSuffixAttribute("1") educationOrganizationReference = factory.Dict({ "educationOrganizationId": SchoolClient.shared_elementary_school_id() }) cohortDescription = "Cohort 1 Description" cohortScopeDescriptor = build_descriptor("CohortScope", "District") cohortTypeDescriptor = build_descriptor("CohortType", "Study Hall")
class StaffEducationOrganizationContactAssociationFactory(APIFactory): contactTitle = UniqueIdAttribute(num_chars=75) staffReference = factory.Dict( dict(staffUniqueId=StaffClient.shared_staff_id()) ) # Prepopulated staff record educationOrganizationReference = factory.Dict( dict(educationOrganizationId=SchoolClient.shared_elementary_school_id( ))) # Prepopulated school electronicMailAddress = '*****@*****.**'
class CourseTranscriptFactory(APIFactory): courseReference = factory.Dict( dict( educationOrganizationId=SchoolClient.shared_elementary_school_id( ), # Prepopulated school courseCode='ELA-01', ), ) studentAcademicRecordReference = factory.Dict( dict( educationOrganizationId=SchoolClient.shared_elementary_school_id(), schoolYear=current_year(), studentUniqueId=111111, # Default value for scenarios, but not in DB termDescriptor=build_descriptor('Term', 'Fall Semester'), ), ) courseAttemptResultDescriptor = build_descriptor('CourseAttemptResult', 'Pass') finalLetterGradeEarned = "B" finalNumericGradeEarned = 83
class CalendarDateFactory(APIFactory): calendarReference = factory.Dict( dict( calendarCode="107SS111111", schoolId=SchoolClient.shared_elementary_school_id(), schoolYear=current_year(), )) calendarEvents = build_descriptor_dicts('CalendarEvent', ['Holiday']) date = "2014-09-16"
class StudentGradebookEntryFactory(APIFactory): numericGradeEarned = 80 gradebookEntryReference = factory.Dict( dict( localCourseCode="ELA-01", schoolId=SchoolClient.shared_elementary_school_id(), schoolYear=current_year(), sectionIdentifier="ELA012017RM555", sessionName="2016-2017 Fall Semester", gradebookEntryTitle="ALG-1 - First Six Weeks - Homework - 20170821", dateAssigned=formatted_date(2, 2))) # Must be entered by user studentSectionAssociationReference = factory.Dict( dict(localCourseCode="ELA-01", schoolId=SchoolClient.shared_elementary_school_id(), schoolYear=current_year(), sectionIdentifier="ELA012017RM555", sessionName="2016-2017 Fall Semester", studentUniqueId=111111, beginDate=formatted_date(5, 5))) # Must be entered by user
class OpenStaffPositionFactory(APIFactory): requisitionNumber = UniqueIdAttribute(num_chars=20) educationOrganizationReference = factory.Dict( dict(educationOrganizationId=SchoolClient.shared_elementary_school_id( ))) employmentStatusDescriptor = build_descriptor('EmploymentStatus', 'Substitute/temporary') staffClassificationDescriptor = build_descriptor('StaffClassification', 'Substitute Teacher') datePosted = formatted_date(3, 17)
class StaffCohortAssociationFactory(APIFactory): beginDate = "2014-09-14" staffReference = factory.Dict( dict(staffUniqueId=None)) # Must be entered by user cohortReference = factory.Dict( dict( cohortIdentifier=None, educationOrganizationId=SchoolClient.shared_elementary_school_id( ) # Prepopulated school record )) # Must be provided by caller
def run_association_scenarios(self): self.run_scenario('academicSubjects', [{ 'academicSubjectDescriptor': build_descriptor('AcademicSubject', 'Social Studies') }]) self.run_scenario('gradeLevels', [{ 'gradeLevelDescriptor': build_descriptor('GradeLevel', 'Tenth grade') }], schoolId=SchoolClient.shared_high_school_id())
class StudentCohortAssociationFactory(APIFactory): studentReference = factory.Dict(dict( studentUniqueId=111111)) # Default value for scenarios, but not in DB cohortReference = factory.Dict( dict( cohortIdentifier='1', # Default value for scenarios, but not in DB educationOrganizationId=SchoolClient.shared_elementary_school_id( ) # Prepopulated school )) beginDate = formatted_date(9, 14)