serenity-health / roadmap

Public roadmap for development of Serenity's apps reported by our community of users
0 stars 1 forks source link

feature/suspend an employee/benefactor (API) #73

Open chris-dare opened 2 years ago

chris-dare commented 2 years ago

Tell us about your request! Corporate admins would like to suspend employees from receiving coverage from their organizations

Which app does this concern? Provider portal

What will be benefit of this feature? This will lower the risk of claim disputes since suspended employees will not have the option to pay with that organizaiton.

Describe the solution you'd like

  1. Implement a method on patient.models.PatientAccount called suspend.

    def suspend(suspended_by: User, asof: datetime.datetime):
    # set the status of the employee to `patient.choices.PatientUserAccountStatus.SUSPENDED`
    # record the action history for the patient account
    # return the patient account and action history just like in patient.models.PatientAccount.create
  2. Implement a method on organization.models.Employee called 'suspend`. This method should suspend all patients accounts managed by the employee's organization AND owned by the user linked to that employee:

    def suspend(self, request: HttpRequest, organization: Organization):
    # find patient accounts owned by self.user and managed by organization
    # for each patient account, suspend
    # return the employee

    Be sure to catch appropriate exceptions

  3. Create a TextChoice for Employee action types. Call this BenefactorActionType. It should support the following options: a. CREATE b. SUSPEND c. ACTIVATE Hint: See diagnostics.choices.DiagnosticReportActionType for inspiration

  4. Implement a method on organization.models.Employee called process_action

    def process_action(self, action: BenefactorActionType, request: HttpRequest, provider: Organization):

    If the action is BenefactorActionType.SUSPEND, call the self.suspend method and return the employee instance that comes from it. See diagnostics.models.DiagnosticReport.process_action method for inspiration

  5. Update fhirresourcemanager.models.Patient.get_patient_accounts_of_user_with_patient_mobile. a. Add a new parameter called account_status: typing.List. Give it a default of [PatientUserAccountStatus.ACTIVE, PatientUserAccountStatus.CREATED] b. In this same method, update the qeurying patient accounts to retrieve PatientAccounts which have any of the statuses in the account_status list Hint: See patient_accounts = PatientAccount.objects.filter( owner__in=related_users, account_type__in=account_types )

  6. Implement an API endpoint to suspend a benefactor See the specification here: https://serenity-health.readme.io/reference/accounts#suspend-a-benefactor

Describe alternatives you've considered N/A

Additional context Related issues: https://github.com/serenity-health/roadmap/issues/23