usaid-gov/baseline-study-of-food-for-peace-title-ii-d7ka-5mp2
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 procotol. 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 baseline_study_of_food_for_peace_title_ii table in this repository, by referencing it like:

"usaid-gov/baseline-study-of-food-for-peace-title-ii-d7ka-5mp2:latest"."baseline_study_of_food_for_peace_title_ii"

or in a full query, like:

SELECT 
    ":id", -- Socrata column ID
    "e19", -- E19 Any eggs
    "child_max", -- Household has at least one child under 18
    "j301b", -- J301B VILLAGE NUMBER
    "j502", -- J502 LINE NUMBER OF WOMAN FROM ROSTER
    "j300m", -- MODULE J3 START MINUTE
    "f00m", -- MODULE F FINISH HOUR
    "f00h", -- MODULE F START HOUR
    "e31d", -- E31D When was the last time you gave birth DAY
    "j303_7", -- J303 7 List five critical moments for handwashing
    "e20", -- E20 Any fish or seafood
    "j106_4", -- J106 During your last pregnancy did you see anyone for antenatal care
    "j303_4", -- J303 4 List five critical moments for handwashing
    "j110_13", -- J110 13 Please list examples of important maternal child care practices
    "c02", -- C02 Was yesterday an unusual or special day
    "j110_8", -- J110 8 Please list examples of important maternal child care practices
    "hhs", -- Household Hunger Scale
    "f10_8", -- F10 8 Do you do anything to the water to make it safer to drink
    "f12", -- F12 What kind of toilet facility do members of your household usually use during the nighttime
    "b21m", -- MODULE B FINISH MINUTE
    "male_adult", -- Household has at least one male 18 or older
    "e31m", -- E31M When was the last time you gave birth MONTH
    "c07", -- C07 Any fruits
    "j501a", -- J501A HOUSEHOLD NUMBER
    "j106_6", -- J106 During your last pregnancy did you see anyone for antenatal care
    "dis", -- A05 DISTRICT
    "cf", -- Eggs
    "c01c", -- C01C LINE NUMBER FROM COLUMN 6
    "j303_1", -- J303 1 List five critical moments for handwashing
    "c05", -- C05 Any foods made from roots or tubers
    "hhwt", -- Household Weight
    "a13m", -- MONTH OF FINAL VISIT
    "ci", -- Milk and milk products
    "eligible_women", -- Women eligible for Module E between 15 and 49 years of age
    "e24", -- E24 Any sugary foods such as chocolate and cake
    "j110_4", -- J110 4 Please list examples of important maternal child care practices
    "f11b", -- F11B How many households share that daytime facility
    "j106_1", -- J106 During your last pregnancy did you see anyone for antenatal care
    "c17", -- C17 How often did this happen in the past 4 weeks
    "e13", -- E13 Potatoes or any other foods made from roots
    "birth_date", -- Woman s date of birth
    "f10a", -- F10A Does your household use a different source of drInking water during the wet season
    "j303_3", -- J303 3 List five critical moments for handwashing
    "wmwt_j5", -- Sampling weight for women 15 49 adjusted for module J5 non response
    "j506_9", -- J506 9 If you are receiving family planning services where do you go for them
    "at_id", -- ANTHRO QUESTIONNAIRE NUMBER
    "j107", -- J107 Where did you receive antenatal care for this pregnancy
    "j506_3", -- J506 3 If you are receiving family planning services where do you go for them
    "b00m", -- MODULE B START MINUTE
    "j506_1", -- J506 1 If you are receiving family planning services where do you go for them
    "e04", -- E04 How old are you
    "j109", -- J109 Did your partner accompany you during your antenatal visits
    "j506_7", -- J506 7 If you are receiving family planning services where do you go for them
    "at_anid", -- ANTHROPOMETRIST ID NUMBER
    "c21", -- C21 How often did this happen in the last 4 weeks
    "e28", -- E28 Are you currently pregnant
    "j505_7", -- J505 7 If yes which method
    "j110_6", -- J110 6 Please list examples of important maternal child care practices
    "j110_5", -- J110 5 Please list examples of important maternal child care practices
    "f17", -- F17 Observe presence of daytime toilet facility that household said they used
    "j304_cat", -- Are there areas in community that you were unable to visit due to security that are now accessible
    "c1617", -- No food at all in the house
    "a20", -- A20 DATA ENTRY OPERATOR CODE
    "f11", -- F11 What kind of toilet facility do members of your household usually use during the day
    "j106_2", -- J106 During your last pregnancy did you see anyone for antenatal care
    "j303_10", -- J303 10 List five critical moments for handwashing
    "c22m", -- MODULE C FINISH MINUTE
    "j102a", -- J102A CHECK IF CARETAKER IS MALE OR FEMALE
    "d66m", -- MODULE D FINISH MINUTE
    "at_spm", -- ANTHRO SUPERVISOR MONTH
    "e11", -- E11 Any foods made from grains
    "a14_5", -- A14 5 Line Number of Respondant to Household Questionnaire
    "c2021", -- Went all day and night without eating
    "j505_15", -- J505 15 If yes which method
    "a20y", -- A20 YEAR OF DATA ENTRY
    "c20", -- C20 In the past 4 weeks did anyone go a whole day and night without eating because there was no food
    "f10_6", -- F10 6 Do you do anything to the water to make it safer to drink
    "j110_11", -- J110 11 Please list examples of important maternal child care practices
    "j506_4", -- J506 4 If you are receiving family planning services where do you go for them
    "at_hh", -- ANTHRO HOUSEHOLD NUMBER
    "c12", -- C12 Any cheese yogurt milk or other milk products
    "j505_9", -- J505 9 If yes which method
    "cj", -- Oil fats
    "c09", -- C09 Any eggs
    "j505_14", -- J505 14 If yes which method
    "a14_2", -- A14 2 Total Women 15 49 yrs
    "c00m", -- MODULE C START MINUTE
    "e34", -- E34 ANTHROPOMETRY LINE NUMBER OF WOMAN FROM ROSTER
    "improved_water", -- Households using an improved drinking water source
    "g00m", -- MODULE G START MINUTE
    "f05", -- F05 Where is that water source located
    "f06", -- F06 How long does it take to go there get water and come back
    "j110_7", -- J110 7 Please list examples of important maternal child care practices
    "j508m", -- MODULE J5 FINISH MINUTE
    "e17", -- E17 Any liver kidney heart or other organ meats blood
    "j103", -- J103 Are you currently married of living together with a man
    "e12", -- E12 Any foods that are yellow or orange inside
    "j505_2", -- J505 2 If yes which method
    "j106_3", -- J106 During your last pregnancy did you see anyone for antenatal care
    "gendered_hh", -- Gendered Household type
    "a13in", -- INTERVIEWER NUMBER FOR FINAL VISIT
    "c14", -- C14 Any sugar or honey
    "f01a", -- F01A HOUSEHOLD NUMBER
    "ed_level_secondary",
    "e06", -- E06 CHECK AGE IS BETWEEN 15 49 YRS
    "ed_level_higher",
    "j505_13", -- J505 13 If yes which method
    "e33m", -- MODULE E FINISH MINUTE
    "a18", -- A18 FIELD COORDINATOR CODE
    "male_adult_max", -- Household has at least one male 18 or older
    "e01b", -- E01B VILLAGE NUMBER
    "cluster", -- Cluster
    "f10_5", -- F10 5 Do you do anything to the water to make it safer to drink
    "f04", -- F04 What is main source of drinking water
    "j304", -- J304 Are there areas in community that you were unable to visit due to security that are now accessible
    "e26", -- E26 Any grubs snails or insects
    "education_level",
    "j508h", -- MODULE J5 FINISH HOUR
    "g27h", -- MODULE G FINISH HOUR
    "j305m", -- MODULE J3 FINISH MINUTE
    "ca", -- Cereals
    "g00h", -- MODULE G START HOUR
    "j507", -- J507 If not what is the reason
    "j300h", -- MODULE J3 START HOUR
    "vn", -- A02 VILLAGE NUMBER
    "f10_2", -- F10 2 Do you do anything to the water to make it safer to drink
    "j501b", -- J501B VILLAGE NUMBER
    "c16", -- C16 In the past 4 weeks was there ever no food to eat due to lack of resources
    "e31y", -- E31Y When was the last time you gave birth YEAR
    "e29", -- E29 Have you ever been pregnant
    "f10_1", -- F10 1 Do you do anything to the water to make it safer to drink
    "c19", -- C19 How often did this happen in the last 4 weeks
    "j301a", -- J301A HOUSEHOLD NUMBER
    "j506_6", -- J506 6 If you are receiving family planning services where do you go for them
    "j101a", -- J101A HOUSEHOLD NUMBER
    "improved_sanitation", -- Households using improved sanitation facilities
    "f11c", -- F11C Do the children in this household use a different daytime toilet facilites as the adult members
    "d66h", -- MODULE D FINISH HOUR
    "a19", -- A19 OFFICE EDITOR CODE
    "pvo", -- PVO
    "j110_2", -- J110 2 Please list examples of important maternal child care practices
    "hhs_n", -- Household Hunger Scale moderate or severe hunger
    "a14_3", -- A14 3 Total Eligible Farmers
    "f14", -- F14 Show me where members of your household most often wash their hands
    "e16", -- E16 Any other fruit or vegetables
    "j110_9", -- J110 9 Please list examples of important maternal child care practices
    "e38", -- E38 WOMAN S WEIGHT KILOGRAMS
    "e39", -- E39 RESULT
    "b00h", -- MODULE B START HOUR
    "a20d", -- A20 DAY OF DATA ENTRY
    "a04", -- A04 SUBCOUNTY NAME
    "j302", -- J302 LINE NUMBER OF RESONDENT FROM HH ROSTER
    "f10_9", -- F10 9 Do you do anything to the water to make it safer to drink
    "j506_2", -- J506 2 If you are receiving family planning services where do you go for them
    "c04", -- C04 Any foods made from wheat maize rice sorghum or millet
    "j303_9", -- J303 9 List five critical moments for handwashing
    "j505_12", -- J505 12 If yes which method
    "j504", -- J504 Are you and your partner doing something to delay or prevent you from getting pregnant
    "c22h", -- MODULE C FINISH HOUR
    "j111m", -- MODULE J2 FINISH MINUTE
    "j106_5", -- J106 During your last pregnancy did you see anyone for antenatal care
    "d00h", -- MODULE D START HOUR
    "j505_6", -- J505 6 If yes which method
    "e15", -- E15 Any ripe mangos papayas melon or passionfruit
    "f01b", -- F01B VILLAGE NUMBER
    "int_date", -- Date of Interview
    "c06", -- C06 Any vegetables
    "j101b", -- J101B VILLAGE NUMBER
    "j303_5", -- J303 5 List five critical moments for handwashing
    "e22", -- E22 Any cheese yogurt or other milk products
    "j1_count2_male", -- Number of unique male caretakers per hh according to roster B08
    "j108", -- J108 How many times did you receive antenatal care during this pregnancy
    "j110_3", -- J110 3 Please list examples of important maternal child care practices
    "a20m", -- A20 MONTH OF DATA ENTRY
    "f12d", -- F12D What kind of nighttime facility do the children use
    "j505_8", -- J505 8 If yes which method
    "j506_5", -- J506 5 If you are receiving family planning services where do you go for them
    "e30", -- E30 Have you ever given birth
    "j110_15", -- J110 15 Please list examples of important maternal child care practices
    "c01b", -- C01B VILLAGE NUMBER
    "j505_10", -- J505 10 If yes which method
    "e01a", -- E01A HOUSEHOLD NUMBER
    "j505_5", -- J505 5 If yes which method
    "j505_1", -- J505 1 If yes which method
    "j505_11", -- J505 11 If yes which method
    "e03a", -- E03A In what month were you born
    "at_sh", -- ANTHRO START HOUR
    "e00h", -- MODULE E START HOUR
    "critical_handwashing_cat", -- Knows 3 of 5 critical moments for handwashing
    "cb", -- Root and tubers
    "ed_level_preprimary",
    "c01a", -- C01A HOUSEHOLD NUMBER
    "e25", -- E25 Any condiments such as chilies spices herbs or fish powder
    "a17", -- A17 TEAM LEADER CODE
    "critical_handwashing", -- Number kown of critical moments for handwashing out of 5
    "child", -- Household has at least one child under 18
    "j505_4", -- J505 4 If yes which method
    "e27", -- E27 Any foods made with red palm oil red palm nut or red palm nut pulp sauce
    "female_adult_max", -- Household has at least one female 18 or older
    "j1wt", -- Sampling weight for primary caretakers adjusted for module J1 non response
    "c08", -- C08 Any meats organ meats or blood
    "j111h", -- MODULE J1 FINISH HOUR
    "at_fh", -- ANTHRO FINISH HOUR
    "id",
    "cg", -- Fish and seafood
    "at_spd", -- ANTHRO SUPERVISOR DAY
    "at_vn", -- ANTHRO VILLAGE NUMBER
    "j1_count2_female", -- Number of unique male caretakers per hh according to roster B08
    "c1819", -- Went to bed hungry
    "at_and", -- ANTHROPOMETRIST DAY
    "e21", -- E21 Any foods made from beans or seeds
    "c11", -- C11 Any foods made from beans nuts or seeds
    "e37", -- E37 WOMAN S HEIGHT CENTIMETERS
    "e14", -- E14 Any dark green leafy vegetables
    "a14", -- A14 FINAL OUTCOME OF INTERVIEW
    "f12a", -- F12A Does your household share the nighttime toilet facility with any other households
    "j110_10", -- J110 10 Please list examples of important maternal child care practices
    "f10_7", -- F10 7 Do you do anything to the water to make it safer to drink
    "ck", -- Sugar honey
    "f10_4", -- F10 4 Do you do anything to the water to make it safer to drink
    "at_spy", -- ANTHRO SUPERVISOR YEAR
    "wom_age", -- Women s age in completed years
    "j102", -- J102 LINE NUMBER OF CARETAKER FROM HOUSEHOLD ROSTER
    "f12c", -- F12C Do the children of this household use a different toilet facility as the adult members
    "at_any", -- ANTHROPOMETRIST YEAR
    "j303_8", -- J303 8 List five critical moments for handwashing
    "any_sanitation", -- Access to a sanitation facility of any type
    "j303_6", -- J303 6 List five critical moments for handwashing
    "ed_level_none",
    "member_id", -- Member ID for module J J102
    "j506_10", -- J506 10 If you are receiving family planning services where do you go for them
    "j503", -- J503 Do you know of a place to go to for family planning
    "f11a", -- F11A Does your household share the daytime toilet facility with other households
    "female_adult", -- Household has at least one female 18 or older
    "at_sm", -- ANTHRO START MINUTE
    "cd", -- Fruits
    "e23", -- E23 Any foods made with oils fats or butter
    "c15", -- C15 Any other foods such as condiments coffee or tea
    "e03b", -- E03B In what year were you born
    "cc", -- Vegetables
    "a14_4", -- A14 4 Total Children Under 5
    "f09", -- F09 Do you do anything to the water to make it safer to drink
    "cl", -- Miscellaneous
    "f08", -- F08 In the last two weeks was water unavailable from this source for a day or longer
    "f12b", -- F12B How many households share the nighttime facility
    "soap_water", -- Cleansing agent and water at handwashing station
    "j110_12", -- J110 12 Please list examples of important maternal child care practices
    "ed_level_primary",
    "f10b", -- F10B What is main source of drinking water during the wet season
    "ce", -- Meats organs blood
    "j500m", -- MODULE J5 START MINUTE
    "j506_8", -- J506 8 If you are receiving family planning services where do you go for them
    "j505_3", -- J505 3 If yes which method
    "f11d", -- F11D What kind of facility do the children use in the daytime
    "c13", -- C13 Any foods made with oil fat or butter
    "f16", -- F16 Observe presence of soap detergent or other cleansing agent at the place for handwashing
    "e18", -- E18 Any meat
    "c10", -- C10 Any fresh or dried fish or shellfish
    "g27m", -- MODULE G FINISH MINUTE
    "j110_1", -- J110 1 Please list examples of important maternal child care practices
    "wmwt", -- Sampling weight for women 15 49 adjusted for module E non response
    "at_spid", -- ANTHRO SUPERVISOR ID NUMBER
    "j500h", -- MODULE J5 START HOUR
    "at_anm", -- ANTHROPOMETRIST MONTH
    "e36", -- E36 WOMAN S AGE IN YEARS
    "e05", -- E05 Are you between the ages of 15 49 yrs
    "j100m", -- MODULE J1 START MINUTE
    "j305h", -- MODULE J3 FINISH HOUR
    "f15", -- F15 Observe presence of water at the place of handwashing
    "a13d", -- DAY OF FINAL VISIT
    "f18h", -- MODULE F FINISH HOUR
    "hhs_n2", -- Household Hunger Scale moderate and severe hunger
    "f18m", -- MODULE F FINISH MINUTE
    "hh", -- A01 HOUSEHOLD NUMBER
    "j303_2", -- J303 2 List five critical moments for handwashing
    "at_fm", -- ANTHRO FINISH MONTH
    "a13y", -- YEAR OF FINAL VISIT
    "b21h", -- MODULE B FINISH HOUR
    "a03", -- A03 PARISH NAME
    "a14_1", -- A14 1 Total Number of Visits
    "j104", -- J104 Who usually makes decision about health care for yourself
    "f02", -- F02 LINE NUMBER OF RESPONDENT
    "f10_3", -- F10 3 Do you do anything to the water to make it safer to drink
    "strata", -- Strata
    "j100h", -- MODULE J1 START HOUR
    "ch", -- Pulses legumes nuts
    "j105", -- J105 Who usually makes decision about health care for your children
    "e02", -- E02 LINE NUMBER OF WOMAN FROM HOUSEHOLD ROSTER
    "e33h", -- MODULE E FINISH HOUR
    "c00h", -- MODULE C START HOUR
    "d00m", -- MODULE D START MINUTE
    "hdds", -- Average Household Dietary Diversity Score HDDS
    "c18", -- C18 In the past 4 weeks did anyone go to sleep hungry because there was not enough food
    "j110_14", -- J110 14 Please list examples of important maternal child care practices
    "e00m", -- MODULE E START MINUTE
    "f07" -- F07 Is water available from this source all year round
FROM
    "usaid-gov/baseline-study-of-food-for-peace-title-ii-d7ka-5mp2:latest"."baseline_study_of_food_for_peace_title_ii"
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 usaid-gov/baseline-study-of-food-for-peace-title-ii-d7ka-5mp2 with SQL in under 60 seconds.

This repository is an "external" repository. That means it's hosted elsewhere, in this case at data.usaid.gov. When you queryusaid-gov/baseline-study-of-food-for-peace-title-ii-d7ka-5mp2: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)"
 

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.usaid.gov, 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 \
  "usaid-gov/baseline-study-of-food-for-peace-title-ii-d7ka-5mp2" \
  --handler-options '{
    "domain": "data.usaid.gov",
    "tables": {
        "baseline_study_of_food_for_peace_title_ii": "d7ka-5mp2"
    }
}'

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, usaid-gov/baseline-study-of-food-for-peace-title-ii-d7ka-5mp2 is just another Postgres schema.

Related Documentation: