Skip to content

Refactor claims_hosp to use smoothing util #433

New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Open
wants to merge 5 commits into
base: main
Choose a base branch
from
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 0 additions & 1 deletion claims_hosp/delphi_claims_hosp/__init__.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
from . import indicator
from . import load_data
from . import run
from . import smooth
from . import update_indicator
from . import weekday

Expand Down
10 changes: 7 additions & 3 deletions claims_hosp/delphi_claims_hosp/indicator.py
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,19 @@
# third party
import numpy as np
import pandas as pd
from delphi_utils import Smoother

# first party
from .config import Config
from .smooth import left_gauss_linear


class ClaimsHospIndicator:
"""Class to fit a hospitalizations indicator using CLI counts from claims-based data."""

smoother = Smoother("savgol",
poly_fit_degree=1,
gaussian_bandwidth=Config.SMOOTHER_BANDWIDTH)

@staticmethod
def gauss_smooth(num, den):
"""Smooth using the left_gauss_linear.
Expand All @@ -33,8 +37,8 @@ def gauss_smooth(num, den):
tuple: (array of smoothed num, array of smoothed den)

"""
num_smooth = left_gauss_linear(num)
den_smooth = left_gauss_linear(den)
num_smooth = ClaimsHospIndicator.smoother.smooth(num)
den_smooth = ClaimsHospIndicator.smoother.smooth(den)
den_smooth = np.clip(den_smooth, 0, None)
num_smooth = np.clip(num_smooth, 0, den_smooth)
return num_smooth, den_smooth
Expand Down
40 changes: 0 additions & 40 deletions claims_hosp/delphi_claims_hosp/smooth.py

This file was deleted.

15 changes: 0 additions & 15 deletions claims_hosp/tests/test_smooth.py

This file was deleted.