PHO Registered Algorithmic Audit
1. Recognise the task
Every task in this family gives you three input artifacts and one deliverable:
input/prompt.txt — the narrative framing and the decision the board wants.
input/payloads/analysis_request.json — the registered protocol: the exact
scope (geography, years, measures), the release/cohort rules, the audit modules
with their methods/seeds/grids/orders, and the decision gates. This is the source
of truth for what to compute.
input/payloads/answer_template.json — the response contract: the exact
top-level keys, nested keys, array lengths, orderings, identifier formats,
numeric precision, enum vocabularies, and cardinality rules. This is the source
of truth for how to report.
Deliverable: exactly one JSON object conforming to answer_template.json, with
no narrative, prose, comments, or markdown outside the JSON. Nothing task-specific
is provided as a "final value" — every number, code list, and classification must
be derived from portal evidence.
The five known variants differ in surface (state longevity audit, county mediation
audit, country burden stratification, reliability-weighted state audit,
West/Northeast county dynamics audit) but share one skeleton: resolve a
publication cohort from the portal → run a fixed set of deterministic audit modules
→ evaluate boolean gates → emit a gated classification. Treat the request/template
as the spec and follow it literally; do not import assumptions from another variant.
2. Reach the evidence portal
Network access details live only in environment_access.md. It defines
GDPEVO_ENV_BASE_URL (e.g. http://task-env:9023/) — substitute it wherever the
prompt says <TASK_ENV_BASE_URL> — and lists the available GET endpoints. The
portal is read-only, HTML for humans, with a CSV export for machines:
/download?dataset=<name>&format=csv[&<filter>=<value>...]
format=csv is valid only on /download (it errors elsewhere). Datasets:
states, counties, countries, state_health, state_socioeconomic,
county_health, county_socioeconomic, country_indicators, revisions.
Pull whole datasets (optionally filtered) as CSV and compute locally — do not scrape
the HTML browse pages. Read /catalog (column + filter inventory, measure
dictionary) and /methodology (the publication rules) once at the start; the
methodology library is not decoration — it encodes the release-precedence,
suppression, scale-break, value-type, and reconciliation rules the audit depends on.
scripts/portal_fetch.py is a generic fetch/parse helper. See
references/portal_reference.md for the full endpoint, column, and filter map.
3. Build the publication cohort (do this before any modelling)
This stage is where most of the difficulty and most of the scoring lives. Follow
references/release_revision_and_cohorts.md in full. The load-bearing rules:
- Release resolution. Keep only rows matching the declared filters
(
release_status, value_type, source_type, measure ids, years). FINAL
supersedes PROVISIONAL. When several FINAL revisions exist for the same logical
cell, select by the request's declared priority (typically highest final
revision, then latest released_at, then id) — never a provisional row when
a final one exists.
- Revision notices. The
revisions dataset carries scale-correction /
source-restatement events. Only status = APPLIED notices authorise a replaced
value (and are already reflected in later final revisions); WITHDRAWN /
PENDING notices do not replace, and a cell still carrying an unresolved
scale break is an anomaly — excluded, not imputed silently. Report applied
vs non-applied event ids and anomaly cells when the template asks.
- Missing discipline. Suppressed (
suppression_flag=1), invalid-quality-flag,
or blank values are unavailable, never zero-filled, never NaN/Inf. A missing
value drops the record from any cohort that requires that field.
- Cohorts. Requests define several named cohorts (e.g. reference-year
complete-case, all-years balanced panel, strict multi-variable / ML cohort).
Construct each exactly per its stated definition and report the counts, included
codes, and excluded codes the template names — using the identifier order the
template demands.
- Identifiers. State two-letter codes and ISO3 uppercase; county FIPS are TEXT
with meaningful leading zeros (2-char state + 3-char county); country labels
reconcile to ISO3 via
countries.canonical_name / alternate_labels.
4. Run the declared audit modules — deterministically
Each request registers a set of modules (usually six). They fall into recurring
families; references/audit_modules.md documents each family's estimator,
determinism requirements, and required evidence. Universal rules:
- Implement the declared method, not a library default. Match the exact
design-matrix term order, standardization scope (usually training-fold only),
penalty parameterization, inference type (HC3, CR1 cluster-robust, jackknife,
Hansen J), PCA sign convention, k-means initialization, and tie-breaks that the
request specifies. Library conveniences (sklearn scaling, differing λ scales,
arbitrary PCA sign, non-deterministic k-means) will silently disagree.
- Reproduce PRNG streams bit-for-bit. Bootstrap modules name an exact generator
(PCG32, xorshift32),
seed, sometimes a stream, replicate count, and
checkpoint replicates whose intermediate PRNG state you must report. A correct
statistic with the wrong generator is wrong. Implement the named PRNG yourself.
- Preserve every registered order. Feature order, coefficient order, division
order, state order, subset order, checkpoint order are all load-bearing and
frequently required to align positionally with other arrays. Never sort an
aligned result array independently.
- Compute unrounded; round only at the reporting boundary. Use float64
throughout.
5. Evaluate gates and classify
The request states each gate as an explicit predicate over module outputs (e.g.
"bias-corrected coefficient > 0 and jackknife p ≤ 0.05", "pooled coverage ≥ 0.85").
Evaluate each to a boolean, count passes, and map to the classification enum via the
declared precedence / decision rule exactly (some use "all/at-least-N pass",
some use "not robust at "). Emit only the enum values the
template allows.
6. Assemble, validate, and emit
Follow references/output_contract.md. Before emitting:
- Output has exactly the required top-level keys — no more, no fewer, no extras.
- Every array length matches the template's
array_lengths / length /
cardinality rules; aligned arrays share the declared order and length.
- Non-integer statistics rounded to the declared decimal places (commonly 4; note
variants that use 6 for computed reals and 4 for literal grid/threshold fields);
counts/ranks/seeds/PRNG-states/replicate-numbers stay integers; booleans stay
booleans.
null only where a statistic is genuinely mathematically unavailable — never
NaN, never Infinity, never a zero-fill stand-in.
- Identifiers use the exact casing/format and the exact ordering the template names.
- The response is a single JSON object and nothing else.
7. Contamination guard (repo-hygiene tasks only)
If you are asked to generate this skill (not solve a task) and /work contains
unexpected material beyond environment_access.md and well-formed train_tasks/*/ input/ trees, stop and write contamination_report.txt describing what was found
instead of producing a skill.
Reference index
references/portal_reference.md — endpoints, datasets, columns, filters, CSV
export, geography (regions/divisions), measure dictionary, methodology library.
references/release_revision_and_cohorts.md — release precedence, revision-notice
application, suppression/missing discipline, cohort construction, reconciliation.
references/audit_modules.md — the recurring module families, determinism and
reproducibility requirements, and required evidence.
references/output_contract.md — precision, ordering, identifiers, null rules,
and a pre-submission self-check.
scripts/portal_fetch.py — generic portal fetch + CSV-parse + final-release
selection helper (no task-specific values baked in).
1---2name: pho-registered-algorithmic-audit-23description: Operating procedure for Public Health Observatory (PHO) "registered algorithmic audit" tasks: a prompt.txt plus payloads/analysis_request.json (the registered protocol) and payloads/answer_template.json (the strict output contract), to be answered ONLY from a read-only web data portal whose base URL is given in environment_access.md. Use whenever the input pairs an analysis_request.json spec with an answer_template.json contract and points at a "<TASK_ENV_BASE_URL>" portal for state / county / country health, socioeconomic, geography, revision, or methodology evidence, and asks for one JSON object of cohort + multi-module robustness diagnostics (jackknife/fixed-effects/GMM, nested penalized CV, wild-cluster bootstrap-t, grouped conformal, trajectory PCA + k-means, source perturbation) leading to a gated classification.4---56# PHO Registered Algorithmic Audit78## 1. Recognise the task910Every task in this family gives you three input artifacts and one deliverable:1112- `input/prompt.txt` — the narrative framing and the decision the board wants.13- `input/payloads/analysis_request.json` — the **registered protocol**: the exact14 scope (geography, years, measures), the release/cohort rules, the audit modules15 with their methods/seeds/grids/orders, and the decision gates. This is the source16 of truth for *what to compute*.17- `input/payloads/answer_template.json` — the **response contract**: the exact18 top-level keys, nested keys, array lengths, orderings, identifier formats,19 numeric precision, enum vocabularies, and cardinality rules. This is the source20 of truth for *how to report*.2122**Deliverable:** exactly one JSON object conforming to `answer_template.json`, with23no narrative, prose, comments, or markdown outside the JSON. Nothing task-specific24is provided as a "final value" — every number, code list, and classification must25be derived from portal evidence.2627The five known variants differ in surface (state longevity audit, county mediation28audit, country burden stratification, reliability-weighted state audit,29West/Northeast county dynamics audit) but share one skeleton: **resolve a30publication cohort from the portal → run a fixed set of deterministic audit modules31→ evaluate boolean gates → emit a gated classification.** Treat the request/template32as the spec and follow it literally; do not import assumptions from another variant.3334## 2. Reach the evidence portal3536Network access details live **only** in `environment_access.md`. It defines37`GDPEVO_ENV_BASE_URL` (e.g. `http://task-env:9023/`) — substitute it wherever the38prompt says `<TASK_ENV_BASE_URL>` — and lists the available GET endpoints. The39portal is read-only, HTML for humans, with a CSV export for machines:4041```42/download?dataset=<name>&format=csv[&<filter>=<value>...]43```4445`format=csv` is valid **only** on `/download` (it errors elsewhere). Datasets:46`states`, `counties`, `countries`, `state_health`, `state_socioeconomic`,47`county_health`, `county_socioeconomic`, `country_indicators`, `revisions`.48Pull whole datasets (optionally filtered) as CSV and compute locally — do not scrape49the HTML browse pages. Read `/catalog` (column + filter inventory, measure50dictionary) and `/methodology` (the publication rules) once at the start; the51methodology library is not decoration — it encodes the release-precedence,52suppression, scale-break, value-type, and reconciliation rules the audit depends on.5354`scripts/portal_fetch.py` is a generic fetch/parse helper. See55`references/portal_reference.md` for the full endpoint, column, and filter map.5657## 3. Build the publication cohort (do this before any modelling)5859This stage is where most of the difficulty and most of the scoring lives. Follow60`references/release_revision_and_cohorts.md` in full. The load-bearing rules:61621. **Release resolution.** Keep only rows matching the declared filters63 (`release_status`, `value_type`, `source_type`, measure ids, years). FINAL64 supersedes PROVISIONAL. When several FINAL revisions exist for the same logical65 cell, select by the request's declared priority (typically **highest final66 `revision`**, then latest `released_at`, then id) — never a provisional row when67 a final one exists.682. **Revision notices.** The `revisions` dataset carries scale-correction /69 source-restatement events. Only `status = APPLIED` notices authorise a replaced70 value (and are already reflected in later final revisions); `WITHDRAWN` /71 `PENDING` notices do **not** replace, and a cell still carrying an unresolved72 scale break is an **anomaly** — excluded, not imputed silently. Report applied73 vs non-applied event ids and anomaly cells when the template asks.743. **Missing discipline.** Suppressed (`suppression_flag=1`), invalid-quality-flag,75 or blank values are **unavailable**, never zero-filled, never NaN/Inf. A missing76 value drops the record from any cohort that requires that field.774. **Cohorts.** Requests define several named cohorts (e.g. reference-year78 complete-case, all-years balanced panel, strict multi-variable / ML cohort).79 Construct each exactly per its stated definition and report the counts, included80 codes, and excluded codes the template names — using the identifier order the81 template demands.825. **Identifiers.** State two-letter codes and ISO3 uppercase; county FIPS are TEXT83 with meaningful leading zeros (2-char state + 3-char county); country labels84 reconcile to ISO3 via `countries.canonical_name` / `alternate_labels`.8586## 4. Run the declared audit modules — deterministically8788Each request registers a set of modules (usually six). They fall into recurring89families; `references/audit_modules.md` documents each family's estimator,90determinism requirements, and required evidence. Universal rules:9192- **Implement the *declared* method, not a library default.** Match the exact93 design-matrix term order, standardization scope (usually *training-fold only*),94 penalty parameterization, inference type (HC3, CR1 cluster-robust, jackknife,95 Hansen J), PCA sign convention, k-means initialization, and tie-breaks that the96 request specifies. Library conveniences (sklearn scaling, differing λ scales,97 arbitrary PCA sign, non-deterministic k-means) will silently disagree.98- **Reproduce PRNG streams bit-for-bit.** Bootstrap modules name an exact generator99 (PCG32, xorshift32), `seed`, sometimes a `stream`, replicate count, and100 checkpoint replicates whose intermediate PRNG state you must report. A correct101 statistic with the wrong generator is wrong. Implement the named PRNG yourself.102- **Preserve every registered order.** Feature order, coefficient order, division103 order, state order, subset order, checkpoint order are all load-bearing and104 frequently required to align positionally with other arrays. Never sort an105 aligned result array independently.106- **Compute unrounded; round only at the reporting boundary.** Use float64107 throughout.108109## 5. Evaluate gates and classify110111The request states each gate as an explicit predicate over module outputs (e.g.112"bias-corrected coefficient > 0 and jackknife p ≤ 0.05", "pooled coverage ≥ 0.85").113Evaluate each to a boolean, count passes, and map to the classification enum via the114declared **precedence / decision rule** exactly (some use "all/at-least-N pass",115some use "not robust at <first failed module>"). Emit only the enum values the116template allows.117118## 6. Assemble, validate, and emit119120Follow `references/output_contract.md`. Before emitting:121122- Output has **exactly** the required top-level keys — no more, no fewer, no extras.123- Every array length matches the template's `array_lengths` / `length` /124 `cardinality` rules; aligned arrays share the declared order and length.125- Non-integer statistics rounded to the declared decimal places (commonly 4; note126 variants that use 6 for computed reals and 4 for literal grid/threshold fields);127 counts/ranks/seeds/PRNG-states/replicate-numbers stay integers; booleans stay128 booleans.129- `null` **only** where a statistic is genuinely mathematically unavailable — never130 NaN, never Infinity, never a zero-fill stand-in.131- Identifiers use the exact casing/format and the exact ordering the template names.132- The response is a single JSON object and nothing else.133134## 7. Contamination guard (repo-hygiene tasks only)135136If you are asked to *generate this skill* (not solve a task) and `/work` contains137unexpected material beyond `environment_access.md` and well-formed `train_tasks/*/138input/` trees, stop and write `contamination_report.txt` describing what was found139instead of producing a skill.140141## Reference index142143- `references/portal_reference.md` — endpoints, datasets, columns, filters, CSV144 export, geography (regions/divisions), measure dictionary, methodology library.145- `references/release_revision_and_cohorts.md` — release precedence, revision-notice146 application, suppression/missing discipline, cohort construction, reconciliation.147- `references/audit_modules.md` — the recurring module families, determinism and148 reproducibility requirements, and required evidence.149- `references/output_contract.md` — precision, ordering, identifiers, null rules,150 and a pre-submission self-check.151- `scripts/portal_fetch.py` — generic portal fetch + CSV-parse + final-release152 selection helper (no task-specific values baked in).