MarkMatute / ph-geo-admin-divisions

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool


ph-geo-admin-divisions

focuses on the geographic and administrative divisions of the Philippines up to barranggay level
Explore the docs »

Getting Started

A library that enables search using an updated collection of Philippines Geo Administrative divisions.

Data Models

Region

{
  "psgcId": "0100000000",
  "name": "Region I (Ilocos Region)",
  "geoLevel": "Reg",
  "regionId": "01",
  "provinceId": "000",
  "municipalityId": "00",
  "baranggayId": "000"
}

Province

{
  "psgcId": "0102800000",
  "name": "Ilocos Norte",
  "geoLevel": "Prov",
  "regionId": "01",
  "provinceId": "028",
  "municipalityId": "00",
  "baranggayId": "000"
}

Municipality

{
  "psgcId": "0102801000",
  "name": "Adams",
  "geoLevel": "Mun",
  "regionId": "01",
  "provinceId": "028",
  "municipalityId": "01",
  "baranggayId": "000"
}

Baranggay

{
  "psgcId": "0102801001",
  "name": "Adams (Pob.)",
  "geoLevel": "Bgy",
  "regionId": "01",
  "provinceId": "028",
  "municipalityId": "01",
  "baranggayId": "001"
}

Usage

Listing Records

const allRegions = await searchRegion();
const allProvinces = await searchProvince();
const allMunicipalities = await searchMunicipalities();
const allBaranggays = await searchBaranggays();

Listing Parameters

interface SearchParams {
  name?: string;
  regionId?: string;
  provinceId?: string;
  municipalityId?: string;
  baranggayId?: string;
}

check test.spec.ts for more usage.

Special Handling for NCR

National Capital Region is manually added to the province list, catering for this special need to complete the flow of searching province, municipality then baranggay, this eliminates the process of searching Regions etc.

License

Distributed under the MIT License. See LICENSE for more information.

Contact

Mark Ernest R. Matute- linkedin - markernest.matute@gmail.com

(back to top)

About

License:MIT License


Languages

Language:TypeScript 100.0%Language:JavaScript 0.0%