Skip to content

Instantly share code, notes, and snippets.

@damonbayer
Created January 30, 2026 15:55
Show Gist options
  • Select an option

  • Save damonbayer/81eb0c8b38f9a404eb788f6694155951 to your computer and use it in GitHub Desktop.

Select an option

Save damonbayer/81eb0c8b38f9a404eb788f6694155951 to your computer and use it in GitHub Desktop.
# you will need https://github.com/cdcgov/cfa-catalog-pub installed
from cfa.dataops import datacat
import polars.selectors as cs
# View all the available data
datacat.__namespace_list__
# This is the wednesday nhsn data
datacat.public.stf.nhsn_hrd_prelim.load.get_versions()
# You can load a particular version like this
df = datacat.public.stf.nhsn_hrd_prelim.load.get_dataframe(
output="pl", version="2025-12-17T00-00-00"
)
# there is suport for fuzzy matching
nhsn_dat = datacat.public.stf.nhsn_hrd_prelim.load.get_dataframe(
output="pl", version="~=2025-12-17"
)
# These are the columns we use
nhsn_dat.select(
"weekendingdate", "jurisdiction", cs.matches("^totalconf.+newadm$")
)
# Similarly for nssp
datacat.public.stf.nssp_gold.load.get_versions()
nssp_dat = datacat.public.stf.nssp_gold.load.get_dataframe(
output="pl", version="~=2025-12-17"
)
nssp_dat
# the updating isn't automated yet. If you absolutely need the latest data, ping ryan to do an update.
@damonbayer
Copy link
Author

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment