-- Who owns America's nursing homes: a concentration story, 2026
-- Fonteum reproducible query — https://fonteum.com/research/nursing-home-ownership-concentration-2026
-- Data as of: 2026-05-25  ·  methodology: cms-snf-all-owners/v1
-- Source datasets: CMS PECOS
-- Run against the frozen federal snapshot to reproduce the published figures.
-- License: U.S. Government Works (federal sources; 17 U.S.C. §105).

-- Who owns America's nursing homes — and how concentrated that ownership is.
-- Fully reproducible query.
--
-- Question: across the skilled nursing facilities (SNFs) in CMS's PECOS "SNF
-- All Owners" disclosure file, how many are tied to a multi-facility
-- ORGANIZATION (a chain/group) versus owned by a single-facility entity or by
-- individuals, and how concentrated is the organizational ownership? The lead
-- figure: of 14,425 SNF enrollments, only 4,056 (28.1%) are independent — owned
-- by individuals or by an organization that appears on no other facility — while
-- 10,369 (71.9%) disclose at least one organization that also owns other
-- facilities, and 7,547 (52.3%) belong to a group of 10 or more facilities.
--
-- This is a STRUCTURAL ownership measure only. It counts disclosed ownership
-- and operational-control relationships. It is NOT a quality, fraud, conduct,
-- or risk signal of any kind, and no individual person is named.
--
-- Sources:
--   public.snf_all_owners — CMS PECOS "Skilled Nursing Facility All Owners"
--     file. One row per owner per SNF enrollment. 280,207 rows; snapshot
--     2026-05-25. associate_id_owner is the canonical owner identifier (PAC ID)
--     — chains are deduped by PAC ID, NOT by name.
--   public.snf_enrollments — companion PECOS "SNF Enrollments" file. One row per
--     SNF enrollment (14,425). enrollment_id is the join key to snf_all_owners.
--   Both: CMS PECOS SNF All Owners, https://data.cms.gov/provider-characteristics/
--     hospitals-and-other-facilities/skilled-nursing-facility-all-owners
--     Public, read-only. License: US-Government-Works (17 U.S.C. Sec. 105).
--     Authorizing statute: ACA Section 6101; 42 CFR Sec. 424.516; CMS-855A.
--
-- Owner roles used as ORGANIZATIONAL OWNERSHIP / OPERATIONAL CONTROL throughout:
--   34 = 5% OR GREATER DIRECT OWNERSHIP INTEREST
--   35 = 5% OR GREATER INDIRECT OWNERSHIP INTEREST
--   85 = DIRECT OWNERSHIP INTEREST
--   86 = INDIRECT OWNERSHIP INTEREST
--   43 = OPERATIONAL/MANAGERIAL CONTROL
--   38 = GENERAL PARTNERSHIP INTEREST
--   39 = LIMITED PARTNERSHIP INTEREST
-- DELIBERATELY EXCLUDED: role 72 (ADP — Additional Disclosable Party, e.g.
--   accounting firms, banks, consultants), 36/37 (mortgage/security interest =
--   lenders), 40/41 (corporate officer/director), 42/25/63 (managing employees,
--   governing body), 71 (trustee). Those parties are disclosed but are not
--   owners or operators of the facility.

-- ============================================================================
-- (1) Universe reconciliation — the two PECOS files at a glance.
-- ============================================================================
SELECT
  (SELECT count(*) FROM public.snf_enrollments)                                AS snf_enrollments,
  (SELECT count(*) FROM public.snf_all_owners)                                 AS owner_rows,
  (SELECT count(DISTINCT associate_id_owner) FROM public.snf_all_owners
     WHERE type_owner = 'O')                                                   AS distinct_org_pac_ids,
  (SELECT count(DISTINCT associate_id_owner) FROM public.snf_all_owners
     WHERE type_owner = 'I')                                                   AS distinct_individual_pac_ids,
  (SELECT max(snapshot_date) FROM public.snf_all_owners)                       AS snapshot;
--  snf_enrollments 14,425 · owner_rows 280,207 · distinct_org_pac_ids 26,453
--  distinct_individual_pac_ids 58,866 · snapshot 2026-05-25

-- ============================================================================
-- (2) HEADLINE: chain vs independent. For each SNF, find the largest "reach"
--     (number of facilities owned) of any of its organizational owners, then
--     classify the facility. Independents = facilities with no organizational
--     owner (individually/family owned) or whose only org owner appears on that
--     one facility. Chain-affiliated = an org owner that also owns >=1 other SNF.
-- ============================================================================
WITH org_owner AS (
  SELECT DISTINCT associate_id_owner, enrollment_id
  FROM public.snf_all_owners
  WHERE type_owner = 'O'
    AND role_code_owner IN ('34','35','85','86','43','38','39')
),
reach AS (  -- how many facilities each organizational owner touches
  SELECT associate_id_owner, count(DISTINCT enrollment_id) AS r
  FROM org_owner GROUP BY associate_id_owner
),
fac AS (    -- per facility: the largest reach among its organizational owners
  SELECT oo.enrollment_id, max(rr.r) AS mr
  FROM org_owner oo JOIN reach rr USING (associate_id_owner)
  GROUP BY oo.enrollment_id
),
allf AS (   -- every enrollment, NULL mr = no organizational owner disclosed
  SELECT e.enrollment_id, f.mr
  FROM public.snf_enrollments e LEFT JOIN fac f USING (enrollment_id)
)
SELECT
  count(*)                                                          AS total_snfs,
  count(*) FILTER (WHERE mr >= 2)                                   AS chain_affiliated,
  round(100.0 * count(*) FILTER (WHERE mr >= 2) / count(*), 1)      AS chain_pct,
  count(*) FILTER (WHERE mr >= 10)                                  AS in_group_10plus,
  round(100.0 * count(*) FILTER (WHERE mr >= 10) / count(*), 1)     AS group_10plus_pct,
  count(*) FILTER (WHERE mr IS NULL OR mr = 1)                      AS independent,
  round(100.0 * count(*) FILTER (WHERE mr IS NULL OR mr = 1) / count(*), 1) AS independent_pct
FROM allf;
--  total_snfs 14,425 · chain_affiliated 10,369 (71.9%) · in_group_10plus 7,547 (52.3%)
--  independent 4,056 (28.1%)

-- ============================================================================
-- (3) HERO: the group-size distribution. Every SNF bucketed by the size of the
--     largest facility-group any of its organizational owners belongs to.
-- ============================================================================
WITH org_owner AS (
  SELECT DISTINCT associate_id_owner, enrollment_id
  FROM public.snf_all_owners
  WHERE type_owner = 'O' AND role_code_owner IN ('34','35','85','86','43','38','39')
),
reach AS (SELECT associate_id_owner, count(DISTINCT enrollment_id) r FROM org_owner GROUP BY 1),
fac AS (SELECT oo.enrollment_id, max(rr.r) mr FROM org_owner oo JOIN reach rr USING (associate_id_owner) GROUP BY 1),
allf AS (SELECT e.enrollment_id, f.mr FROM public.snf_enrollments e LEFT JOIN fac f USING (enrollment_id))
SELECT
  CASE WHEN mr IS NULL          THEN '0 individually/family owned'
       WHEN mr = 1              THEN '1 single-facility org'
       WHEN mr BETWEEN 2 AND 9  THEN '2-9 facilities'
       WHEN mr BETWEEN 10 AND 49 THEN '10-49 facilities'
       WHEN mr BETWEEN 50 AND 99 THEN '50-99 facilities'
       ELSE '100+ facilities' END                                  AS group_size,
  count(*)                                                          AS snfs,
  round(100.0 * count(*) / sum(count(*)) OVER (), 1)               AS pct
FROM allf
GROUP BY 1 ORDER BY min(coalesce(mr, -1));
--  0 individually/family owned   2,232  15.5%
--  1 single-facility org         1,824  12.6%
--  2-9 facilities                2,822  19.6%
--  10-49 facilities              4,648  32.2%
--  50-99 facilities              1,807  12.5%
--  100+ facilities               1,092   7.6%

-- ============================================================================
-- (4) The concentration tail. Rank every organizational owner by reach and take
--     the top decile. The largest 10% of owner organizations account for the
--     majority of all facility-owner relationships on file.
-- ============================================================================
WITH org_owner AS (
  SELECT DISTINCT associate_id_owner, enrollment_id
  FROM public.snf_all_owners
  WHERE type_owner = 'O' AND role_code_owner IN ('34','35','85','86','43','38','39')
),
reach AS (SELECT associate_id_owner, count(DISTINCT enrollment_id) r FROM org_owner GROUP BY 1),
ranked AS (SELECT associate_id_owner, r, ntile(10) OVER (ORDER BY r DESC) decile FROM reach)
SELECT
  count(*)                                                          AS owner_orgs,
  sum(r)                                                            AS facility_owner_links,
  sum(r) FILTER (WHERE decile = 1)                                  AS top_decile_links,
  round(100.0 * sum(r) FILTER (WHERE decile = 1) / sum(r), 1)       AS top_decile_pct,
  min(r) FILTER (WHERE decile = 1)                                  AS top_decile_floor_reach,
  max(r)                                                            AS max_reach
FROM ranked;
--  owner_orgs 12,646 · facility_owner_links 46,832 · top_decile_links 29,550
--  top_decile_pct 63.1% · top_decile_floor_reach 7 · max_reach 249

-- ============================================================================
-- (5) The largest disclosed organizations, deduped by canonical PAC ID. Column
--     is "SNF enrollments where the organization appears as an owner/operator."
--     NOTE: related entities within one corporate family are disclosed under
--     SEPARATE PAC IDs and so list separately — e.g. PACS Group, Inc. and PACS
--     Holdings, LLC; the several Genesis HealthCare operating entities. This is
--     a count of disclosed organizations, NOT resolved beneficial owners; true
--     family-level concentration is therefore AT LEAST what is shown here. No
--     quality, conduct, or risk inference attaches to any organization listed.
-- ============================================================================
WITH org_owner AS (
  SELECT associate_id_owner AS pac, enrollment_id,
         nullif(trim(organization_name_owner), '') AS nm
  FROM public.snf_all_owners
  WHERE type_owner = 'O' AND role_code_owner IN ('34','35','85','86','43','38','39')
),
nm AS (  -- representative display name per PAC ID (most frequent non-blank name)
  SELECT pac, nm, row_number() OVER (PARTITION BY pac ORDER BY count(*) DESC) rn
  FROM org_owner WHERE nm IS NOT NULL GROUP BY pac, nm
)
SELECT n.nm AS owner_org, o.pac AS pac_id,
       count(DISTINCT o.enrollment_id) AS snf_enrollments
FROM org_owner o JOIN nm n ON n.pac = o.pac AND n.rn = 1
GROUP BY n.nm, o.pac
ORDER BY snf_enrollments DESC
LIMIT 12;
--  PACS Holdings, LLC             6103289202  249
--  PACS Group, Inc.               7911360011  248
--  The Ensign Group Inc           3476460494  233
--  Life Care Centers Of America   6608783543  194
--  HCCF Management Group XI LLC    1456511880  187
--  Gen Operations II LLC          2769671536  186
--  ZAC Properties XI LLC          7911167341  186
--  Gen Operations I LLC           1759570526  185
--  Genesis Healthcare LLC         6305035171  184
--  Genesis Healthcare Inc         7810077864  183
--  Providence Group NH, LLC       5294198396  178
--  Sun Healthcare Group Inc       6507774304  177

-- ============================================================================
-- (6) Ownership is layered, not flat. How many DISTINCT organizational owners
--     each facility discloses across direct + indirect + operational layers.
-- ============================================================================
WITH oo AS (
  SELECT enrollment_id, count(DISTINCT associate_id_owner) AS n_org_owners
  FROM public.snf_all_owners
  WHERE type_owner = 'O' AND role_code_owner IN ('34','35','85','86','43','38','39')
  GROUP BY enrollment_id
)
SELECT
  count(*)                                                          AS facilities_with_org_owner,
  round(avg(n_org_owners), 1)                                       AS mean_org_owners,
  percentile_cont(0.5) WITHIN GROUP (ORDER BY n_org_owners)         AS median_org_owners,
  max(n_org_owners)                                                 AS max_org_owners
FROM oo;
--  facilities_with_org_owner 12,193 · mean_org_owners 3.8 · median_org_owners 2
--  max_org_owners 99

-- ============================================================================
-- (7) The independent minority, characterized. Of the 2,232 SNFs with NO
--     organizational owner disclosed, what roles ARE disclosed? They are owned
--     and run by individuals — confirming these are genuinely independent, not
--     a data gap.
-- ============================================================================
WITH has_org AS (
  SELECT DISTINCT enrollment_id FROM public.snf_all_owners
  WHERE type_owner = 'O' AND role_code_owner IN ('34','35','85','86','43','38','39')
)
SELECT o.type_owner, o.role_text_owner,
       count(DISTINCT o.enrollment_id) AS facilities
FROM public.snf_all_owners o
WHERE o.enrollment_id NOT IN (SELECT enrollment_id FROM has_org)
GROUP BY o.type_owner, o.role_text_owner
ORDER BY facilities DESC
LIMIT 6;
--  I · OPERATIONAL/MANAGERIAL CONTROL          1,464
--  I · CORPORATE OFFICER                       1,371
--  I · 5% OR GREATER DIRECT OWNERSHIP INTEREST 1,289
--  I · CORPORATE DIRECTOR                      1,110
--  I · W-2 MANAGING EMPLOYEE                    1,052
--  I · ADP OF THE SNF                          1,018
