Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ Dates are Philippine time (UTC+8). See [MILESTONES.md](MILESTONES.md) for the bi
- AMUMA: removed the landline (082) 295-2133. PhilHealth's official directory lists it as PhilHealth Regional Office XI's trunkline.
- SSS (Financial #2): `bgImageURL` is now empty. The old link (https://www.sss.gov.ph/sss/images/SSS_Building.jpg) returns 404 (checked 2026-11-27). Apps show no background image until an official one is found.

### Repo: v2 is the main version
- `data-v2/` is now the source of truth: v2 is edited directly, and validate and the Worker tests require it. `data/` (v1) is frozen and stays online read-only until a stop date is agreed. `scripts/convert-v2.mjs` is frozen (it stops unless run with `--unfreeze`); its last run after PR #18 changed nothing.

### v2 (in development, not public)
A new data shape, to be served at `/v2/…` next to v1. Not live yet; v1 is unchanged by it.
- Institutions get `branches` (address, map point, hours and contacts per office).
Expand Down
2 changes: 2 additions & 0 deletions MAINTAINING.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,6 +68,8 @@ The smoke test fetches every file from the public URL and checks status `200`, t

## Changing the data

**v2 is the source of truth (since 2026-11-27).** Edit `data-v2/` and its schemas directly. `data/` (v1) and `scripts/convert-v2.mjs` are frozen: v1 stays online read-only, marked deprecated, until a stop date agreed with the app team. The converter stops unless run with `--unfreeze`, because a re-run would undo v2 edits. Validate and the Worker tests fail if `data-v2/` is missing.

Check locally before you push:

```bash
Expand Down
8 changes: 8 additions & 0 deletions scripts/convert-v2.mjs
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
// FROZEN since 2026-11-27. v2 is the source of truth: edit data-v2/ and its
// schemas directly. A re-run would overwrite those edits with v1, so the script
// stops unless --unfreeze is given. The last run (after PR #18) changed nothing.
//
// Converts the v1 data in data/ to the v2 shape in data-v2/.
// Values are copied as written. Nothing is guessed: a value the v1 data
// doesn't have becomes null or an empty list ("Not given" in apps).
Expand All @@ -13,6 +17,10 @@ import { join } from "node:path";
import { execFileSync } from "node:child_process";

const args = process.argv.slice(2);
if (!args.includes("--unfreeze")) {
console.error("convert-v2.mjs is frozen (2026-11-27): edit data-v2/ directly. A re-run would undo v2 edits. Use --unfreeze only to compare.");
process.exit(1);
}
const provDir = args.includes("--provenance") ? args[args.indexOf("--provenance") + 1] : null;

const read = (p) => JSON.parse(readFileSync(p, "utf8"));
Expand Down
2 changes: 2 additions & 0 deletions scripts/validate.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,8 @@ import {

const DATA_DIR = "data";
// v2 data (served at /v2/) lives in data-v2/ with the same layout and rules.
// v2 is the main version since 2026-11-27, so data-v2/ must exist. v1 (data/) is frozen.
if (!existsSync("data-v2")) { console.error("FAIL data-v2/ is missing: v2 is the main version"); process.exit(1); }
const DATA_DIRS = [DATA_DIR, "data-v2"].filter(d => existsSync(d));
const datasetDirs = () => DATA_DIRS.flatMap(base =>
readdirSync(base, { withFileTypes: true }).filter(f => f.isDirectory()).map(f => join(base, f.name)));
Expand Down
5 changes: 3 additions & 2 deletions worker/test/worker.test.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -93,8 +93,9 @@ execFileSync("node", ["scripts/build-site.mjs"], { cwd: root, stdio: "inherit",
rmSync(imgDir, { recursive: true, force: true });
const index = JSON.parse(readFileSync(join(here, "..", "dist", "index.json"), "utf8"));
const files = index.datasets.flatMap(d => [d.data, d.schema]).map(p => p.slice(1));
// v2 is built only when data-v2/ exists; its tests run only then.
const hasV2 = existsSync(join(root, "data-v2"));
// v2 is the main version since 2026-11-27: data-v2/ must exist, so its tests always run.
if (!existsSync(join(root, "data-v2"))) throw new Error("data-v2/ is missing: v2 is the main version");
const hasV2 = true;
const indexV2 = hasV2 ? JSON.parse(readFileSync(join(here, "..", "dist", "v2", "index.json"), "utf8")) : null;
const filesV2 = hasV2 ? indexV2.datasets.flatMap(d => [d.data, d.schema]).map(p => p.slice(1)) : [];

Expand Down