Getting Started with datagovindia

library(datagovindia)

datagovindia is a wrapper around >80,000 APIS of the Government of India’s open data platform data.gov.in. Here is a small guide to take you thorugh the package. Primarily,the functionality is centered around three aspects :

API Discovery

The APIs from the portal are scraped every week to update a list of all APIs and the information attached to them like sector, source, field names etc. The website data.gov.in provides a search functionality through string searches and drop down menus but these are very limited. The functions in this package allows one to have more robust string based searches.
A user can search by API title, description, organization type, organization (ministry), sector and sources. Briefly there are two types of functions here, the first lets the user get a list of all available and unique organization type, organization (ministry), sector and sources and the other lets one “search” by these criteria and more.

Here is a demonstration of the former (getting only the first few values)

###List of organizations (or ministries)
get_list_of_organizations() %>% 
  head
#> [1] "Ministry of Environment and Forests"             
#> [2] "Central Pollution Control Board"                 
#> [3] "Ministry of Home Affairs"                        
#> [4] "Department of Home"                              
#> [5] "Registrar General and Census Commissioner, India"
#> [6] "Ministry of Agriculture and Farmers Welfare"
###List of sectors 
get_list_of_sectors() %>% 
  head
#> [1] "Industrial Air Pollution" "Census and Surveys"      
#> [3] "Census"                   "Statistics"              
#> [5] "Agriculture"              "Agricultural Marketing"

Searching for the right API

Once you have an idea about what you want to look for in the API, search queries can be constructed using titles, descriptions as well as the categories explored earlier. A data.frame with information of APIs matching the search keywords is returned. Multiple search functions can be applied over each other utilising the data.frame structure of the result.

search_api_by_title(title_contains = "agri") %>% head(2)
index_name title description org_type org sector source created_date updated_date
2962ee1b-4554-4c38-a8a7-953ecfeeb438 State-wise Total Procurements of Cotton under Minimum Support Price (MSP) by CCI during 2017-18 and 2018-19 (From: Ministry of Agriculture and Farmers Welfare) State-wise Total Procurements of Cotton under Minimum Support Price (MSP) by CCI during 2017-18 and 2018-19 (From: Ministry of Agriculture and Farmers Welfare) Central Rajya Sabha All data.gov.in 2021-03-03T05:49:12Z 2021-03-12T17:09:47Z
7acc437f-f8e3-4ecf-a0a8-d21201c6411c Details of Procurements of Cotton under MSP by CCI from 2016-17 to 2018-19 (From: Ministry of Agriculture and Farmers Welfare) Details of Procurements of Cotton under MSP by CCI from 2016-17 to 2018-19 (From: Ministry of Agriculture and Farmers Welfare) Central Rajya Sabha All data.gov.in 2021-03-04T02:57:25Z 2021-03-12T16:53:07Z