npm package discovery and stats viewer.

Discover Tips

  • General search

    [free text search, go nuts!]

  • Package details

    pkg:[package-name]

  • User packages

    @[username]

Sponsor

Optimize Toolset

I’ve always been into building performant and accessible sites, but lately I’ve been taking it extremely seriously. So much so that I’ve been building a tool to help me optimize and monitor the sites that I build to make sure that I’m making an attempt to offer the best experience to those who visit them. If you’re into performant, accessible and SEO friendly sites, you might like it too! You can check it out at Optimize Toolset.

About

Hi, 👋, I’m Ryan Hefner  and I built this site for me, and you! The goal of this site was to provide an easy way for me to check the stats on my npm packages, both for prioritizing issues and updates, and to give me a little kick in the pants to keep up on stuff.

As I was building it, I realized that I was actually using the tool to build the tool, and figured I might as well put this out there and hopefully others will find it to be a fast and useful way to search and browse npm packages as I have.

If you’re interested in other things I’m working on, follow me on Twitter or check out the open source projects I’ve been publishing on GitHub.

I am also working on a Twitter bot for this site to tweet the most popular, newest, random packages from npm. Please follow that account now and it will start sending out packages soon–ish.

Open Software & Tools

This site wouldn’t be possible without the immense generosity and tireless efforts from the people who make contributions to the world and share their work via open source initiatives. Thank you 🙏

© 2026 – Pkg Stats / Ryan Hefner

ph-schools

v1.0.3

Published

Search and filter Philippine school records with simple TypeScript and JavaScript helpers.

Readme

ph-schools

Quickly find and search Philippine school records in your app.

ph-schools includes ready-to-use school data (SY 2020-2021) and simple helpers for BEIS ID lookup, filtering, and search in both TypeScript and JavaScript.

📦 Install

npm install ph-schools

📜 Changelog

  • See CHANGELOG.md for release notes and migration updates.

🏛️ Data Source

  • Source organization: gov.ph 🇵🇭
  • Source dataset: SY 2020-2021 Masterlist of Schools 🏫
  • Canonical dataset repo: darwinphi/ph-schools-dataset 📚
  • Pinned data release tag used by this library: v1.0.1 (via data-source.json) 🧷
  • Embedded source filename in generated output: schools_masterlist_2020_2021.json 🗂️

🔷 Usage (TypeScript)

import {
  getAllSchools,
  findByBeisId,
  searchSchools,
  type PaginationOptions,
  type SchoolRecord,
  type SearchOptions,
} from 'ph-schools';

const school: SchoolRecord | undefined = findByBeisId('100001');

const options: SearchOptions = {
  fields: ['schoolName', 'barangay'],
  page: 1,
  pageSize: 10,
};
const matches: SchoolRecord[] = searchSchools('bacarra', options);
const page2: readonly SchoolRecord[] = getAllSchools({ page: 2, pageSize: 5 });
const pagination: PaginationOptions = { page: 3, pageSize: 20 };
const page3Matches: SchoolRecord[] = searchSchools('region i', pagination);

console.log(school?.schoolName);
console.log(matches.length);
console.log(page2.length);
console.log(page3Matches.length);

⚡ Usage (JavaScript ESM)

import {
  schools,
  getAllSchools,
  findByBeisId,
  filterSchools,
  searchSchools,
  dataVersion,
} from 'ph-schools';

const one = findByBeisId('100001');
const regionPublicPage1 = filterSchools(
  { region: 'Region I', sector: 'Public' },
  { page: 1, pageSize: 25 },
);
const matchesPage2 = searchSchools('bacarra', { page: 2, pageSize: 10 });
const allPage3 = getAllSchools({ page: 3, pageSize: 100 });

console.log(schools.length);
console.log(regionPublicPage1.length);
console.log(matchesPage2.length);
console.log(allPage3.length);
console.log(dataVersion.sourceOrganization);

🧩 Usage (CommonJS)

const {
  schools,
  findByBeisId,
  filterSchools,
  searchSchools,
  dataVersion,
} = require('ph-schools');

console.log(findByBeisId('100001'));
console.log(dataVersion);

🛠️ API

  • schools: readonly SchoolRecord[]
  • getAllSchools(options?: PaginationOptions): readonly SchoolRecord[]
  • findByBeisId(beisId: string): SchoolRecord | undefined
  • filterSchools(criteria: Partial<Omit<SchoolRecord, "raw">>, options?: PaginationOptions): SchoolRecord[]
  • searchSchools(query: string, options?: { fields?: SearchableField[]; page?: number; pageSize?: number }): SchoolRecord[]
  • PaginationOptions: { page?: number; pageSize?: number }
  • dataVersion: { packageVersion: string; schoolYear: "2020-2021"; sourceFile: string; sourceOrganization: "gov.ph"; recordCount: number }

🔁 Data Update (Maintainers)

When the dataset repo publishes a new tag:

  1. Update data-source.json (tag and sha256)
  2. Regenerate and test:
    • npm run build
    • npm test
  3. Release npm package:
    • npm version patch (or minor / major)
    • git push
    • git push --tags

📝 Notes

  • The runtime package uses generated embedded data built from a pinned release in ph-schools-dataset
  • Build command regenerates embedded data before bundling 🔁
  • Set PH_SCHOOLS_DATA_PATH=/path/to/local.json to generate from a local override dataset for development 🛠️
  • Runtime guards are included for JavaScript callers:
    • findByBeisId(nonString) returns undefined
    • searchSchools(nonStringQuery) returns []
    • filterSchools(nonObject) returns []
    • filterSchools({}) and filterSchools({ region: undefined }) return all schools
    • Unknown filterSchools keys or invalid searchSchools fields safely return []
    • Invalid pagination values fall back to page: 1, pageSize: 50
  • Exported school records are frozen to prevent accidental mutation