Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Add linguistics major and minor #454

Merged
merged 9 commits into from
Apr 14, 2021
Merged
Show file tree
Hide file tree
Changes from 8 commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
Original file line number Diff line number Diff line change
Expand Up @@ -192,6 +192,11 @@ Array [
"Major-ISST2-Primary Concentration",
"Major-ISST2-Secondary Concentration",
"Major-ISST2-Two Major Approved Electives",
"Major-LING-Additional Courses: 1000 or above",
"Major-LING-Additional Courses: 2000 or above",
"Major-LING-Additional Courses: 3000 or above",
"Major-LING-Ancillary Skills Courses",
"Major-LING-Foundation Courses",
"Major-ME-Design Requirement",
"Major-ME-Engineering Distriubtions",
"Major-ME-M.E. Major Electives",
Expand Down Expand Up @@ -226,6 +231,11 @@ Array [
"Minor-DEA-Upper level DEA thematic courses",
"Minor-ISST-Concentration",
"Minor-ISST-Elective",
"Minor-LING-Additional Course: 1000 or above",
"Minor-LING-Additional Course: 2000 or above",
"Minor-LING-Additional Course: 3000 or above",
"Minor-LING-Foundation Course",
"Minor-LING-Introduction to Linguistics",
"Minor-MATH-At least one 4000 level course",
"Minor-MATH-Four 3000 or 4000 level MATH courses",
"Minor-MATH-Math Minor Prerequisites",
Expand Down
19 changes: 18 additions & 1 deletion src/requirements/data/checkers-common.ts
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ export const courseMatchesCodeOptions = (course: Course, codeOptions: readonly s
codeOptions.some(code => ifCodeMatch(`${course.subject} ${course.catalogNbr}`, code));

/**
* Almost colleges have FWS requirements. Instead of writing them from scratch each time, call this
* Almost all colleges have FWS requirements. Instead of writing them from scratch each time, call this
* function.
*
* @param course course object with useful information retrived from Cornell courses API.
Expand All @@ -52,6 +52,23 @@ export const courseIsFWS = (course: Course): boolean =>
export const courseIsSpecial = (course: Course): boolean =>
course.crseId === CREDITS_COURSE_ID || course.crseId === FWS_COURSE_ID;

/**
* This function checks whether a course's maximum number of credits reaches a specified minimum
*
* @param course course object with useful information retrived from Cornell courses API.
* @param minCredits number of credits to check if this course can fulfill
* @returns if course can possibly be taken with credits equal to or greater than minCredits
*/
export const courseMeetsCreditMinimum = (course: Course, minCredits: number): boolean => {
for (let i = 0; i < course.enrollGroups.length; i += 1) {
if (course.enrollGroups[i].unitsMaximum >= minCredits) {
return true;
}
}

return false;
};

/**
* This function returns a checker that checks whether a course satisfy a single requirement by
* checking whether the course code appears in the includes array.
Expand Down
14 changes: 13 additions & 1 deletion src/requirements/data/index.ts
Original file line number Diff line number Diff line change
Expand Up @@ -28,8 +28,9 @@ import hotelAdminRequirements from './majors/hadm';
import historyRequirements from './majors/hist';
import infoRequirements from './majors/info';
import isstRequirements from './majors/isst';
import oldIsstRequirements from './majors/oldIsst';
import lingRequirements from './majors/ling';
import mechnicalEngineeringRequirements from './majors/me';
import oldIsstRequirements from './majors/oldIsst';
import orieRequirements from './majors/orie';

import appliedMathMinorRequirements from './minors/applied-math';
Expand All @@ -39,6 +40,7 @@ import csMinorRequirements from './minors/cs';
import dbmeMinorRequirements from './minors/dbme';
import deaMinorRequirements from './minors/dea';
import infoENMinorRequirements from './minors/infoEN';
import lingMinorRequirements from './minors/ling';
import mathMinorRequirements from './minors/math';
import ormsMinorRequirements from './minors/orms';
import policyMinorRequirements from './minors/policy';
Expand Down Expand Up @@ -186,6 +188,11 @@ const json: RequirementsJson = {
schools: ['EN'],
requirements: isstRequirements,
},
LING: {
name: 'Linguistics',
schools: ['AS1', 'AS2'],
requirements: lingRequirements,
},
ME: {
name: 'Mechanical Engineering',
schools: ['EN'],
Expand Down Expand Up @@ -233,6 +240,11 @@ const json: RequirementsJson = {
schools: ['EN'],
requirements: infoENMinorRequirements,
},
LING: {
name: 'Linguistics',
schools: ['AS1', 'AS2'],
requirements: lingMinorRequirements,
},
MATH: {
name: 'Mathematics',
schools: ['AS1', 'AS2'],
Expand Down
2 changes: 1 addition & 1 deletion src/requirements/data/majors/envE.ts
Original file line number Diff line number Diff line change
Expand Up @@ -138,7 +138,7 @@ const envEngineeringRequirements: readonly CollegeOrMajorRequirement[] = [
(course: Course): boolean =>
majorApproved.some(subject => course.subject?.includes(subject) ?? false),
],
checkerWarning: 'We do not check that the courses are major approved electives',
checkerWarning: 'We do not check that the courses are major approved electives.',
fulfilledBy: 'courses',
perSlotMinCount: [2],
},
Expand Down
90 changes: 90 additions & 0 deletions src/requirements/data/majors/ling.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,90 @@
import { Course, CollegeOrMajorRequirement } from '../../types';

import {
courseIsFWS,
ifCodeMatch,
courseMatchesCodeOptions,
includesWithSubRequirements,
courseMeetsCreditMinimum,
} from '../checkers-common';

const lingRequirements: readonly CollegeOrMajorRequirement[] = [
{
name: 'Foundation Courses',
description: 'LING 1101, LING 3302, LING 3303, and LING 3314.',
source: 'https://linguistics.cornell.edu/undergraduate#major-requirements:',
checker: includesWithSubRequirements(
['LING 1101'],
['LING 3302'],
['LING 3303'],
['LING 3314']
),
fulfilledBy: 'courses',
perSlotMinCount: [1, 1, 1, 1],
},
// TODO - change this into a compounded requirement instead of 3000, 2000, 1000+ electives. Works as expected right now though.
{
name: 'Additional Courses: 3000 or above',
description:
'At least 2 additional linguistics courses must be at the 3000 level or above and at least 3 credits.',
source: 'https://linguistics.cornell.edu/undergraduate#major-requirements:',
checker: [
(course: Course): boolean =>
ifCodeMatch(course.subject, 'LING') &&
!(ifCodeMatch(course.catalogNbr, '1***') || ifCodeMatch(course.catalogNbr, '2***')) &&
!courseMatchesCodeOptions(course, ['LING 1101', 'LING 3302', 'LING 3303', 'LING 3314']) &&
!courseIsFWS(course) &&
courseMeetsCreditMinimum(course, 3),
],
fulfilledBy: 'courses',
perSlotMinCount: [2],
},
{
name: 'Additional Courses: 2000 or above',
description:
'At least 3 additional linguistics courses must be 2000 level or above and at least 3 credits.',
source: 'https://linguistics.cornell.edu/undergraduate#major-requirements:',
checker: [
(course: Course): boolean =>
ifCodeMatch(course.subject, 'LING') &&
!ifCodeMatch(course.catalogNbr, '1***') &&
!courseMatchesCodeOptions(course, ['LING 1101', 'LING 3302', 'LING 3303', 'LING 3314']) &&
!courseIsFWS(course) &&
courseMeetsCreditMinimum(course, 3),
],
fulfilledBy: 'courses',
perSlotMinCount: [3],
},
{
name: 'Additional Courses: 1000 or above',
description:
'At most 1 additional linguistics course can be 1000 level or above, but it must be at least 3 credits.',
source: 'https://linguistics.cornell.edu/undergraduate#major-requirements:',
checker: [
(course: Course): boolean =>
ifCodeMatch(course.subject, 'LING') &&
!courseMatchesCodeOptions(course, ['LING 1101', 'LING 3302', 'LING 3303', 'LING 3314']) &&
!courseIsFWS(course) &&
courseMeetsCreditMinimum(course, 3),
],
fulfilledBy: 'courses',
perSlotMinCount: [1],
},
{
name: 'Ancillary Skills Courses',
description:
'Two courses (3 credits or more) must be in areas relevant to specific areas in linguistics.',
source: 'https://linguistics.cornell.edu/undergraduate#major-requirements:',
checker: [
(course: Course): boolean =>
!courseMatchesCodeOptions(course, ['LING 1101', 'LING 3302', 'LING 3303', 'LING 3314']) &&
courseMeetsCreditMinimum(course, 3),
],
checkerWarning:
'We do not check that the courses are from linguistics related areas or 3+ credits.',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Don't we check that the courses are 3+ credits?

fulfilledBy: 'courses',
perSlotMinCount: [2],
},
];

export default lingRequirements;
78 changes: 78 additions & 0 deletions src/requirements/data/minors/ling.ts
Original file line number Diff line number Diff line change
@@ -0,0 +1,78 @@
import { Course, CollegeOrMajorRequirement } from '../../types';

import {
courseIsFWS,
ifCodeMatch,
courseMatchesCodeOptions,
includesWithSingleRequirement,
courseMeetsCreditMinimum,
} from '../checkers-common';

const lingMinorRequirements: readonly CollegeOrMajorRequirement[] = [
{
name: 'Introduction to Linguistics',
description: 'LING 1101.',
source: 'https://linguistics.cornell.edu/undergraduate#minor-requirements:',
checker: includesWithSingleRequirement('LING 1101'),
fulfilledBy: 'courses',
perSlotMinCount: [1],
},
{
name: 'Foundation Course',
description: 'LING 3302, LING 3303, or LING 3314.',
source: 'https://linguistics.cornell.edu/undergraduate#minor-requirements:',
checker: includesWithSingleRequirement('LING 3302', 'LING 3303', 'LING 3314'),
fulfilledBy: 'courses',
perSlotMinCount: [1],
},
// TODO - currently has a double counting issue because this is a minor with the foundation courses that can fulfill the elective courses, so they double count.
// TODO - furthermore, this req is split into 3 and is a "compounded requirement." It works in the major right now, but in the minor
// the double counting issue means one course can fulfill each part of the compounded requirement.
{
name: 'Additional Course: 3000 or above',
description:
'At least 1 additional linguistics course must be at the 3000 level or above and at least 3 credits.',
Copy link
Collaborator

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Is there any way to check the restriction that "language courses" cannot be used for additional courses? I don't think so because LING courses can be crosslisted with language course codes and not count as a "language course," but still unsure.

Do you want to add in the descriptions for the additional courses req that language courses cannot be used? There doesn't seem to be any indication in the descriptions currently.

source: 'https://linguistics.cornell.edu/undergraduate#minor-requirements:',
checker: [
(course: Course): boolean =>
ifCodeMatch(course.subject, 'LING') &&
!(ifCodeMatch(course.catalogNbr, '1***') || ifCodeMatch(course.catalogNbr, '2***')) &&
!courseIsFWS(course) &&
courseMeetsCreditMinimum(course, 3),
],
fulfilledBy: 'courses',
perSlotMinCount: [1],
},
{
name: 'Additional Course: 2000 or above',
description:
'At least 1 additional linguistics course must be 2000 level or above and at least 3 credits.',
source: 'https://linguistics.cornell.edu/undergraduate#minor-requirements:',
checker: [
(course: Course): boolean =>
ifCodeMatch(course.subject, 'LING') &&
!ifCodeMatch(course.catalogNbr, '1***') &&
!courseIsFWS(course) &&
courseMeetsCreditMinimum(course, 3),
],
fulfilledBy: 'courses',
perSlotMinCount: [1],
},
{
name: 'Additional Course: 1000 or above',
description:
'At most 1 additional linguistics course can be 1000 level or above, but it must be at least 3 credits.',
source: 'https://linguistics.cornell.edu/undergraduate#minor-requirements:',
checker: [
(course: Course): boolean =>
ifCodeMatch(course.subject, 'LING') &&
!courseMatchesCodeOptions(course, ['LING 1101']) &&
!courseIsFWS(course) &&
courseMeetsCreditMinimum(course, 3),
],
fulfilledBy: 'courses',
perSlotMinCount: [1],
},
];

export default lingMinorRequirements;
Loading