Enrich a dialysis facility portfolio in Python

Add services, capacity and separately dated clinical quality and patient survey ratings to a facility research list.

A facility research list

You have CMS identifiers for dialysis facilities and want to add services, capacity and quality context to a research portfolio. This example joins two facilities to the Dialysis Facility & Quality Reference, then displays clinical quality and patient survey ratings with their different reporting periods.

The optional example input CSV contains two real facility identifiers with fictional project labels, “Cary review” and “Durham review.” Those labels simply represent your own research projects. The identical records are in the portfolio list in the Python code below.

The three reference CSVs below are small excerpts from the paid dataset, with the same filenames and fields: two facility records and every clinical and survey observation for those facilities. The full purchase contains 7,490 facilities. Save the three reference CSVs in one folder; the optional example input CSV is not needed to run the inline example.

Code example

Run this code in a notebook cell or a Python script with that folder as the working directory. It uses Python’s standard library. The long measure tables are filtered to one rating before joining, so the result stays at one record per facility.

Paths are relative to your working folder; use from pathlib import Path; print(Path.cwd()) to check it, or supply full paths.

Python 3.10+ · Jupyter, IPython or a script
import csv
from pathlib import Path

folder = Path('.')  # Folder containing the extracted CSVs.
# Fictional research labels; the CMS facility identifiers are real.
portfolio = [
    {'project': 'Cary review', 'facility_id': '342544'},
    {'project': 'Durham review', 'facility_id': '342616'},
]

def read_csv(name):
    with (folder / name).open(newline='', encoding='utf-8') as source:
        return list(csv.DictReader(source))

facilities = {r['facility_id']: r for r in read_csv('facilities.csv')}
quality = {r['facility_id']: r for r in read_csv('quality_measures.csv')
           if r['measure_id'] == 'quality_stars'}
survey = {r['facility_id']: r for r in read_csv('patient_experience.csv')
          if r['measure_id'] == 'survey_stars'}
results = []
for item in portfolio:
    key = item['facility_id']
    facility = facilities.get(key)
    if facility is None:
        print(f"{item['project']}: CMS identifier {key} is absent from this edition.")
        continue
    q, s = quality[key], survey[key]
    result = {
        **item, 'facility_name': facility['facility_name'],
        'stations': facility['dialysis_stations'],
        'home_hd_training': facility['home_hemodialysis_training'],
        'quality_stars': q['value'], 'survey_stars': s['value'],
        'survey_status': s['value_status'], 'survey_note': s['availability_text'],
    }
    results.append(result)
    print(f"{item['project']} | {facility['facility_name']} | {key}")
    print(f"  Stations: {result['stations']}; home hemodialysis training: {result['home_hd_training']}")
    print(f"  Clinical quality: {q['value'] or 'unavailable'} stars ({q['period_start']} to {q['period_end']})")
    print(f"  Patient survey: {s['value'] or 'unavailable'} stars ({s['period_start']} to {s['period_end']})")
    if s['value_status'] != 'published':
        print(f"  CMS explanation: {s['availability_text']}")

Analysis of the output

Cary review | FMC CARY KIDNEY CENTER | 342544
  Stations: 28; home hemodialysis training: Yes
  Clinical quality: 5.0 stars (2021-01-01 to 2024-12-31)
  Patient survey: 3.0 stars (2024-10-18 to 2025-07-11)
Durham review | DaVita Durham West Dialysis | 342616
  Stations: 25; home hemodialysis training: Yes
  Clinical quality: 3.0 stars (2021-01-01 to 2024-12-31)
  Patient survey: unavailable stars (2024-10-18 to 2025-07-11)
  CMS explanation: Too few completed survey responses to report.

The Cary facility has 28 stations and reports offering home hemodialysis training. Its clinical quality rating is 5 stars; its patient survey rating is 3. These are separate CMS measures, with different underlying data and collection periods. The output adds useful facility context without combining them into an invented ranking.

The Durham facility also matches successfully, with 25 stations and a 3-star clinical quality rating. Its survey rating is unavailable because CMS received too few completed responses. The reference keeps that explanation alongside the blank score; it is not a zero rating or evidence of poor patient experience.

These are reported attributes of a dated source snapshot. They do not establish current appointment availability or recommend a facility for an individual’s care. The survey interval combines fall and spring collection windows; it does not imply continuous measurement throughout the interval.

Using the full dataset

After purchase, extract the ZIP and point folder at its CSVs. The same code uses the complete tables. Replace portfolio with your own list, or load a CSV containing project and facility_id. Read the CMS identifier as text to preserve leading zeros.

facilities.csv adds location, ownership, services and capacity. quality_measures.csv includes 27 clinical observations per facility, and patient_experience.csv includes 32 survey observations. Use measures.csv to select other measures and inspect their units, periods, availability codes and source columns before comparing results. Mortality and hospitalization rates per 100 patient-years are not percentages.

The download includes six CSV tables, field dictionaries, complete source-row accounting, quality checks, provenance and this runnable example. It is $29 once for this source edition, with free ACD processing improvements.

Sources and versions

The source files are CMS’s dialysis facility listing and ICH CAHPS facility survey, released July 15, 2026. ACD captured and prepared them October 18 UTC. Clinical quality stars use the published 2021–2024 interval; the survey window is October 18, 2024–July 11, 2025. Other measures have their own periods.

The source and preparation record describes scope and validation. Original CMS data are freely available; ACD supplies prepared tables, documentation and checked delivery. Independent preparation; no CMS endorsement.

Example checked October 18, 2026 against both these samples and the complete purchased files. Source and processing records, sample checksums · Expected result CSV. Independent preparation; no agency endorsement.