School districts (schoolDistricts)
The schoolDistricts query reads the Insights SchoolDistricts OData entity. Filters use flat district columns; expansions load related schools and test rows by foreign key.
Connection result
| Field | Type | Description |
|---|---|---|
totalCount | Int! | District rows matching the filter. |
nodes | [SchoolDistrict] | District records for this page. |
Endpoint
POST /graphqlRoot query (example)
query SchoolDistrictsQuery(
$filter: SchoolDistrictFilter!
$limit: Int
$offset: Int
$orderBy: SchoolDistrictSort
) {
schoolDistricts(
filter: $filter
limit: $limit
offset: $offset
orderBy: $orderBy
) {
totalCount
nodes {
id
name
status
modificationTimestamp
location {
address { city stateOrProvince postalCode }
gis { countyFipsCode countyOrParish }
}
composition {
gradeRangeMin
gradeRangeMax
numberElementarySchools
numberMiddleSchools
numberHighSchools
}
ratings { districtRating districtRank districtRankYear }
graduation { graduationRate graduationRateYear }
schools { id name level status }
testScores { testYear subjectName percentMetStandard }
}
}
}Variables (example)
{
"filter": {
"stateOrProvince": { "eq": "TX" },
"name": { "contains": "Independent" }
},
"limit": 10,
"offset": 0,
"orderBy": { "name": "ASC" }
}How filtering works
- Flat filters: Keys on
SchoolDistrictFiltermap 1:1 to OData properties (e.g.name,city,districtRating,numberElementarySchools). - Operators: Identical vocabulary to schools (
eq, contains, startswith, plus numeric comparisons). - Combining: Implicit
andwrapping whenandororis omitted at the top level.
| SchoolDistrictFilter (examples) | Purpose |
|---|---|
id, name, status | Identity. |
unparsedAddress, city, stateOrProvince, postal fields | District office address. |
countyFipsCode, countyOrParish | Regional filters. |
gradeRangeMin, gradeRangeMax | District-wide grade span. |
numberElementarySchools, numberMiddleSchools, numberHighSchools | Composition counts. |
districtRating, districtRank, districtRankOf, districtRankYear | Accountability metrics. |
graduationRate, graduationRateYear | District graduation filters. |
How sorting works
| SchoolDistrictSort field | Typical use |
|---|---|
name, city, stateOrProvince, status | Lexical ordering. |
districtRating, districtRank | Performance ordering. |
graduationRate | Outcome ordering. |
How expansion works
schools: Batch-fetches allSchoolrows whosedistrictIdequals this district’sid(large result sets possible - use pagination on the parent query and narrow filters).testScores: TestScores joined withschoolIdequal to the district id (same identifier space as documented onTestScore).
SchoolDistrict - fields by level (schema)
| Field | Description / child type |
|---|---|
id, name, status, modificationTimestamp | Core identifiers. |
location | SchoolDistrictLocation -> address, gis. |
composition | SchoolDistrictComposition (grade span, school counts). |
ratings | SchoolDistrictRatings. |
graduation | SchoolDistrictGraduation. |
schools | [School!]! - member schools (expanded query). |
testScores | [TestScore!]! - linked assessments. |
Pagination
Same as schools: limit maps to OData $top, and offset maps to $skip.