populate

package
v3.6.1 Latest Latest
Warning

This package is not in the latest version of its module.

Go to latest
Published: Jul 18, 2023 License: Apache-2.0 Imports: 15 Imported by: 0

Documentation

Overview

populate contains functions to populate SIF objects from the sifxml package with plausible values.

Purpose

The populate package provides functions to populate SIF XML objects (as specified in the sifxml package) with plausible values (objects.go). It provides helper functions to make that population more straightforward (base.go). Objects are generated in the first instance to populate the NSIP HITS test harness http://hits.nsip.edu.au/dashboard/ with input data, for clients to consume as part of use case validation. The code to generate bundles of interrelated object (usecases.go) parametrises object generation according to the HITS use cases it fulfils.

The assumptions and default values behind the generation of each object are documented in for each method involved.

Index

Constants

This section is empty.

Variables

This section is empty.

Functions

func AddToScheduledTeacherList

func AddToScheduledTeacherList(t *sifxml.ScheduledTeacherListType, staff []*sifxml.StaffPersonal,
	start time.Time, finish time.Time) *sifxml.ScheduledTeacherListType

Add a teacher to a list of scheduled teachers (SIF type sifxml.ScheduledTeacherListType, appearing in ScheduledActivty or TimeTableCell), with a starting time and finish time for their scheduled teaching.

* Weighting is set at 1.0.

* Supervision is set with weighted probability: "Normal" (0.8), "MergedClass" (0.1), "MinimalSupervision" (0.1).

* Credit is only set with probability 0.4. If it is set, its value is set randomly as one of "Casual", "Extra", "In-Lieu", "Underload".

func All_AGCollections

func All_AGCollections() []string

func All_teachingSubjects

func All_teachingSubjects() []string

Default selection of teaching subjects: "MAT", "ENG", "PHYS", "BIO", "CHEM", "COMP", "VIS", "ECON", "HIST".

func CollectionCode2Name

func CollectionCode2Name(code string) string

func CollectionRoundCode

func CollectionRoundCode(collection string, year string, round int) string

func Create_Address

func Create_Address(state string) sifxml.AddressType

Populate an address. Used in Create_SchoolInfo(), Create_StudentContactPersonal(), Create_ChargedLocationInfo().

If state (StateProvince) is not provided, it is selected at random from valid Australian states.

* PostalCode is random based on state.

* Type and Role are set at "0123" (Mailing Address) and "012A" (Home Address).

* StreetNumber, StreetName, City are randomised.

* StreetType is a random selection from a list of typical Australian street types.

func Create_CalendarDate

func Create_CalendarDate(calendar *sifxml.CalendarSummary, school *sifxml.SchoolInfo, date time.Time,
	studentholiday bool, publicholiday bool, calendar_date_number int) *sifxml.CalendarDate

Create a CalendarDate object linked to CalendarSummary object calendar and SchoolInfo object school, for the given date (date). Indicate whether the date is a student holiday (studentholiday), and/or a public holiday (publicholiday), and provide the ordinal number of the day in the student calendar (calendar_date_number; to be ignored if given the value -1).

* Date is set to date.

* SchoolYear is set to calendar.SchoolYear.

* CalendarDateType is set to the enum corresponding to the holiday status of the day: "0846" if publicholiday, else "0845" if studentholiday, else "INST".

* StudentAttendance.CountsTowardAttendance is set to No only if studentholiday is set.

* TeacherAttendance.CountsTowardAttendance is set to No only if publicholiday is set.

* AdministratorAttendance.CountsTowardAttendance is set to No only if publicholiday is set.

* All of StudentAttendance.AttendanceValue, TeacherAttendance.AttendanceValue, AdministratorAttendance.AttendanceValue are set to either 1.0 or 0.0, depending on whether they count towards that attendance.

func Create_CalendarDates

func Create_CalendarDates(calendar *sifxml.CalendarSummary, school *sifxml.SchoolInfo) []*sifxml.CalendarDate

Create a range of CalendarDate objects linked to CalendarSummary object calendar and SchoolInfo object school.

A calendar date is generated for each weekday between calendar.StartDate and calendar.EndDate. It is deemed a public holiday if it is a public holiday in Victoria. It is deemed a student hoiliday if it is a public holiday, or else if it is between days 45 and 55, 105 and 115, and 155 and 165 exclusive of the calendar.

func Create_CalendarSummary

func Create_CalendarSummary(school *sifxml.SchoolInfo) *sifxml.CalendarSummary

Create a CalendarSummary object, linked to SchoolInfo object school.

* SchoolYear is set to the current year.

* LocalId is a sequence number shared between all objects.

* DaysInSession is set to 277.

* StartDate is set to January 28 of the current year. No attempt is made to set it to a weekday.

* EndDate is set to December 19 of the current year. No attempt is made to set it to a weekday.

func Create_ChargedLocationInfo

func Create_ChargedLocationInfo(parent *sifxml.ChargedLocationInfo,
	school *sifxml.SchoolInfo) *sifxml.ChargedLocationInfo

Create a ChargedLocationInfo object, linked to parent ChargedLocationInfo object parent (if it is not nil), and SchoolInfo object school (if it is not nil)

If school is present:

* SiteCategory is set to "School"

* LocationType is set to "School"

* Name, LocalId, StateProvinceId, AddressList are copied from school.

* PhoneNumberList is copied from school if present.

If school is not present:

* SiteCategory is set to "NonSchool"

* LocationType is set to a random choice out of "HR", "Professional Development", "Accounting", "Management", "Cleaning"

* Name is set to a radndom company name followed by LocationType.

* LocalId is a sequence number shared between all objects.

* AddressList is a single entry set by Create_Address(), in a random state.

* PhoneNumberList is a single entry of Type "0096" (Main Telephone Number), and is a phone number with a landline corresponding to the address state.

func Create_ChargedLocationInfos

func Create_ChargedLocationInfos(count int, schools []*sifxml.SchoolInfo) []*sifxml.ChargedLocationInfo

Create count ChargedLocationInfo objects. The slice schools gives SchoolInfo objects that are to be represented in the generated ChargedLocationInfo objects, one per school. If count is larger than the length of schools, the remaining objects are non-school charged locations. Half of the remaining objects generated are parents of the other half, assigned randomly.

func Create_CollectionRound

func Create_CollectionRound(collection string) *sifxml.CollectionRound

Creates a CollectionRound object for a given AG Collection. Presupposes that there are two rounds for each collection per year.

* AGCollection is set to the standard abbreviation for the collection.

* CollectionYear is set to the current year.

* AGRoundList/AGRound/RoundCode is set to the collection abbreviation plus the year plus the round number.

* AGRoundList/AGRound/RoundName is set to the expansion of the collection abbreviation plus the year plus the round number.

* In Round 1, AGRoundList/AGRound/StartDate is set to March 1. In Round 2, it is set to September 1.

* In Round 1, AGRoundList/AGRound/DueDate is set to March 30. In Round 2, it is set to a September 30.

* In Round 1, AGRoundList/AGRound/EndDate is set to March 30. In Round 2, it is set to September 30.

func Create_CollectionRounds

func Create_CollectionRounds() []*sifxml.CollectionRound

Create CollectionRound objects for the currently supported AG Collections.

func Create_CollectionStatus

func Create_CollectionStatus(collection string, round int, school *sifxml.SchoolInfo) *sifxml.CollectionStatus

Create a CollectionStatus object, given the standard abbreviation for the collection, and the round number. Presupposes that there are two rounds for each collection per year. The CollectionStatus is not linked to any Collection objects submitted to HITS, as it is statically populated.

* ReportingAuthority is set to "Middleton Primary School Reporting Authority".

* ReportingAuthoritySystem is set to "Reporting Authority System B"

* ReportingAuthorityCommonwealthId is set to "1234".

* SubmittedBy is set to "John Smith".

* SubmissionTimestamp is set to the 30th of either March or September, depending on the round number.

* AGCollection is set to the collection value.

* CollectionYear is set to the current year.

* RoundCode is set to the collection abbreviation plus the current year plus the round number.

* ReportingObjectResponseList/ReportingObjectResponse/HTTPStatusCode is set one of 201 (75%), 422 (15%) or 500 (10%).

* ReportingObjectResponseList/ReportingObjectResponse/ErrorText is set to the HTTP Status text corresponding to HTTPStatusCode.

* ReportingObjectResponseList/ReportingObjectResponse/CommonwealthId is set to "101".

* ReportingObjectResponseList/ReportingObjectResponse/EntityName is set to "Middleton Primary School".

* ReportingObjectResponseList/ReportingObjectResponse/AGSubmissionStatusCode is set to a random value of the valid status codes: "Cancelled", "Declaration Pending", "Declared", "Exempt", "Finalised", "In Error", "In Progress", "In Review", "Not Started", "Processing", "Reopened".

* ReportingObjectResponseList/ReportingObjectResponse/AGRuleList is given three rule entries.

* ReportingObjectResponseList/ReportingObjectResponse/AGRuleList/AGRule/AGRuleCode is set to "WR-nnn", for nnn is 001 to 003.

* ReportingObjectResponseList/ReportingObjectResponse/AGRuleList/AGRule/AGRuleComment is set to "Cannot be ignored because Components do not add up to Total - Fix"

* ReportingObjectResponseList/ReportingObjectResponse/AGRuleList/AGRule/AGRuleResponse is set to "Rejected".

* ReportingObjectResponseList/ReportingObjectResponse/AGRuleList/AGRule/AGRuleStatus is set to "Fail".

func Create_CollectionStatuses

func Create_CollectionStatuses(school *sifxml.SchoolInfo) []*sifxml.CollectionStatus

Create CollectionStatus objects for the currently supported AG Collections, and for each round created in CollectionRounds. Presupposes that there are two rounds for each collection per year.

func Create_Debtor

func Create_Debtor(student *sifxml.StudentPersonal, staff *sifxml.StaffPersonal,
	contact *sifxml.StudentContactPersonal, vendor *sifxml.VendorInfo) *sifxml.Debtor

Create a Debtor object, associated with one of StudentPersonal object student, StaffPersonal object staff, StudentContactPersonal object contact, or VendorInfo object vendor. The options are mutually exclusive, and all other arguments are expected to be nil.

* LocalId is a sequence number shared between all objects.

func Create_Debtors

func Create_Debtors(student []*sifxml.StudentPersonal, staff []*sifxml.StaffPersonal,
	contact []*sifxml.StudentContactPersonal, vendor []*sifxml.VendorInfo) []*sifxml.Debtor

Create a Debtor object corresponding to each object in each of the slices of objects passed to the function.

func Create_FinancialAccount

func Create_FinancialAccount(parent *sifxml.FinancialAccount, location *sifxml.ChargedLocationInfo) *sifxml.FinancialAccount

Create a FinancialAccount object, linked to parent FinancialAccount object parent (if it is not nil), and ChargedLocationInfo object location (if it is not nil)

* LocalId is a sequence number shared between all objects.

* CreationDate is a random date between 2012-01-01 and 2015-12-31.

* CreationTime is a random time.

* AccountNumber is a unique random number between 1 and 100000000

* ClassType is randomly set to one of "Asset", "Liability", "Revenue", "Expense", "Other".

* Name is set to a random name. If location is not nil, it is instead set to the same Name as Location.Name.

func Create_FinancialAccounts

func Create_FinancialAccounts(count int, locations []*sifxml.ChargedLocationInfo) []*sifxml.FinancialAccount

Create count FinancialAccount objects, some of which shall be linked to ChargedLocationInfo objects randomly drawn from locations.

Half the accounts to be generated are children of other accounts generated in the same function, chosen randomly. A third of all parent accounts are randomly associated with a charged location; all children of that account are associated with the same charged location.

func Create_GradingAssignment

func Create_GradingAssignment(school *sifxml.SchoolInfo, teachinggroup *sifxml.TeachingGroup,
	students []*sifxml.StudentPersonal) *sifxml.GradingAssignment

Create a GradingAssignment object, linked to SchoolInfo object school, TeachingGroup object teachinggroup, and slice of StudentPersonal objects students.

* GradingCategory is randomly selected from "quiz", "essay", "project".

* PointsPossible is set at 10.

* CreateDate is set at a random date between February 1 and November 1 in the current year.

* DueDate is set to 30 days after CreateDate.

* Description is set to a randomised string of eight letters.

* Weight is set to a random integer between 2 and 5 inclusive.

* MaxAttemptsAllowed is set to 5.

* DetailedDescriptionURL is set to "http://www.example.com/" followed by Description.

func Create_GradingAssignmentScore

func Create_GradingAssignmentScore(assignment *sifxml.GradingAssignment, school *sifxml.SchoolInfo,
	teachinggroup *sifxml.TeachingGroup, student *sifxml.StudentPersonal,
	staff *sifxml.StaffPersonal) *sifxml.GradingAssignmentScore

Create a GradingAssignmentScore object, linked to GradingAssignment object assignment, SchoolInfo object school, TeachingGroup object teachinggroup, StudentPersonal object student, and StaffPersonalObject staff.

* ScorePoints is set to a random number between 0 and GradingAssignment.PointsPossible.

* ScoreDescription is set to a randomised sentence of 10 words.

* DateGraded is set to a date between 0 and 6 days inclusive after GradingAssignment.DueDate.

func Create_GradingAssignmentScores

func Create_GradingAssignmentScores(assignment *sifxml.GradingAssignment, school *sifxml.SchoolInfo,
	teachinggroup *sifxml.TeachingGroup, students []*sifxml.StudentPersonal,
	staff *sifxml.StaffPersonal) []*sifxml.GradingAssignmentScore

Create a GradingAssignmentScore object for each student in the slice of StudentPersonal objects students, each of them linked to GradingAssignment object assignment, SchoolInfo object school, TeachingGroup object teachinggroup, and StaffPersonalObject staff.

func Create_GradingAssignments

func Create_GradingAssignments(count int, school *sifxml.SchoolInfo, teachinggroup *sifxml.TeachingGroup,
	students []*sifxml.StudentPersonal) []*sifxml.GradingAssignment

Create count GradingAssignment objects, each linked to SchoolInfo object school, TeachingGroup object teachinggroup, and slice of StudentPersonal objects students.

func Create_RoomInfo

func Create_RoomInfo(school *sifxml.SchoolInfo) *sifxml.RoomInfo

Create a RoomInfo object linked to SchoolInfo object school, with no associated staff.

func Create_RoomInfoWithStaff

func Create_RoomInfoWithStaff(school *sifxml.SchoolInfo, staff []*sifxml.StaffPersonal) *sifxml.RoomInfo

Create a RoomInfo object linked to SchoolInfo object school, with associated StaffPersonal objects given in staff (populating StaffList).

* LocalId is a sequence number shared between all objects.

* RoomNumber is a unique random number between 1 and 999.

* Description is "Room" plus RoomNumber.

* Capacity is a random integer between 10 and 60.

* Size is a random integer between 2 and 7.

* RoomType is set with weighted probability: "Classroom" (0.8), "Art" (0.1), "Basketball court" (0.1)

func Create_RoomInfos

func Create_RoomInfos(count int, school *sifxml.SchoolInfo) []*sifxml.RoomInfo

Create count RoomInfo objects, linked to SchoolInfo object school.

func Create_ScheduledActivities

func Create_ScheduledActivities(cells []*sifxml.TimeTableCell, dates []*sifxml.CalendarDate,
	tg []*sifxml.TeachingGroup) []*sifxml.ScheduledActivity

Create ScheduledActivity objects corresponding to the slice of TimeTableCell objects cells, the slice of CalendarDate objects dates, and the slice of TeachingGroup objects tg. Uses Create_ScheduledActivityBasic(). Creates one scheduled activity for each cell and each date which has StudentAttendance.CountsTowardAttendance as "Yes". Also creates one scheduled activity as an excursion for each teaching group, on a random day in the calendar with StudentAttendance.CountsTowardAttendance as "Yes", before the last 10 days of dates.

Presupposes that the calendar dates are in the current year. Presupposes that all calendar dates are on weekdays.

func Create_ScheduledActivity

func Create_ScheduledActivity(school *sifxml.SchoolInfo, timetable *sifxml.TimeTable,
	timetablecell *sifxml.TimeTableCell, timetablesubject *sifxml.TimeTableSubject,
	students []*sifxml.StudentPersonal, staff []*sifxml.StaffPersonal, teachinggroups []*sifxml.TeachingGroup,
	rooms []*sifxml.RoomInfo) *sifxml.ScheduledActivity

Create a ScheduledActivity object, linked to SchoolInfo object school, TimeTable object timetable, TimeTableCell object timetablecell, TimeTableSubject object timetablesubject, slice of StudentPersonal objects students, slice of StaffPersonal objects staff, Slice of TeachingGroup objects teachinggroups, and slice of RoomInfo objects rooms. This object is hard-coded to generate excursions, and is not the object used for use case object generation.

* ActivityDate is set to a random date in the current year.

* StartTime is set to a random time.

* FinishTime is set to three hours after StartTime.

* CellType is set to "Excursion".

* ActivityType is set to "Excursion".

* Location is set to "Zoo".

* ActivityName is set to "Zoo Excursion".

* TeacherList is set through AddToScheduledTeacherList().

func Create_ScheduledActivityBasic

func Create_ScheduledActivityBasic(date string, c *sifxml.TimeTableCell,
	tg *sifxml.TeachingGroup) *sifxml.ScheduledActivity

Create a ScheduledActivity object, based on the contents of TimeTableCell object c, and TeachingGroup object tg, for the given date (ActivityDate).

If c is not nil (so the ScheduledActivity reflects a recurring teaching event):

* The TimeTableCell-based attributes TimeTableCellRefId, DayId, PeriodId, TimeTableRefId, CellType, TeacherList, RoomList are copied across.

* StartTime and FinishTime are set based on PeriodId, through PeriodStart(), PeriodEnd().

Else, if tg is not nil (so the ScheduledActivity is a non-recurring event for a teaching group):

* StartTime is set as "09:00:00".

* EndTime is set as "15:00:00".

* Location is set to "Zoo".

* ActivityType is set to "Excursion".

* ActivityName is set to "Zoo Excursion".

func Create_SchoolCourseInfo

func Create_SchoolCourseInfo(subject *sifxml.TimeTableSubject, terms []*sifxml.TermInfo) *sifxml.SchoolCourseInfo

Creates a SchoolCourseInfo object, linking to TimeTableSubject object subject and the slice of TermInfo object terms. Presupposes that terms are in consecutive chronological order, and are semesters.

Updates subject: sets subject.SchoolCourseInfoRefId to be the RefId of the generated object.

* CourseCode is set to a unique random number between 1 and 10000.

* SchoolYear is copied across from subject.

* CourseTitle is copied across from subject.SubjectLocalId.

* TermInfoRefId is identified as the RefId of the nth element of terms, where n is subject.Semester.

func Create_SchoolCourseInfos

func Create_SchoolCourseInfos(subjects []*sifxml.TimeTableSubject, terms []*sifxml.TermInfo) []*sifxml.SchoolCourseInfo

Creates a SchoolCourseInfo object for each subject in TimeTableSubject, linking to the slice of TermInfo object terms. Presupposes that terms are in consecutive chronological order, and are semesters.

func Create_SchoolInfo

func Create_SchoolInfo(schooltype string) *sifxml.SchoolInfo

Create a school with its school of SchoolType schooltype. If schooltype is empty, a random value will be selected (drawn from the codeset AUCodeSetsSchoolLevelType).

Each school has a campus type populated. The SchoolCampusId is a random number between 1 and 4. The ParentSchoolId is the same as the school LocalId. The CampusType is the same as the SchoolType. The AdminStatus is set with weighted probability: "N" (0.2), "Y" (0.8).

* LocalId is a sequence number shared between all objects.

* StateProvinceId is a unique random number between 1 and 10000.

* CommonwealthId is a unique random number between 1 and 10000.

* SchoolName is a random name, suffixed with a descriptor consistent with schooltype.

* SchoolSector is set to "Gov".

* OperationalStatus is set to "O".

* IndependentSchool is set to "N".

* ARIA is set to 1.0.

* Entity_Open is set to "1990-01-01".

* AddressList is populated by a single entry from Create_Address().

func Create_SchoolInfos

func Create_SchoolInfos(count int) []*sifxml.SchoolInfo

Creates count SchoolInfo objects, with random school types.

func Create_SessionInfo

func Create_SessionInfo(c *sifxml.TimeTableCell, date string) *sifxml.SessionInfo

Create a SessionInfo object for TimeTableCell c, and the given date.

* LocalId is a sequence number shared between all objects.

* SchoolYear is set to the year component of date.

* SessionDate is set to date.

* StartTime is set through PeriodStart().

* EndTime is set through PeriodEnd().

* RollMarked is set to "Y".

func Create_SessionInfos

func Create_SessionInfos(cells []*sifxml.TimeTableCell, dates []*sifxml.CalendarDate) []*sifxml.SessionInfo

Create a sequence of SessionInfo objects, one for each TimeTableCell object in cells, and for each CalendarDate object in dates which has a StudentAttendance.CountsTowardAttendance value of "Y".

Presupposes that the calendar dates are in the current year. Presupposes that all calendar dates are on weekdays.

func Create_StaffAssignment

func Create_StaffAssignment(staff *sifxml.StaffPersonal, school *sifxml.SchoolInfo) *sifxml.StaffAssignment

Create a StaffAssignment object, linking StaffPersonal object staff to SchoolInfo object school.

Updates student: the staff email is set to a domain value based on the school name.

* PrimaryAssignment is set to "Y".

* SchoolYear is set to the current year.

* JobStartDate is set to "1990-01-01".

* JobFunction is set to "teacher"

* StaffActivity is set to a random valid value.

* If the student year level is set, YearLevel is set to the same value; otherwise it is set to a random value between 1 and 12.

func Create_StaffAssignments

func Create_StaffAssignments(staff []*sifxml.StaffPersonal, school *sifxml.SchoolInfo) []*sifxml.StaffAssignment

Creates one StaffAssignment for each staff member in staff, linking it to school.

func Create_StaffPersonal

func Create_StaffPersonal() *sifxml.StaffPersonal

Create a StaffPersonal record.

Only a legal name (Type: "LGL") is provided for the staff member.

* FamilyName, GivenName, Sex are randomised as a bundle (https://github.com/brianvoe/gofakeit). Sex is binary.

* MiddleName is randomised separately (gofakeit does not support middle names), and may not be of the same gender as the GivenName.

* PreferredGivenName is set to be the same as GivenName.

* Title is randomised, based on the staff sex.

* The staff is assigned two OtherId identifiers: One of type "DET_USER_ID", a unique random number between 1 and 100000000, and one of type either "pep" (probability 0.9) or "cep" (probability 0.1), also a unique random number between 1 and 100000000.

* Email is only a single entry, of type "01" (Primary), and is generated using the first name, the middle initial, the surname, and the domain "example.edu.au". (Overridden in Create_StaffAssignment().)

* LocalId is a sequence number shared between all objects.

* StateProvinceId is a unique random number between 1 and 100000000.

* EmploymentStatus is set to "A".

* BirthDate is a random date betweem 25 and 65 years before the current year.

* CountryOfBirth is fixed at "1101" (Australia).

func Create_StaffPersonals

func Create_StaffPersonals(count int) []*sifxml.StaffPersonal

Create count StaffPersonal objects.

func Create_StudentContactPersonal

func Create_StudentContactPersonal(student *sifxml.StudentPersonal, ordinal int) *sifxml.StudentContactPersonal

Create a StudentContactPersonal record for a student contact corresponding to StudentPersonal object student, with the Parent1/Parent2 status set by ordinal.

If ordinal == 1, the EmploymentType, SchoolEducationalLevel and NonSchoolEducation of the contact are set to match the Parent1 values under student. If ordinal == 2, the EmploymentType, SchoolEducationalLevel and NonSchoolEducation of the contact are set to match the Parent2 values under student. If ordinal is neither, the EmploymentType, SchoolEducationalLevel and NonSchoolEducation of the contact are set to random valid values.

Only a legal name (Type: "LGL") is provided for the contact.

* FamilyName, GivenName, Sex are randomised as a bundle (https://github.com/brianvoe/gofakeit). Sex is binary. With probability 0.8, the family name is updated to match that of the student.

* MiddleName is randomised separately (gofakeit does not support middle names), and may not be of the same gender as the GivenName.

* PreferredGivenName is set to the same as GivenName.

* PreferredFamilyName is set to the same as FamilyName.

* Title is randomised, based on the contact sex.

* EmailList is a single entry, and is of type "01" (Primary), and is generated using the first name, the middle initial, the surname, and a random commercial domain.

* LocalId is a sequence number shared between all objects.

* CountryOfBirth is fixed at "1101" (Australia).

* AddressList is a single entry set by Create_Address(). If the student has an address, the address is set to be in the same state.

* Phonelist is a single entry of Type "0096" (Main Telephone Number), and is a mobile phone number.

* LanguageList has one entry of Type "1" (Main Language Spoken At Home), set to "1201" (English).

With probability 0.2, a second language is added to LanguageList, of Type "2" (Main Language Other Than English Spoken at Home), set to a random selection of "0002", "7101", "2401", "2201", "5203", "4202" (Not Stated, Cantonese, Italian, Greek, Hindi, Arabic).

func Create_StudentContactPersonalAndRelationship

func Create_StudentContactPersonalAndRelationship(students []*sifxml.StudentPersonal) ([]*sifxml.StudentContactPersonal,
	[]*sifxml.StudentContactRelationship)

Create one or two StudentContactPersonal objects and StudentContactRelationship objects for each student in students. Whether one or two contacts and relationships are created depends on the encoding of Parent1 and Parent2 attributes in the student object. Each student has distinct parents: there is no modelling of siblings.

func Create_StudentContactRelationship

func Create_StudentContactRelationship(student *sifxml.StudentPersonal, contact *sifxml.StudentContactPersonal) *sifxml.StudentContactRelationship

Create a StudentContactRelationship record joining StudentPersonal object student to StudentContactPersonal object contact.

* Relationship is set with weighted probability: "01" (Parent) (0.26), and 0.02 for each other value between "02" and "13" inclusive.

* Each flag in ContactFlags is set to "Y" with probability 0.9, else "N". Exceptions: "ParentLegalGuardian" is set to "Y" with probability 0.8; "InterventionOrder" is set to "N" with probability 0.9.

func Create_StudentPersonal

func Create_StudentPersonal(yearlevel string) *sifxml.StudentPersonal

Create a StudentPersonal record, with the student enrolled in the given year level. If no year level is provided, generate a random value.

The student has a parent 1 with probability 0.8, and has a parent 2 with probability 0.8, or if parent 1 is not provided.

Only a legal name (Type: "LGL") is provided for the student.

* FamilyName, GivenName, Sex are randomised as a bundle (https://github.com/brianvoe/gofakeit). Sex is binary.

* MiddleName is randomised separately (gofakeit does not support middle names), and may not be of the same gender as the GivenName.

* Email is only a single entry, of type "01" (Primary), and is generated using the first name, the middle initial, the surname, and the domain "example.edu.au". (Overridden in Create_StudentSchoolEnrollment().)

* LocalId is a sequence number shared between all objects.

* StateProvinceId is a unique random number between 1 and 100000000.

* BirthDate is a random date consistent with the year level and the current year.

* IndigenousStatus is set with weighted probability: "4" = "Neither Aboriginal nor Torres Strait Islander origin" (0.8), "1" = "Aboriginal but not Torres Strait Islander origin" (0.05), "2" = "Torres Strait Islander but not Aboriginal origin" (0.05), "3" = "Both Aboriginal and Torres Strait Islander origin" (0.05), "9" = "Not stated/unknown" (0.05).

* CountryOfBirth is fixed at "1101" (Australia).

* Parent1Language and Parent2Language are fixed at "1201" (English).

* Parent1EmploymentType, Parent1SchoolEducationLevel, Parent1NonSchoolEducation, Parent2EmploymentType, Parent2SchoolEducationLevel, Parent2NonSchoolEducation are set randomly to a valid value.

func Create_StudentPersonals

func Create_StudentPersonals(count int, yearlevels []string) []*sifxml.StudentPersonal

Create count StudentPersonal records; each student is assigned a random member of yearlevels as their year level.

func Create_StudentSchoolEnrollment

func Create_StudentSchoolEnrollment(student *sifxml.StudentPersonal,
	school *sifxml.SchoolInfo) *sifxml.StudentSchoolEnrollment

Create a StudentSchoolEnrollment object, linking StudentPersonal object student to SchoolInfo object school.

Updates student: the student email is set to a domain value based on the school name.

* MembershipType is set to "01".

* SchoolYear is set to the current year.

* TimeFrame is set to "C".

* FTE is set to 1.0.

* EntryDate is set to 25 January of the current year.

* If the student year level is set, YearLevel is set to the same value; otherwise it is set to a random value between 1 and 12.

func Create_StudentSchoolEnrollments

func Create_StudentSchoolEnrollments(students []*sifxml.StudentPersonal,
	school *sifxml.SchoolInfo) []*sifxml.StudentSchoolEnrollment

Creates one StudentSchoolEnrollment for each student in students, linking it to school.

func Create_TeachingGroup

func Create_TeachingGroup(school *sifxml.SchoolInfo, students []*sifxml.StudentPersonal,
	staff []*sifxml.StaffPersonal, timetablesubject *sifxml.TimeTableSubject) *sifxml.TeachingGroup

Create a TeachingGroup object, linked to StudentPersonal objects students (StudentList), StaffPersonal objects staff (TeacherList), and TimeTableSubject timetablesubject.

* LocalId is a sequence number shared between all objects.

* SchoolYear is the current year.

* Semester is set to 1.

* MinClassSize is set to 20.

* MaxClassSize is set to 40.

* ShortName is set to timetablesubject SubjectShortName if present; otherwise it is a random choice of subject out of the defaults on offer (All_teachingSubjects())

* LongName and KeyLearningArea are the full name and key learning area associated with ShortName (TeachingGroupKLA()).

func Create_TeachingGroups

func Create_TeachingGroups(school *sifxml.SchoolInfo, staff []*sifxml.StaffPersonal,
	students []*sifxml.StudentPersonal, subjects []*sifxml.TimeTableSubject) []*sifxml.TeachingGroup

Create TeachingGroup objects linking to SchoolInfo object school, drawing on preexisting objects in staff, students, and subjects.

* Create teaching groups for all 12 year levels.

* Split the student population into the year levels they are assigned to.

* Split staff into primary school teachers (half) and secondary school teachers (half).

* There are len(secondarystaff)/len(subjects) secondary staff assigned to each subject, meaning that on average each teacher is assigned to one subject in the best case. Assignment of secondary staff to subjects is random.

* Teaching groups have a membership of at most 20 students. Students are assigned in slices of 20 to each group; the remainder is assigned to another group.

* CurriculumLevel is set to the year level of the group.

* Primary school students (years 1 to 6) are assigned to a single teaching group. No KeyLearningArea or TimeTableSubject is assigned to the group. A random single primary teacher is assigned to the group. The ShortName and LongName of the group are both of format "6A".

* Junior secondary school students (years 7 to 9) are assigned to a single teaching group. No KeyLearningArea or TimeTableSubject is assigned to the group. A random single secondary teacher is assigned to the group. The ShortName and LongName of the group are both of format "7A".

* Senior secondary school students (years 10 to 12) are each assigned to four random subjects. For each subject in each year level, teaching groups are created to accommodate the assgined students. A random single secondary teacher assigned to that subject is assigned to each group. The KeyLearningArea corresponding to the subject is assigned to the group (TeachingGroupKLA()). The ShortName and LongName are of format "MAT 12C" and "Mathematics 12C" respectively.

func Create_TermInfo

func Create_TermInfo(school *sifxml.SchoolInfo, semester int) *sifxml.TermInfo

Create a TermInfo object linked to the SchoolInfo object school, and representing the given semester.

* SchoolYear is set to the current year.

* StartDate is set to the start date of the given semester, as given in Term_start_date().

* EndtDate is set to the start date of the given semester, as given in Term_end_date().

* TermCode is set to "Term" followed by the semester number.

* TermSpan is set to "0828" (Semester).

* MarkingTerm, SchedulingTerm, and AttendanceTerm are all set to "Y".

func Create_TermInfos

func Create_TermInfos(school *sifxml.SchoolInfo) []*sifxml.TermInfo

Create TermInfo objects linked to SchoolInfo object school. Two objects are created for the year, each representing a semester.

func Create_TimeTable

func Create_TimeTable(school *sifxml.SchoolInfo) *sifxml.TimeTable

Create a TimeTable object linked to SchoolInfo object school.

* LocalId is a sequence number shared between all objects.

* SchoolYear is the current year.

* Title is "Timetable" plus the timetable RefId.

* DaysPerCycle is set as 10.

* PeriodsPerDay is set as 7.

* TeachingPeriodsPerDay is set as 6.

* TimeTableDayList/TimeTableDay/DayTitle cycles through "Monday", "Tuesday", "Wednesday", "Thursday", "Friday" twice.

* TimeTableDayList/TimeTableDay/TimeTablePeriodList/TimeTablePeriod/PeriodTitle cycles through the list in Periods().

* TimeTableDayList/TimeTableDay/TimeTablePeriodList/TimeTablePeriod/PeriodStart is set through PeriodStart().

* TimeTableDayList/TimeTableDay/TimeTablePeriodList/TimeTablePeriod/PeriodEnd is set through PeriodEnd().

func Create_TimeTableCell

func Create_TimeTableCell(day string, period string, celltype string, school *sifxml.SchoolInfo,
	timetable *sifxml.TimeTable, subject *sifxml.TimeTableSubject, teachinggroup *sifxml.TeachingGroup,
	room *sifxml.RoomInfo, rooms []*sifxml.RoomInfo, staff *sifxml.StaffPersonal,
	teachers []*sifxml.StaffPersonal) *sifxml.TimeTableCell

Create a TimeTableCell object linked to the SchoolInfo object school, the TimeTable object timetable, the TimeTableSubject object subject, the TeachingGroup object teachinggroup, the RoomInfo object room (as primary room), the slice of RoomInfo objects rooms, the StaffPersonal object staff (as primary staff), and the slice of StaffPersonal objects teachers. The created object has DayId day, PeriodId period, and Celltype celltype.

* TeacherList is set through AddToScheduledTeacherList(), with period starts and ends set through PeriodStart() and PeriodEnd().

func Create_TimeTableCells

func Create_TimeTableCells(school *sifxml.SchoolInfo, timetable *sifxml.TimeTable, tg []*sifxml.TeachingGroup,
	staff []*sifxml.StaffPersonal, rooms []*sifxml.RoomInfo, tts []*sifxml.TimeTableSubject) []*sifxml.TimeTableCell

Create TimeTableCell objects linking to SchoolInfo object school, TimeTable object timetable, slice of StaffPersonal objects staff, slice of RoomInfo objects rooms, and slice of TimeTableSubject objects tts.

Teaching groups without a timetable subject (i.e. Primary, Junior Secondary) are assigned two cells a week for each subject in tts that is available for that year level, in the same randomly selected room.

Teaching groups with a timetable subject (i.e. Senior Secondary) are assigned two cells a week, each teaching group in a separate randomly selected room.

The two groups for each subject and teaching group are on randomly selected weekdays and periods, but are not at the same time. Each timetable cell is assigned the first teacher listed for the group.

No attempt whatsoever to avoid room clashes. The year level of each teaching group is determined from its CurriculumLevel. Currently all subjects in the program are available at all year levels.

func Create_TimeTableSubject

func Create_TimeTableSubject(school *sifxml.SchoolInfo, course *sifxml.SchoolCourseInfo, subject string,
	acyear string, acyear_end string, semester int) *sifxml.TimeTableSubject

Create a TimeTableSubject object linking to SchoolInfo object school, SchoolCourseInfo object course, with parameters giving the subject matter (subject), the year level (acyear), the end year level if the subject is offered across multiple year levels (acyear_end; "" if it does not apply), and the semester number.

Code assumes that subject has the same enum value across all year levels. Code further assumes that time table subjects across year labels can be grouped on SubjectShortName as a label for the subject matter.

* SchoolYear is the current year.

* SubjectShortName is subject.

* SubjectLongName is a long version of subject (looked up locally).

* SubjectType is a random selection of one of "Core", "Elective", "?".

* SubjectLocalId is formed from concatenating SubjectLongName, acyear (dash acyear_end, if present), and a unique random number between 100 and 1000.

* ProposedMinClassSize is set to a random number between 5 and 20.

* ProposedMaxClassSize is set to ProposedMinClassSize.

* Semester is set to semester.

* OtherCodeList has a single entry, with Codeset set to "mycodeset", and Value set to a unique random number between 100 and 1000.

* AcademicYear is set to acyear if acyear_end is empty.

* AcademicYearRange.Start and AcademicYearRange.End are set to acyear and acyear_end, if acyear_end is not empty.

func Create_TimeTableSubjects

func Create_TimeTableSubjects(school *sifxml.SchoolInfo, subjects []string,
	terms []*sifxml.TermInfo) []*sifxml.TimeTableSubject

Create TimeTableSubject objects linked to SchoolInfo object school. One object is created for each subject in the list given, for each year level that the school offers, and for each of the terms in the TermInfo slice terms. Presupposes that terms are in consecutive chronological order, and are semesters.

There is no implementation of differentiating timetable subject offerings by year level.

func Create_VendorInfo

func Create_VendorInfo() *sifxml.VendorInfo

Create a VendorInfo object.

* LocalId is a sequence number shared between all objects.

* Name is a random company name, followed by a random corporate suffix ("Company", "Pty Ltd", "Ltd", "Pty", "Inc").

* CustomerId is a unique random number between 1000 and 100000.

* ABN is a random number between 1000000000 and 100000000000.

* RegisteredForGST is set to "Y".

* PaymentTerms is set to "15 days".

* AccountNumber is set to a unique random number between 10000 and 1000000.

* AccountName is set to be the same as Name.

* In ContactInfo, FamilyName and GivenName are randomised as a bundle (https://github.com/brianvoe/gofakeit). PositionTitle is set to "Sales", and Role is set to "Sales".

* EmailList is a single entry, and is of type "01" (Primary), and is generated using the first name, the middle initial, the surname, and a random commercial domain.

* PhoneNumberList is a single entry of Type "0096" (Main Telephone Number), and is a phone number with a landline corresponding to the address state.

func Create_VendorInfos

func Create_VendorInfos(count int) []*sifxml.VendorInfo

Create count VendorInfo objects.

func Errcheck

func Errcheck(err error)

Abort on error.

func HTTPStatus2Text

func HTTPStatus2Text(code string) string

func PeriodEnd

func PeriodEnd(id int) time.Time

Set the time that the period with PeriodID id ends; e.g. period 1 maps to 9:55.

func PeriodStart

func PeriodStart(id int) time.Time

Set the time that the period with PeriodID id starts; e.g. period 1 maps to 9:05.

func Periods

func Periods() []string

The permitted periods for a school day.

func PrintJSON

func PrintJSON(record interface{})

Marshal to JSON, and print to output.

func PrintXML

func PrintXML(record interface{}) error

Marshal to XML, and print to output.

func Schooltype2Yearlevels

func Schooltype2Yearlevels(schooltype string) []string

Map the School Type schooltype to a slice of year levels that a school of that type offers.

func TeachingGroupKLA

func TeachingGroupKLA(shortname string) string

func Term_end_date

func Term_end_date(year string, semester int) string

End date for the given semester in the given year. Set to May 30 and November 30.

func Term_start_date

func Term_start_date(year string, semester int) string

Start date for the given semester in the given year. Set to February 1 and July 1.

Types

type MakeUsecaseCounts

type MakeUsecaseCounts struct {
	Students          int
	Staff             int
	Schools           int
	Rooms             int
	Vendors           int
	ChargedLocations  int
	FinancialAccounts int
}

The counts of different SIF objects to be generated by MakeUsecaseObjects(), for each object that it makes sense to specify a count for as an indepedent variable. Each count is a count of objects to be generated per school (except for Schools itself).

func Initcounts

func Initcounts(counts MakeUsecaseCounts) MakeUsecaseCounts

The default counts of objects that MakeUsecaseObjects() is to generate, if they are not overtly specified in the call to MakeUsecaseObjects(). As noted, all counts but Schools are counts per school. The defaults are:

* SchoolInfo: 1

* StaffPersonal: 50

* StudentPersonal: 500

* RoomInfo: 100

* VendorInfo: 20

* ChargedLocationInfo: 10

* FinancialAccount: 100

type MakeUsecases

type MakeUsecases struct {
	DailyAttendance           bool
	Financial                 bool
	Enrolment                 bool
	Gradebook                 bool
	StudentAttendanceTimeList bool
	TeacherJudgement          bool
	Timetable                 bool
	Wellbeing                 bool
	Provisioning              bool
	AGCollections             bool
}

The different HITS use cases that MakeUsecaseObjects() is to generate objects for. These use cases are documented in https://github.com/nsip/usecases/tree/master/docs, replicated in HITS http://hits.nsip.edu.au/dashboard/usecase.html

type UseCaseObjects

type UseCaseObjects struct {
	Schools             []*sifxml.SchoolInfo
	Students            []*sifxml.StudentPersonal
	Staff               []*sifxml.StaffPersonal
	Enrolments          []*sifxml.StudentSchoolEnrollment
	Assignments         []*sifxml.StaffAssignment
	TeachingGroups      []*sifxml.TeachingGroup
	TimeTables          []*sifxml.TimeTable
	TimeTableSubjects   []*sifxml.TimeTableSubject
	TimeTableCells      []*sifxml.TimeTableCell
	Rooms               []*sifxml.RoomInfo
	Contacts            []*sifxml.StudentContactPersonal
	Relationships       []*sifxml.StudentContactRelationship
	FinancialAccounts   []*sifxml.FinancialAccount
	Vendors             []*sifxml.VendorInfo
	Debtors             []*sifxml.Debtor
	ChargedLocations    []*sifxml.ChargedLocationInfo
	Terms               []*sifxml.TermInfo
	CalendarSummarys    []*sifxml.CalendarSummary
	CalendarDates       []*sifxml.CalendarDate
	SessionInfos        []*sifxml.SessionInfo
	SchoolCourses       []*sifxml.SchoolCourseInfo
	ScheduledActivities []*sifxml.ScheduledActivity
	CollectionRounds    []*sifxml.CollectionRound
	CollectionStatuses  []*sifxml.CollectionStatus
}

All the SIF objects generated by MakeUsecaseObjects(), bundled up as a single object.

func MakeUsecaseObjects

func MakeUsecaseObjects(usecases MakeUsecases, counts MakeUsecaseCounts) UseCaseObjects

Given a list of HITS use cases to fulfil, and a list of counts of objects to generate (for those counts which are independent variables), generate all the SIF objects required to fulfil those use case requirements, ensuring that the objects are interrelated as appropriate. Objects are generated one school at a time, and the objects for each school have no connection to the objects generated for other schools.

All objects are generated using Create_Xs where appropriate, to guarantee that they are interrelated. The only parametrisations local to this function are:

* All schools generated are of School Type "Pri/Sec", i.e. they are combined schools

* Timetable subjects are drawn from All_teachingSubjects()

Jump to

Keyboard shortcuts

? : This menu
/ : Search site
f or F : Jump to
y or Y : Canonical URL