cityofchicago/chicago-public-schools-elementary-school-progress-b5gj-d4r4
Icon for Socrata external plugin

Query the Data Delivery Network

Query the DDN

The easiest way to query any data on Splitgraph is via the "Data Delivery Network" (DDN). The DDN is a single endpoint that speaks the PostgreSQL wire protocol. Any Splitgraph user can connect to it at data.splitgraph.com:5432 and query any version of over 40,000 datasets that are hosted or proxied by Splitgraph.

For example, you can query the chicago_public_schools_elementary_school_progress table in this repository, by referencing it like:

"cityofchicago/chicago-public-schools-elementary-school-progress-b5gj-d4r4:latest"."chicago_public_schools_elementary_school_progress"

or in a full query, like:

SELECT
    ":id", -- Socrata column ID
    "teacher_attendance_2011_percent", -- Average daily attendance of teachers -- the number of days in which teachers were present divided by the number of days they were scheduled to work.
    "geographic_network",
    "managed_by_network",
    ":@computed_region_rpca_8um6",
    "reading_growth_grade_6", -- Portion of students making expected growth between fall and spring tests. The national average is 0.5.
    "effective_leaders", -- Does leadership focus on results and school improvement? For more information, visit https://cps.5-essentials.org/2012.
    "reading_growth_grade_7", -- Portion of students making expected growth between fall and spring tests. The national average is 0.5.
    "reading_growth_grade_8", -- Portion of students making expected growth between fall and spring tests. The national average is 0.5.
    "math_growth_grade_3", -- Portion of students making expected growth between fall and spring tests. The national average is 0.5.
    "math_growth_grade_4", -- Portion of students making expected growth between fall and spring tests. The national average is 0.5.
    "collaborative_teachers", -- Do teachers work well together and strive for excellence? For more information, visit https://cps.5-essentials.org/2012.
    "safety", -- Do students feel safe and does the school support positive behavior? For more information, visit https://cps.5-essentials.org/2012.
    "misconducts_resulting_in_suspensions_2011_percent", -- Number of misconducts resulting in suspension divided by the number of misconducts reported.
    "math_growth_grade_6", -- Portion of students making expected growth between fall and spring tests. The national average is 0.5.
    "math_growth_grade_7", -- Portion of students making expected growth between fall and spring tests. The national average is 0.5.
    "math_growth_grade_8", -- Portion of students making expected growth between fall and spring tests. The national average is 0.5.
    "math_growth_all_grades", -- Portion of students making expected growth between fall and spring tests. The national average is 0.5.
    "student_performance_level", -- Student performance on the test compared to similar schools nationally
    ":@computed_region_bdys_3d7i",
    "reading_growth_students_with_disabilities", -- Portion of students with disabilities making expected growth between fall and spring tests. The national average is 0.5. No results are shown if there were fewer than 30 students.
    "location_city",
    "student_performance_reading_and_math", -- Portion of students performing at or above the national average.  Weighted average of reading and math results. The national average is 0.5.
    "reading_performance_grade_4", -- Portion of students performing at or above the national average. The national average is 0.5.
    "reading_performance_grade_7", -- Portion of students performing at or above the national average. The national average is 0.5.
    "reading_performance_all_grades", -- Portion of students performing at or above the national average. The national average is 0.5.
    "math_performance_grade_3", -- Portion of students performing at or above the national average. The national average is 0.5.
    "math_performance_grade_4", -- Portion of students performing at or above the national average. The national average is 0.5.
    "math_performance_grade_6", -- Portion of students performing at or above the national average. The national average is 0.5.
    "math_performance_grade_7", -- Portion of students performing at or above the national average. The national average is 0.5.
    "math_performance_all_grades", -- Portion of students performing at or above the national average. The national average is 0.5.
    "reading_growth_hispanic", -- Portion of Hispanic students making expected growth between fall and spring tests. The national average is 0.5. No results are shown if there were fewer than 30 students.
    "reading_growth_english_language_learners", -- Portion of English language learners making expected growth between fall and spring tests. The national average is 0.5. No results are shown if there were fewer than 30 students.
    "reading_growth_free_and_reduced_lunch", -- Portion of students receiving free or reduced lunch making expected growth between fall and spring tests. The national average is 0.5. No results are shown if there were fewer than 30 students.
    "math_growth_hispanic", -- Portion of Hispanic students making expected growth between fall and spring tests. The national average is 0.5. No results are shown if there were fewer than 30 students.
    "math_growth_african_american", -- Portion of African American students making expected growth between fall and spring tests. The national average is 0.5. No results are shown if there were fewer than 30 students.
    "math_growth_english_language_learners", -- Portion of English language learners making expected growth between fall and spring tests. The national average is 0.5. No results are shown if there were fewer than 30 students.
    "math_growth_free_and_reduced_lunch", -- Portion of students receiving free or reduced lunch making expected growth between fall and spring tests. The national average is 0.5. No results are shown if there were fewer than 30 students.
    "overall_foundation", -- Overall status from the "My Voice, My School" survey completed by teachers and 6th-12th grade students. For more information, visit https://cps.5-essentials.org/2012.
    "involved_families", -- Does the school partner with families and communities? For more information, visit https://cps.5-essentials.org/2012.
    "website",
    "location",
    "math_growth_white", -- Portion of White students making expected growth between fall and spring tests. The national average is 0.5. No results are shown if there were fewer than 30 students.
    "math_growth_students_with_disabilities", -- Portion of students with disabilities making expected growth between fall and spring tests. The national average is 0.5. No results are shown if there were fewer than 30 students.
    "misconducts_resulting_in_suspensions_2012_percent", -- Number of misconducts resulting in suspension divided by the number of misconducts reported.
    "on_probation", -- Is the school on probation?
    "city",
    ":@computed_region_vrxf_vc4k",
    ":@computed_region_6mkv_f3dw",
    ":@computed_region_43wa_7qmu",
    "location_zip",
    "location_state",
    "school_id",
    "school_short_name",
    "math_performance_grade_5", -- Portion of students performing at or above the national average. The national average is 0.5.
    "state",
    "reading_performance_grade_8", -- Portion of students performing at or above the national average. The national average is 0.5.
    "latitude",
    "y_coordinate",
    "average_days_of_suspension_2011", -- Average length of suspensions, in days, divided by the number of suspensions.
    "reading_performance_grade_6", -- Portion of students performing at or above the national average. The national average is 0.5.
    "reading_performance_grade_5", -- Portion of students performing at or above the national average. The national average is 0.5.
    "average_days_of_suspension_2012", -- Average length of suspensions, in days, divided by the number of suspensions.
    "reading_performance_grade_3", -- Portion of students performing at or above the national average. The national average is 0.5.
    "math_growth_grade_5", -- Portion of students making expected growth between fall and spring tests. The national average is 0.5.
    "student_attendance_2011_percent", -- Average daily attendance of students -- the number of days in which students were present divided by the number of days in which students were scheduled to attend.
    "supportive_environment", -- Is the school safe and supportive with high expectations? For more information, visit https://cps.5-essentials.org/2012.
    "student_attendance_2012_percent", -- Average daily attendance of students -- the number of days in which students were present divided by the number of days in which students were scheduled to attend.
    "teacher_attendance_2012_percent", -- Average daily attendance of teachers -- the number of days in which teachers were present divided by the number of days they were scheduled to work.
    "school_name",
    "street_address",
    "zip",
    "location_address",
    "longitude",
    "school_track", -- Which schedule.  See http://www.cps.edu/calendar/Pages/Calendar.aspx.
    "blue_ribbon_award_year", -- Year in which the school won a U.S. Department of Education Blue Ribbon.
    "overall_rating", -- The Overall Rating on the school progress report is based on the school’s rating under the 2012-2013 Performance, Remediation and Probation Policy. Level 1 is highest.
    "years_on_probation", -- How many years has the school been on probation?
    "nwea_or_scantron", -- Assessment test used
    "growth_overall_level", -- Student growth compared to similar schools nationally
    "growth_overall_reading_and_math", -- Portion of students making expected growth between fall and spring tests
    "ambitious_instruction", -- Is instruction focused, challenging, and engaging? For more information, visit https://cps.5-essentials.org/2012.
    "reading_growth_grade_3", -- Portion of students making expected growth between fall and spring tests. The national average is 0.5.
    "x_coordinate",
    "blue_ribbon_award", -- Did the school win a U.S. Department of Education Blue Ribbon? See http://www2.ed.gov/programs/nclbbrs/index.html.
    "healthy_school_certified", -- Is the school certified by the USDA’s Healthier US School Challenge?
    "reading_growth_grade_4", -- Portion of students making expected growth between fall and spring tests. The national average is 0.5.
    "reading_growth_grade_5", -- Portion of students making expected growth between fall and spring tests. The national average is 0.5.
    "phone_number",
    "math_performance_grade_8", -- Portion of students performing at or above the national average. The national average is 0.5.
    "reading_growth_african_american", -- Portion of African American students making expected growth between fall and spring tests. The national average is 0.5. No results are shown if there were fewer than 30 students.
    "reading_growth_white", -- Portion of White students making expected growth between fall and spring tests. The national average is 0.5. No results are shown if there were fewer than 30 students.
    ":@computed_region_awaf_s7ux",
    "reading_growth_all_grades" -- Portion of students making expected growth between fall and spring tests. The national average is 0.5.
FROM
    "cityofchicago/chicago-public-schools-elementary-school-progress-b5gj-d4r4:latest"."chicago_public_schools_elementary_school_progress"
LIMIT 100;

Connecting to the DDN is easy. All you need is an existing SQL client that can connect to Postgres. As long as you have a SQL client ready, you'll be able to query cityofchicago/chicago-public-schools-elementary-school-progress-b5gj-d4r4 with SQL in under 60 seconds.

This repository is an "external" repository. That means it's hosted elsewhere, in this case at data.cityofchicago.org. When you querycityofchicago/chicago-public-schools-elementary-school-progress-b5gj-d4r4:latest on the DDN, we "mount" the repository using the socrata mount handler. The mount handler proxies your SQL query to the upstream data source, translating it from SQL to the relevant language (in this case SoQL).

We also cache query responses on the DDN, but we run the DDN on multiple nodes so a CACHE_HIT is only guaranteed for subsequent queries that land on the same node.

Query Your Local Engine

Install Splitgraph Locally
bash -c "$(curl -sL https://github.com/splitgraph/splitgraph/releases/latest/download/install.sh)"
 

Read the installation docs.

Splitgraph Cloud is built around Splitgraph Core (GitHub), which includes a local Splitgraph Engine packaged as a Docker image. Splitgraph Cloud is basically a scaled-up version of that local Engine. When you query the Data Delivery Network or the REST API, we mount the relevant datasets in an Engine on our servers and execute your query on it.

It's possible to run this engine locally. You'll need a Mac, Windows or Linux system to install sgr, and a Docker installation to run the engine. You don't need to know how to actually use Docker; sgrcan manage the image, container and volume for you.

There are a few ways to ingest data into the local engine.

For external repositories (like this repository), the Splitgraph Engine can "mount" upstream data sources by using sgr mount. This feature is built around Postgres Foreign Data Wrappers (FDW). You can write custom "mount handlers" for any upstream data source. For an example, we blogged about making a custom mount handler for HackerNews stories.

For hosted datasets, where the author has pushed Splitgraph Images to the repository, you can "clone" and/or "checkout" the data using sgr cloneand sgr checkout.

Mounting Data

This repository is an external repository. It's not hosted by Splitgraph. It is hosted by data.cityofchicago.org, and Splitgraph indexes it. This means it is not an actual Splitgraph image, so you cannot use sgr clone to get the data. Instead, you can use the socrata adapter with the sgr mount command. Then, if you want, you can import the data and turn it into a Splitgraph image that others can clone.

First, install Splitgraph if you haven't already.

Mount the table with sgr mount

sgr mount socrata \
  "cityofchicago/chicago-public-schools-elementary-school-progress-b5gj-d4r4" \
  --handler-options '{
    "domain": "data.cityofchicago.org",
    "tables": {
        "chicago_public_schools_elementary_school_progress": "b5gj-d4r4"
    }
}'

That's it! Now you can query the data in the mounted table like any other Postgres table.

Query the data with your existing tools

Once you've loaded the data into your local Splitgraph engine, you can query it with any of your existing tools. As far as they're concerned, cityofchicago/chicago-public-schools-elementary-school-progress-b5gj-d4r4 is just another Postgres schema.