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

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.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.