This Python module allows you to get data from the WFP Data Bridges API, including household survey data, market prices, exchange rates, GORP (Global Operational Response Plan) data, and food security data (IPC equivalent). It is a wrapper for the Data Bridges API Client, providing an easier way to data analysts to get VAM and monitoring data using their language of choice (Python, R and STATA).
NB This is the dev version of the data_bridges_knots and API client package, it is frequently updated yet not stable.
You can install the data_bridges_knots
package using pip
and the Git repository URL:
pip install git+https://github.com/WFP-VAM/DataBridgesKnots.git
- Create a
data_bridges_api_config.yaml
in the main folder you're running your core from. - The structure of the file is:
NAME: '' VERSION : '' KEY: '' SECRET: '' SCOPES: - '' - ''
- Replace your_api_key and your_api_secret with your actual API key and secret from the Data Bridges API. Update the SCOPES list with the required scopes for your use case.
- (For WFP users) Credentials and scopes for DataBridges API can be requested by opening a ticket with the TEC Digital Core team. See documentation
- External users can reach out to [email protected] for support on getting the API credentials.
Run the following code to extract household survey data.
from data_bridges_knots import DataBridgesShapes
CONFIG_PATH = r"data_bridges_api_config.yaml"
client = DataBridgesShapes(CONFIG_PATH)
#%% XSLForm definition and Household dataset
CONGO_CFSVA = {
'questionnaire': 1509,
'dataset': 3094
}
# get household survey data
survey_data = client.get_household_survey(survey_id=CONGO_CFSVA["dataset"], access_type='full')
# get XLSForm data
questionnaire = client.get_household_questionnaire(CONGO_CFSVA["questionnaire"])
Contributions are welcome! Please open an issue or submit a pull request if you have any improvements or bug fixes.
This project is licensed under the AGPL 3.0 License.