Created
January 30, 2026 15:55
-
-
Save damonbayer/81eb0c8b38f9a404eb788f6694155951 to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
| # 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. |
Author
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
https://github.com/cdcent/cfa-stf-handbook/issues/199