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

Me/dpc 4201 log waivers #2246

Merged
merged 16 commits into from
Aug 22, 2024
Merged

Me/dpc 4201 log waivers #2246

merged 16 commits into from
Aug 22, 2024

Conversation

MEspositoE14s
Copy link
Contributor

@MEspositoE14s MEspositoE14s commented Aug 19, 2024

🎫 Ticket

https://jira.cms.gov/browse/DPC-4201

🛠 Changes

  • Update ao_verification_service to return flags indicating if the AO or the provider organization have waivers.
  • Updated the invitations_controller, verify_ao_job and verify_provider_organizations_job to log when the AO or organization has a waiver.
  • Updated tests to make sure everything works as advertised.

ℹ️ Context

We want to be able to monitor how many AOs and organizations are using the DPC API with a waiver. This is the first step in doing so.

🧪 Validation

Created RSpec tests.

@MEspositoE14s MEspositoE14s requested a review from a team August 19, 2024 20:59
@@ -165,12 +165,26 @@ def check_code
status: :bad_request)
end

# rubocop:disable Metrics/AbcSize
Copy link
Contributor

Choose a reason for hiding this comment

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

Please refactor instead of disabling

Rails.logger.info(['Organization has a waiver',
{ actionContext: LoggingConstants::ActionContext::Registration,
actionType: LoggingConstants::ActionType::OrgHasWaiver,
providerOrganization: @organization.id }])
Copy link
Contributor

Choose a reason for hiding this comment

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

Maybe add invitation id?
Organization id should already be added automagically by logger.

{ actionContext: LoggingConstants::ActionContext::BatchVerificationCheck,
actionType: LoggingConstants::ActionType::AoHasWaiver,
authorizedOfficial: link.user.id,
providerOrganization: link.provider_organization.id }])
Copy link
Contributor

Choose a reason for hiding this comment

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

Should use attributes for user and organization found in app/models/current_attributes

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Is that filled in when running this job?

Copy link
Contributor

Choose a reason for hiding this comment

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

Nope, but it would be nice to use the same format


{ success: true, ao_role: }
{ success: true, ao_role: response[:ao_role], has_ao_waiver: response[:has_ao_waiver],
Copy link
Contributor

@jdettmannnava jdettmannnava Aug 20, 2024

Choose a reason for hiding this comment

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

Should be able to just have response.merge(success: true)

ao_role = get_authorized_official_role(organization_npi, identifier_type, identifier)
check_individual_med_sanctions(ao_role['ssn'])
ao_role
ao_role_response = get_authorized_official_role(organization_npi, identifier_type, identifier)
Copy link
Contributor

@jdettmannnava jdettmannnava Aug 20, 2024

Choose a reason for hiding this comment

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

The logic is fine, but I find the names very confusing.
Maybe something like

role_and_waivers = get_ao_role_and_wavers
individual_sanctions = check...
role_and_waivers.merge(individual_sanctions)

And change the keys so the merge works?

Copy link
Contributor

@jdettmannnava jdettmannnava left a comment

Choose a reason for hiding this comment

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

Sorry, more refactoring...

Rails.logger.info(['Authorized official has a waiver',
{ actionContext: LoggingConstants::ActionContext::BatchVerificationCheck,
actionType: LoggingConstants::ActionType::AoHasWaiver,
current_user: link.user.id,
Copy link
Contributor

Choose a reason for hiding this comment

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

In current_attibutes, we are storing these as

organization: {
      id: org.id,
      dpc_api_organization_id: org.dpc_api_organization_id
    }

and

current_user: {
      id: user.id,
      external_id: user.uid,
      pac_id: user.pac_id
    }


private

def log_waivers(role_and_waivers, link)
Copy link
Contributor

Choose a reason for hiding this comment

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

log_waivers is essentially the same for both jobs (you can get the org from the link), so it should probably be shared by moving it to app/concerns/verification.rb

Copy link
Contributor

@jdettmannnava jdettmannnava left a comment

Choose a reason for hiding this comment

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

Nice, but I think just one more thing...

@@ -12,6 +12,7 @@ def perform
@start = Time.now
service = AoVerificationService.new
links_to_check.each do |link|
CurrentAttributes.save_organization_attributes(link.provider_organization, link.user)
Copy link
Contributor

Choose a reason for hiding this comment

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

I think you need to save_user_attributes too

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Doh! Total oversight on my part.

Copy link
Contributor

@jdettmannnava jdettmannnava left a comment

Choose a reason for hiding this comment

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

LGTM!

@MEspositoE14s MEspositoE14s merged commit d778c22 into main Aug 22, 2024
5 checks passed
@MEspositoE14s MEspositoE14s deleted the me/dpc-4201-log-waivers branch August 22, 2024 16:57
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants