Skip to content
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

BCDA-8351: Exclude MD TCoC requests from suppression #993

Open
wants to merge 3 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
16 changes: 16 additions & 0 deletions bcda/service/fixtures/cclf_beneficiaries.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,16 @@
---
- file_id: 1
mbi: MBI00000001
- file_id: 1
mbi: MBI00000002
- file_id: 1
mbi: MBI00000003
- file_id: 1
mbi: MBI00000004
- file_id: 1
mbi: MBI00000005
- file_id: 1
mbi: MBI00000006
- file_id: 1
mbi: MBI00000007

154 changes: 154 additions & 0 deletions bcda/service/fixtures/suppressions.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,154 @@
---
- id: 1
created_at: RAW=NOW() - INTERVAL '1 DAY'
source_code: 1-800
effective_dt: NULL
pref_indicator: NULL
samhsa_source_code: 1-800
samhsa_effective_dt: NULL
samhsa_pref_indicator: NULL
aco_cms_id: K0001
beneficiary_link_key: NULL
effective_date: RAW=NOW() - INTERVAL '1 DAY'
preference_indicator: "N"
samhsa_effective_date: NULL
samhsa_preference_indicator: NULL
file_id: 1000
blue_button_id: NULL
mbi: "MBI00000001"
- id: 2
created_at: RAW=NOW() - INTERVAL '1 DAY'
source_code: 1-800
effective_dt: NULL
pref_indicator: NULL
samhsa_source_code: 1-800
samhsa_effective_dt: NULL
samhsa_pref_indicator: NULL
aco_cms_id: K0001
beneficiary_link_key: NULL
effective_date: RAW=NOW() - INTERVAL '10 DAY'
preference_indicator: ""
samhsa_effective_date: NULL
samhsa_preference_indicator: NULL
file_id: 1000
blue_button_id: NULL
mbi: "MBI00000001"
- id: 3
created_at: RAW=NOW() - INTERVAL '1 DAY'
source_code: 1-800
effective_dt: NULL
pref_indicator: NULL
samhsa_source_code: 1-800
samhsa_effective_dt: NULL
samhsa_pref_indicator: NULL
aco_cms_id: K0001
beneficiary_link_key: NULL
effective_date: RAW=NOW() - INTERVAL '30 DAYS'
preference_indicator: "Y"
samhsa_effective_date: NULL
samhsa_preference_indicator: NULL
file_id: 1000
blue_button_id: NULL
mbi: "MBI00000002"
- id: 4
created_at: RAW=NOW() - INTERVAL '1 DAY'
source_code: 1-800
effective_dt: NULL
pref_indicator: NULL
samhsa_source_code: 1-800
samhsa_effective_dt: NULL
samhsa_pref_indicator: NULL
aco_cms_id: K0001
beneficiary_link_key: NULL
effective_date: RAW=NOW() - INTERVAL '10 DAY'
preference_indicator: "N"
samhsa_effective_date: NULL
samhsa_preference_indicator: NULL
file_id: 1000
blue_button_id: NULL
mbi: "MBI00000002"
- id: 5
created_at: RAW=NOW() - INTERVAL '1 DAY'
source_code: 1-800
effective_dt: NULL
pref_indicator: NULL
samhsa_source_code: 1-800
samhsa_effective_dt: NULL
samhsa_pref_indicator: NULL
aco_cms_id: K0001
beneficiary_link_key: NULL
effective_date: RAW=NOW() - INTERVAL '1 DAY'
preference_indicator: "N"
samhsa_effective_date: NULL
samhsa_preference_indicator: NULL
file_id: 1000
blue_button_id: NULL
mbi: "MBI00000003"
- id: 6
created_at: RAW=NOW() - INTERVAL '1 DAY'
source_code: 1-800
effective_dt: NULL
pref_indicator: NULL
samhsa_source_code: 1-800
samhsa_effective_dt: NULL
samhsa_pref_indicator: NULL
aco_cms_id: K0001
beneficiary_link_key: NULL
effective_date: RAW=NOW() - INTERVAL '1 DAY'
preference_indicator: ""
samhsa_effective_date: NULL
samhsa_preference_indicator: NULL
file_id: 1000
blue_button_id: NULL
mbi: "MBI00000004"
- id: 7
created_at: RAW=NOW() - INTERVAL '1 DAY'
source_code: 1-800
effective_dt: NULL
pref_indicator: NULL
samhsa_source_code: 1-800
samhsa_effective_dt: NULL
samhsa_pref_indicator: NULL
aco_cms_id: K0001
beneficiary_link_key: NULL
effective_date: RAW=NOW() - INTERVAL '1 DAY'
preference_indicator: "Y"
samhsa_effective_date: NULL
samhsa_preference_indicator: NULL
file_id: 1000
blue_button_id: NULL
mbi: "MBI00000005"
- id: 8
created_at: RAW=NOW() - INTERVAL '1 DAY'
source_code: 1-800
effective_dt: NULL
pref_indicator: NULL
samhsa_source_code: 1-800
samhsa_effective_dt: NULL
samhsa_pref_indicator: NULL
aco_cms_id: K0001
beneficiary_link_key: NULL
effective_date: RAW=NOW() - INTERVAL '18 DAYS'
preference_indicator: "N"
samhsa_effective_date: NULL
samhsa_preference_indicator: NULL
file_id: 1000
blue_button_id: NULL
mbi: "MBI00000006"
- id: 9
created_at: RAW=NOW() - INTERVAL '1 DAY'
source_code: 1-800
effective_dt: NULL
pref_indicator: NULL
samhsa_source_code: 1-800
samhsa_effective_dt: NULL
samhsa_pref_indicator: NULL
aco_cms_id: K0001
beneficiary_link_key: NULL
effective_date: RAW=NOW() - INTERVAL '3 DAYS'
preference_indicator: "Y"
samhsa_effective_date: NULL
samhsa_preference_indicator: NULL
file_id: 1000
blue_button_id: NULL
mbi: "MBI00000006"
11 changes: 8 additions & 3 deletions bcda/service/service.go
Original file line number Diff line number Diff line change
Expand Up @@ -496,10 +496,15 @@ func (s *service) getBenesByFileID(ctx context.Context, cclfFileID uint, conditi
upperBound = time.Now()
}

ignoredMBIs, err = s.repository.GetSuppressedMBIs(ctx, s.sp.lookbackDays, upperBound)
if err != nil {
return nil, fmt.Errorf("failed to retreive suppressedMBIs %s", err.Error())
if cfg, ok := s.GetACOConfigForID(conditions.CMSID); ok {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We already get the config in our middleware when a request is made, so this feels a little redundant. Having something similar to line 493 or adding it as a request condition may have been better, so I am open to discussing this one!

if cfg.Model != "TCOCMD" {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

In NewService Im seeing:

return &service{
		...
		sp: suppressionParameters{
			includeSuppressedBeneficiaries: false,
			lookbackDays: cfg.SuppressionLookbackDays,
		},
		...

Is there a reason we cant use includeSuppressedBeneficiaries as opposed to a hardcode check of "TCOCMD"?

This means when we create the MD TCoC service (or link it to the ACO?) we will have to override the suppression parameters?

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

yeah, I saw that too and would much more prefer to use that but it's part of the service structure that's instantiated with our handlers (called on service start instead of per request).

Copy link
Contributor

@carlpartridge carlpartridge Sep 19, 2024

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Ok so a service is instantiated on app start. But we pass something in as part of each request (ACO ID?) to get the specific request ACO out of all of the available ACOConfigs of the service. It looks like we are pulling ACOConfigs from files in conf/config/{env}.yml? Is there a reason we cant add onto these a new field eg ignoreSuppressed?

Somewhat related question how do these ACOConfigs compare with what we have in the acos DB table? Looks like the DB table is just identifiers and web/auth related, no config?

ignoredMBIs, err = s.repository.GetSuppressedMBIs(ctx, s.sp.lookbackDays, upperBound)
if err != nil {
return nil, fmt.Errorf("failed to retreive suppressedMBIs %s", err.Error())
}
}
}

}

benes, err := s.repository.GetCCLFBeneficiaries(ctx, cclfFileID, ignoredMBIs)
Expand Down
Loading
Loading