Census API

https://dev.munetrix.com/n/census-csv/index.php?year=<YEAR IN WHICH DATA NEED TO FETCH>

 

This API will store all the data to the 'c_census_data_detail' table.

 

Use the SQL scripts in CO Census API.

 

 

Example of API

For fetching 2016 data, Please modify the above API link like this.

https://dev.munetrix.com/n/census-csv/index.php?year=2016

 

In the above API, we will get the county, city, town, village wise data for 2015 to 2017

 

From the year 2015 to 2017, for the county, we get the population data by age group and sex

From the year 2015 to 2017, for  city, town, village etc.. we get population data by place wise only ( no age group and sex ).

 

For 2018 we have not got the county's data ( We got only data based on  city, town, village, etc )

 

For 2019 we have got only county wise data ( In this, age group and sex-wise data is not present )

 

After fetching the year-wise data from the Census API, run this API to aggregate the data that we got from the above API.

 

API

https://dev.munetrix.com/n/census-csv/calcaggre.php?year=<YEAR IN WHICH DATA NEED TO AGGREGATE>

 

Example of  API

For getting the aggregate data of 2016,  Please modify the year in above API link to 2016

https://dev.munetrix.com/n/census-csv/calcaggre.php?year=2016

 

This API will aggregate the data and store it into the 'c_census_data_aggre' table.

 

Below are some of the other tables that we use.

c_census_state (For saving the state name and code)

c_census_place (For saving place name, place code etc..)

c_census_data_temp (Temporarily storing the data for processing)

 

 

Example of SQL query to be run to fetch the results.

 

//Fetching data from  c_census_data_detail table based on place and state.

Select CD.agegroup,CD.sex,CD.population,CP.place_name,CS.state_name,CD.`year` from c_census_data_detail CD JOIN c_census_place CP ON CP.id=CD.place_id JOIN c_census_state CS ON CS.state_code=CP.state_code limit 50

 

  //Fetching data from  c_census_data_aggre table based on place and state. 

Select CA.population,CP.place_name,CS.state_name,CA.`year` from c_census_data_aggre CA JOIN c_census_place CP ON CP.id=CA.place_id JOIN c_census_state CS ON CS.state_code=CP.state_code LIMIT 50.