Skip to Content
GraphQLSchools

Schools (schools)

The schools query reads the Insights Schools OData entity. Each School node is one school record; filters are flat OData column names (no nested filter objects like Base Property).

Connection result

FieldTypeDescription
totalCountInt!Row count for the filter.
nodes[School]School records for this page.

Endpoint

POST /graphql

Root query (example)

query SchoolsQuery( $filter: SchoolFilter! $limit: Int $offset: Int $orderBy: SchoolSort ) { schools(filter: $filter, limit: $limit, offset: $offset, orderBy: $orderBy) { totalCount nodes { id name status modificationTimestamp location { address { city stateOrProvince postalCode } gis { countyFipsCode latitude longitude } } classification { level gradeRangeMin gradeRangeMax charterYN } enrollment { studentsTotal studentTeacherRatio } district { id name status } testScores { testYear subjectName percentMetStandard } schoolRatings { schoolRating schoolRank schoolRankYear } } } }

Variables (example)

{ "filter": { "stateOrProvince": { "eq": "CA" }, "city": { "contains": "Los Angeles" } }, "limit": 25, "offset": 0, "orderBy": { "name": "ASC" } }

How filtering works

  • Flat filters: Every key on SchoolFilter maps to a single OData property (e.g. city, studentsTotal, latitude). There is no location.address.city path in the filter - use city directly.
  • Operators: Same primitives as elsewhere: StringFilter (eq, contains, startswith), plus IntFilter, FloatFilter, and BooleanFilter for fields such as charterYN.
  • Combining: Resolver wraps plain objects in { and: ... } when you omit explicit and or or.
  • Strings in OData: Insights double-quotes certain school string literals for OData compatibility - handled inside the API client.
SchoolFilter (examples)Purpose
id, districtId, name, statusIdentity and lifecycle.
unparsedAddress, city, stateOrProvince, postalCode, …Address matching.
countyFipsCode, countyOrParishGeography filters.
level, gradeRangeMin, gradeRangeMaxGrade span.
charterYN, magnetYN, privateYN, virtualYNProgram flags.
studentsTotal, studentTeacherRatio, graduationRate, …Numeric metrics.
latitude, longitudeGeo bounds / proximity filters.

How sorting works

SchoolSort exposes top-level fields only. Mapped OData columns include:

Sort fieldNotes
name, city, stateOrProvince, statusLexical / status ordering.
studentsTotalEnrollment size.
graduationRateSchool-level graduation metric.

Directions: ASC or DESC. Only one field per group is typical; multiple entries depend on server mapping (comma-separated OData).

How expansion works

  • district: Resolver loads SchoolDistrict via districtId + DataLoader (batched).
  • testScores: Loads TestScores rows where schoolId equals this school’s id.
  • schoolRatings: Loads accountability/rating rows for the school id.
  • Omit these fields in the GraphQL selection set when you do not need them to reduce Insights calls.

School - fields by level (schema)

FieldDescription / child type
id, name, status, modificationTimestampCore identifiers and freshness.
locationSchoolLocation -> address (SchoolAddress), gis (SchoolGIS).
contactSchoolContact (website, phone).
classificationSchoolClassification (level, grades, charter/magnet/private/virtual flags).
enrollmentSchoolEnrollment (counts, ratios, demographics).
spendingSchoolSpending (per-pupil and federal/state splits).
graduationSchoolGraduation (rate + year).
districtOptional SchoolDistrict parent.
testScores[TestScore!]! - assessment outcome rows.
schoolRatings[SchoolRating!]! - rating/rank rows.

Pagination

limit maps to OData $top, and offset maps to $skip.