Nandi County API Docs

v1.0.0 ~ June 15, 2022

v1.0.0

Updated June 17, 2022

Prerequisites

All requests must have the following headers

Accept : Application/Json

Every response will have the following headers

Content-Type : application/json

API responses will use the following format

{
    "code": 200,
    "data": []
}

Sample error response:

{
    "code": 500,
    "data": "The given data was invalid."
}




Get Sectors

This API lets you get list of available sectors

Endpoint GET https://api.production.nandi.opencounty.org/api/sectors

{
    "code": 200,
    "data": [
        {
            "id": 1,
            "name": "Agriculture",
            "icon": "https://api.production.nandi.opencounty.org/icons/agriculture.png",
            "indicators": [
                {
                    "id": 1,
                    "sector_id": 1,
                    "index": "6.1",
                    "name": "SubCounty Agro-Ecological and Crop Entreprise",
                    "description": null,
                    "source": null,
                    "created_at": "2022-05-27T07:31:37.000000Z",
                    "updated_at": "2022-05-27T07:31:37.000000Z"
                },
                {
                    "id": 2,
                    "sector_id": 1,
                    "index": "6.2",
                    "name": "Land Potential productivity by SubCounty and Area",
                    "description": null,
                    "source": null,
                    "created_at": "2022-05-27T07:31:37.000000Z",
                    "updated_at": "2022-05-27T07:31:37.000000Z"
                }
            ]
        },
        {
            "id": 2,
            "name": "Education",
            "icon": "https://api.production.nandi.opencounty.org/icons/education.png",
            "indicators": [
                {
                    "id": 46,
                    "sector_id": 2,
                    "index": "4.1",
                    "name": "4.1 Type of Educational Institutions by ownership, 2015-2020*",
                    "description": null,
                    "source": null,
                    "created_at": "2022-05-27T07:31:37.000000Z",
                    "updated_at": "2022-05-27T07:31:37.000000Z"
                },
                {
                    "id": 47,
                    "sector_id": 2,
                    "index": "4.2",
                    "name": "ECDE Enrolment in Public Schools by Sub County,Ward  2015-2020",
                    "description": null,
                    "source": null,
                    "created_at": "2022-05-27T07:31:37.000000Z",
                    "updated_at": "2022-05-27T07:31:37.000000Z"
                }
            ]
        }
    ]
}




Get Boundary

Get list of sub counties and their wards

Endpoint GET https://api.production.nandi.opencounty.org/api/boundary

{
    "code": 200,
    "data": [
        {
            "id": 5,
            "name": "Aldai",
            "wards": [
                {
                    "id": 21,
                    "name": "Kabwareng"
                },
                {
                    "id": 22,
                    "name": "Terik"
                }
            ]
        },
        {
            "id": 2,
            "name": "Chesumei",
            "wards": [
                {
                    "id": 5,
                    "name": "Chemundu/kapng'etuny"
                },
                {
                    "id": 6,
                    "name": "Kosirai"
                }
            ]
        }
    ]
}




Get Indicators

This API lets you get list of available indicators

Endpoint GET https://api.production.nandi.opencounty.org/api/indicators

{
    "code": 200,
    "data": [
        {
            "id": 1,
            "sector_id": 1,
            "index": "6.1",
            "name": "SubCounty Agro-Ecological and Crop Entreprise",
            "description": null,
            "source": null,
            "created_at": "2022-05-30T12:22:44.000000Z",
            "updated_at": "2022-05-30T12:22:44.000000Z",
            "sector": {
                "id": 1,
                "name": "Agriculture",
                "icon": "https://api.production.nandi.opencounty.org/icons/agriculture.png"
            }
        },
        {
            "id": 2,
            "sector_id": 1,
            "index": "6.2",
            "name": "Land Potential productivity by SubCounty and Area",
            "description": null,
            "source": null,
            "created_at": "2022-05-30T12:22:44.000000Z",
            "updated_at": "2022-05-30T12:22:44.000000Z",
            "sector": {
                "id": 1,
                "name": "Agriculture",
                "icon": "https://api.production.nandi.opencounty.org/icons/agriculture.png"
            }
        }
    ]
}




Get Projects

Get a list of available projects

Use the GET https://api.production.nandi.opencounty.org/api/projects/filters to filter the results

Available filters are : constituency_id, ward_id, status, payment_status, department_id, period and contractor

Endpoint GET https://api.production.nandi.opencounty.org/api/projects?constituency_id=1,23&ward_id=1,22&status=pending,completed&period=2018/2019,2019/2020

To perform search use ?search=xxx

{
    "code": 200,
    "data": {
        "current_page": 1,
        "data": [
            {
                "id": 1,
                "name": "PROPOSED RENOVATION WORKS AT CHEPTERWAI SUB COUNTY HOSPITAL",
                "constituency_id": 3,
                "ward_id": 10,
                "department_id": 1,
                "activities": "-Roofing, -doors, ceiling, fittings, plumbing works, painting and external finishes",
                "status": "Completed",
                "status_description": "Complete & In use",
                "year": "2017/2018",
                "amount": "2727624.00",
                "payment_status": "Fully paid",
                "contractor": "DASTNINE CO LTD",
                "impact": "Improved environment for service delivery",
                "feedback": "-Leaking roof affecting operations,Water gutters not done,Inconsistent supply of drugs",
                "geo": null,
                "completion": 0,
                "created_at": "2022-05-30T07:40:45.000000Z",
                "updated_at": "2022-05-30T07:40:45.000000Z",
                "department": {
                    "id": 1,
                    "name": "DEPARTMENT OF HEALTH AND SANITATION"
                },
                "constituency": {
                    "id": 3,
                    "name": "Mosop"
                },
                "ward": {
                    "id": 10,
                    "name": "Chepterwai"
                }
            },
            {
                "id": 2,
                "name": "New Facility At Kapsosio Dispensary",
                "constituency_id": 3,
                "ward_id": 10,
                "department_id": 1,
                "activities": "-",
                "status": "Incomplete",
                "status_description": "95% At finishes stage",
                "year": "2018/2019",
                "amount": "3000000.00",
                "payment_status": "Not paid",
                "contractor": "KENORU INVESTMENT LIMITED",
                "impact": null,
                "feedback": "The project is faced by land ownership issues",
                "geo": null,
                "completion": 0,
                "created_at": "2022-05-30T07:40:45.000000Z",
                "updated_at": "2022-05-30T07:40:45.000000Z",
                "department": {
                    "id": 1,
                    "name": "DEPARTMENT OF HEALTH AND SANITATION"
                },
                "constituency": {
                    "id": 3,
                    "name": "Mosop"
                },
                "ward": {
                    "id": 10,
                    "name": "Chepterwai"
                }
            }
        ],
        "first_page_url": "http://nandi.test/api/projects?page=1",
        "from": 1,
        "last_page": 297,
        "last_page_url": "http://nandi.test/api/projects?page=297",
        "links": [
            {
                "url": null,
                "label": "« Previous",
                "active": false
            },
            {
                "url": "http://nandi.test/api/projects?page=1",
                "label": "1",
                "active": true
            }
        ],
        "next_page_url": "http://nandi.test/api/projects?page=2",
        "path": "http://nandi.test/api/projects",
        "per_page": 2,
        "prev_page_url": null,
        "to": 2,
        "total": 594
    }
}




Get Departments

Get a list of all project departments

Endpoint GET https://api.production.nandi.opencounty.org/api/departments

{
    "code": 200,
    "data": [
        {
            "id": 1,
            "name": "DEPARTMENT OF HEALTH AND SANITATION"
        },
        {
            "id": 2,
            "name": "DEPARTMENT OF TRANSPORT & INFRASTRUCTURE"
        },
        {
            "id": 3,
            "name": "DEPARTMENT OF EDUCATION AND VOCATIONAL TRAINING"
        }
    ]
}




Get Project Summary Stats

Get overall project summary statistics for the whole county

Endpoint GET https://api.production.nandi.opencounty.org/api/projects/summaries/{key}

Example GET https://api.production.nandi.opencounty.org/api/projects/summaries/status

Parameters

key => This is the key/indicator you want to report against. Supported keys include status and payment_status

Response Body

{
    "summaries": [
        {
            "status": "Canceled",
            "total": "999650.00",
            "count": 1,
            "percentage": 0.04
        },
        {
            "status": "Tendering stage",
            "total": "42123622.00",
            "count": 9,
            "percentage": 1.59
        }
    ],
    "trends": [
        {
            "year": "2017/2018",
            "total": "527469329.00",
            "count": 377,
            "percentage": 19.86,
            "status": [
                {
                    "status": "Not started",
                    "total": "1727506.00",
                    "count": 4,
                    "percentage_total": 0.33,
                    "percentage_count": 1.06
                },
                {
                    "status": "Incomplete",
                    "total": "71422045.00",
                    "count": 89,
                    "percentage_total": 13.54,
                    "percentage_count": 23.61
                }
            ]
        },
        {
            "year": "2018/2019",
            "total": "932206037.00",
            "count": 348,
            "percentage": 35.1,
            "status": [
                {
                    "status": "Canceled",
                    "total": "999650.00",
                    "count": 1,
                    "percentage_total": 0.11,
                    "percentage_count": 0.29
                },
                {
                    "status": "Tendering stage",
                    "total": "2000000.00",
                    "count": 2,
                    "percentage_total": 0.21,
                    "percentage_count": 0.57
                }
            ]
        },
        {
            "year": "2021/2022",
            "total": "124590022.00",
            "count": 38,
            "percentage": 4.69,
            "status": [
                {
                    "status": "Tendering stage",
                    "total": "37380000.00",
                    "count": 2,
                    "percentage_total": 30,
                    "percentage_count": 5.26
                },
                {
                    "status": "Ongoing",
                    "total": "60000000.00",
                    "count": 1,
                    "percentage_total": 48.16,
                    "percentage_count": 2.63
                }
            ]
        },
        {
            "year": "2019/2020",
            "total": "380156793.00",
            "count": 64,
            "percentage": 14.32,
            "status": [
                {
                    "status": "Completed",
                    "total": "13871900.00",
                    "count": 3,
                    "percentage_total": 3.65,
                    "percentage_count": 4.69
                },
                {
                    "status": "Not started",
                    "total": "1196882.00",
                    "count": 7,
                    "percentage_total": 0.31,
                    "percentage_count": 10.94
                }
            ]
        },
        {
            "year": "2020/2021",
            "total": "590223190.00",
            "count": 117,
            "percentage": 22.23,
            "status": [
                {
                    "status": "Tendering stage",
                    "total": "2743622.00",
                    "count": 5,
                    "percentage_total": 0.46,
                    "percentage_count": 4.27
                },
                {
                    "status": "Stalled",
                    "total": "2571970.00",
                    "count": 2,
                    "percentage_total": 0.44,
                    "percentage_count": 1.71
                }
            ]
        },
        {
            "year": "2020/2022",
            "total": "4607450.00",
            "count": 1,
            "percentage": 0.17,
            "status": [
                {
                    "status": "Incomplete",
                    "total": "4607450.00",
                    "count": 1,
                    "percentage_total": 100,
                    "percentage_count": 100
                }
            ]
        },
        {
            "year": "2018/20191",
            "total": "1996900.00",
            "count": 1,
            "percentage": 0.08,
            "status": [
                {
                    "status": "Complete",
                    "total": "1996900.00",
                    "count": 1,
                    "percentage_total": 100,
                    "percentage_count": 100
                }
            ]
        }
    ]
}




Get Project Summary Stats

Get overall project summary statistics for the whole county

Parameters

constituency_id => This is the id of the constituency that you want to get stats on

Obtain constituency ids from the https://api.production.nandi.opencounty.org/api/boundary

key => This is the key/indicator you want to report against. Supported keys include status, payment_status and year

Endpoint GET https://api.production.nandi.opencounty.org/api/projects/stats/{constituency_id}/{key}

Example GET https://api.production.nandi.opencounty.org/api/projects/stats/3/status

Response Body

{
    "code": 200,
    "data": [
        {
            "constituency": "Mosop",
            "constituency_id": 3,
            "total": "356925000.00",
            "count": 191,
            "percentage": 13.44,
            "trends": [
                {
                    "status": "Completed",
                    "total": "12918052.00",
                    "count": 13,
                    "percentage": 3.62,
                    "percentage_count": 6.81
                },
                {
                    "status": "Incomplete",
                    "total": "149286656.00",
                    "count": 64,
                    "percentage": 41.83,
                    "percentage_count": 33.51
                }
            ],
            "departments": [
                {
                    "name": "DEPARTMENT OF HEALTH AND SANITATION",
                    "total": "123620057.00",
                    "count": 30,
                    "percentage": 34.63,
                    "percentage_count": 15.71,
                    "trends": [
                        {
                            "status": "Completed",
                            "total": "12918052.00",
                            "count": 13,
                            "percentage": 10.45
                        },
                        {
                            "status": "Incomplete",
                            "total": "149286656.00",
                            "count": 64,
                            "percentage": 120.76
                        }
                    ]
                }
            ],
            "wards": [
                {
                    "ward_id": 10,
                    "ward": "Chepterwai",
                    "total": "89182733.00",
                    "count": 30,
                    "percentage": 24.99,
                    "percentage_count": 15.71,
                    "trends": [
                        {
                            "status": "Completed",
                            "total": "4253952.00",
                            "count": 2,
                            "percentage": 4.77
                        },
                        {
                            "status": "Incomplete",
                            "total": "76264315.00",
                            "count": 20,
                            "percentage": 85.51
                        }
                    ]
                },
                {
                    "ward_id": null,
                    "ward": null,
                    "total": "83384732.00",
                    "count": 54,
                    "percentage": 23.36,
                    "percentage_count": 28.27,
                    "trends": [
                        {
                            "status": "Complete",
                            "total": "55661648.00",
                            "count": 27,
                            "percentage": 66.75
                        },
                        {
                            "status": "Completed",
                            "total": "1597663.00",
                            "count": 2,
                            "percentage": 1.92
                        }
                    ]
                }
            ]
        }
    ]
}




Get Project Filters

Get a list of available project filters and their project counts

Endpoint GET https://api.production.nandi.opencounty.org/api/projects/filters

{
    "code": 200,
    "data": {
        "departments": [
            {
                "id": 1,
                "name": "DEPARTMENT OF HEALTH AND SANITATION",
                "projects_count": 183
            },
            {
                "id": 2,
                "name": "DEPARTMENT OF TRANSPORT & INFRASTRUCTURE",
                "projects_count": 270
            }
        ],
        "wards": [
            {
                "id": 1,
                "name": "Chepkumia",
                "projects_count": 12
            },
            {
                "id": 2,
                "name": "Kapkangani",
                "projects_count": 17
            }
        ],
        "constituencies": [
            {
                "id": 5,
                "name": "Aldai",
                "projects_count": 101
            },
            {
                "id": 2,
                "name": "Chesumei",
                "projects_count": 111
            }
        ],
        "years": [
            {
                "year": "2017/2018",
                "count": 232
            },
            {
                "year": "2018/2019",
                "count": 193
            }
        ],
        "statuses": [
            {
                "status": "Complete & operational",
                "count": 58
            },
            {
                "status": "Incomplete",
                "count": 100
            }
        ],
        "payment_statuses": [
            {
                "payment_status": "Fully paid",
                "count": 53
            },
            {
                "payment_status": "Not paid",
                "count": 85
            }
        ],
        "contractors": [
            {
                "contractor": "DASTNINE CO LTD",
                "count": 1
            },
            {
                "contractor": "KENORU INVESTMENT LIMITED",
                "count": 1
            }
        ]
    }
}




Get Indicator Data

Use this API to get report data for specific indicator

Endpoint GET https://api.production.nandi.opencounty.org/api/indicator/{indicator_index}

Example GET https://api.production.nandi.opencounty.org/api/indicator/4.2

{
    "code": 200,
    "data": {
        "indicator": {
            "id": 1,
            "sector_id": 1,
            "index": "6.1",
            "name": "SubCounty Agro-Ecological and Crop Enterprise",
            "description": null,
            "source": null,
            "created_at": "2022-05-27T07:31:37.000000Z",
            "updated_at": "2022-05-27T07:31:37.000000Z",
            "sector": {
                "id": 1,
                "name": "Agriculture"
            }
        },
        "data": []
    }
}




Get County About Details

Get about county details

Endpoint GET https://api.production.nandi.opencounty.org/api/about

{
    "code": 200,
    "data": {
        "name": "Nandi",
        "code": "29",
        "area": "2884",
        "population": {
            "year": "2019",
            "total": "885711",
            "male": "441259",
            "female": "444430"
        },
        "contacts": {
            "telephone": "254(0) 53-52621, 0535252355",
            "email": "info@nandi.go.ke",
            "website": "https://nandi.co.ke/",
            "address": "P.O Box 802-30300,  Box 331-30300, Kapsabet"
        },
        "about": "Nandi County is located in Rift Valley and constitutes 4 constituencies (Mosop, Aldai, Emgwen and Tinderet)."
    }
}




Get Budgets

Revenues

Get revenue sources data

Endpoint GET https://api.production.nandi.opencounty.org/api/budgets/revenue

To get revenue for specific period, add period as shown below

Endpoint GET https://api.production.nandi.opencounty.org/api/budgets/revenue/{period}

Example

Endpoint GET https://api.production.nandi.opencounty.org/api/budgets/revenue/2014-15

Expenditure

Get county expenditure data

Endpoint GET https://api.production.nandi.opencounty.org/api/budgets/expenditure




Get County Documents

Get county resources

Endpoint GET https://api.production.nandi.opencounty.org/api/documents

{
    "code": 200,
    "data": [
        {
            "id": 32,
            "user_id": null,
            "path": "32_62a31a800211e.pdf",
            "title": "County Government Reports 2018/2019 -Nandi County Assembly",
            "publisher": "",
            "description": "<P>County Government Reports 2018/2019 -Nandi County Assembly<Br></P>",
            "tags": "County,Government,Reports,2018,2019,Nandi,County,Assembly,County Government Reports 2018/2019 -Nandi County Assembly",
            "created_at": "2022-06-10T10:18:40.000000Z",
            "updated_at": "2022-06-10T10:19:02.000000Z",
            "url": "https://nandi-documents.s3.eu-west-2.amazonaws.com/nandi/32_62a31a800211e.pdf",
            "slug": "county-government-reports-20182019-nandi-county-assembly",
            "getTags": [
                "County",
                "Government",
                "Reports",
                "2018",
                "2019",
                "Nandi",
                "County",
                "Assembly",
                "County Government Reports 2018/2019 -Nandi County Assembly"
            ]
        },
        {
            "id": 33,
            "user_id": null,
            "path": null,
            "title": "County Government Reports 2018/2019 -Nandi County Executive",
            "publisher": "",
            "description": "<P>County Government Reports 2018/2019 -Nandi County Executive <Br></P>",
            "tags": "County,Government,Reports,2018,2019,Nandi,County,Executive,County Government Reports 2018/2019 -Nandi County Executive",
            "created_at": "2022-06-10T10:19:02.000000Z",
            "updated_at": "2022-06-10T10:19:02.000000Z",
            "url": "https://nandi-documents.s3.eu-west-2.amazonaws.com/nandi/",
            "slug": "county-government-reports-20182019-nandi-county-executive",
            "getTags": [
                "County",
                "Government",
                "Reports",
                "2018",
                "2019",
                "Nandi",
                "County",
                "Executive",
                "County Government Reports 2018/2019 -Nandi County Executive"
            ]
        }
    ]
}