1.0.6 • Published 1 year ago

ph-geo-admin-divisions v1.0.6

Weekly downloads
-
License
ISC
Repository
github
Last release
1 year ago

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