Documentation Guide

A comprehensive guide to understanding Philippine geographic data, ingestion workflows, and API usage.

Interactive Demo

Test the cascading data retrieval system. Select a region to drill down all the way to the barangay level.

Sample Form

10-Digit PSGC Structure

The system follows the 2024 Revision 1 of the Philippine Standard Geographic Code (PSGC). All codes are consistently padded to 10 digits to ensure compatibility across all levels.

Region

RR00000000

2-digit Region + 8 Zeros

Province/District

RRPRO00000

2-digit Reg + 3-digit Prov + 5 Zeros

City/Municipality

RRPROCM000

Reg/Prov + 2-digit City + 3 Zeros

Barangay

RRPROCMBRG

Full 10-digit unique identifier

Sourcing the Data

To update the dataset, you must obtain the official files from the Philippine Statistics Authority (PSA).

  1. Visit the PSA PSGC Portal.
  2. Download the latest PSGC Publication (Excel) file.
  3. Ensure the file contains the PSGC sheet with the 10-digit coding columns.

Ingestion Workflow

Verified Admin Upload

The backend features a resilient ingestion engine that automatically identifies columns, cleans messy data, and performs safe atomic upserts to prevent database corruption.

Whenever a new file is uploaded via the /admin dashboard:

  • The database is updated with the latest codes and names.
  • The Redis cache is automatically flushed to ensure fresh data.
  • Static SQL, CSV, and JSON dumps are regenerated for direct download.

Integrate into your Project

Ready to use the Geographic API in your application? Use the snippets below to get started quickly with your favorite language or tool.

curl -X GET "https://barangays.sanchez.ph/api/regions/0300000000/provinces" \
     -H "Accept: application/json"