PHO Audit Solver
Solve Public Health Observatory algorithmic audit tasks by completing the
declared modules against the portal API and returning one JSON object
conforming to the attached answer template.
Core Workflow
- Parse the request: extract protocol_id, geography scope, analysis years,
measures, cohorts, and module specifications from analysis_request.json.
- Resolve the TASK_ENV_BASE_URL from the prompt. Query the portal for all
required data using the download endpoints or filtered queries.
- Apply publication resolution to select authoritative records: highest
revision, then latest release timestamp, then lowest record ID. Exclude
suppressed, invalid, and withdrawn values; never zero-fill them.
- Build the requested cohorts (core balanced, broad, strict, panel) from
resolved records following the request completeness rules.
- Execute each declared audit module in the specified order using the
portal data. Preserve every declared entity order, feature order, grid
order, and checkpoint order from the analysis request.
- Apply the controlled decision rules and return the completed JSON object.
Portal Data Access
See references/portal_api.md for the complete API
reference including all endpoints, query parameters, column schemas,
methodology documents, and geography references.
Use scripts/download_portal_data.py to bulk-fetch all datasets as CSV when
the task needs full data:
python3 scripts/download_portal_data.py <TASK_ENV_BASE_URL> <output_dir>
Publication Resolution
See references/publication_resolution.md
for the exact release-selection algorithm. In brief:
- Filter by release_status, value_type, source_type, and validity as specified
in the analysis request.
- For each entity-year-measure combination, pick the record with the greatest
revision, then latest released_at, then lowest observation_id/record_id.
- Suppressed, invalid, withdrawn, blank, or null values are unavailable and
never zero-filled.
Cohort Building
See references/cohort_patterns.md for the
standard cohort patterns used across all protocol families. Key patterns:
- Core balanced: entities complete for all required variables in every
analysis year.
- Broad/reference-year: entities complete for outcome and all features in a
single reference year.
- Strict dual-source: entities complete for outcome, primary exposure,
parallel exposure, and adjustments in every analysis year.
- Panel: entities complete for all required variables in every year.
Entity ordering is always by state/county/country code ascending (ASCII).
Statistical Modules
See references/statistical_modules.md
for the complete reusable implementations. The standard module library:
| Module |
Description |
| Release Resolution and Cohorts |
Publication selection and cohort assembly |
| Delete-One Cluster Fixed Effects |
Two-way demeaning, OLS, delete-one jackknife |
| Nested Ridge / Elastic Net CV |
Leave-group-out cross-validation with grid search |
| Wild Cluster Bootstrap |
PCG32 or XORSHIFT32 paired bootstrap t-test |
| Grouped Split Conformal |
Out-of-fold conformal prediction intervals |
| Trajectory PCA Clustering |
Covariance PCA, k-means, leave-time-out stability |
| Source Perturbation |
Exhaustive source/year substitution, Shapley attribution |
| Controlled Decision |
Gate evaluation with precedence |
All modules must be executed exactly in the declared order. Preserve every
entity-code order, feature order, grid order, and checkpoint order from the
effective request. Use the exact PRNG algorithms (PCG32 or XORSHIFT32) when
specified with their full wraparound state and output mapping as documented
in the statistical modules reference.
Answer Format
Return one JSON object conforming to the attached answer_template.json.
Round all non-integer reported statistics to the precision declared in the
request (typically 4 or 6 decimal places). Use JSON null only when a
statistic is mathematically unavailable. Preserve every formal array order
from the request. Do not include narrative outside the JSON object.
1---2name: pho-audit-solver-43description: "Solve Public Health Observatory (PHO) registered algorithmic audit tasks. Use when a task references a PHO portal, PHO protocol IDs (PHO_STATE_TRANSPORT_AUDIT_V1, PHO_COUNTY_MEDIATION_TRANSPORT_V1, PHO_STATE_ROBUSTNESS_TRANSPORT_V1, PHO_COUNTY_PANEL_TRANSPORT_V1), registered six-module or multi-module audits, algorithmic transportability or robustness analyses, burden-stratification briefings, or PHO publication-board decisions. Handles state, county, and country data across health, socioeconomic, and revision endpoints."4license: MIT5compatibility: designed for deepagents-code6metadata:7 source: https://skillmd.com/skills/prism-shadow/pho-audit-solver-48---910# PHO Audit Solver1112Solve Public Health Observatory algorithmic audit tasks by completing the13declared modules against the portal API and returning one JSON object14conforming to the attached answer template.1516## Core Workflow17181. Parse the request: extract protocol_id, geography scope, analysis years,19 measures, cohorts, and module specifications from analysis_request.json.202. Resolve the TASK_ENV_BASE_URL from the prompt. Query the portal for all21 required data using the download endpoints or filtered queries.223. Apply publication resolution to select authoritative records: highest23 revision, then latest release timestamp, then lowest record ID. Exclude24 suppressed, invalid, and withdrawn values; never zero-fill them.254. Build the requested cohorts (core balanced, broad, strict, panel) from26 resolved records following the request completeness rules.275. Execute each declared audit module in the specified order using the28 portal data. Preserve every declared entity order, feature order, grid29 order, and checkpoint order from the analysis request.306. Apply the controlled decision rules and return the completed JSON object.3132## Portal Data Access3334See [references/portal_api.md](references/portal_api.md) for the complete API35reference including all endpoints, query parameters, column schemas,36methodology documents, and geography references.3738Use scripts/download_portal_data.py to bulk-fetch all datasets as CSV when39the task needs full data:4041```bash42python3 scripts/download_portal_data.py <TASK_ENV_BASE_URL> <output_dir>43```4445## Publication Resolution4647See [references/publication_resolution.md](references/publication_resolution.md)48for the exact release-selection algorithm. In brief:4950- Filter by release_status, value_type, source_type, and validity as specified51 in the analysis request.52- For each entity-year-measure combination, pick the record with the greatest53 revision, then latest released_at, then lowest observation_id/record_id.54- Suppressed, invalid, withdrawn, blank, or null values are unavailable and55 never zero-filled.5657## Cohort Building5859See [references/cohort_patterns.md](references/cohort_patterns.md) for the60standard cohort patterns used across all protocol families. Key patterns:6162- Core balanced: entities complete for all required variables in every63 analysis year.64- Broad/reference-year: entities complete for outcome and all features in a65 single reference year.66- Strict dual-source: entities complete for outcome, primary exposure,67 parallel exposure, and adjustments in every analysis year.68- Panel: entities complete for all required variables in every year.6970Entity ordering is always by state/county/country code ascending (ASCII).7172## Statistical Modules7374See [references/statistical_modules.md](references/statistical_modules.md)75for the complete reusable implementations. The standard module library:7677| Module | Description |78|--------|-------------|79| Release Resolution and Cohorts | Publication selection and cohort assembly |80| Delete-One Cluster Fixed Effects | Two-way demeaning, OLS, delete-one jackknife |81| Nested Ridge / Elastic Net CV | Leave-group-out cross-validation with grid search |82| Wild Cluster Bootstrap | PCG32 or XORSHIFT32 paired bootstrap t-test |83| Grouped Split Conformal | Out-of-fold conformal prediction intervals |84| Trajectory PCA Clustering | Covariance PCA, k-means, leave-time-out stability |85| Source Perturbation | Exhaustive source/year substitution, Shapley attribution |86| Controlled Decision | Gate evaluation with precedence |8788All modules must be executed exactly in the declared order. Preserve every89entity-code order, feature order, grid order, and checkpoint order from the90effective request. Use the exact PRNG algorithms (PCG32 or XORSHIFT32) when91specified with their full wraparound state and output mapping as documented92in the statistical modules reference.9394## Answer Format9596Return one JSON object conforming to the attached answer_template.json.97Round all non-integer reported statistics to the precision declared in the98request (typically 4 or 6 decimal places). Use JSON null only when a99statistic is mathematically unavailable. Preserve every formal array order100from the request. Do not include narrative outside the JSON object.