Public Health Observatory Audit Portal Skill
Execute registered PHO algorithmic audit protocols against the Public Health Observatory read-only web portal. Implement all statistical methods from scratch using portal CSV data; interpret protocol specifications in analysis_request.json and fill answer_template.json with computed results.
Quick Start
- Read the request: Parse
analysis_request.json to identify the protocol, scope, parameters, modules, and answer template.
- Read the answer template: The template defines exact field names, array orders, cardinalities, enum values, and numeric precision; follow it exactly.
- Retrieve geography: Download state/county/country reference tables from the portal to establish the entity universe and group structures.
- Resolve data: Follow the release selection rules (see references/data-rules.md) to get the analytic dataset for each module cohort.
- Execute modules in order: Implement each module algorithm from references/algorithms.md using only portal data.
- Evaluate gates: Apply decision predicates to unrounded computed values.
- Write answer: Exactly one JSON object conforming to the template, with no narrative outside it.
Portal Interface
The portal lives at the base URL declared in the task environment (typically http://task-env:9023/). See references/portal-api.md for the complete endpoint reference, CSV schemas, and download patterns.
Key retrieval pattern:
curl -s "BASE_URL/download?dataset=<dataset>&format=csv&<filters>"
Parse with Python csv.DictReader. Use paginated HTML only if CSV download fails.
Efficient Data Download
- State health: One CSV request per year (hundreds of rows each)
- State socioeconomic: One request per year (about 50-100 rows)
- County health: Filter by year and optionally state; can be large
- County socioeconomic: Download by year, filter by region if needed
- Country indicators: One request per year
- Geography tables: Download full tables once (states, counties, countries)
- Revisions: Download full table once
Geography
See references/geography.md for state/division/region tables, county RUCC structure, and country label reconciliation rules. Always re-retrieve geography tables from the portal at runtime; do not rely on static copies.
Data Resolution
See references/data-rules.md for the full release selection algorithm, suppression rules, cohort construction patterns, geography joins, and variable transformations.
Key principles:
- FINAL releases only; highest revision wins; tiebreak by latest
released_at then lowest record id
- Suppressed (
suppression_flag=1), null, and invalid values are unavailable; never zero-fill
- Count selected publications before analytic completeness checks when the request asks for selected-row counts
- State socioeconomic
food_insecurity is distinct from state health food_insecurity -- they come from independent sources
Algorithms
See references/algorithms.md for complete specifications of every registered statistical method. Implement each from scratch; do not substitute external packages that would change the algorithmic contract.
Core method families:
- Delete-one cluster jackknife: Two-way FE transformation (or weighted OLS), delete-one refit, jackknife inference with G-1 df, CR1/HC3 standard errors
- Nested ridge/elastic-net CV: Training-only standardization, coordinate descent solver, inner-grid selection, outer-test pooling, OOF metrics
- Wild cluster bootstrap: Null-restricted model, PCG32/Xorshift32 PRNG, Webb/Rademacher weights, CR1 studentization, plus-one p-values, nearest-rank quantiles
- Grouped split conformal: Calibration-set threshold, prediction intervals, coverage/width by fold and aggregate
- Trajectory PCA clustering: Covariance PCA with symmetric Jacobi, deterministic k-means, leave-group-out stability via adjusted Rand index, silhouette scores
- Source/year perturbation: Exhaustive subset enumeration or source-replacement grid, stability summaries, Shapley attribution
- Difference GMM mediation: Two-step GMM, cross-equation delta method, Hansen J, state-deletion diagnostics
- Sensitivity analysis: Partial R2 surface, tipping-point identification
- Source group perturbation: No-retune group deletion, outer-fold RMSE deterioration, ranking
Protocol Families
PHO_STATE_TRANSPORT_AUDIT_V1
Six-module state-level transportability audit. Modules: delete-cluster FE, nested ridge CV, wild cluster bootstrap, grouped split conformal, trajectory PCA clustering, source-year perturbation.
Decision: all-six-gates-pass -> PRIMARY_TRANSPORTABLE_LONGEVITY_SIGNAL; 4-5 gates -> ASSOCIATED_LONGEVITY_SIGNAL_WITH_LIMITED_TRANSPORTABILITY; otherwise NO_TRANSPORTABLE_LONGEVITY_SIGNAL.
PHO_COUNTY_MEDIATION_TRANSPORT_V1
County mediation audit. Modules: difference GMM mediation, nested state ridge, wild cluster bootstrap, state-grouped conformal, mediation sensitivity surface, trajectory PCA clustering.
Decision: all 6 -> CONSISTENT_OBESITY_MEDIATION_AUDIT; 4-5 -> PARTIAL_OBESITY_MEDIATION_AUDIT; 2-3 -> FRAGILE_OBESITY_MEDIATION_AUDIT; otherwise NO_OBESITY_MEDIATION_AUDIT.
PHO_COUNTY_PANEL_TRANSPORT_V1
County panel dynamics audit. Modules: delete-state two-step GMM, nested elastic net, wild cluster bootstrap, grouped conformal calibration, trajectory PCA clustering, source group perturbation.
Decision: all 6 -> DEPLOY_DIABETES_DYNAMICS; 4-5 -> REVIEW_DIABETES_DYNAMICS; otherwise RETAIN_LAGGED_DIABETES.
Country Burden Stratification (PHO-CBR)
Country cross-section and panel audit. Steps: label reconciliation, quality/revision audit, PCA on burden indicators, k-means clustering with silhouette selection, region-FE panel model of life_expectancy against PC1 burden score, advisory classification.
Implementation Order
Every protocol executes modules in the declared order. Within each module:
- Construct the analytic dataset for that module cohort
- Implement the algorithm exactly as specified in references/algorithms.md
- Collect all required evidence (fold-level, delete-level, checkpoint details)
- Report at the declared numeric precision
- Preserve every declared array order, identifier case, and enum value
Common Pitfalls
- Suppressed values: Treat as missing, never as zero
- Revision selection: Always select highest FINAL revision; multiple FINAL revisions of the same record can exist for different revision numbers
- Training-only standardization: Standardize using training-set moments only; apply to validation/test
- PRNG state: Do not reset the generator between replicates; checkpoints are recorded after the replicate completes without resetting the stream
- Array order: Never sort result arrays independently of their paired reference arrays; preserve portal order or declared order
- Identifiers: Use uppercase state abbreviations and exact division/region names from the portal geography tables
- Numeric precision: Round non-integers to declared decimal places; counts, seeds, and ranks as integers
- Socioeconomic food_insecurity vs health food_insecurity: These are independent variables from separate sources; do not conflate them
- Delete-state/leave-out ordering: Always process deletions in the declared entity order; aggregate results in that same order
- Inner RMSE grid ordering: Each inner grid row must align positionally with the lambda_grid or (alpha, l1_ratio) grid order
- Conformal calibration tiebreak: When multiple groups tie for calibration selection, choose by ascending group name
- K-means canonicalization: After convergence, reorder cluster ids by centroid coordinates then original working id
1---2name: pho-audit-portal3description: "Public Health Observatory algorithmic audit protocol execution. Use when an analysis_request.json or prompt references a PHO registered audit protocol, when the task involves executing multi-module transportability audits for state/county/country health data via the PHO web portal, or when the solver must implement deterministic statistical methods (fixed-effects jackknife, nested ridge/elastic-net CV, wild cluster bootstrap, grouped split conformal, trajectory PCA clustering, source/year perturbation, difference GMM mediation, sensitivity analysis) from raw portal CSV data. Covers all PHO protocol families: PHO_STATE_TRANSPORT_AUDIT_V1, PHO_COUNTY_MEDIATION_TRANSPORT_V1, PHO_COUNTY_PANEL_TRANSPORT_V1, and country burden stratification audits."4license: MIT5compatibility: designed for deepagents-code6metadata:7 source: https://skillmd.com/skills/prism-shadow/pho-audit-portal8---910# Public Health Observatory Audit Portal Skill1112Execute registered PHO algorithmic audit protocols against the Public Health Observatory read-only web portal. Implement all statistical methods from scratch using portal CSV data; interpret protocol specifications in `analysis_request.json` and fill `answer_template.json` with computed results.1314## Quick Start15161. Read the request: Parse `analysis_request.json` to identify the protocol, scope, parameters, modules, and answer template.172. Read the answer template: The template defines exact field names, array orders, cardinalities, enum values, and numeric precision; follow it exactly.183. Retrieve geography: Download state/county/country reference tables from the portal to establish the entity universe and group structures.194. Resolve data: Follow the release selection rules (see [references/data-rules.md](references/data-rules.md)) to get the analytic dataset for each module cohort.205. Execute modules in order: Implement each module algorithm from [references/algorithms.md](references/algorithms.md) using only portal data.216. Evaluate gates: Apply decision predicates to unrounded computed values.227. Write answer: Exactly one JSON object conforming to the template, with no narrative outside it.2324## Portal Interface2526The portal lives at the base URL declared in the task environment (typically `http://task-env:9023/`). See [references/portal-api.md](references/portal-api.md) for the complete endpoint reference, CSV schemas, and download patterns.2728Key retrieval pattern:29```30curl -s "BASE_URL/download?dataset=<dataset>&format=csv&<filters>"31```3233Parse with Python `csv.DictReader`. Use paginated HTML only if CSV download fails.3435### Efficient Data Download3637- State health: One CSV request per year (hundreds of rows each)38- State socioeconomic: One request per year (about 50-100 rows)39- County health: Filter by year and optionally state; can be large40- County socioeconomic: Download by year, filter by region if needed41- Country indicators: One request per year42- Geography tables: Download full tables once (states, counties, countries)43- Revisions: Download full table once4445## Geography4647See [references/geography.md](references/geography.md) for state/division/region tables, county RUCC structure, and country label reconciliation rules. Always re-retrieve geography tables from the portal at runtime; do not rely on static copies.4849## Data Resolution5051See [references/data-rules.md](references/data-rules.md) for the full release selection algorithm, suppression rules, cohort construction patterns, geography joins, and variable transformations.5253Key principles:54- FINAL releases only; highest revision wins; tiebreak by latest `released_at` then lowest record id55- Suppressed (`suppression_flag=1`), null, and invalid values are unavailable; never zero-fill56- Count selected publications before analytic completeness checks when the request asks for selected-row counts57- State socioeconomic `food_insecurity` is distinct from state health `food_insecurity` -- they come from independent sources5859## Algorithms6061See [references/algorithms.md](references/algorithms.md) for complete specifications of every registered statistical method. Implement each from scratch; do not substitute external packages that would change the algorithmic contract.6263Core method families:64- Delete-one cluster jackknife: Two-way FE transformation (or weighted OLS), delete-one refit, jackknife inference with G-1 df, CR1/HC3 standard errors65- Nested ridge/elastic-net CV: Training-only standardization, coordinate descent solver, inner-grid selection, outer-test pooling, OOF metrics66- Wild cluster bootstrap: Null-restricted model, PCG32/Xorshift32 PRNG, Webb/Rademacher weights, CR1 studentization, plus-one p-values, nearest-rank quantiles67- Grouped split conformal: Calibration-set threshold, prediction intervals, coverage/width by fold and aggregate68- Trajectory PCA clustering: Covariance PCA with symmetric Jacobi, deterministic k-means, leave-group-out stability via adjusted Rand index, silhouette scores69- Source/year perturbation: Exhaustive subset enumeration or source-replacement grid, stability summaries, Shapley attribution70- Difference GMM mediation: Two-step GMM, cross-equation delta method, Hansen J, state-deletion diagnostics71- Sensitivity analysis: Partial R2 surface, tipping-point identification72- Source group perturbation: No-retune group deletion, outer-fold RMSE deterioration, ranking7374## Protocol Families7576### PHO_STATE_TRANSPORT_AUDIT_V17778Six-module state-level transportability audit. Modules: delete-cluster FE, nested ridge CV, wild cluster bootstrap, grouped split conformal, trajectory PCA clustering, source-year perturbation.79Decision: all-six-gates-pass -> PRIMARY_TRANSPORTABLE_LONGEVITY_SIGNAL; 4-5 gates -> ASSOCIATED_LONGEVITY_SIGNAL_WITH_LIMITED_TRANSPORTABILITY; otherwise NO_TRANSPORTABLE_LONGEVITY_SIGNAL.8081### PHO_COUNTY_MEDIATION_TRANSPORT_V18283County mediation audit. Modules: difference GMM mediation, nested state ridge, wild cluster bootstrap, state-grouped conformal, mediation sensitivity surface, trajectory PCA clustering.84Decision: all 6 -> CONSISTENT_OBESITY_MEDIATION_AUDIT; 4-5 -> PARTIAL_OBESITY_MEDIATION_AUDIT; 2-3 -> FRAGILE_OBESITY_MEDIATION_AUDIT; otherwise NO_OBESITY_MEDIATION_AUDIT.8586### PHO_COUNTY_PANEL_TRANSPORT_V18788County panel dynamics audit. Modules: delete-state two-step GMM, nested elastic net, wild cluster bootstrap, grouped conformal calibration, trajectory PCA clustering, source group perturbation.89Decision: all 6 -> DEPLOY_DIABETES_DYNAMICS; 4-5 -> REVIEW_DIABETES_DYNAMICS; otherwise RETAIN_LAGGED_DIABETES.9091### Country Burden Stratification (PHO-CBR)9293Country cross-section and panel audit. Steps: label reconciliation, quality/revision audit, PCA on burden indicators, k-means clustering with silhouette selection, region-FE panel model of life_expectancy against PC1 burden score, advisory classification.9495## Implementation Order9697Every protocol executes modules in the declared order. Within each module:98991. Construct the analytic dataset for that module cohort1002. Implement the algorithm exactly as specified in [references/algorithms.md](references/algorithms.md)1013. Collect all required evidence (fold-level, delete-level, checkpoint details)1024. Report at the declared numeric precision1035. Preserve every declared array order, identifier case, and enum value104105## Common Pitfalls106107- Suppressed values: Treat as missing, never as zero108- Revision selection: Always select highest FINAL revision; multiple FINAL revisions of the same record can exist for different revision numbers109- Training-only standardization: Standardize using training-set moments only; apply to validation/test110- PRNG state: Do not reset the generator between replicates; checkpoints are recorded after the replicate completes without resetting the stream111- Array order: Never sort result arrays independently of their paired reference arrays; preserve portal order or declared order112- Identifiers: Use uppercase state abbreviations and exact division/region names from the portal geography tables113- Numeric precision: Round non-integers to declared decimal places; counts, seeds, and ranks as integers114- Socioeconomic food_insecurity vs health food_insecurity: These are independent variables from separate sources; do not conflate them115- Delete-state/leave-out ordering: Always process deletions in the declared entity order; aggregate results in that same order116- Inner RMSE grid ordering: Each inner grid row must align positionally with the lambda_grid or (alpha, l1_ratio) grid order117- Conformal calibration tiebreak: When multiple groups tie for calibration selection, choose by ascending group name118- K-means canonicalization: After convergence, reorder cluster ids by centroid coordinates then original working id