Medicare calculates patient survey and outcomes data based on a patient survey called the Hospital Consumer Assessment of Health Providers and Systems (HCAHPS) survey. This survey is administered to hospital patients and is intended to assess hospital performance in general, not just their performance in senior housing.
These star ratings are different from the consumer ratings that you see on websites for products like books, restaurants, or hotels that reflect averages of consumers' opinions. Since the star ratings rank all agencies from lowest to highest, some facilities will be ranked below others even though they're providing good quality care.
Survey data may not be available for every hospital. More detail about the survey is available here: https://www.cms.gov/data-research/research/consumer-assessment-healthcare-providers-systems/hospital-cahps-hcahps.