Skip to contents

Downloads and processes school and district directory data from the California Department of Education (CDE). This includes all public schools and districts with contact information and administrator names. For district records, the administrator is the superintendent; for school records, the administrator is the principal.

Usage

fetch_directory(end_year = NULL, tidy = TRUE, use_cache = TRUE)

Arguments

end_year

Currently unused. The directory data represents the current state of California public schools and is updated by CDE. Included for API consistency with other fetch functions.

tidy

If TRUE (default), returns data in a standardized format with consistent column names. If FALSE, returns raw column names from CDE.

use_cache

If TRUE (default), uses locally cached data when available. Set to FALSE to force re-download from CDE.

Value

A tibble with school directory data. Columns include:

  • cds_code: 14-digit County-District-School identifier

  • county_code: 2-digit county code

  • district_code: 5-digit district code

  • school_code: 7-digit school code (0000000 for districts)

  • state_district_id: County + district code (7 digits)

  • state_school_id: Full 14-digit CDS code (for schools)

  • county_name: County name

  • district_name: District or administrative authority name

  • school_name: School name (NA for district records)

  • entity_type: "district", "school", or "charter"

  • status: Entity status (Active, Closed, Merged, Pending)

  • address: Physical street address

  • city: City

  • state: State (always "CA")

  • zip: ZIP code

  • phone: Phone number

  • website: Website URL

  • grades_served: Grade span served (from CALPADS enrollment)

  • superintendent_name: Superintendent name (district records)

  • superintendent_email: NA (CDE does not provide email)

  • principal_name: Principal/administrator name (school records)

  • principal_email: NA (CDE does not provide email)

  • is_charter: Logical, TRUE if charter school

  • doc_type: District Ownership Code description

  • soc_type: School Ownership Code description

  • latitude: Latitude

  • longitude: Longitude

Details

The directory data is downloaded from the CDE School Directory download page. The file contains both district-level and school-level records. District records are identified by school_code == "0000000" and School == "No Data".

The CDE does not provide email addresses for administrators. The superintendent_email and principal_email columns are included for schema consistency but will always be NA.

Examples

if (FALSE) { # \dontrun{
# Get school directory data
dir_data <- fetch_directory()

# Get raw format (original CDE column names)
dir_raw <- fetch_directory(tidy = FALSE)

# Force fresh download (ignore cache)
dir_fresh <- fetch_directory(use_cache = FALSE)

# Filter to active schools only
library(dplyr)
active_schools <- dir_data |>
  filter(status == "Active", entity_type == "school")

# Get superintendent info for all active districts
supts <- dir_data |>
  filter(entity_type == "district", status == "Active") |>
  select(district_name, superintendent_name, phone, website)
} # }