Get Contract Service Area
get_contract_service_areaThe county-level service area of Medicare Advantage contracts, month by month, from CMS's monthly MA Contract Service Area file (2006-10 on; 2022-11 was never published). Both directions: the counties a contract serves (contract_id) and the contracts serving a county (county_fips, 5 digits) or a state (state_code, 2 letters).
WINDOW: report_month (YYYY-MM) or year; with neither, the newest month held (stated in value.query.report_month).
RETURNS value.summary (distinct contracts, counties, contract-counties and contract-county-months; national, employer-group and partial-county counts; the months read), value.contracts (one row per contract: organization, organization type, plan type, counties served, employer-group and partial counties) and value.rows (one row per contract, county, month and flag combination: state_code, county_fips, county_ssa, county_name, eghp, partial_county, national_service_area). limit bounds both lists (default 100, max 2000); a truncated list carries a caveat.
THREE RULES: (1) eghp (employer-group only) and partial_county are CMS's own flags; eghp_only=true keeps employer-group rows. (2) A contract serving the whole country (National PACE and similar) is one national row with no state or county (national_service_area=true); it is never counted as a county, and a state or county filter leaves it out unless include_national=true. (3) CMS lists a contract-county twice when its plans there differ in the partial or employer flag, so count DISTINCT contract-counties, never rows; the summary already does.
Each month is read at its newest CMS edition. Stand-alone Part D (PDP) service areas are a separate file and are not here.
Input Schema
| Name | Required | Description | Default |
|---|---|---|---|
| year | No | ||
| limit | No | ||
| eghp_only | No | ||
| state_code | No | ||
| contract_id | No | ||
| county_fips | No | ||
| report_month | No | ||
| include_national | No |
Output Schema
| Name | Required | Description | Default |
|---|---|---|---|
| unit | No | ||
| as_of | No | ||
| value | Yes | ||
| source | Yes | ||
| status | No | complete | |
| caveats | No | ||
| failure | No | ||
| quality | No | ||
| refusal | No | ||
| vintage | No | as_restated | |
| audit_id | Yes | UUID; ties to medicare_silver.audit_log row. | |
| signature | No | ||
| tenant_id | No | Calling tenant slug, resolved by the binding and stamped via the per-call tenant context. Defaults to the bootstrap 'internal' tenant for local/in-process callers. | |
| timestamp | Yes | ||
| confidence | No | ||
| data_as_of | No | ||
| request_id | Yes | ||
| methodology | No | ||
| snapshot_set | Yes | {table_fqn → iceberg_snapshot_id (int64)}. Per M-2 §2.2. | |
| tool_version | Yes | ||
| response_hash | Yes | SHA-256 of canonicalized form per M-2 §2.4. | |
| result_status | Yes | ||
| vintage_basis | No | default_unmeasured | |
| as_of_asserted | No | ||
| as_of_observed | No | ||
| parse_revision | No | ||
| as_of_effective | No | ||
| freshness_state | No | unknown | |
| methodology_era | No | ||
| confidence_basis | No | ||
| semantic_version | Yes | ||
| invariants_applied | No | ||
| finality_confidence | No | ||
| cms_vintage_sequence | Yes | ||
| parser_artifact_hash | Yes | ||
| methodology_blend_factors | No | ||
| parser_artifact_hash_basis | No | not_evaluated |