Skip to content

Commit

Permalink
add readme
Browse files Browse the repository at this point in the history
  • Loading branch information
bryanbierce committed Jan 27, 2025
1 parent 8df4a1f commit 66d9a92
Show file tree
Hide file tree
Showing 4 changed files with 35 additions and 15 deletions.
Original file line number Diff line number Diff line change
@@ -0,0 +1,26 @@
This capability is responsible for accepting data that describes the companies benefits the lines which employees are enrolled in and returning a formated file to be sent to the 3rd party according to the app configuration.


An simple implementation might look like
```
COLUMNS = [
# column strings
]
def format_employee_enrollment_data(
companyEnrollmentInfo: CompanyEnrollmentInfo,
employee: list[Employee]
) -> File:
csv_output = contextlib.closing(io.StringIO())
writer = csv.DictWriter(csv_output, fieldnames=COLUMNS)

for employee_enrollment in companyEnrollmentInfo.employeeEnrollments:
row = {
# define data for each column here
}
writer.writerow(row)

file = File()
file.name = # your file name
file.content = csv_output.getvalue().encode()
return file
```

This file was deleted.

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

from flux_sdk.benefits_enrollments.capabilities.report_employee_enrollments.data_models import (
ReportEmployeeEnrollmentsConfig,
)
from flux_sdk.benefits_enrollments.data_models import CompanyEnrollmentInfo
from flux_sdk.flux_core.data_models import File
from flux_sdk.flux_core.data_models import File, Employee


class ReportEmployeeEnrollments(ABC):
Expand All @@ -19,8 +16,8 @@ class ReportEmployeeEnrollments(ABC):
@staticmethod
@abstractmethod
def format_employee_enrollment_data(
config: ReportEmployeeEnrollmentsConfig,
employee_enrollment_data: CompanyEnrollmentInfo
companyEnrollmentInfo: CompanyEnrollmentInfo,
employees: list[Employee],
) -> File:
"""This method is expected to use the employee data it receives to format a file to send to the 3rd party.
Expand All @@ -29,6 +26,7 @@ def format_employee_enrollment_data(
enrollment for an employee or a dependent.
```
:param config: Includes any app config that might be helpful
:param employee_enrollment_data: Includes line level data on every employee and their dependents
:param companyEnrollmentInfo: Includes line level data on every employee and their dependents
:param Employee: HR data for each employee
:return: File
"""
7 changes: 4 additions & 3 deletions flux_sdk/benefits_enrollments/data_models.py
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,8 @@ class LineEnrollment:
]
"""The group type of the enrollment"""
groupingType: GroupingType

"""Indicates if the employee is enrolled in COBRA"""
isCobra: bool

class BenefitsPlan:
"""The details of a benefit plan"""
Expand All @@ -139,7 +140,7 @@ class BenefitsPlan:
"""The plan class code"""
classCode: str

class EmployeeEnrollments:
class EmployeeEnrollment:
"""This object contains the details of an employee's enrollments in benefit plans."""
"""The unique ID of the employee"""
employeeId: str
Expand All @@ -154,5 +155,5 @@ class CompanyEnrollmentInfo:
"""The list of plans offered by the company"""
plans: list[BenefitsPlan]
"""The list of employees and their enrollments"""
employeeEnrollments: list[EmployeeEnrollments]
employeeEnrollments: list[EmployeeEnrollment]

0 comments on commit 66d9a92

Please sign in to comment.