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
1 change: 1 addition & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ Dates are Philippine time (UTC+8). See [MILESTONES.md](MILESTONES.md) for the bi
- 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
- v1 and v2 are both labeled **beta**: the docs picker shows "v1 (beta)" and "v2 (beta)", each OpenAPI title says "(beta)", and `GET /` and `GET /v2/` have `"status": "beta"` (v2 was "preview"). `GET /` also gets `"apiVersion": "v1"`. Nothing else changes: same links, same data.
- `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)
Expand Down
2 changes: 1 addition & 1 deletion MAINTAINING.md
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ 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.
**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 until a stop date agreed with the app team. Both v1 and v2 are labeled **beta** (docs picker, OpenAPI title, `status` in `GET /` and `GET /v2/`). 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:

Expand Down
1 change: 1 addition & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ Financial help, hospitals, specialists, support groups and news, as JSON with a

[![Validate and deploy data](https://github.com/ProjectFuritsu/CancerOpenData/actions/workflows/deploy-data.yml/badge.svg)](https://github.com/ProjectFuritsu/CancerOpenData/actions/workflows/deploy-data.yml)
[![API](https://img.shields.io/badge/API-live-2ea44f)](https://cancer-open-data.capillanesjohnfritz.workers.dev/)
[![Status: beta](https://img.shields.io/badge/status-beta-orange)](CHANGELOG.md)
[![OpenAPI 3.1](https://img.shields.io/badge/OpenAPI-3.1-6BA539?logo=openapiinitiative&logoColor=white)](https://cancer-open-data.capillanesjohnfritz.workers.dev/openapi.json)
[![JSON Schema](https://img.shields.io/badge/JSON%20Schema-2020--12-blue)](https://json-schema.org/draft/2020-12)
[![Cloudflare Workers](https://img.shields.io/badge/hosted%20on-Cloudflare%20Workers-F38020?logo=cloudflare&logoColor=white)](https://developers.cloudflare.com/workers/static-assets/)
Expand Down
14 changes: 11 additions & 3 deletions scripts/build-openapi.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,17 @@ const DESCRIPTIONS = {
};

const INTRO = {
v1: { title: "Cancer Open Data API", note: [] },
v1: {
title: "Cancer Open Data API (beta)",
note: [
"**Beta.** The API can still change. Version 1 is frozen: new and corrected data goes to version 2 at `/v2/`. Version 1 stays at the same links until a stop date is announced.",
"",
],
},
v2: {
title: "Cancer Open Data API v2 (preview)",
title: "Cancer Open Data API v2 (beta)",
note: [
"**Preview of version 2.** The data shape can still change before release. Version 1 stays at the same links.",
"**Beta.** Version 2 is the main version, but its data shape can still change. Version 1 stays at the same links.",
"- **New in v2:** office `branches` with their own hours and contacts, lists of `sources` and `cancerTypes`, a `meta` block with `lastUpdated` in each file, benefit `amount`, clinic `bookingType`, and `eligibility` as a list. No loan programs; PCSO and DOH added.",
"- **A `null`, empty text or empty list means \"Not given\".**",
"",
Expand Down Expand Up @@ -88,6 +94,8 @@ export function buildOpenApi(datasets, schemas, version, { apiVersion = "v1" } =
required: ["name", "version", "datasets"],
properties: {
name: { type: "string" },
apiVersion: { type: "string", description: "Which API version this list is for." },
status: { type: "string", description: "Release status of this API version, for example beta." },
about: { type: "string" },
source: { type: "string", format: "uri" },
version: { type: "string", description: "The Git commit that is live." },
Expand Down
11 changes: 7 additions & 4 deletions scripts/build-site.mjs
Original file line number Diff line number Diff line change
Expand Up @@ -82,6 +82,8 @@ const v1 = collect(DATA, OUT, "");
writeFileSync(join(OUT, "index.json"), JSON.stringify({
name: "Cancer Open Data",
about: "Public data on cancer care resources in one place. Each dataset has a JSON data file and a JSON Schema.",
apiVersion: "v1",
status: "beta",
source: SOURCE,
version,
docs: "/docs/",
Expand All @@ -91,16 +93,17 @@ writeFileSync(join(OUT, "index.json"), JSON.stringify({
}, null, 2) + "\n");
writeFileSync(join(OUT, "openapi.json"), JSON.stringify(buildOpenApi(v1.list, v1.schemas, version), null, 2) + "\n");

// ---- v2: data-v2/ under /v2/ (preview until it is released) ----
const docVersions = [{ id: "v1", label: "v1 (current)", spec: "/openapi.json" }];
// ---- v2: data-v2/ under /v2/ ----
// Both versions are labeled beta (2026-11-27): the API can still change.
const docVersions = [{ id: "v1", label: "v1 (beta)", spec: "/openapi.json" }];
let v2 = null;
if (existsSync(DATA_V2)) {
const V2_OUT = join(OUT, "v2");
v2 = collect(DATA_V2, V2_OUT, "/v2");
writeFileSync(join(V2_OUT, "index.json"), JSON.stringify({
name: "Cancer Open Data",
apiVersion: "v2",
status: "preview",
status: "beta",
about: "Version 2 of the data: branches, sources, cancer types, amounts and booking type. A null or empty value means \"Not given\".",
source: SOURCE,
version,
Expand All @@ -110,7 +113,7 @@ if (existsSync(DATA_V2)) {
datasets: v2.list,
}, null, 2) + "\n");
writeFileSync(join(V2_OUT, "openapi.json"), JSON.stringify(buildOpenApi(v2.list, v2.schemas, version, { apiVersion: "v2" }), null, 2) + "\n");
docVersions.push({ id: "v2", label: "v2 (preview)", spec: "/v2/openapi.json" });
docVersions.push({ id: "v2", label: "v2 (beta)", spec: "/v2/openapi.json" });
}

let images = 0;
Expand Down