PHO Algorithmic Audit Skill
Execute registered Public Health Observatory algorithmic audits from an
analysis_request.json contract through the PHO read-only web portal.
Quick start
- Read the analysis request and answer template.
- Resolve every
TASK_ENV_BASE_URL or explicit URL to the PHO portal root.
- Fetch
/catalog and relevant geography listings.
- For each requested dataset and measure, fetch data using the request's
filter, value-type, and release-status specifications.
- Select the single best record per entity-time-measure key using revision,
then release timestamp, then record-id precedence (descending).
- Construct the requested cohorts from completeness predicates.
- Execute each audit module in the declared order, following its exact
reusable method profile (see references/statistical_modules.md).
- Apply the protocol override system when a protocol registry record is
present (see references/protocol_system.md).
- Evaluate every robustness gate on unrounded values and apply the
controlled decision rule.
- Return one JSON object matching the answer template exactly.
Portal API
See references/api_endpoints.md for the full
endpoint catalog, query-parameter conventions, and response shapes.
The PHO portal is a read-only HTTP REST API. No credentials are required.
All data endpoints return JSON arrays. Key endpoints:
GET / - Portal root
GET /catalog - Full dataset, measure, and geography catalog
GET /geographies/states - U.S. state code listing
GET /geographies/counties - U.S. county listing
GET /geographies/countries - Country listing
GET /data/state-health - State-level health indicators
GET /data/state-socioeconomic - State-level socioeconomic data
GET /data/county-health - County-level health indicators
GET /data/county-socioeconomic - County-level socioeconomic data
GET /data/country-indicators - Country-level burden and outcome indicators
GET /data/revisions - Revision event log
GET /methodology - Methodology documentation
GET /download - Bulk data download
Data resolution
See references/data_resolution.md for the
complete record-selection, filtering, revision-precedence, and cohort-
construction rules.
Record selection precedence
For every entity-time-measure key, choose exactly one publication record
using this ordered comparison, preferring the greater value at each step:
- Highest
revision
- Latest
released_at timestamp
- Lowest
observation_id (health) or record_id (socioeconomic)
Filtering
Filter records by the effective request's declared fields:
release_status (typically FINAL)
value_type (e.g., AGE_ADJUSTED, CRUDE)
source_type (e.g., DIRECT_SURVEY, COUNTY_ROLLUP)
- Geographic constraints (state codes, county FIPS, ISO3 codes)
Validity rules
- Suppressed, invalid (
INVALID_SCALE, INVALID), withdrawn, blank, or
null analytic values count as publication evidence but are unavailable
for analysis.
- Never zero-fill missing values.
- Quality-flag exclusions apply after record selection.
Cohort construction
Construct every requested cohort by intersecting complete-case entities
over the effective time periods using the effective completeness predicates.
Preserve declared entity order (typically ASCII-ordered state codes or FIPS).
Protocol resolution
See references/protocol_system.md for the
full override-resolution and contract-merging specification.
When the analysis request carries a protocol_id, match its case-sensitive
value against the protocol registry record's portable protocol profile.
Apply the override system:
- Direct keys bind identically to canonical keys.
<section>_overrides keys target canonical <section> after stripping the
_overrides suffix.
module_overrides.<module_name> targets the canonical module of that exact name.
reporting_overrides targets reporting.
- Objects deep-merge by exact key; arrays and scalars replace in full.
- Reject unknown targets, implicit renames, type coercion, and positional
array patching before any computation.
- Freeze one effective contract and use it consistently across every module.
The protocol profile is REUSABLE_METHOD_ONLY: entities, measures, time
coordinates, random seeds, hyperparameter grids, business cutoffs, and output
vocabulary bind exclusively from the effective future request.
Statistical modules
See references/statistical_modules.md
for the complete reusable method catalog. Every module specification is a
deterministic, reproducible, fully-specified algorithm. Key families:
State-level modules (protocol: PHO_STATE_*)
- Release resolution and cohorts - Filter, select, count, and construct
balanced/broad/strict cohorts.
- Delete-cluster fixed effects - Double-demeaned FE OLS with delete-one
jackknife, bias correction, and cluster-robust inference.
- Nested ridge/elastic-net division CV - Leave-one-division-out nested
cross-validation with training-only standardization and coordinate-
descent solvers.
- Wild cluster bootstrap - PCG32/xorshift32 restricted-null wild
cluster bootstrap-t with CR1 studentization.
- Grouped split conformal - Leave-one-group-out split conformal
prediction with absolute-residual calibration.
- Trajectory PCA clustering - Covariance PCA with Jacobi eigendecomposition,
deterministic k-means, and leave-period-out adjusted Rand stability.
- Source year/group perturbation - Exhaustive time-subset or source-group
deletion with Shapley attribution.
- Controlled decision - Ordered gate evaluation with precedence.
County-level modules (protocol: PHO_COUNTY_*)
- Publication and linked cohorts - County-level resolution with RUCC
indicators.
- Primary mediation models / Difference GMM - Two-step linear GMM
with state-cluster sandwich, stacked indirect effects, and delete-state
diagnostics.
- Nested state/block ridge/elastic-net - State-blocked nested
cross-validation with training-only moments.
- Wild cluster bootstrap (paired equations) - Restricted-null state-
clustered bootstrap-t with coordinated PRNG draws.
- Grouped split / cross-fold conformal - State-grouped conformal
calibration with RUCC-band and decile diagnostics.
- Partial-R2 sensitivity surface - Mediation confounding sensitivity
with equal-strength tipping point.
- County/state trajectory PCA - Variable-major county trajectory PCA
with deterministic k-means and leave-state/leave-year stability.
- Source group perturbation - No-retune source-group deletion with
deterioration ranking.
Country-level modules (protocol: PHO_CBR_*)
- Reconciliation - Label-to-ISO3 resolution with alias counting.
- Quality audit - Revision event classification, scale-break anomaly
detection, missing/imputed cell counting.
- PCA - Burden-indicator covariance PCA with top-loading extraction.
- Clustering - Silhouette selection across candidate k, burden-segment
labeling.
- Panel model - Region-fixed-effects panel regression of outcome on
PC1 burden.
- Advisory - Controlled policy advisory from panel evidence.
Decision rules
Every audit concludes with a controlled decision. Complete all modules first,
evaluate every business predicate on unrounded computed values, and
apply the effective request's decision mapping in the declared precedence
order. Gate predicates are boolean conditions on specific module outputs
(e.g., "p-value <= 0.05", "coverage >= 0.80", "ARI >= 0.55"). The first
unsatisfied gate determines the conclusion string from the request's
enumerated mapping.
Precision and reporting
- Compute everything in double precision; report non-integer values to the
declared number of decimal places (typically 4 or 6).
- Integers, counts, seeds, PRNG states, ranks, fold indices, and booleans
use natural JSON types.
- Preserve every declared array order; never independently sort an aligned
result vector.
- Never emit
NaN or Infinity; use null only when a statistic is
mathematically undefined.
- Use uppercase state codes and ISO3 values.
- Return exactly one JSON object matching the answer template's top-level
keys, with no narrative outside it.
General execution discipline
- Resolve the whole effective contract before any data access, random draw,
fit, aggregation, or decision.
- Read all evidence from the portal; do not fabricate or carry forward
task-specific values from other invocations.
- When a protocol registry record exists in the answer, place it in the
output as an optional solved-answer provenance record but bind all
instance-specific content only from the effective future request.
- Implement every algorithm from its reusable specification; do not import
black-box library routines that violate the declared steps.
- For PRNG sequences, implement the exact generator (PCG32 or xorshift32)
as specified, maintain a single continuous stream, and record checkpoints
after the specified replicate completes without resetting the stream.
1---2name: pho-audit-23description: >4 Public Health Observatory algorithmic audit execution using the PHO read-only5 web API. Provides the complete reusable method catalog, data-resolution6 protocol, statistical module specifications (fixed-effects, ridge/elastic-net7 CV, wild-cluster bootstrap, grouped conformal calibration, trajectory PCA,8 source perturbation, GMM mediation, sensitivity surfaces, and controlled9 decision gates), plus the protocol override and contract-resolution system.10 Use when a future request references a registered PHO protocol_id, an11 answer_template.json contract, or an analysis_request.json with a12 geography_scope, study years, audit modules, and robustness gates; or when13 the task involves accessing the PHO portal endpoint catalog, resolving14 publication records by revision precedence, constructing balanced-cohort15 panels, or running any combination of the registered statistical audit16 modules against PHO evidence.17metadata:18 source: https://skillmd.com/skills/prism-shadow/pho-audit-219---2021# PHO Algorithmic Audit Skill2223Execute registered Public Health Observatory algorithmic audits from an24`analysis_request.json` contract through the PHO read-only web portal.2526## Quick start27281. Read the analysis request and answer template.292. Resolve every `TASK_ENV_BASE_URL` or explicit URL to the PHO portal root.303. Fetch `/catalog` and relevant geography listings.314. For each requested dataset and measure, fetch data using the request's32 filter, value-type, and release-status specifications.335. Select the single best record per entity-time-measure key using **revision,34 then release timestamp, then record-id** precedence (descending).356. Construct the requested cohorts from completeness predicates.367. Execute each audit module in the declared order, following its exact37 reusable method profile (see [references/statistical_modules.md](references/statistical_modules.md)).388. Apply the protocol override system when a protocol registry record is39 present (see [references/protocol_system.md](references/protocol_system.md)).409. Evaluate every robustness gate on unrounded values and apply the41 controlled decision rule.4210. Return one JSON object matching the answer template exactly.4344## Portal API4546See [references/api_endpoints.md](references/api_endpoints.md) for the full47endpoint catalog, query-parameter conventions, and response shapes.4849The PHO portal is a read-only HTTP REST API. No credentials are required.50All data endpoints return JSON arrays. Key endpoints:5152- `GET /` - Portal root53- `GET /catalog` - Full dataset, measure, and geography catalog54- `GET /geographies/states` - U.S. state code listing55- `GET /geographies/counties` - U.S. county listing56- `GET /geographies/countries` - Country listing57- `GET /data/state-health` - State-level health indicators58- `GET /data/state-socioeconomic` - State-level socioeconomic data59- `GET /data/county-health` - County-level health indicators60- `GET /data/county-socioeconomic` - County-level socioeconomic data61- `GET /data/country-indicators` - Country-level burden and outcome indicators62- `GET /data/revisions` - Revision event log63- `GET /methodology` - Methodology documentation64- `GET /download` - Bulk data download6566## Data resolution6768See [references/data_resolution.md](references/data_resolution.md) for the69complete record-selection, filtering, revision-precedence, and cohort-70construction rules.7172### Record selection precedence7374For every entity-time-measure key, choose exactly one publication record75using this ordered comparison, preferring the greater value at each step:76771. Highest `revision`782. Latest `released_at` timestamp793. Lowest `observation_id` (health) or `record_id` (socioeconomic)8081### Filtering8283Filter records by the effective request's declared fields:84- `release_status` (typically `FINAL`)85- `value_type` (e.g., `AGE_ADJUSTED`, `CRUDE`)86- `source_type` (e.g., `DIRECT_SURVEY`, `COUNTY_ROLLUP`)87- Geographic constraints (state codes, county FIPS, ISO3 codes)8889### Validity rules9091- Suppressed, invalid (`INVALID_SCALE`, `INVALID`), withdrawn, blank, or92 null analytic values count as publication evidence but are **unavailable**93 for analysis.94- Never zero-fill missing values.95- Quality-flag exclusions apply after record selection.9697### Cohort construction9899Construct every requested cohort by intersecting complete-case entities100over the effective time periods using the effective completeness predicates.101Preserve declared entity order (typically ASCII-ordered state codes or FIPS).102103## Protocol resolution104105See [references/protocol_system.md](references/protocol_system.md) for the106full override-resolution and contract-merging specification.107108When the analysis request carries a `protocol_id`, match its case-sensitive109value against the protocol registry record's portable protocol profile.110Apply the override system:111112- Direct keys bind identically to canonical keys.113- `<section>_overrides` keys target canonical `<section>` after stripping the114 `_overrides` suffix.115- `module_overrides.<module_name>` targets the canonical module of that exact name.116- `reporting_overrides` targets reporting.117- Objects deep-merge by exact key; arrays and scalars replace in full.118- Reject unknown targets, implicit renames, type coercion, and positional119 array patching before any computation.120- Freeze one effective contract and use it consistently across every module.121122The protocol profile is **REUSABLE_METHOD_ONLY**: entities, measures, time123coordinates, random seeds, hyperparameter grids, business cutoffs, and output124vocabulary bind exclusively from the effective future request.125126## Statistical modules127128See [references/statistical_modules.md](references/statistical_modules.md)129for the complete reusable method catalog. Every module specification is a130deterministic, reproducible, fully-specified algorithm. Key families:131132### State-level modules (protocol: `PHO_STATE_*`)1331341. **Release resolution and cohorts** - Filter, select, count, and construct135 balanced/broad/strict cohorts.1362. **Delete-cluster fixed effects** - Double-demeaned FE OLS with delete-one137 jackknife, bias correction, and cluster-robust inference.1383. **Nested ridge/elastic-net division CV** - Leave-one-division-out nested139 cross-validation with training-only standardization and coordinate-140 descent solvers.1414. **Wild cluster bootstrap** - PCG32/xorshift32 restricted-null wild142 cluster bootstrap-t with CR1 studentization.1435. **Grouped split conformal** - Leave-one-group-out split conformal144 prediction with absolute-residual calibration.1456. **Trajectory PCA clustering** - Covariance PCA with Jacobi eigendecomposition,146 deterministic k-means, and leave-period-out adjusted Rand stability.1477. **Source year/group perturbation** - Exhaustive time-subset or source-group148 deletion with Shapley attribution.1498. **Controlled decision** - Ordered gate evaluation with precedence.150151### County-level modules (protocol: `PHO_COUNTY_*`)1521531. **Publication and linked cohorts** - County-level resolution with RUCC154 indicators.1552. **Primary mediation models / Difference GMM** - Two-step linear GMM156 with state-cluster sandwich, stacked indirect effects, and delete-state157 diagnostics.1583. **Nested state/block ridge/elastic-net** - State-blocked nested159 cross-validation with training-only moments.1604. **Wild cluster bootstrap (paired equations)** - Restricted-null state-161 clustered bootstrap-t with coordinated PRNG draws.1625. **Grouped split / cross-fold conformal** - State-grouped conformal163 calibration with RUCC-band and decile diagnostics.1646. **Partial-R2 sensitivity surface** - Mediation confounding sensitivity165 with equal-strength tipping point.1667. **County/state trajectory PCA** - Variable-major county trajectory PCA167 with deterministic k-means and leave-state/leave-year stability.1688. **Source group perturbation** - No-retune source-group deletion with169 deterioration ranking.170171### Country-level modules (protocol: `PHO_CBR_*`)1721731. **Reconciliation** - Label-to-ISO3 resolution with alias counting.1742. **Quality audit** - Revision event classification, scale-break anomaly175 detection, missing/imputed cell counting.1763. **PCA** - Burden-indicator covariance PCA with top-loading extraction.1774. **Clustering** - Silhouette selection across candidate k, burden-segment178 labeling.1795. **Panel model** - Region-fixed-effects panel regression of outcome on180 PC1 burden.1816. **Advisory** - Controlled policy advisory from panel evidence.182183## Decision rules184185Every audit concludes with a controlled decision. Complete all modules first,186evaluate every business predicate on **unrounded** computed values, and187apply the effective request's decision mapping in the declared precedence188order. Gate predicates are boolean conditions on specific module outputs189(e.g., "p-value <= 0.05", "coverage >= 0.80", "ARI >= 0.55"). The first190unsatisfied gate determines the conclusion string from the request's191enumerated mapping.192193## Precision and reporting194195- Compute everything in double precision; report non-integer values to the196 declared number of decimal places (typically 4 or 6).197- Integers, counts, seeds, PRNG states, ranks, fold indices, and booleans198 use natural JSON types.199- Preserve every declared array order; never independently sort an aligned200 result vector.201- Never emit `NaN` or `Infinity`; use `null` only when a statistic is202 mathematically undefined.203- Use uppercase state codes and ISO3 values.204- Return exactly one JSON object matching the answer template's top-level205 keys, with no narrative outside it.206207## General execution discipline208209- Resolve the whole effective contract before any data access, random draw,210 fit, aggregation, or decision.211- Read all evidence from the portal; do not fabricate or carry forward212 task-specific values from other invocations.213- When a protocol registry record exists in the answer, place it in the214 output as an optional solved-answer provenance record but bind all215 instance-specific content only from the effective future request.216- Implement every algorithm from its reusable specification; do not import217 black-box library routines that violate the declared steps.218- For PRNG sequences, implement the exact generator (PCG32 or xorshift32)219 as specified, maintain a single continuous stream, and record checkpoints220 after the specified replicate completes without resetting the stream.