NSSP emergency department visits¶
Data access¶
get_nssp ¶
get_nssp(disease: str | Iterable[str] | None = None, state_abb: str | Iterable[str] | None = None, dataset: NSSPDataset = 'gold', as_of: date | None = None, start_date: date | None = None, end_date: date | None = None, lazy: Literal[True] = ..., get_exclusions: bool = False, exclusions_as_of: date | None = None) -> LazyFrame
get_nssp(disease: str | Iterable[str] | None = None, state_abb: str | Iterable[str] | None = None, dataset: NSSPDataset = 'gold', as_of: date | None = None, start_date: date | None = None, end_date: date | None = None, lazy: Literal[False] = ..., get_exclusions: bool = False, exclusions_as_of: date | None = None) -> DataFrame
get_nssp(disease: str | Iterable[str] | None = None, state_abb: str | Iterable[str] | None = None, dataset: NSSPDataset = 'gold', as_of: date | None = None, start_date: date | None = None, end_date: date | None = None, lazy: bool = True, get_exclusions: bool = False, exclusions_as_of: date | None = None) -> DataFrame | LazyFrame
Retrieve and filter NSSP emergency department data.
This function retrieves vintages of NSSP emergency department
visits data specified by the as_of date from the
datacat.public.stf catalog. It filters data for a specific disease
and location, within optional date boundaries, as available up to
a specified reference date.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
disease
|
str | Iterable[str] | None
|
The disease to filter for ("covid", "flu", "rsv", or the aggregate "total" series). If None, all diseases are included. |
None
|
state_abb
|
str | Iterable[str] | None
|
Location abbreviation to filter for. If None, all locations are included. |
None
|
dataset
|
NSSPDataset
|
One of the two datasets to retrieve from datacat: "gold" or "comprehensive" (defaults to "gold"). |
'gold'
|
as_of
|
date | None
|
Reference date for data availability. Only data available as of this date will be used. If None, all available data will be used (defaults to None). |
None
|
start_date
|
date | None
|
Start date for filtering data (inclusive). If None, no lower bound is applied (defaults to None). |
None
|
end_date
|
date | None
|
End date for filtering data (inclusive). If None, no upper bound is applied (defaults to None). |
None
|
lazy
|
bool
|
Whether to return a lazy frame (defaults to True). If True, returns a
|
True
|
get_exclusions
|
bool
|
Add Boolean |
False
|
exclusions_as_of
|
date | None
|
The latest catalog version date to consider for the data-review
snapshot, or None for the newest available snapshot. Uses the same
inclusive cutoff convention as |
None
|
Returns:
| Type | Description |
|---|---|
DataFrame | LazyFrame
|
Aggregated ED counts with columns:
|
Notes
- Catalog disease labels are converted to the canonical names "covid", "flu", and "rsv".
- The function only includes data from parquet files with dates up to and including the as_of date.
Version resolution¶
resolve_nssp_version ¶
resolve_nssp_version(dataset: NSSPDataset = 'gold', as_of: date | None = None) -> datetime | str | None
Resolve the catalog version that get_nssp
would load.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
dataset
|
NSSPDataset
|
One of the two NSSP datasets: |
'gold'
|
as_of
|
date | None
|
The latest catalog version date to consider. If None, resolves the most recent available version. |
None
|
Returns:
| Type | Description |
|---|---|
datetime | str | None
|
The selected catalog version converted to a datetime when possible, or None if no version matches. |
resolve_nssp_exclusion_version ¶
Resolve the data-review snapshot that get_nssp would load.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
as_of
|
date | None
|
The latest catalog version date to consider, corresponding to
|
None
|
Returns:
| Type | Description |
|---|---|
datetime | str | None
|
The selected catalog version converted to a datetime when possible, or None if no version matches. |