コード例 #1
0
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
コード例 #2
0
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 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,
        ))
コード例 #4
0
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
コード例 #5
0
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)
コード例 #6
0
    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'],
        )
コード例 #7
0
    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)
コード例 #8
0
    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)
コード例 #9
0
    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)
コード例 #10
0
    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'],
        )
コード例 #11
0
    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,
        }
コード例 #12
0
    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)
コード例 #13
0
    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
        )
コード例 #14
0
    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'],
        }
コード例 #15
0
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)
コード例 #16
0
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()})
コード例 #17
0
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 = '*****@*****.**'
コード例 #18
0
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
コード例 #19
0
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")
コード例 #20
0
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"
コード例 #21
0
    def create_with_dependencies(self, **kwargs):
        feeder_school_reference = self.school_client.create_with_dependencies()

        return self.create_using_dependencies(
            feeder_school_reference,
            feederSchoolReference__schoolId=feeder_school_reference[
                'attributes']['schoolId'],
            schoolReference__schoolId=SchoolClient.shared_elementary_school_id(
            ),
        )
コード例 #22
0
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)
コード例 #23
0
class StudentAcademicRecordFactory(APIFactory):
    educationOrganizationReference = factory.Dict(
        dict(educationOrganizationId=SchoolClient.shared_elementary_school_id(
        )))  # Prepopulated school
    schoolYearTypeReference = factory.Dict(dict(schoolYear=current_year()))
    studentReference = factory.Dict(dict(
        studentUniqueId=111111))  # Default value for scenarios, but not in DB
    termDescriptor = build_descriptor('Term', 'Fall Semester')
    cumulativeAttemptedCredits = 0
    cumulativeEarnedCredits = 0
コード例 #24
0
class GradingPeriodFactory(APIFactory):
    periodSequence = UniquePrimaryKeyAttribute()
    beginDate = "2014-08-23"
    endDate = "2014-10-04"
    totalInstructionalDays = 29
    schoolReference = factory.Dict(
        dict(schoolId=SchoolClient.shared_elementary_school_id()))
    schoolYearTypeReference = factory.Dict(dict(schoolYear=2014))
    gradingPeriodDescriptor = build_descriptor("GradingPeriod",
                                               "First Six Weeks")
コード例 #25
0
class StudentEducationOrganizationResponsibilityAssociationFactory(APIFactory):
    educationOrganizationReference = factory.Dict(
        dict(educationOrganizationId=SchoolClient.shared_elementary_school_id(
        )))  # Prepopulated school
    studentReference = factory.Dict(
        dict(studentUniqueId=StudentClient.shared_student_id())
    )  # Prepopulated student
    beginDate = RandomDateAttribute()
    responsibilityDescriptor = build_descriptor('Responsibility', 'Graduation')
    endDate = formatted_date(8, 8)
コード例 #26
0
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
コード例 #27
0
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)
コード例 #28
0
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
class GradebookEntryFactory(APIFactory):
    gradebookEntryTitle = UniqueIdAttribute()
    dateAssigned = formatted_date(2, 2)
    sectionReference = factory.Dict(
        dict(
            localCourseCode="ELA-01",
            schoolId=SchoolClient.shared_elementary_school_id(),
            schoolYear=current_year(),
            sectionIdentifier="ELA012017RM555",
            sessionName="2016-2017 Fall Semester",
        ))