Skip to contents

Downloads and processes school directory data from the Pennsylvania Department of Education via the PA Open Data Portal. Returns school and district records with addresses, entity types, grades served, and website URLs.

Usage

fetch_directory(tidy = TRUE, use_cache = TRUE)

Arguments

tidy

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

use_cache

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

Value

A tibble with school directory data. When tidy = TRUE, columns include:

  • aun: Administrative Unit Number (9-digit PDE identifier)

  • school_number: 4-digit school identifier (0000 = district)

  • district_name: LEA/district name

  • school_name: School name

  • lea_type: Entity type (School District, Charter School, etc.)

  • entity_type: Simplified type (district, school, charter)

  • county_name: County name

  • address: Street address

  • city: City

  • state: State (always "PA")

  • zip: ZIP code

  • phone: Phone number (not available from open data portal)

  • grades_served: Grade range (e.g., "K5F-5" or "9-12")

  • website: School/district website URL

  • latitude: Latitude coordinate

  • longitude: Longitude coordinate

  • is_district: TRUE if district-level record

  • is_school: TRUE if school-level record

  • is_charter: TRUE if charter school entity

Details

Directory data is downloaded from the PA Open Data Portal (data.pa.gov), which publishes PDE's Education Names and Addresses (EdNA) data. Two datasets are joined:

  • Public and Private Education Institutions (dataset a5nq-sy2w): provides entity type, county, address, and status

  • EdNA GIS dataset (dataset knsp-q7fv): provides grades served and website URLs

Administrator contact information (superintendent/principal names and emails) is available through the EdNA web application at http://www.edna.pa.gov but is not available via API.

Examples

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

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

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

# Filter to active school districts only
library(dplyr)
districts <- dir_data |>
  filter(is_district)

# Find all schools in Philadelphia
philly_schools <- dir_data |>
  filter(aun == "126515001", is_school)

# Charter schools only
charters <- dir_data |>
  filter(is_charter)
} # }