← back to Norma

agents/price-agent/lib/ca-schools-registry.js

385 lines

/**
 * California Higher Education Institutions Registry
 *
 * Static registry of UC, CSU, and CCC system schools with IPEDS unit IDs
 * and financial aid / cost-of-attendance URLs for scraping.
 *
 * Sources:
 *   - IPEDS: https://nces.ed.gov/ipeds/
 *   - UC:    https://www.universityofcalifornia.edu/
 *   - CSU:   https://www.calstate.edu/
 *   - CCC:   https://www.cccco.edu/
 */

// ---------------------------------------------------------------------------
// UC System — 10 campuses (9 with undergraduate programs)
// ---------------------------------------------------------------------------

const UC_CAMPUSES = [
  {
    unitId: 110635,
    name: 'University of California-Berkeley',
    abbreviation: 'UC Berkeley',
    costsUrl: 'https://financialaid.berkeley.edu/cost-of-attendance',
    system: 'uc',
  },
  {
    unitId: 110644,
    name: 'University of California-Davis',
    abbreviation: 'UC Davis',
    costsUrl: 'https://financialaid.ucdavis.edu/undergraduate/cost',
    system: 'uc',
  },
  {
    unitId: 110653,
    name: 'University of California-Irvine',
    abbreviation: 'UC Irvine',
    costsUrl: 'https://www.ofas.uci.edu/cost-of-attendance/',
    system: 'uc',
  },
  {
    unitId: 110662,
    name: 'University of California-Los Angeles',
    abbreviation: 'UCLA',
    costsUrl: 'https://financialaid.ucla.edu/cost-of-attendance',
    system: 'uc',
  },
  {
    unitId: 445188,
    name: 'University of California-Merced',
    abbreviation: 'UC Merced',
    costsUrl: 'https://financialaid.ucmerced.edu/cost-attendance',
    system: 'uc',
  },
  {
    unitId: 110671,
    name: 'University of California-Riverside',
    abbreviation: 'UC Riverside',
    costsUrl: 'https://financialaid.ucr.edu/cost-of-attendance',
    system: 'uc',
  },
  {
    unitId: 110680,
    name: 'University of California-San Diego',
    abbreviation: 'UC San Diego',
    costsUrl: 'https://fas.ucsd.edu/cost-of-attendance/',
    system: 'uc',
  },
  {
    unitId: 110689,
    name: 'University of California-San Francisco',
    abbreviation: 'UCSF',
    costsUrl: null, // Medical/graduate only — no undergraduate program
    system: 'uc',
    undergradOnly: false,
    note: 'Graduate/professional school only. Skip for undergraduate cost tracking.',
  },
  {
    unitId: 110705,
    name: 'University of California-Santa Barbara',
    abbreviation: 'UC Santa Barbara',
    costsUrl: 'https://www.finaid.ucsb.edu/cost-of-attendance',
    system: 'uc',
  },
  {
    unitId: 110714,
    name: 'University of California-Santa Cruz',
    abbreviation: 'UC Santa Cruz',
    costsUrl: 'https://financialaid.ucsc.edu/cost-to-attend/',
    system: 'uc',
  },
];

// ---------------------------------------------------------------------------
// CSU System — 23 campuses
// ---------------------------------------------------------------------------

const CSU_CENTRAL_COSTS_URL =
  'https://www2.calstate.edu/attend/paying-for-college/Pages/costs-and-fees.aspx';

const CSU_CAMPUSES = [
  {
    unitId: 110486,
    name: 'California State University-Bakersfield',
    abbreviation: 'CSU Bakersfield',
    costsUrl: CSU_CENTRAL_COSTS_URL,
    system: 'csu',
  },
  {
    unitId: 441937,
    name: 'California State University-Channel Islands',
    abbreviation: 'CSU Channel Islands',
    costsUrl: CSU_CENTRAL_COSTS_URL,
    system: 'csu',
  },
  {
    unitId: 110495,
    name: 'California State University-Chico',
    abbreviation: 'CSU Chico',
    costsUrl: CSU_CENTRAL_COSTS_URL,
    system: 'csu',
  },
  {
    unitId: 110510,
    name: 'California State University-Dominguez Hills',
    abbreviation: 'CSU Dominguez Hills',
    costsUrl: CSU_CENTRAL_COSTS_URL,
    system: 'csu',
  },
  {
    unitId: 110529,
    name: 'California State University-East Bay',
    abbreviation: 'CSU East Bay',
    costsUrl: CSU_CENTRAL_COSTS_URL,
    system: 'csu',
  },
  {
    unitId: 110538,
    name: 'California State University-Fresno',
    abbreviation: 'Fresno State',
    costsUrl: CSU_CENTRAL_COSTS_URL,
    system: 'csu',
  },
  {
    unitId: 110547,
    name: 'California State University-Fullerton',
    abbreviation: 'CSU Fullerton',
    costsUrl: CSU_CENTRAL_COSTS_URL,
    system: 'csu',
  },
  {
    unitId: 110556,
    name: 'California State Polytechnic University-Humboldt',
    abbreviation: 'Cal Poly Humboldt',
    costsUrl: CSU_CENTRAL_COSTS_URL,
    system: 'csu',
  },
  {
    unitId: 110583,
    name: 'California State University-Long Beach',
    abbreviation: 'CSU Long Beach',
    costsUrl: CSU_CENTRAL_COSTS_URL,
    system: 'csu',
  },
  {
    unitId: 110592,
    name: 'California State University-Los Angeles',
    abbreviation: 'CSU Los Angeles',
    costsUrl: CSU_CENTRAL_COSTS_URL,
    system: 'csu',
  },
  {
    unitId: 110608,
    name: 'California State University Maritime Academy',
    abbreviation: 'Cal Maritime',
    costsUrl: CSU_CENTRAL_COSTS_URL,
    system: 'csu',
  },
  {
    unitId: 367884,
    name: 'California State University-Monterey Bay',
    abbreviation: 'CSU Monterey Bay',
    costsUrl: CSU_CENTRAL_COSTS_URL,
    system: 'csu',
  },
  {
    unitId: 110617,
    name: 'California State University-Northridge',
    abbreviation: 'CSU Northridge',
    costsUrl: CSU_CENTRAL_COSTS_URL,
    system: 'csu',
  },
  {
    unitId: 445027,
    name: 'California State Polytechnic University-Pomona',
    abbreviation: 'Cal Poly Pomona',
    costsUrl: CSU_CENTRAL_COSTS_URL,
    system: 'csu',
    unitIdApprox: true,
  },
  {
    unitId: 110617,
    name: 'California State University-Sacramento',
    abbreviation: 'Sacramento State',
    costsUrl: CSU_CENTRAL_COSTS_URL,
    system: 'csu',
    unitIdApprox: true,
    note: 'IPEDS unit ID needs verification — placeholder used.',
  },
  {
    unitId: 110510,
    name: 'California State University-San Bernardino',
    abbreviation: 'CSU San Bernardino',
    costsUrl: CSU_CENTRAL_COSTS_URL,
    system: 'csu',
    unitIdApprox: true,
    note: 'IPEDS unit ID needs verification — placeholder used.',
  },
  {
    unitId: 110680,
    name: 'San Diego State University',
    abbreviation: 'SDSU',
    costsUrl: CSU_CENTRAL_COSTS_URL,
    system: 'csu',
    unitIdApprox: true,
    note: 'IPEDS unit ID needs verification — placeholder used.',
  },
  {
    unitId: 110693,
    name: 'San Francisco State University',
    abbreviation: 'SF State',
    costsUrl: CSU_CENTRAL_COSTS_URL,
    system: 'csu',
  },
  {
    unitId: 110714,
    name: 'San Jose State University',
    abbreviation: 'SJSU',
    costsUrl: CSU_CENTRAL_COSTS_URL,
    system: 'csu',
    unitIdApprox: true,
    note: 'IPEDS unit ID needs verification — placeholder used.',
  },
  {
    unitId: 110422,
    name: 'California Polytechnic State University-San Luis Obispo',
    abbreviation: 'Cal Poly SLO',
    costsUrl: CSU_CENTRAL_COSTS_URL,
    system: 'csu',
  },
  {
    unitId: 366711,
    name: 'California State University-San Marcos',
    abbreviation: 'CSU San Marcos',
    costsUrl: CSU_CENTRAL_COSTS_URL,
    system: 'csu',
  },
  {
    unitId: 110510,
    name: 'Sonoma State University',
    abbreviation: 'Sonoma State',
    costsUrl: CSU_CENTRAL_COSTS_URL,
    system: 'csu',
    unitIdApprox: true,
    note: 'IPEDS unit ID needs verification — placeholder used.',
  },
  {
    unitId: 110510,
    name: 'California State University-Stanislaus',
    abbreviation: 'CSU Stanislaus',
    costsUrl: CSU_CENTRAL_COSTS_URL,
    system: 'csu',
    unitIdApprox: true,
    note: 'IPEDS unit ID needs verification — placeholder used.',
  },
];

// ---------------------------------------------------------------------------
// CCC System — 116 community colleges, centralized config
// ---------------------------------------------------------------------------

const CCC_CONFIG = {
  system: 'ccc',
  statewideFeePerUnit: 46, // Current CA Community College per-unit enrollment fee (2025-26)
  fullTimeUnitsPerYear: 24, // Typical full-time load: 12 units/semester x 2 semesters
  annualTuitionEstimate: 46 * 24, // $1,104 for full-time in-state
  nonResidentFeePerUnit: 290, // Approximate non-resident supplemental fee per unit
  centralDataUrl: 'https://www.cccco.edu/Students/Paying-for-College',
  totalColleges: 116,
  note: 'Individual college costs vary by campus-specific fees. Tuition is set statewide.',
};

// ---------------------------------------------------------------------------
// Aggregate helpers
// ---------------------------------------------------------------------------

/**
 * All UC campuses that offer undergraduate programs (excludes UCSF).
 */
const UC_UNDERGRAD = UC_CAMPUSES.filter(
  (c) => c.undergradOnly !== false
);

/**
 * Combined list of all individually-tracked campuses (UC + CSU).
 * CCC is tracked as a system, not per-campus.
 */
const ALL_CAMPUSES = [...UC_CAMPUSES, ...CSU_CAMPUSES];

/**
 * Summary of all three CA public higher ed systems.
 */
const ALL_CA_SYSTEMS = {
  uc: {
    name: 'University of California',
    abbreviation: 'UC',
    campuses: UC_CAMPUSES,
    undergradCampuses: UC_UNDERGRAD,
    totalCampuses: UC_CAMPUSES.length,
    undergradCount: UC_UNDERGRAD.length,
  },
  csu: {
    name: 'California State University',
    abbreviation: 'CSU',
    campuses: CSU_CAMPUSES,
    totalCampuses: CSU_CAMPUSES.length,
    centralCostsUrl: CSU_CENTRAL_COSTS_URL,
  },
  ccc: {
    name: 'California Community Colleges',
    abbreviation: 'CCC',
    config: CCC_CONFIG,
    totalColleges: CCC_CONFIG.totalColleges,
  },
};

/**
 * Look up a campus by IPEDS unit ID.
 * @param {number} unitId
 * @returns {object|null}
 */
function findByUnitId(unitId) {
  return ALL_CAMPUSES.find((c) => c.unitId === unitId) || null;
}

/**
 * Look up a campus by abbreviation (case-insensitive).
 * @param {string} abbrev
 * @returns {object|null}
 */
function findByAbbreviation(abbrev) {
  const lower = (abbrev || '').toLowerCase();
  return ALL_CAMPUSES.find((c) => c.abbreviation.toLowerCase() === lower) || null;
}

/**
 * Get all campuses that have a scrapeable costs URL.
 * @returns {object[]}
 */
function getScrapeable() {
  return ALL_CAMPUSES.filter((c) => c.costsUrl != null);
}

/**
 * Get campuses with approximate (unverified) IPEDS unit IDs.
 * These should be verified against the Scorecard API before production use.
 * @returns {object[]}
 */
function getApproxIdCampuses() {
  return ALL_CAMPUSES.filter((c) => c.unitIdApprox === true);
}

module.exports = {
  UC_CAMPUSES,
  UC_UNDERGRAD,
  CSU_CAMPUSES,
  CSU_CENTRAL_COSTS_URL,
  CCC_CONFIG,
  ALL_CAMPUSES,
  ALL_CA_SYSTEMS,
  findByUnitId,
  findByAbbreviation,
  getScrapeable,
  getApproxIdCampuses,
};