usaid-gov/feed-the-future-mozambique-baseline-population-7dr5-x8hy

  • agriculture
  • consumption
  • feed the future
  • food insecurity
  • hunger
  • + 4

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 feed_the_future_mozambique_baseline_population table in this repository, by referencing it like:

"usaid-gov/feed-the-future-mozambique-baseline-population-7dr5-x8hy:latest"."feed_the_future_mozambique_baseline_population"

or in a full query, like:

SELECT 
    ":id", -- Socrata column ID
    "f01", -- ZIF_No_food_yn
    "groupmember_any", -- Inadequacy in group member
    "country",
    "c01a_h", -- g3.1a.h Anyone Owns Nonfarm Equip
    "g02_e",
    "rp",
    "jown_count", -- Inadequacy in ownership of assets
    "c04_b", -- g3.03b. Decide to sell Large Livestock
    "c01b_n", -- g3.1b.n Household owns Transportation
    "c06_c", -- g3.05c. Decide to rent out Small Livestock
    "c01b_b", -- g3.1b.b Household owns Large Livestock
    "c09_n", -- g3.06n. Decide to buy new Transportation
    "g404_h",
    "ch_20p", -- Condition of disempowerment k
    "c01b_k", -- g3.1b.k Household owns Small Durable
    "g05_b",
    "d03", -- ZID_Ext_wall_tp
    "c04_d", -- g3.03d. Decide to sell Chicken
    "c01b_j", -- g3.1b.j Household owns Large Durable
    "gpi",
    "b02_3", -- g2.02c Input for Livestock raising
    "g04_b",
    "e02_b", -- g4.02 Speak in public to ensure proper wages
    "e07_e",
    "c04_e", -- g3.03e. Decide to sell Fish Pond
    "c05_c", -- g3.04c. Decide to give away Small Livestock
    "c01b_h", -- g3.1b.h Household owns Nonfarm Equip
    "c06_h", -- g3.05h. Decide to rent out Nonfarm Equip
    "d10", -- ZID_Electr_yn_2
    "c05_e", -- g3.04e. Decide to give away Fish Pond
    "c05_l", -- g3.04l. Decide to give away Cell Phone
    "g05_e",
    "e07_h",
    "d02", -- ZID_Floor_tp
    "c12_b", -- g3.09b. Decide how to use money from Informal lender
    "g01_g",
    "d06", -- ZID_Drink_water_src
    "c01a_b", -- g3.1a.b Anyone Owns Large Livestock
    "c01b_c", -- g3.1b.c Household owns Small Livestock
    "c06_g", -- g3.05g. Decide to rent out Farm Equip - mech
    "c02_n", -- g3.02n. Owns most of Transportation
    "ci", -- Individual disempowerment score
    "g01_b",
    "pbs_id",
    "c09_f", -- g3.06f. Decide to buy new Farm Equip - non mech
    "g03_c",
    "c01a_n", -- g3.1a.n Anyone Owns Transportation
    "b01_6", -- g2.01f Participate in Fishing or fishpond culture
    "g01_d",
    "e07_c",
    "g02_c",
    "c01b_g", -- g3.1b.g Household owns Farm Equip - mech
    "g02_b",
    "a12", -- ZIG1_Int_alone
    "b01_4", -- g2.01d Participate in Non-farm
    "modf_missing",
    "zia_visit2_dt",
    "f05", -- ZIF_Whl_day_no_eat_yn
    "g404_a",
    "c04_m", -- g3.03m. Decide to sell Other Land
    "e07_d",
    "c06_f", -- g3.05f. Decide to rent out Farm Equip - non mech
    "g404_c",
    "c01a_i", -- g3.1a.i Anyone Owns House
    "c06_e", -- g3.05e. Decide to rent out Fish Pond
    "g404_f",
    "c09_a", -- g3.06a. Decide to buy new Agriculture
    "hp",
    "c02_g", -- g3.02g. Owns most of Farm Equip - mech
    "g04_e",
    "c01b_e", -- g3.1b.e Household owns Fish Pond
    "zia_cluster_cd",
    "c02_f", -- g3.02f. Owns most of Farm Equip - non mech
    "b01_3", -- g2.01c Participate in Livestock raising
    "c11_b", -- g3.08b. Decide to borrow from Informal lender
    "g03_d",
    "c12_a", -- g3.09a. Decide how to use money from NGO
    "g02_i",
    "g01_i",
    "zi_start_dt",
    "f04", -- ZIF_Sleep_hungry_freq
    "b03_2", -- g2.03b Input for spend money from Cash crop farming
    "c06_i", -- g3.05i. Decide to rent out House
    "c10_e", -- g3.07e. Taken any loans from Group
    "c04_a", -- g3.03a. Decide to sell Agriculture
    "c01a_k", -- g3.1a.k Anyone Owns Small Durable
    "c02_b", -- g3.02b. Owns most of Large Livestock
    "c06_b", -- g3.05b. Decide to rent out Large Livestock
    "e07_a",
    "b03_1", -- g2.03a Input for spend money from Food crop farming
    "b02_6", -- g2.02f Input for Fishing or fishpond culture
    "f04b", -- g6.02 How satisfied, scale of 1-10
    "b03_6", -- g2.03f Input for spend money from Fishing or fishpond culture
    "c02_k", -- g3.02k. Owns most of Small Durable
    "c01a_l", -- g3.1a.l Anyone Owns Cell Phone
    "c02_c", -- g3.02c. Owns most of Small Livestock
    "c05_f", -- g3.04f. Decide to give away Farm Equip - non mech
    "g404_e",
    "b01_2", -- g2.01b Participate in Cash crop farming
    "e07_g",
    "zia_district_cd",
    "g03_b",
    "g404_i",
    "c05_n", -- g3.04n. Decide to give away Transportation
    "c06_d", -- g3.05d. Decide to rent out Chicken
    "c05_d", -- g3.04d. Decide to give away Chicken
    "zia_visit2_yn",
    "c04_c", -- g3.03c. Decide to sell Small Livestock
    "wt_weai_2", -- WEAI weight for Females
    "c11_a", -- g3.08a. Decide to borrow from NGO
    "f06", -- ZIF_Whl_day_no_eat_freq
    "c09_g", -- g3.06g. Decide to buy new Farm Equip - mech
    "c02_h", -- g3.02h. Owns most of Nonfarm Equip
    "d01", -- ZID_Roof_tp
    "d07", -- ZID_Electr_yn
    "c10_b", -- g3.07b. Taken any loans from Informal lender
    "b01_5", -- g2.01e Participate in Wage and salary employment
    "b02_2", -- g2.02b Input for Cash crop farming
    "g04_d",
    "modd_missing",
    "feelinputdecagr", -- Inadequacy in input in productive decisions
    "f03", -- ZIF_Sleep_hungry_yn
    "c11_d", -- g3.08d. Decide to borrow from Friends
    "weaiwght", -- WEAI gender specific weight
    "c05_a", -- g3.04a. Decide to give away Agriculture
    "ci_gap_20p", -- Individual empowerment gap for women without parity
    "c12_d", -- g3.09d. Decide how to use money from Friends
    "d09", -- ZID_Drink_water_src_2
    "g404_k",
    "ea_20p",
    "c12_e", -- g3.09e. Decide how to use money from Group
    "g01_h",
    "c09_d", -- g3.06d. Decide to buy new Chicken
    "wt_weai_1", -- WEAI weight for Males
    "c06_m", -- g3.05m. Decide to rent out Other Land
    "g02_g",
    "c09_c", -- g3.06c. Decide to buy new Small Livestock
    "c04_k", -- g3.03k. Decide to sell Small Durable
    "speakpublic_any", -- Inadequacy in speaking in public
    "e02_c", -- g4.03 Speak in public to protest
    "c05_b", -- g3.04b. Decide to give away Large Livestock
    "c05_k", -- g3.04k. Decide to give away Small Durable
    "c01a_m", -- g3.1a.m Anyone Owns Other Land
    "b02_4", -- g2.02d Input for Non-farm
    "b03_4", -- g2.03d Input for spend money from Non-farm
    "c06_j", -- g3.05j. Decide to rent out Large Durable
    "c05_j", -- g3.04j. Decide to give away Large Durable
    "c04_n", -- g3.03n. Decide to sell Transportation
    "urbrur", -- Urban Rural - 1:urban; 2:rural
    "c02_i", -- g3.02i. Owns most of House
    "e02_a", -- g4.01 Speak in public to help decide
    "d04", -- ZID_Rooms_num
    "c12_c", -- g3.09c. Decide how to use money from Formal lender
    "e07_b",
    "e07_k",
    "leisuretime", -- Inadequacy in leisure
    "c04_l", -- g3.03l. Decide to sell Cell Phone
    "c02_j", -- g3.02j. Owns most of Large Durable
    "zia_int_outcome",
    "c06_n", -- g3.05n. Decide to rent out Transportation
    "c06_l", -- g3.05l. Decide to rent out Cell Phone
    "g04_c",
    "g02_h",
    "b03_3", -- g2.03c Input for spend money from Livestock raising
    "c01a_f", -- g3.1a.f Anyone Owns Farm Equip - non mech
    "c11_c", -- g3.08c. Decide to borrow from Formal lender
    "d11", -- ZID_Fuel_src_2
    "e07_f",
    "zia_supervisor_cd",
    "npoor_z105", -- Inadequacy in workload
    "c09_k", -- g3.06k. Decide to buy new Small Durable
    "id_code", -- ZIG1_Respondent_id
    "c04_h", -- g3.03h. Decide to sell Nonfarm Equip
    "zia_location_cd",
    "c02_e", -- g3.02e. Owns most of Fish Pond
    "incdec_count", -- Inadequacy in control over use of income
    "g03_e",
    "a06", -- ZIA_Household Type
    "c09_m", -- g3.06m. Decide to buy new Other Land
    "g01_e",
    "credjanydec_any", -- Inadequacy in access to and decisions on credit
    "d05", -- ZID_Toilet_tp
    "c04_i", -- g3.03i. Decide to sell House
    "a05", -- ZIG1_Sex_g1
    "c05_m", -- g3.04m. Decide to give away Other Land
    "g404_g",
    "c01a_j", -- g3.1a.j Anyone Owns Large Durable
    "c04_f", -- g3.03f. Decide to sell Farm Equip - non mech
    "g404_d",
    "c09_j", -- g3.06j. Decide to buy new Large Durable
    "c09_h", -- g3.06h. Decide to buy new Nonfarm Equip
    "c10_c", -- g3.07c. Taken any loans from Formal lender
    "zia_region_cd",
    "aa",
    "c09_e", -- g3.06e. Decide to buy new Fish Pond
    "c05_h", -- g3.04h. Decide to give away Nonfarm Equip
    "c09_i", -- g3.06i. Decide to buy new House
    "g404_j",
    "c01b_l", -- g3.1b.l Household owns Cell Phone
    "c01b_a", -- g3.1b.a Household owns Agriculture
    "c01a_a", -- g3.1a.a Anyone Owns Agriculture
    "b02_1", -- g2.02a Input for Food crop farming
    "ci_above_20p", -- Individual indicator that woman lacks gender parity
    "c06_a", -- g3.05a. Decide to rent out Agriculture
    "e07_j",
    "c05_i", -- g3.04i. Decide to give away House
    "he",
    "g404_b",
    "c04_j", -- g3.03j. Decide to sell Large Durable
    "raiprod_any", -- Inadequacy in autonomy in production
    "c01b_i", -- g3.1b.i Household owns House
    "g01_c",
    "a04", -- Primary Secondary
    "c01a_c", -- g3.1a.c Anyone Owns Small Livestock
    "c10_d", -- g3.07d. Taken any loans from Friends
    "c04_g", -- g3.03g. Decide to sell Farm Equip - mech
    "c02_d", -- g3.02d. Owns most of Chicken
    "g05_c",
    "g02_d",
    "c01b_f", -- g3.1b.f Household owns Farm Equip - non mech
    "c11_e", -- g3.08e. Decide to borrow from Group
    "provname",
    "d08", -- ZID_Fuel_src
    "c01b_m", -- g3.1b.m Household owns Other Land
    "b02_5", -- g2.02e Input for Wage and salary employment
    "c01a_g", -- g3.1a.g Anyone Owns Farm Equip - mech
    "c10_a", -- g3.07a. Taken any loans from NGO
    "b03_5", -- g2.03e Input for spend money from Wage and salary employment
    "g05_d",
    "c02_a", -- g3.02a. Owns most of Agriculture
    "c05_g", -- g3.04g. Decide to give away Farm Equip - mech
    "c09_l", -- g3.06l. Decide to buy new Cell Phone
    "c09_b", -- g3.06b. Decide to buy new Large Livestock
    "c01a_d", -- g3.1a.d Anyone Owns Chicken
    "e07_i",
    "c01a_e", -- g3.1a.e Anyone Owns Fish Pond
    "f02", -- ZIF_No_food_freq
    "c01b_d", -- g3.1b.d Household owns Chicken
    "c02_m", -- g3.02m. Owns most of Other Land
    "c02_l", -- g3.02l. Owns most of Cell Phone
    "jrightanyagr", -- Inadequacy in purchase,sale, or transfer of assets
    "districname",
    "c06_k", -- g3.05k. Decide to rent out Small Durable
    "b01_1" -- g2.01a Participate in Food crop farming
FROM
    "usaid-gov/feed-the-future-mozambique-baseline-population-7dr5-x8hy:latest"."feed_the_future_mozambique_baseline_population"
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/feed-the-future-mozambique-baseline-population-7dr5-x8hy 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/feed-the-future-mozambique-baseline-population-7dr5-x8hy: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/feed-the-future-mozambique-baseline-population-7dr5-x8hy" \
  --handler-options '{
    "domain": "data.usaid.gov",
    "tables": {
        "feed_the_future_mozambique_baseline_population": "7dr5-x8hy"
    }
}'

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/feed-the-future-mozambique-baseline-population-7dr5-x8hy is just another Postgres schema.

Related Documentation: