brynq-sdk-nmbrs 2.3.1__py3-none-any.whl → 2.3.1.dev0__py3-none-any.whl

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
Files changed (32) hide show
  1. brynq_sdk_nmbrs/__init__.py +36 -22
  2. brynq_sdk_nmbrs/costcenter.py +53 -8
  3. brynq_sdk_nmbrs/costunit.py +16 -4
  4. brynq_sdk_nmbrs/department.py +36 -27
  5. brynq_sdk_nmbrs/employee_wage_tax_settings.py +106 -0
  6. brynq_sdk_nmbrs/employees.py +119 -24
  7. brynq_sdk_nmbrs/employment.py +12 -4
  8. brynq_sdk_nmbrs/salaries.py +5 -2
  9. brynq_sdk_nmbrs/schemas/address.py +4 -5
  10. brynq_sdk_nmbrs/schemas/bank.py +0 -2
  11. brynq_sdk_nmbrs/schemas/contracts.py +25 -11
  12. brynq_sdk_nmbrs/schemas/costcenter.py +57 -18
  13. brynq_sdk_nmbrs/schemas/costunit.py +0 -2
  14. brynq_sdk_nmbrs/schemas/days.py +0 -2
  15. brynq_sdk_nmbrs/schemas/department.py +8 -7
  16. brynq_sdk_nmbrs/schemas/employees.py +42 -38
  17. brynq_sdk_nmbrs/schemas/employment.py +10 -10
  18. brynq_sdk_nmbrs/schemas/function.py +6 -7
  19. brynq_sdk_nmbrs/schemas/hours.py +0 -4
  20. brynq_sdk_nmbrs/schemas/leave.py +0 -1
  21. brynq_sdk_nmbrs/schemas/manager.py +0 -3
  22. brynq_sdk_nmbrs/schemas/salary.py +19 -12
  23. brynq_sdk_nmbrs/schemas/schedules.py +0 -1
  24. brynq_sdk_nmbrs/schemas/wage_tax.py +4 -4
  25. brynq_sdk_nmbrs/schemas/wage_tax_settings.py +63 -0
  26. brynq_sdk_nmbrs/schemas/wagecomponents.py +0 -4
  27. brynq_sdk_nmbrs/wage_tax.py +1 -1
  28. {brynq_sdk_nmbrs-2.3.1.dist-info → brynq_sdk_nmbrs-2.3.1.dev0.dist-info}/METADATA +1 -1
  29. brynq_sdk_nmbrs-2.3.1.dev0.dist-info/RECORD +52 -0
  30. {brynq_sdk_nmbrs-2.3.1.dist-info → brynq_sdk_nmbrs-2.3.1.dev0.dist-info}/WHEEL +1 -1
  31. brynq_sdk_nmbrs-2.3.1.dist-info/RECORD +0 -50
  32. {brynq_sdk_nmbrs-2.3.1.dist-info → brynq_sdk_nmbrs-2.3.1.dev0.dist-info}/top_level.txt +0 -0
@@ -1,9 +1,17 @@
1
1
  import math
2
+ from typing import Any, Dict
3
+
2
4
  import pandas as pd
3
5
  import requests
6
+
4
7
  from brynq_sdk_functions import Functions
5
- from typing import Dict, Any
6
- from .schemas.employment import EmploymentGet, EmploymentCreate, EmploymentUpdate, EmploymentDelete
8
+
9
+ from .schemas.employment import (
10
+ EmploymentCreate,
11
+ EmploymentDelete,
12
+ EmploymentGet,
13
+ EmploymentUpdate,
14
+ )
7
15
 
8
16
 
9
17
  class Employment:
@@ -66,7 +74,7 @@ class Employment:
66
74
  return employment_model
67
75
 
68
76
  # Convert validated model to dict for API payload
69
- payload = employment_model.model_dump(exclude_none=True, by_alias=True)
77
+ payload = employment_model.model_dump(exclude_none=True, by_alias=True, mode='json')
70
78
 
71
79
  # Send request
72
80
  resp = self.nmbrs.session.post(
@@ -96,7 +104,7 @@ class Employment:
96
104
  return employment_model
97
105
 
98
106
  # Convert validated model to dict for API payload
99
- payload = employment_model.model_dump(exclude_none=True, by_alias=True)
107
+ payload = employment_model.model_dump(exclude_none=True, by_alias=True, mode='json')
100
108
 
101
109
  # Send request
102
110
  resp = self.nmbrs.session.put(
@@ -1,9 +1,12 @@
1
1
  import math
2
+ from typing import Any, Dict
3
+
2
4
  import pandas as pd
3
5
  import requests
4
- from typing import Dict, Any
6
+
5
7
  from brynq_sdk_functions import Functions
6
- from .schemas.salary import SalaryGet, SalaryCreate
8
+
9
+ from .schemas.salary import SalaryCreate, SalaryGet
7
10
 
8
11
 
9
12
  class Salaries:
@@ -26,7 +26,7 @@ class AddressGet(BrynQPanderaDataFrameModel):
26
26
  postal_code: Series[String] = pa.Field(coerce=True, description="Postal Code", alias="postalCode")
27
27
  city: Series[String] = pa.Field(coerce=True, description="City", alias="city")
28
28
  state_province: Series[String] = pa.Field(coerce=True, nullable=True, description="State or Province", alias="stateProvince")
29
- country_i_s_o_code: Series[String] = pa.Field(coerce=True, nullable=True, description="Country ISO code", alias="countryISOCode")
29
+ country_iso_code: Series[String] = pa.Field(coerce=True, nullable=True, description="Country ISO code", alias="countryISOCode")
30
30
  period_year: Series[pd.Int64Dtype] = pa.Field(coerce=True, nullable=True, description="Year", alias="period.year")
31
31
  period_period: Series[pd.Int64Dtype] = pa.Field(coerce=True, nullable=True, description="Period", alias="period.period")
32
32
 
@@ -45,11 +45,10 @@ class AddressGet(BrynQPanderaDataFrameModel):
45
45
  # ---------------------------
46
46
 
47
47
  class Period(BaseModel):
48
- year: int = Field(..., ge=1900, le=2100, example=2021, description="Year", alias="year")
49
- period: int = Field(..., ge=1, le=53, example=4, description="Period", alias="period")
48
+ period_year: int = Field(..., ge=1900, le=2100, example=2021, description="Year", alias="year")
49
+ period_period: int = Field(..., ge=1, le=53, example=4, description="Period", alias="period")
50
50
 
51
51
  class AddressCreate(BaseModel):
52
- employee_id: str = Field(..., description="Employee identifier", alias="employeeId")
53
52
  is_default: Optional[bool] = Field(None, description="Default Address", alias="isDefault")
54
53
  type: Annotated[
55
54
  str,
@@ -64,7 +63,7 @@ class AddressCreate(BaseModel):
64
63
  postal_code: Optional[str] = Field(None, max_length=15, example="1043BZ", description="Postal Code", alias="postalCode")
65
64
  city: str = Field(..., min_length=1, max_length=100, example="Amsterdam", description="City", alias="city")
66
65
  state_province: Optional[str] = Field(None, max_length=100, example="Noord-Holland", description="State or Province", alias="stateProvince")
67
- country_code: Annotated[
66
+ country_iso_code: Annotated[
68
67
  str,
69
68
  StringConstraints(
70
69
  pattern=r'^[A-Za-z]+$',
@@ -53,7 +53,6 @@ class BankGet(BrynQPanderaDataFrameModel):
53
53
  # Upload Schemas
54
54
  # ---------------------------
55
55
  class BankCreate(BaseModel):
56
- employee_id: str = Field(..., description="Employee identifier", alias="employeeId")
57
56
  number: Optional[str] = Field(None, max_length=34, example="123456789", description="Bank Account Number", alias="number")
58
57
  description: Optional[str] = Field(None, max_length=100, example="Salary Bank", description="Bank Account Description", alias="description")
59
58
  iban: str = Field(..., min_length=5, max_length=34, example="NL20INGB0001234567", description="IBAN", alias="IBAN")
@@ -62,7 +61,6 @@ class BankCreate(BaseModel):
62
61
  bank_account_type: Optional[BankAccountType] = Field(None, example=BankAccountType.BANK_ACCOUNT_1.value, description="Bank Account Type", alias="bankAccountType")
63
62
 
64
63
  class BankUpdate(BaseModel):
65
- employee_id: str = Field(..., description="Employee identifier", alias="employeeId")
66
64
  bank_account_id: str = Field(..., example="49a69eda-252e-4ccb-a220-38ea90511d4f", description="Bank Account ID", alias="bankAccountId")
67
65
  number: Optional[str] = Field(None, max_length=34, example="123456789", description="Bank Account Number", alias="number")
68
66
  description: Optional[str] = Field(None, max_length=100, example="Main Checking Account", description="Bank Account Description", alias="description")
@@ -5,7 +5,7 @@ from pandera.typing import Series, String, Float, DateTime
5
5
  import pandera.extensions as extensions
6
6
  from brynq_sdk_functions import BrynQPanderaDataFrameModel
7
7
  from typing import Optional
8
- from pydantic import BaseModel, Field
8
+ from pydantic import BaseModel, Field, field_validator
9
9
  from datetime import datetime
10
10
 
11
11
  # ---------------------------
@@ -19,7 +19,7 @@ class ContractGet(BrynQPanderaDataFrameModel):
19
19
  end_date: Series[DateTime] = pa.Field(coerce=True, nullable=True, description="End Date Contract", alias="endDate")
20
20
  indefinite: Series[Bool] = pa.Field(coerce=True, description="Indefinite Contract", alias="indefinite")
21
21
  written_contract: Series[Bool] = pa.Field(coerce=True, description="Written Contract", alias="writtenContract")
22
- weekly_hours: Series[Float] = pa.Field(coerce=True, nullable=True, description="Contract Hours per Week", alias="hoursPerWeek")
22
+ hours_per_week: Series[Float] = pa.Field(coerce=True, nullable=True, description="Contract Hours per Week", alias="hoursPerWeek")
23
23
  created_at: Series[DateTime] = pa.Field(coerce=True, description="Contract Created At", alias="createdAt")
24
24
 
25
25
  class _Annotation:
@@ -36,22 +36,36 @@ class ContractGet(BrynQPanderaDataFrameModel):
36
36
  # Upload Schemas
37
37
  # ---------------------------
38
38
  class ContractCreate(BaseModel):
39
- employee_id: str = Field(..., description="Employee identifier", alias="employeeId")
40
- start_date_contract: datetime = Field(..., example="2021-01-01T09:29:18Z", description="Start Date Contract", alias="startDate")
39
+ start_date: datetime = Field(..., example="2021-01-01T09:29:18Z", description="Start Date Contract", alias="startDate")
41
40
  trial_period: Optional[datetime] = Field(None, example="2021-02-01T00:00:00Z", description="Trial Period Contract", alias="trialPeriod")
42
- end_date_contract: Optional[datetime] = Field(None, example="2021-08-24T14:15:22Z", description="End Date Contract", alias="endDate")
43
- indefinite_contract: bool = Field(..., example=True, description="Indefinite Contract", alias="indefinite")
41
+ end_date: Optional[datetime] = Field(None, example="2021-08-24T14:15:22Z", description="End Date Contract", alias="endDate")
42
+ indefinite: bool = Field(..., example=True, description="Indefinite Contract", alias="indefinite")
44
43
  written_contract: Optional[bool] = Field(None, example=True, description="Written Contract", alias="writtenContract")
45
- weekly_hours: Optional[float] = Field(None, ge=0, le=168, example=40, description="Contract Hours per Week", alias="hoursPerWeek")
44
+ hours_per_week: Optional[float] = Field(None, ge=0, le=168, example=40, description="Contract Hours per Week", alias="hoursPerWeek")
45
+
46
+ @field_validator("start_date", "trial_period", "end_date", mode="before")
47
+ @classmethod
48
+ def empty_str_to_none(cls, v):
49
+ """Convert empty strings to None for date fields"""
50
+ if v == "":
51
+ return None
52
+ return v
46
53
 
47
54
  class ContractUpdate(BaseModel):
48
- employee_id: str = Field(..., description="Employee identifier", alias="employeeId")
49
55
  contract_id: str = Field(..., example="e35e343b-55a3-4e44-bc4b-f41c3b93bcf5", description="Contract ID", alias="contractId")
50
56
  trial_period: Optional[datetime] = Field(None, example="2021-07-31T00:00:00Z", description="Trial Period Contract", alias="trialPeriod")
51
- end_date_contract: Optional[datetime] = Field(None, example="2021-12-31T00:00:00Z", description="End Date Contract", alias="endDate")
52
- indefinite_contract: bool = Field(..., example=True, description="Indefinite Contract", alias="indefinite")
57
+ end_date: Optional[datetime] = Field(None, example="2021-12-31T00:00:00Z", description="End Date Contract", alias="endDate")
58
+ indefinite: bool = Field(..., example=True, description="Indefinite Contract", alias="indefinite")
53
59
  written_contract: Optional[bool] = Field(None, example=True, description="Written Contract", alias="writtenContract")
54
- weekly_hours: Optional[float] = Field(None, ge=0, le=168, example=20, description="Contract Hours per Week", alias="hoursPerWeek")
60
+ hours_per_week: Optional[float] = Field(None, ge=0, le=168, example=20, description="Contract Hours per Week", alias="hoursPerWeek")
61
+
62
+ @field_validator("trial_period", "end_date", mode="before")
63
+ @classmethod
64
+ def empty_str_to_none(cls, v):
65
+ """Convert empty strings to None for date fields"""
66
+ if v == "":
67
+ return None
68
+ return v
55
69
 
56
70
  class Config:
57
71
  primary_key = "contractId"
@@ -1,12 +1,13 @@
1
+ from typing import List, Optional
2
+
1
3
  import pandas as pd
2
4
  import pandera as pa
3
5
  from pandera import Bool
4
- from pandera.typing import Series, String, Float, DateTime
5
- import pandera.extensions as extensions
6
- from brynq_sdk_functions import BrynQPanderaDataFrameModel
7
- from typing import Optional, List
6
+ from pandera.typing import DateTime, Float, Series, String
8
7
  from pydantic import BaseModel, Field
9
- from datetime import datetime
8
+
9
+ from brynq_sdk_functions import BrynQPanderaDataFrameModel
10
+
10
11
 
11
12
  # ---------------------------
12
13
  # Get Schemas
@@ -14,12 +15,12 @@ from datetime import datetime
14
15
  class EmployeeCostcenterGet(BrynQPanderaDataFrameModel):
15
16
  employee_id: Series[String] = pa.Field(coerce=True, description="Employee ID", alias="employeeId")
16
17
  employee_cost_center_id: Series[String] = pa.Field(coerce=True, description="Employee Cost Center ID", alias="employeeCostCenterId")
17
- cost_centers_cost_center_id: Series[String] = pa.Field(coerce=True, description="Cost Center ID", alias="costCenters.costCenterId")
18
+ cost_center_id: Series[String] = pa.Field(coerce=True, description="Cost Center ID", alias="costCenters.costCenterId")
18
19
  cost_centers_code: Series[String] = pa.Field(coerce=True, description="Cost Centers Code", alias="costCenters.code")
19
20
  cost_centers_description: Series[String] = pa.Field(coerce=True, description="Cost Centers Description", alias="costCenters.description")
20
- cost_units_cost_unit_id: Series[String] = pa.Field(coerce=True, description="Cost Unit ID", alias="costUnits.costUnitId")
21
- cost_units_code: Series[String] = pa.Field(coerce=True, description="Cost Unit Code", alias="costUnits.code")
22
- cost_units_description: Series[String] = pa.Field(coerce=True, description="Cost Unit Description", alias="costUnits.description")
21
+ cost_unit_id: Series[String] = pa.Field(coerce=True, nullable=True, description="Cost Unit ID", alias="costUnits.costUnitId")
22
+ cost_units_code: Series[String] = pa.Field(coerce=True, nullable=True, description="Cost Unit Code", alias="costUnits.code")
23
+ cost_units_description: Series[String] = pa.Field(coerce=True, nullable=True, description="Cost Unit Description", alias="costUnits.description")
23
24
  percentage: Series[Float] = pa.Field(coerce=True, description="Percentage", alias="percentage")
24
25
  default: Series[Bool] = pa.Field(coerce=True, description="Default", alias="default")
25
26
  period_year: Series[pd.Int64Dtype] = pa.Field(coerce=True, description="Year", alias="period.year")
@@ -27,7 +28,7 @@ class EmployeeCostcenterGet(BrynQPanderaDataFrameModel):
27
28
  created_at: Series[DateTime] = pa.Field(coerce=True, description="Created At", alias="createdAt")
28
29
 
29
30
  class _Annotation:
30
- primary_key = "employee_cost_center_id"
31
+ primary_key = "cost_center_id"
31
32
  foreign_keys = {
32
33
  "employee_id": {
33
34
  "parent_schema": "EmployeeSchema",
@@ -44,19 +45,59 @@ class CostcenterGet(BrynQPanderaDataFrameModel):
44
45
  class _Annotation:
45
46
  primary_key = "cost_center_id"
46
47
 
48
+ # ---------------------------
49
+ # API Response Models (Pydantic)
50
+ # ---------------------------
51
+ class CostCenter(BaseModel):
52
+ cost_center_id: str = Field(..., description="Cost Center ID", alias="costCenterId")
53
+ code: str = Field(..., description="Cost Center Code", alias="code")
54
+ description: str = Field(..., description="Cost Center Description", alias="description")
55
+
56
+
57
+ class CostUnit(BaseModel):
58
+ cost_unit_id: Optional[str] = Field(None, description="Cost Unit ID", alias="costUnitId")
59
+ code: Optional[str] = Field(None, description="Cost Unit Code", alias="code")
60
+ description: Optional[str] = Field(None, description="Cost Unit Description", alias="description")
61
+
62
+
63
+ class Period(BaseModel):
64
+ period_year: int = Field(..., ge=1900, le=2100, example=2021, description="Year", alias="year")
65
+ period_period: int = Field(..., ge=1, le=53, example=4, description="Period", alias="period")
66
+
67
+
68
+ class EmployeeCostCenterItem(BaseModel):
69
+ employee_cost_center_id: str = Field(..., description="Employee Cost Center ID", alias="employeeCostCenterId")
70
+ cost_centers: CostCenter = Field(..., description="Cost Center", alias="costCenters")
71
+ cost_units: Optional[CostUnit] = Field(None, description="Cost Unit", alias="costUnits")
72
+ percentage: float = Field(..., description="Percentage", alias="percentage")
73
+ default: bool = Field(..., description="Default", alias="default")
74
+ period: Period = Field(..., description="Period", alias="period")
75
+ created_at: str = Field(..., description="Created At", alias="createdAt")
76
+
77
+
78
+ class EmployeeCostCentersList(BaseModel):
79
+ employee_id: str = Field(..., description="Employee ID", alias="employeeId")
80
+ employee_cost_centers: List[EmployeeCostCenterItem] = Field(..., description="Employee Cost Centers", alias="employeeCostCenters")
81
+
82
+
83
+ class EmployeeCostCentersResponse(BaseModel):
84
+ data: List[EmployeeCostCentersList] = Field(..., description="List of employee cost centers")
85
+
86
+
87
+ class CostCentersResponse(BaseModel):
88
+ data: List[CostCenter] = Field(..., description="List of cost centers")
89
+
90
+
47
91
  # ---------------------------
48
92
  # Upload Schemas
49
93
  # ---------------------------
50
94
  class CostcenterTable(BaseModel):
51
- costcenter_id: str = Field(..., example="a405f980-1c4c-42c1-8ddb-2d90c58da0b1", description="Cost Center ID", alias="costCenterId")
52
- costunit_id: Optional[str] = Field(None, example="b505f980-1c4c-42c1-8ddb-2d90c58da0b2", description="Cost Unit ID", alias="costUnitId")
95
+ cost_center_id: str = Field(..., example="a405f980-1c4c-42c1-8ddb-2d90c58da0b1", description="Cost Center ID", alias="costCenterId")
96
+ cost_unit_id: Optional[str] = Field(None, example="b505f980-1c4c-42c1-8ddb-2d90c58da0b2", description="Cost Unit ID", alias="costUnitId")
53
97
  percentage: Optional[float] = Field(100, example=100, description="Percentage", alias="percentage")
54
98
  default: Optional[bool] = Field(True, example=True, description="Default", alias="default")
55
99
 
56
100
 
57
- class Period(BaseModel):
58
- year: int = Field(..., ge=1900, le=2100, example=2021, description="Year", alias="year")
59
- period: int = Field(..., ge=1, le=53, example=4, description="Period", alias="period")
60
101
 
61
102
 
62
103
  class EmployeeCostcenterUpdate(BaseModel):
@@ -69,17 +110,15 @@ class EmployeeCostcenterUpdate(BaseModel):
69
110
 
70
111
 
71
112
  class EmployeeCostcenterDelete(BaseModel):
72
- employee_cost_center_id: str = Field(..., example="c605f980-1c4c-42c1-8ddb-2d90c58da0b3", description="Employee Cost Center ID", alias="employeeCostCenterId")
113
+ cost_center_id: str = Field(..., example="c605f980-1c4c-42c1-8ddb-2d90c58da0b3", description="Employee Cost Center ID", alias="employeeCostCenterId")
73
114
 
74
115
  # CostCenter CRUD schemas - These are hypothetical since the API doesn't have create/update/delete endpoints
75
116
  # but we add them for consistency with other schema files
76
117
  class CostcenterCreate(BaseModel):
77
- company_id: str = Field(..., description="Company identifier", alias="companyId")
78
118
  code: str = Field(..., example="CC001", description="Code", alias="code")
79
119
  description: str = Field(..., example="Sales Department", description="Description", alias="description")
80
120
 
81
121
  class CostcenterUpdate(BaseModel):
82
- company_id: str = Field(..., description="Company identifier", alias="companyId")
83
122
  cost_center_id: str = Field(..., example="a405f980-1c4c-42c1-8ddb-2d90c58da0b1", description="Cost Center ID", alias="costCenterId")
84
123
  code: str = Field(..., example="CC001", description="Code", alias="code")
85
124
  description: str = Field(..., example="Sales Department", description="Description", alias="description")
@@ -23,12 +23,10 @@ class CostunitGet(BrynQPanderaDataFrameModel):
23
23
  # Upload Schemas
24
24
  # ---------------------------
25
25
  class CostunitCreate(BaseModel):
26
- company_id: str = Field(..., description="Company identifier", alias="companyId")
27
26
  code: str = Field(..., example="CU001", description="Code", alias="code")
28
27
  description: str = Field(..., example="Marketing Unit", description="Description", alias="description")
29
28
 
30
29
  class CostunitUpdate(BaseModel):
31
- company_id: str = Field(..., description="Company identifier", alias="companyId")
32
30
  cost_unit_id: str = Field(..., example="b505f980-1c4c-42c1-8ddb-2d90c58da0b2", description="Cost Unit ID", alias="costUnitId")
33
31
  code: str = Field(..., example="CU001", description="Code", alias="code")
34
32
  description: str = Field(..., example="Marketing Unit", description="Description", alias="description")
@@ -86,13 +86,11 @@ class HoursDelete(BaseModel):
86
86
 
87
87
 
88
88
  class FixedDaysCreate(BaseModel):
89
- employee_id: str = Field(..., description="Employee identifier", alias="employeeId")
90
89
  number_of_days: int = Field(..., ge=0, le=1000, example=40, description="Days", alias="days")
91
90
  days_for_wage_components_per_day: Optional[int] = Field(None, ge=0, le=1000, example=40, description="Days for Wage Components per Day", alias="daysForWageComponentsPerDay")
92
91
  period_details: Optional[PeriodPost] = Field(None, example="Period details", description="Period details", alias="periodDetails")
93
92
 
94
93
  class VariableDaysCreate(BaseModel):
95
- employee_id: str = Field(..., description="Employee identifier", alias="employeeId")
96
94
  number_of_days: int = Field(..., ge=0, le=1000, example=40, description="Days", alias="days")
97
95
  days_for_wage_components_per_day: Optional[int] = Field(None, ge=0, le=1000, example=40, description="Days for Wage Components per Day", alias="daysForWageComponentsPerDay")
98
96
  period_details: Optional[PeriodPost] = Field(None, example="Period details", description="Period details", alias="periodDetails")
@@ -1,12 +1,15 @@
1
1
  from datetime import datetime
2
+ from typing import Optional
3
+
2
4
  import pandas as pd
3
5
  import pandera as pa
4
- from pandera.typing import Series, String, Float, DateTime
5
6
  import pandera.extensions as extensions
6
- from brynq_sdk_functions import BrynQPanderaDataFrameModel
7
- from typing import Optional
7
+ from pandera.typing import DateTime, Float, Series, String
8
8
  from pydantic import BaseModel, Field
9
9
 
10
+ from brynq_sdk_functions import BrynQPanderaDataFrameModel
11
+
12
+
10
13
  # ---------------------------
11
14
  # Get Schemas
12
15
  # ---------------------------
@@ -33,8 +36,8 @@ class EmployeeDepartmentGet(BrynQPanderaDataFrameModel):
33
36
  # Upload Schemas
34
37
  # ---------------------------
35
38
  class Period(BaseModel):
36
- year: int = Field(..., ge=1900, le=2100, example=2021, description="Year", alias="year")
37
- period: int = Field(..., ge=1, le=53, example=4, description="Period", alias="period")
39
+ period_year: int = Field(..., ge=1900, le=2100, example=2021, description="Year", alias="year")
40
+ period_period: int = Field(..., ge=1, le=53, example=4, description="Period", alias="period")
38
41
 
39
42
  class DepartmentGet(BrynQPanderaDataFrameModel):
40
43
  department_id: Series[String] = pa.Field(coerce=True, description="Department ID", alias="departmentId")
@@ -44,12 +47,10 @@ class DepartmentGet(BrynQPanderaDataFrameModel):
44
47
  managers: Series[String] = pa.Field(coerce=True, description="List of managers", alias="managers")
45
48
 
46
49
  class DepartmentCreate(BaseModel):
47
- employee_id: str = Field(..., description="Employee identifier", alias="employeeId")
48
50
  code: int = Field(..., ge=1, example=2, description="Department Code", alias="code")
49
51
  description: str = Field(..., min_length=1, max_length=200, example="Sales", description="Department Description", alias="description")
50
52
 
51
53
  class EmployeeDepartmentUpdate(BaseModel):
52
- employee_id: str = Field(..., description="Employee identifier", alias="employeeId")
53
54
  department_id: str = Field(..., example="3214", description="Department ID", alias="departmentId")
54
55
  period_details: Period = Field(..., example=Period(year=2021, period=4), description="Period details", alias="periodDetails")
55
56
 
@@ -1,12 +1,15 @@
1
1
  import math
2
+ from typing import Annotated, Optional
3
+
2
4
  import pandas as pd
3
5
  import pandera as pa
4
- from pandera.typing import Series, String, DateTime
5
6
  import pandera.extensions as extensions
6
- from brynq_sdk_functions import BrynQPanderaDataFrameModel
7
- from typing import Optional, Annotated
7
+ from pandera.typing import DateTime, Series, String
8
8
  from pydantic import BaseModel, Field, StringConstraints
9
9
 
10
+ from brynq_sdk_functions import BrynQPanderaDataFrameModel
11
+
12
+
10
13
  # ---------------------------
11
14
  # Get Schemas
12
15
  # ---------------------------
@@ -14,29 +17,28 @@ class EmployeeGet(BrynQPanderaDataFrameModel):
14
17
  employee_id: Series[String] = pa.Field(coerce=True, description="Employee ID", alias="employeeId")
15
18
  personal_info_id: Series[String] = pa.Field(coerce=True, description="Personal Info ID", alias="personalInfoId")
16
19
  created_at: Series[DateTime] = pa.Field(coerce=True, description="Employee Created At", alias="createdAt", nullable=True)
17
- basic_info_employee_number: Series[pd.Int64Dtype] = pa.Field(coerce=True, description="Employee Number", alias="basicInfo.employeeNumber")
18
- basic_info_first_name: Series[String] = pa.Field(coerce=True, nullable=True, description="First Name", alias="basicInfo.firstName")
19
- basic_info_first_name_in_full: Series[String] = pa.Field(coerce=True, nullable=True, description="First Name In Full", alias="basicInfo.firstNameInFull")
20
- basic_info_prefix: Series[String] = pa.Field(coerce=True, nullable=True, description="Prefix", alias="basicInfo.prefix")
21
- basic_info_initials: Series[String] = pa.Field(coerce=True, nullable=True, description="Initials", alias="basicInfo.initials")
22
- basic_info_last_name: Series[String] = pa.Field(coerce=True, description="Last Name", alias="basicInfo.lastName")
23
- basic_info_employee_type: Series[String] = pa.Field(coerce=True, description="Employee Type", alias="basicInfo.employeeType")
24
- birth_info_birth_date: Series[DateTime] = pa.Field(coerce=True, description="Birth Date", alias="birthInfo.birthDate")
25
- birth_info_birth_country_code_iso: Series[String] = pa.Field(coerce=True, nullable=True, description="Birth Country Code ISO", alias="birthInfo.birthCountry.codeISO")
26
- birth_info_nationality_code_iso: Series[String] = pa.Field(coerce=True, nullable=True, description="Nationality Code ISO", alias="birthInfo.nationality.codeISO")
27
- birth_info_gender: Series[String] = pa.Field(coerce=True, nullable=True, description="Gender", alias="birthInfo.gender")
28
- contact_info_private_email: Series[String] = pa.Field(coerce=True, nullable=True, description="Private Email", alias="contactInfo.privateEmail")
29
- contact_info_business_email: Series[String] = pa.Field(coerce=True, nullable=True, description="Business Email", alias="contactInfo.businessEmail")
30
- contact_info_business_phone: Series[String] = pa.Field(coerce=True, nullable=True, description="Business Phone", alias="contactInfo.businessPhone")
31
- contact_info_business_mobile_phone: Series[String] = pa.Field(coerce=True, nullable=True, description="Business Mobile Phone", alias="contactInfo.businessMobilePhone")
32
- contact_info_private_phone: Series[String] = pa.Field(coerce=True, nullable=True, description="Private Phone", alias="contactInfo.privatePhone")
33
- contact_info_private_mobile_phone: Series[String] = pa.Field(coerce=True, nullable=True, description="Private Mobile Phone", alias="contactInfo.privateMobilePhone")
34
- contact_info_other_phone: Series[String] = pa.Field(coerce=True, nullable=True, description="Other Phone", alias="contactInfo.otherPhone")
35
- partner_info_partner_prefix: Series[String] = pa.Field(coerce=True, nullable=True, description="Partner Prefix", alias="partnerInfo.partnerPrefix")
36
- partner_info_partner_name: Series[String] = pa.Field(coerce=True, nullable=True, description="Partner Name", alias="partnerInfo.partnerName")
20
+ employee_number: Series[pd.Int64Dtype] = pa.Field(coerce=True, description="Employee Number", alias="basicInfo.employeeNumber")
21
+ first_name: Series[String] = pa.Field(coerce=True, nullable=True, description="First Name", alias="basicInfo.firstName")
22
+ first_name_in_full: Series[String] = pa.Field(coerce=True, nullable=True, description="First Name In Full", alias="basicInfo.firstNameInFull")
23
+ prefix: Series[String] = pa.Field(coerce=True, nullable=True, description="Prefix", alias="basicInfo.prefix")
24
+ initials: Series[String] = pa.Field(coerce=True, nullable=True, description="Initials", alias="basicInfo.initials")
25
+ last_name: Series[String] = pa.Field(coerce=True, description="Last Name", alias="basicInfo.lastName")
26
+ employee_type: Series[String] = pa.Field(coerce=True, description="Employee Type", alias="basicInfo.employeeType")
27
+ birth_date: Series[DateTime] = pa.Field(coerce=True, description="Birth Date", alias="birthInfo.birthDate")
28
+ birth_country_code_iso: Series[String] = pa.Field(coerce=True, nullable=True, description="Birth Country Code ISO", alias="birthInfo.birthCountry")
29
+ nationality_code_iso: Series[String] = pa.Field(coerce=True, nullable=True, description="Nationality Code ISO", alias="birthInfo.nationality.codeISO")
30
+ gender: Series[String] = pa.Field(coerce=True, nullable=True, description="Gender", alias="birthInfo.gender")
31
+ private_email: Series[String] = pa.Field(coerce=True, nullable=True, description="Private Email", alias="contactInfo.privateEmail")
32
+ business_email: Series[String] = pa.Field(coerce=True, nullable=True, description="Business Email", alias="contactInfo.businessEmail")
33
+ business_phone: Series[String] = pa.Field(coerce=True, nullable=True, description="Business Phone", alias="contactInfo.businessPhone")
34
+ business_mobile_phone: Series[String] = pa.Field(coerce=True, nullable=True, description="Business Mobile Phone", alias="contactInfo.businessMobilePhone")
35
+ private_phone: Series[String] = pa.Field(coerce=True, nullable=True, description="Private Phone", alias="contactInfo.privatePhone")
36
+ private_mobile_phone: Series[String] = pa.Field(coerce=True, nullable=True, description="Private Mobile Phone", alias="contactInfo.privateMobilePhone")
37
+ other_phone: Series[String] = pa.Field(coerce=True, nullable=True, description="Other Phone", alias="contactInfo.otherPhone")
38
+ partner_prefix: Series[String] = pa.Field(coerce=True, nullable=True, description="Partner Prefix", alias="partnerInfo.partnerPrefix")
39
+ partner_name: Series[String] = pa.Field(coerce=True, nullable=True, description="Partner Name", alias="partnerInfo.partnerName")
37
40
  period_year: Series[pd.Int64Dtype] = pa.Field(coerce=True, description="Year", alias="period.year")
38
41
  period_period: Series[pd.Int64Dtype] = pa.Field(coerce=True, description="Period", alias="period.period")
39
- birth_info_birth_country: Series[String] = pa.Field(coerce=True, nullable=True, description="Birth Country", alias="birthInfo.birthCountry")
40
42
  company_id: Series[String] = pa.Field(coerce=True, description="Company ID", alias="companyId")
41
43
 
42
44
  class _Annotation:
@@ -46,7 +48,7 @@ class EmployeeGet(BrynQPanderaDataFrameModel):
46
48
  # Upload Schemas
47
49
  # ---------------------------
48
50
  class BasicInfo(BaseModel):
49
- employee_id: Optional[int] = Field(None, ge=1, example=98072, description="Employee Number", alias="employeeNumber")
51
+ employee_number: Optional[int] = Field(None, ge=1, example=98072, description="Employee Number", alias="employeeNumber")
50
52
  first_name: Optional[str] = Field(None, max_length=50, example="John", description="First Name", alias="firstName")
51
53
  first_name_in_full: Optional[str] = Field(None, max_length=100, example="John in Full", description="First Name In Full", alias="firstNameInFull")
52
54
  prefix: Optional[str] = Field(None, max_length=50, example="van der", description="Prefix", alias="prefix")
@@ -61,7 +63,7 @@ class BasicInfo(BaseModel):
61
63
  ] = Field(..., example="payroll", description="Employee Type", alias="employeeType")
62
64
 
63
65
  class BasicInfoUpdate(BaseModel):
64
- employee_id: Optional[int] = Field(None, ge=1, example=98072, description="Employee Number", alias="employeeNumber")
66
+ employee_number: Optional[int] = Field(None, ge=1, example=98072, description="Employee Number", alias="employeeNumber")
65
67
  first_name: Optional[str] = Field(None, max_length=50, example="John", description="First Name", alias="firstName")
66
68
  first_name_in_full: Optional[str] = Field(None, max_length=100, example="John in Full", description="First Name In Full", alias="firstNameInFull")
67
69
  prefix: Optional[str] = Field(None, max_length=50, example="van der", description="Prefix", alias="prefix")
@@ -79,7 +81,7 @@ class BirthInfo(BaseModel):
79
81
  max_length=3
80
82
  )
81
83
  ]] = Field(None, example="NL", description="Birth Country Code ISO", alias="birthCountryCodeISO")
82
- nationality: Optional[Annotated[
84
+ nationality_code_iso: Optional[Annotated[
83
85
  str,
84
86
  StringConstraints(
85
87
  pattern=r'^[A-Za-z]+$',
@@ -92,16 +94,16 @@ class BirthInfo(BaseModel):
92
94
  gender: Optional[Annotated[
93
95
  str,
94
96
  StringConstraints(
95
- pattern=r'^(unspecified|male|female|unknown)$',
97
+ pattern=r'^(|unspecified|male|female|unknown)$',
96
98
  strip_whitespace=True
97
99
  )
98
100
  ]] = Field(None, example="male", description="Gender", alias="gender")
99
101
 
100
102
  class ContactInfo(BaseModel):
101
- email_private: Optional[str] = Field(None, max_length=100, example="doe@private.com", description="Private Email", alias="privateEmail")
102
- email_work: Optional[str] = Field(None, max_length=100, example="doe@business.com", description="Business Email", alias="businessEmail")
103
- phone_work: Optional[str] = Field(None, max_length=50, example="+351222222", description="Business Phone", alias="businessPhone")
104
- mobile_work: Optional[str] = Field(None, max_length=50, example="+351222222", description="Business Mobile Phone", alias="businessMobilePhone")
103
+ private_email: Optional[str] = Field(None, max_length=100, example="doe@private.com", description="Private Email", alias="privateEmail")
104
+ business_email: Optional[str] = Field(None, max_length=100, example="doe@business.com", description="Business Email", alias="businessEmail")
105
+ business_phone: Optional[str] = Field(None, max_length=50, example="+351222222", description="Business Phone", alias="businessPhone")
106
+ business_mobile_phone: Optional[str] = Field(None, max_length=50, example="+351222222", description="Business Mobile Phone", alias="businessMobilePhone")
105
107
  private_phone: Optional[str] = Field(None, max_length=50, example="+351222222", description="Private Phone", alias="privatePhone")
106
108
  private_mobile_phone: Optional[str] = Field(None, max_length=50, example="+351222222", description="Private Mobile Phone", alias="privateMobilePhone")
107
109
  other_phone: Optional[str] = Field(None, max_length=50, example="+351222222", description="Other Phone", alias="otherPhone")
@@ -112,12 +114,12 @@ class PartnerInfo(BaseModel):
112
114
  ascription_code: Optional[int] = Field(None, ge=0, example=0, description="Ascription Code", alias="ascriptionCode")
113
115
 
114
116
  class Period(BaseModel):
115
- year: int = Field(..., ge=1900, le=2100, example=2021, description="Year", alias="year")
116
- period: int = Field(..., ge=1, le=53, example=4, description="Period", alias="period")
117
+ period_year: int = Field(..., ge=1900, le=2100, example=2021, description="Year", alias="year")
118
+ period_period: int = Field(..., ge=1, le=53, example=4, description="Period", alias="period")
117
119
 
118
120
  class AdditionalEmployeeInfo(BaseModel):
119
- in_service_date: str = Field(..., example="2019-08-24", description="In Service Date", alias="inServiceDate")
120
- default_employee_template: Optional[str] = Field(None, description="Default Employee Template", alias="defaultEmployeeTemplate")
121
+ in_service_date: Optional[str] = Field(None, example="2019-08-24", description="In Service Date", alias="inServiceDate")
122
+ default_employee_template: Optional[str] = Field(None, description="Default employee template unique identifier to be only used for employee's of type Payroll", alias="defaultEmployeeTemplate")
121
123
 
122
124
  class CreateEmployeePersonalInfo(BaseModel):
123
125
  basic_info: BasicInfo = Field(..., alias="basicInfo")
@@ -128,12 +130,10 @@ class CreateEmployeePersonalInfo(BaseModel):
128
130
  created_at: Optional[str] = Field(None, example="2021-07-01T10:15:08Z", description="Created At", alias="createdAt")
129
131
 
130
132
  class EmployeeCreate(BaseModel):
131
- company_id: str = Field(..., description="Company identifier", alias="companyId")
132
133
  personal_info: CreateEmployeePersonalInfo = Field(..., alias="personalInfo")
133
134
  additional_employee_info: AdditionalEmployeeInfo = Field(..., alias="additionalEmployeeInfo")
134
135
 
135
136
  class EmployeeUpdate(BaseModel):
136
- employee_id: str = Field(..., description="Employee identifier", alias="employeeId")
137
137
  basic_info: Optional[BasicInfoUpdate] = Field(None, alias="basicInfo")
138
138
  birth_info: Optional[BirthInfo] = Field(None, alias="birthInfo")
139
139
  contact_info: Optional[ContactInfo] = Field(None, alias="contactInfo")
@@ -151,3 +151,7 @@ class BsnGet(BrynQPanderaDataFrameModel):
151
151
 
152
152
  class _Annotation:
153
153
  primary_key = "employee_id"
154
+
155
+ class DefaultEmployeeTemplates(BrynQPanderaDataFrameModel):
156
+ default_employee_template: Series[String] = pa.Field(coerce=True, description="UID of the default employee tempalte", alias="defaultEmployeeTemplateId")
157
+ description: Series[String] = pa.Field(coerce=True, description="The description of the default employee template ")
@@ -1,13 +1,15 @@
1
+ from datetime import datetime
2
+ from typing import Optional
3
+
1
4
  import pandas as pd
2
5
  import pandera as pa
3
- from pandera import Bool
4
- from pandera.typing import Series, String, Float, DateTime
5
6
  import pandera.extensions as extensions
7
+ from pandera import Bool
8
+ from pandera.typing import DateTime, Float, Series, String
9
+ from pydantic import BaseModel, Field
10
+
6
11
  from brynq_sdk_functions import BrynQPanderaDataFrameModel
7
12
 
8
- from typing import Optional
9
- from pydantic import BaseModel, Field
10
- from datetime import datetime
11
13
 
12
14
  # ---------------------------
13
15
  # Get Schemas
@@ -33,16 +35,14 @@ class EmploymentGet(BrynQPanderaDataFrameModel):
33
35
  # Upload Schemas
34
36
  # ---------------------------
35
37
  class EmploymentCreate(BaseModel):
36
- employee_id: str = Field(..., description="Employee identifier", alias="employeeId")
37
38
  start_date: datetime = Field(..., example="2021-06-07T07:59:11Z", description="Start Date Employment", alias="startDate")
38
39
  seniority_date: Optional[datetime] = Field(None, example="2021-06-09T07:59:11Z", description="Seniority Date Employment", alias="seniorityDate")
39
40
 
40
41
  class EmploymentUpdate(BaseModel):
41
- employee_id: str = Field(..., description="Employee identifier", alias="employeeId")
42
42
  employment_id: str = Field(..., example="a405f980-1c4c-42c1-8ddb-2d90c58da0b1", description="Employment ID", alias="employmentId")
43
43
  seniority_date: Optional[datetime] = Field(None, example="2021-06-07T07:59:11Z", description="Seniority Date Employment", alias="seniorityDate")
44
- end_of_service_date: Optional[datetime] = Field(None, example="2021-10-01T00:00:00Z", description="End of Service Date Employment", alias="endOfServiceDate")
45
- end_of_contract_reason: Optional[int] = Field(None, ge=0, example=3, description="End of Contract Reason Employment", alias="endOfContractReason")
44
+ end_date: Optional[datetime] = Field(None, example="2021-10-01T00:00:00Z", description="End of Service Date Employment", alias="endOfServiceDate")
45
+ end_contract_reason: Optional[int] = Field(None, ge=0, example=3, description="End of Contract Reason Employment", alias="endOfContractReason")
46
46
 
47
47
  class EmploymentDelete(BaseModel):
48
- employment_id: str = Field(..., example="a405f980-1c4c-42c1-8ddb-2d90c58da0b1", description="Employment ID", alias="employmentId")
48
+ employment_id: str = Field(..., example="a405f980-1c4c-42c1-8ddb-2d90c58da0b1", description="Employment ID", alias="employmentId")
@@ -1,13 +1,14 @@
1
1
  from datetime import datetime
2
+ from typing import Optional
2
3
 
3
4
  import pandas as pd
4
5
  import pandera as pa
5
- from pandera.typing import Series, String, Float, DateTime
6
6
  import pandera.extensions as extensions
7
+ from pandera.typing import DateTime, Float, Series, String
8
+ from pydantic import BaseModel, Field
9
+
7
10
  from brynq_sdk_functions import BrynQPanderaDataFrameModel
8
11
 
9
- from typing import Optional
10
- from pydantic import BaseModel, Field
11
12
 
12
13
  # ---------------------------
13
14
  # Get Schemas
@@ -35,16 +36,14 @@ class EmployeeFunctionGet(BrynQPanderaDataFrameModel):
35
36
  # Upload Schemas
36
37
  # ---------------------------
37
38
  class Period(BaseModel):
38
- year: int = Field(..., ge=1900, le=2100, example=2021, description="Year", alias="year")
39
- period: int = Field(..., ge=1, le=53, example=4, description="Period", alias="period")
39
+ period_year: int = Field(..., ge=1900, le=2100, example=2021, description="Year", alias="year")
40
+ period_period: int = Field(..., ge=1, le=53, example=4, description="Period", alias="period")
40
41
 
41
42
  class FunctionGet(BrynQPanderaDataFrameModel):
42
43
  function_id: Series[pa.String] = pa.Field(coerce=True, description="Function ID", alias="functionId")
43
44
  code: Series[pd.Int64Dtype] = pa.Field(coerce=True, description="Function Code", alias="code")
44
45
  description: Series[pa.String] = pa.Field(coerce=True, description="Function Description", alias="description")
45
- created_at: Series[datetime] = pa.Field(coerce=True, description="Function Created At", alias="createdAt")
46
46
 
47
47
  class FunctionUpdate(BaseModel):
48
- employee_id: str = Field(..., description="Employee identifier", alias="employeeId")
49
48
  function_id: str = Field(..., example="5981", description="Function ID", alias="functionId")
50
49
  period_details: Period = Field(..., alias="periodDetails")