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

Ben Admin Kit #18

Merged
merged 43 commits into from
Apr 9, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
43 commits
Select commit Hold shift + click to select a range
6596b36
add ben admin scaffold
bryanbierce Nov 10, 2023
ea3e2a7
update data models
bryanbierce Nov 10, 2023
ccf692e
update models. bump version
bryanbierce Nov 13, 2023
5ce3da4
update comment
bryanbierce Nov 13, 2023
7a469ca
add deductions app config;
bryanbierce Nov 13, 2023
5b74a8a
update naming
bryanbierce Nov 14, 2023
f98af7c
update name
bryanbierce Nov 15, 2023
3362011
fix type
bryanbierce Nov 15, 2023
db1c925
update employee data
bryanbierce Nov 15, 2023
583539f
update group_number
bryanbierce Dec 7, 2023
388c4c1
add company_id
bryanbierce Dec 7, 2023
9bc1c9b
add id at top level
bryanbierce Dec 7, 2023
679d608
update name
bryanbierce Dec 7, 2023
4a487ae
Revert "update dep"
bryanbierce Dec 7, 2023
d8e679b
update name
bryanbierce Dec 12, 2023
dffecf1
add place holder for deductions
bryanbierce Dec 12, 2023
2252eec
add comp values
bryanbierce Dec 15, 2023
11ef9a0
Update BUILD
bryanbierce Dec 19, 2023
b02f681
Update data_models.py
bryanbierce Dec 19, 2023
91248f0
Update BUILD
bryanbierce Dec 19, 2023
f74bd7d
Add Ben Admin deduction data models (#36)
sravyavalipe Jan 31, 2024
7249db4
update data models
bryanbierce Mar 19, 2024
5894a83
reset poetry
bryanbierce Mar 19, 2024
1cdb40f
lint
bryanbierce Mar 20, 2024
f0657d6
bump version
bryanbierce Mar 20, 2024
3580ff3
lint
bryanbierce Mar 21, 2024
b982548
lint
bryanbierce Mar 21, 2024
2a7489b
lint
bryanbierce Mar 21, 2024
8bb6d05
lint
bryanbierce Mar 21, 2024
b0d41a0
try again
bryanbierce Mar 21, 2024
28e45e0
dont change version
bryanbierce Mar 21, 2024
600648b
remove options for long hand union. ¯\_(ツ)_/¯
bryanbierce Mar 22, 2024
b8db335
change capability name
bryanbierce Mar 22, 2024
3f7e790
update types
bryanbierce Apr 2, 2024
a6bc315
remove get_file_name
bryanbierce Apr 2, 2024
f61d5d3
move types to core
bryanbierce Apr 4, 2024
423a348
import format
bryanbierce Apr 4, 2024
4a4b29d
update field name casing. fix doc strings
bryanbierce Apr 4, 2024
090230b
import order again
bryanbierce Apr 4, 2024
40e2abb
add types to core
bryanbierce Apr 4, 2024
0fd6d99
fix import sort
bryanbierce Apr 5, 2024
16887cd
fix rebase
bryanbierce Apr 5, 2024
da100d9
field casing
bryanbierce Apr 7, 2024
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
Empty file.
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python_sources()
Original file line number Diff line number Diff line change
@@ -0,0 +1,23 @@
from datetime import datetime
from decimal import Decimal
from enum import Enum


class DeductionDetails:
company_id: str
employee_id: str
deduction_code: str
effective_from: datetime
end_date: datetime | None
employee_contribution: Decimal | None
company_contribution: Decimal | None

class DeductionCodeField(Enum):
EMPLOYEE_CONTRIBUTION = "EMPLOYEE_CONTRIBUTION"
COMPANY_CONTRIBUTION = "COMPANY_CONTRIBUTION"

class ExternalDeductionCodeToRipplingCode:
external_code: str
rippling_code: str
rippling_deduction_field: DeductionCodeField

Original file line number Diff line number Diff line change
@@ -0,0 +1,29 @@
from abc import ABC, abstractmethod
from io import IOBase

from flux_sdk.benefits_administration.capabilities.process_employees_deductions.data_models import (
DeductionDetails,
ExternalDeductionCodeToRipplingCode,
)


class ProcessEmployeesDeductions(ABC):
"""
This class represents the "process employee deductions" capability. The developer is supposed to implement
the following methods in their implementation.

The methods on this class are required to instantiate an instance of this class.
"""

@staticmethod
@abstractmethod
def format_and_fetch_deduction_info(
stream: IOBase, deduction_code_mapping: list[ExternalDeductionCodeToRipplingCode]
) -> list[DeductionDetails]:
"""
This method receives the file which contains the deductions relevant to the companies employees and returns the
deductions details for each employee
:param IOBase:
:param list[ExternalDeductionCodeToRipplingCode]:
:return list[DeductionDetails]:
"""
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
python_sources()
Original file line number Diff line number Diff line change
@@ -0,0 +1,84 @@
from datetime import datetime
from decimal import Decimal
from enum import Enum

from flux_sdk.flux_core.data_models import (
Employee,
EmployeeState,
EmploymentType,
PayFrequency,
PayTimeUnit,
TerminationType,
)


class ReportEmployeesHrDataConfig:
'''
This contains the application data gathered durring installation
which is necesary to prepare employee data or process deductions
'''
auto_enroll: bool
group_number: str
company_id: str


class MonetaryValue:
value: Decimal
currency_type: str


class Pay:
frequency: PayFrequency
frequency_effective_date: datetime
time_unit: PayTimeUnit
value_per_unit: MonetaryValue
value_effective_date: datetime
salary_or_equivalent: MonetaryValue
expected_commission: MonetaryValue | None

class EmploymentHours:
type: EmploymentType
type_effective_date: datetime
hours_per_week: int | None
hours_effective_date: datetime


class Employment:
hours: EmploymentHours
pay: Pay
is_rehire: bool
termination_date: datetime | None
termination_type: TerminationType | None
start_date: datetime
original_hire_date: datetime
w2_start_date: datetime
Comment on lines +39 to +54
Copy link
Contributor

Choose a reason for hiding this comment

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

@bryanbierce What are the fields do you need that are not part of Employee ?

I see that hours_per_week and hours_effective_date are the only fields ? Can they go inside Employee data type ? cc: @stevevls @Kingpin007 @ujjwalshukla

Copy link
Contributor Author

Choose a reason for hiding this comment

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

type_effective_date, hours_per_week, hours_effective_date , termination_type and the pay object are not on Employee currently. I had asked the team if I could extend Employee with these originally and the answer from @Kingpin007 and @ujjwalshukla was no. Happy to move them around if you all would rather co-locate these now. This Employment object only existed because the team originally did not want any of the new data in flux_core so I took the opportunity to duplicate some fields and make the objects a bit more sensible to work with.



class BenefitsEligibility(Enum):
# this will expand to cover cobra later
ELIGIBLE = 1
IN_ELIGIBLE = 2

class BenefitsEligibilityStatus:
eligibility: BenefitsEligibility
effective_date: datetime

class EmployeeStatus:
status: EmployeeState
effective_date: datetime


class EmployeeHrData:
'''
This contains the core data about an employee
which is relevant to a benefits administration provider
'''
id: str
employee_number: int
company_tax_id: str
personal: Employee
employment: Employment
pay: Pay
status: EmployeeStatus
benefits_eligibility: BenefitsEligibilityStatus

Original file line number Diff line number Diff line change
@@ -0,0 +1,32 @@
from abc import ABC, abstractmethod

from flux_sdk.benefits_administration.capabilities.report_employees_hr_data.data_models import (
EmployeeHrData,
ReportEmployeesHrDataConfig,
)
from flux_sdk.flux_core.data_models import File


class ReportEmployeesHrData(ABC):
"""
This class represents the "report employee data" capability. The developer is supposed to implement
the following methods in their implementation.

The methods on this class are required to instantiate an instance of this class.
"""

@staticmethod
@abstractmethod
def format_employees_hr_data(
config: ReportEmployeesHrDataConfig,
employee_data: list[EmployeeHrData]
) -> File:
"""
This method receives the apps configuration data and a list of employee data.
The developer is expected to create a file, formated to their use case, and return that file.
The file will be tranfered to the partner company via SFTP

:param ReportEmployeesHrDataConfig:
:param list[EmployeeHrData]:
:return File:
"""
39 changes: 39 additions & 0 deletions flux_sdk/flux_core/data_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -212,3 +212,42 @@ class AppContext:
customer_partner_settings: This dict contains the settings value specified on manifest in key-value pair
"""
customer_partner_settings: dict


class EmploymentType(Enum):
CONTRACTOR = 1
SALARIED_FT = 2
SALARIED_PT = 3
HOURLY_FT = 4
HOURLY_PT = 5
TEMP = 6


class PayFrequency(Enum):
WEEKLY = 1
BI_WEEKLY = 2
MONTHLY = 3
SEMI_MONTHLY = 4
QUARTERLY = 5
ANNUALLY = 6


class PayTimeUnit(Enum):
HOUR = 1
DAY = 2
WEEK = 3
MONTH = 4
YEAR = 5
PAY_PERIOD = 6


class TerminationType(Enum):
VOLUNTARY = 0
INVOLUNTARY = 1
RETIREMENT = 2
DEATH = 3
ABANDONMENT = 4
OFFER_DECLINE = 5
RESCIND = 6
RENEGE = 7

Loading