Wheatpool Data Labs API Quick Start Guide
Welcome to the Wheatpool Data Labs API Quick Start Guide. This platform offers unparalleled access to the dialogues and discussions within Saskatchewan's parliamentary debates, enabling a deep dive into historical records, current political narratives, and the evolution of legislative discourse.
Ideal for researchers, journalists, and civic technologists, this guide demonstrates new and exciting methods for creating data-driven insights and analysis. Start using the API today to unlock new perspectives and contribute to informed public discourse.
Accessing the Wheatpool Data Labs API
Access to the Wheatpool Data Labs API is provided on a request basis to ensure the integrity of our data and maintain a high level of service for our valued collaborators. If you would like to obtain an API key, please reach out to us at [email protected] with a brief description of your intended use. Our team will carefully review your request and, once approved, supply you with personalized credentials to start exploring the legislative archives. We look forward to partnering with you in unlocking deeper insights from Saskatchewan's parliamentary records.
Getting Started
Start by ensuring curl is installed on your machine. Next, explore the examples below by running them yourself. Try modifying the parameters and see what happens! Once you've successfully run a few examples you can navigate to the Wheatpool Data Labs API Reference for a comprehensive list of available endpoints and parameters.
After you've mastered the basics, check out the PostgREST tables and views documentation for a deep dive into all the possible ways you are able to construct queries against the Wheatpool Data Labs API.
Insights into Young Voices
Discover the impact of young voices in Saskatchewan politics through this API request. The parameter age_at_time_spoken=lte.30 filters for contributions by Members of the Legislative Assembly (MLAs) who were 30 years old or younger at the time of speaking, where lte stands for 'less than or equal to'. The limit=5 and order=date_of_debate.desc narrows down the results to the five most recent entries, highlighting the active role of younger politicians in shaping policy and debate.
curl -X GET "https://api.wheatpool.ca/api/debate_filter?age_at_time_spoken=lte.30&limit=5&order=date_of_debate.desc" -H "X-API-Key: [YOUR API KEY HERE]" -H "accept: application/json"Fetching Debates on Hot Topics
In this example we will explore how climate change is discussed in parliamentary debates. The ilike modifier performs a case-insensitive search, while asterisks act as wildcards, capturing any content related to "climate change". We'll use the tone parameter to filter for discussions marked by immediacy.
curl -X GET "https://api.wheatpool.ca/api/debate_filter?content=ilike.*climate%20change*&tone=ilike.*urgent*&limit=10" -H "X-API-Key: [YOUR API KEY HERE]" -H "accept: application/json"Innovative Women
This API call brings to light the contributions of women in areas of innovation and technology. By utilizing the or clause in topics.ilike.*innovation*,topics.ilike.*technology*, it broadens the search to include discussions on either innovation or technology. This example demonstrates how to structure queries to capture a range of topics, providing users with flexibility in data exploration.
curl -X GET "https://api.wheatpool.ca/api/debate_filter?gender=eq.female&or=(topics.ilike.*innovation*,topics.ilike.*technology*)&limit=5" -H "X-API-Key: [YOUR API KEY HERE]" -H "accept: application/json"Indigenous Voices in Debates
Let's explore a slightly more complicated request. In this example, we'll uncover the narratives of indigenous MLAs within the legislature through a tailored API call. It filters debates for indigenous participation, focusing on discussions related to reconciliation and women's perspectives from 2020. To accomplish this we'll leverage the not.is.null filter on the indigenous parameter to ensure only debates with indigenous representation are selected. Additionally, the dual use of date_of_debate parameters sets a specific time frame, capturing discussions within the chosen period. Lastly, we'll once again use the content parameter to filter for discussions containing the term 'reconciliation'.
curl -X GET "https://api.wheatpool.ca/api/debate_filter?indigenous=not.is.null&date_of_debate=gte.2020-01-01&date_of_debate=lte.2020-12-31&content=ilike.*reconciliation*&gender=eq.female&limit=5" -H "X-API-Key: [YOUR API KEY HERE]" -H "accept: application/json"Dive into a Full Debate
You can at any time retrieve the full transcript for any debate you came across in the previous examples. Each snippet we retrieved earlier returned a field called wheatpool_hansard_id. We'll supply the value of this field to the /rpc/debate endpoint and in return we'll receive the full text of the Hansard that the snippet occurred in.
curl -X POST "https://api.wheatpool.ca/api/rpc/debate" -H "Content-Type: application/json" -d '{"document_id": [wheatpool_hansard_id_value]}'