Skip to content

sol-eng/access-to-care

Repository files navigation

Access to Care

This project combines US CENSUS population data with hospital data provided by Medicare to analyze healthcare accessibility across the United States. The analysis aims to identify counties that are underserved or overserved in terms of hospital resources relative to their population size. The main goal of these assets is to showcase Posit Connect’s capabilities, such as its ability to host presentations, REST APIs, applications, reports, and interactive content in both R and Python.

Data Sources

  • Population Data: 2024 US CENSUS data providing county-level population estimates
  • Hospital Data: 2025 Medicare hospital facility data, including location and operational information

Analysis Methodology

A linear regression model is used to establish a baseline relationship between population size and the expected number of hospitals in a county. This model helps identify:

  • Underserved counties: Areas with fewer hospitals than predicted by the model based on their population
  • Overserved counties: Areas with more hospitals than predicted by the model
  • Adequately served counties: Areas where hospital availability aligns with population expectations

The model and processed data are made available through the pins package, enabling reproducible analysis and easy integration with other analytical workflows.

Project Contents

This repository contains multiple implementations of the Access to Care analysis across different formats and programming languages. All content is deployed to Posit Connect for easy access and interactivity.

Thumbnail Title Type Description GitHub Connect
Pins - Data Pins - Data Data County level data with the population and hospital count pins-data View on Connect
Pins - Model Pins - Model Model Linear regression model to determine appropiate levels of hospitals based on population of a given county pins-model View on Connect
REST API - R REST API Multiple endpoints to access the model and data, using plumber2 api-r View on Connect
REST API - Python REST API REST API with multiple endpoints using FastAPI and Python api-python View on Connect
App - R App - R Application County-level data for all of the US app-r View on Connect
App - Python App - Python Dashboard Dashboard by state using Dash app-python View on Connect
Dashboard - R Dashboard - R Dashboard Dashboard by state dashboard-r View on Connect
Dashboard - Python Dashboard - Python Dashboard Interactive dashboard showing Access to Care data by state using Python, Polars, and Plotnine dashboard-python View on Connect
Report - R Report - R Report Single state report with customized blastula email report-r View on Connect
Report - Python Report - Python Quarto HTML HTML document showing Access to Care analysis using Python, Polars, Plotnine, and Great Tables report-python View on Connect
Presentation - R Presentation - R Presentation Presentation of the data and model presentation-r View on Connect
Presentation - Python Presentation - Python Quarto presentation Published version of the presentation created using Python, Polars, and Plotnine presentation-python View on Connect
Plot - R Plot - R Plot US Map showing the model results. Created using ggplot2 plot-r View on Connect
Interactive Plot - R Interactive Plot - R Plot Interactive US Map showing the model results, created using htmlwidget htmlwidgets-r View on Connect
PDF - R PDF - R Report Single state report with a PDF output pdf-r View on Connect
ConnectWidgets ConnectWidgets Application Application that lists of all related content connectwidgets View on Connect

Repository Structure

Each folder in this repository contains a complete, deployable implementation:

  • pins-data and pins-model: Shared data and model artifacts accessible via the pins package
  • api-r and api-python: REST API implementations for programmatic access to data and predictions
  • app-r and app-python: Interactive applications for exploring county-level data
  • dashboard-r and dashboard-python: State-level dashboards with visualizations
  • report-r and report-python: Comprehensive HTML reports with analysis
  • presentation-r and presentation-python: Presentation-format outputs for sharing findings
  • plot-r and htmlwidgets-r: Static and interactive visualization outputs
  • pdf-r: PDF report generation for single-state analysis
  • connectwidgets: Landing page application listing all related content

This project was created using the accesstocare R package, which provides tools for generating Access to Care analyses.

Deploy to Your Posit Connect Instance

If you want to deploy all of these assets to your own Posit Connect instance, you can use the programmatic deployment capabilities built into the accesstocare package. This approach will replicate the entire project structure, including all content types, custom thumbnails, and vanity URLs, to your Connect server.

The deployment process uses Git-backed deployment, which means your Posit Connect instance will maintain a direct connection to the repository for ongoing synchronization and updates.

Deployment Steps

Step 1: Clone the repository

git clone https://github.com/sol-eng/access-to-care.git
cd access-to-care

Step 2: Install the accesstocare package

pak::pak("sol-eng/accesstocare")

Step 3: Deploy everything to your Connect instance

library(accesstocare)
deploy_git_backed(".")

The deploy_git_backed() function will automatically:

  • Deploy all example data products to your Posit Connect instance
  • Set custom thumbnails for each content item
  • Establish vanity URLs for convenient access to each asset
  • Configure Git-backed deployment for all compatible content types

Make sure you have your Posit Connect credentials configured (via environment variables or RStudio Connect pane) before running the deployment.