-- America's active integrity agreements: half sit in five states
-- Fonteum reproducible query — https://fonteum.com/research/oig-corporate-integrity-agreements-2026
-- Data as of: 2026-06-13  ·  methodology: oig-cia/v1
-- Source datasets: OIG Corporate Integrity Agreements
-- Run against the frozen federal snapshot to reproduce the published figures.
-- License: U.S. Government Works (federal sources; 17 U.S.C. §105).

-- America's ACTIVE federal health-care integrity-agreement caseload — what it
-- is, where it sits, and how it is split between agreement types. Fully
-- reproducible query.
--
-- Question: of the integrity agreements HHS-OIG publishes in its Corporate
-- Integrity Agreement registry, how many are currently IN EFFECT, where are
-- those active agreements located, and how do they break down by agreement
-- type and effective year? The lead figure: 114 of the 335 agreements on the
-- published registry are currently Effective, and 57 of those 114 (50.0%) sit
-- in just five states. A Corporate / Integrity Agreement is a forward-looking
-- COMPLIANCE obligation OIG enters with an organization or individual, typically
-- alongside the resolution of a matter; this study reports the published
-- regulatory record only and draws NO inference of fraud, wrongdoing, or risk
-- about any party.
--
-- Source:
--   public.oig_cia_agreements — HHS Office of Inspector General "Corporate
--     Integrity Agreements" registry (oig.hhs.gov/compliance/corporate-
--     integrity-agreements). 335 agreement rows; source_release_date 2026-06-13.
--     Public, read-only. License: US-Government-Works (17 U.S.C. Sec. 105).
--     methodology_version = 'oig-cia/v1'.
--
-- Universe: this study reads the published registry AS A WHOLE — every row is
--   an agreement OIG lists. The registry carries both currently-Effective
--   agreements and Closed (concluded) ones, so figures are a point-in-time
--   snapshot, not a modeled trend. The NPI-to-entity-graph link is not
--   populated for this source (entity_id is NULL on every row); no individual
--   or organization is named in the study.
--
-- Counting note: effective_date is published only while an agreement is in
--   force (it is NULL on every Closed row); closed_date is published only once
--   an agreement concludes (NULL on every Effective row). The effective-year
--   figures below therefore describe the currently-active population by the
--   year each active agreement took effect — not an annual flow of new matters.

-- ============================================================================
-- (1) Universe reconciliation — the published registry at a glance.
-- ============================================================================
SELECT
  count(*)                                                          AS agreements,
  count(DISTINCT entity_name)                                       AS distinct_entities,
  count(DISTINCT state) FILTER (WHERE state IS NOT NULL AND state <> '') AS jurisdictions,
  count(*) FILTER (WHERE status = 'Effective')                      AS effective,
  count(*) FILTER (WHERE status = 'Closed')                         AS closed,
  count(*) FILTER (WHERE status IS NULL)                            AS status_null,
  max(source_release_date)                                          AS snapshot
FROM public.oig_cia_agreements;
--  agreements 335 · distinct_entities 333 · jurisdictions 43
--  effective 114 · closed 208 · status_null 13 · snapshot 2026-06-13

-- ============================================================================
-- (2) Status structure — effective_date is present ONLY on Effective rows;
--     closed_date is present ONLY on Closed rows. This is why the active
--     caseload (114) equals the count of rows carrying an effective_date.
-- ============================================================================
SELECT
  coalesce(status, '(unlabelled)')                                  AS status,
  count(*)                                                          AS agreements,
  count(effective_date)                                             AS with_effective_date,
  count(closed_date)                                                AS with_closed_date
FROM public.oig_cia_agreements
GROUP BY status
ORDER BY agreements DESC;
--  Closed        208 ·   0 effective_date · 208 closed_date
--  Effective     114 · 114 effective_date ·   0 closed_date
--  (unlabelled)   13 ·   0 effective_date ·   0 closed_date

-- ============================================================================
-- (3) HEADLINE: the ACTIVE caseload is geographically concentrated. Of the 114
--     currently-Effective agreements, the five largest states hold 57 — exactly
--     50.0% — and California + Florida alone hold 35 (30.7%).
-- ============================================================================
SELECT
  state,
  count(*)                                                          AS effective,
  round(100.0 * count(*) / sum(count(*)) OVER (), 1)                AS pct_of_active
FROM public.oig_cia_agreements
WHERE status = 'Effective' AND state IS NOT NULL AND state <> ''
GROUP BY state
ORDER BY effective DESC, state
LIMIT 8;
--  CA 18 15.8% · FL 17 14.9% · TX 9 7.9% · NY 7 6.1% · GA 6 5.3%
--  PA 5 4.4% · IL 5 4.4% · NC 5 4.4%
--  top-5 (CA,FL,TX,NY,GA) = 57 = 50.0% · CA+FL = 35 = 30.7%
--  29 distinct jurisdictions carry an active agreement; 0 active rows lack a state.

-- ============================================================================
-- (4) Concentration, computed directly (no manual sum of the rows above).
-- ============================================================================
SELECT
  count(*)                                                          AS active_total,
  count(*) FILTER (WHERE state IN ('CA','FL','TX','NY','GA'))       AS top5,
  round(100.0 * count(*) FILTER (WHERE state IN ('CA','FL','TX','NY','GA'))
        / count(*), 1)                                              AS top5_pct,
  count(*) FILTER (WHERE state IN ('CA','FL'))                      AS ca_fl,
  round(100.0 * count(*) FILTER (WHERE state IN ('CA','FL')) / count(*), 1) AS ca_fl_pct,
  count(DISTINCT state) FILTER (WHERE state IS NOT NULL AND state <> '') AS active_jurisdictions
FROM public.oig_cia_agreements
WHERE status = 'Effective';
--  active_total 114 · top5 57 · top5_pct 50.0% · ca_fl 35 · ca_fl_pct 30.7%
--  active_jurisdictions 29

-- ============================================================================
-- (5) Agreement TYPE split of the active caseload. A Corporate Integrity
--     Agreement (CIA) is the comprehensive form; an Integrity Agreement (IA) is
--     the lighter-weight form. Among the 114 active agreements, CIAs dominate.
-- ============================================================================
SELECT
  agreement_type,
  count(*) FILTER (WHERE status = 'Effective')                      AS effective,
  count(*) FILTER (WHERE status = 'Closed')                         AS closed,
  count(*)                                                          AS total
FROM public.oig_cia_agreements
GROUP BY agreement_type
ORDER BY total DESC;
--  Corporate Integrity Agreement  88 effective · 118 closed · 219 total
--  Integrity Agreement            26 effective ·  90 closed · 116 total
--  (active CIA share = 88/114 = 77.2%)

-- ============================================================================
-- (6) WHEN the active agreements took effect. CIAs run a multi-year term, so the
--     active population spans roughly the last several years; agreements
--     effective before ~2019 have largely concluded and dropped off the active
--     list. 2022 and 2024 are the busiest effective years still in force.
-- ============================================================================
SELECT
  extract(year FROM effective_date)::int                            AS effective_year,
  count(*)                                                          AS effective,
  count(*) FILTER (WHERE agreement_type = 'Corporate Integrity Agreement') AS cia,
  count(*) FILTER (WHERE agreement_type = 'Integrity Agreement')    AS ia
FROM public.oig_cia_agreements
WHERE status = 'Effective'
GROUP BY effective_year
ORDER BY effective_year;
--  2019  1  (1 CIA, 0 IA)
--  2020  7  (6, 1)
--  2021 15  (14, 1)
--  2022 25  (21, 4)
--  2023 19  (11, 8)
--  2024 25  (15, 10)
--  2025 15  (13, 2)
--  2026  7  (7, 0)   (partial year)
