Api reference
components.es.public.account ¶
get_account_admins ¶
Source code in components/es/public/account.py
get_account_name ¶
Source code in components/es/public/account.py
user_is_account_admin ¶
Source code in components/es/public/account.py
components.es.public.auth ¶
authorization ¶
business_logic ¶
mfa_push_notification ¶
send_mfa_operation_pending_push_notification ¶
Sends a request to validate an MFA-protected operation
Source code in components/es/public/auth/business_logic/mfa_push_notification.py
components.es.public.blueprints ¶
admin_api_blueprint ¶
admin_tools ¶
customize_email ¶
Source code in components/es/public/blueprints/admin_tools.py
dkv_authorization ¶
Source code in components/es/public/blueprints/admin_tools.py
dkv_enrollment ¶
Source code in components/es/public/blueprints/admin_tools.py
228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 | |
enrollment_address ¶
Source code in components/es/public/blueprints/admin_tools.py
export_batch ¶
Source code in components/es/public/blueprints/admin_tools.py
index ¶
Source code in components/es/public/blueprints/admin_tools.py
init_blueprint ¶
Source code in components/es/public/blueprints/admin_tools.py
insurance_card ¶
Source code in components/es/public/blueprints/admin_tools.py
insurance_cards ¶
Source code in components/es/public/blueprints/admin_tools.py
580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 662 663 664 665 666 667 668 669 670 671 672 673 674 675 676 677 678 679 680 681 682 683 684 685 686 687 688 689 690 691 692 693 694 695 696 697 698 699 700 701 702 703 704 705 706 707 708 709 710 711 712 713 | |
list_api_endpoints ¶
Source code in components/es/public/blueprints/admin_tools.py
list_commands ¶
Source code in components/es/public/blueprints/admin_tools.py
list_email ¶
Source code in components/es/public/blueprints/admin_tools.py
load_admin_tools_blueprint ¶
meeting_doctors_user_panel ¶
Source code in components/es/public/blueprints/admin_tools.py
nursery_installments ¶
Source code in components/es/public/blueprints/admin_tools.py
1016 1017 1018 1019 1020 1021 1022 1023 1024 1025 1026 1027 1028 1029 1030 1031 1032 1033 1034 1035 1036 1037 1038 1039 1040 1041 1042 1043 1044 1045 1046 1047 1048 1049 1050 1051 1052 1053 1054 1055 1056 1057 1058 1059 1060 1061 1062 1063 1064 1065 1066 1067 1068 1069 1070 1071 1072 1073 1074 1075 1076 1077 1078 1079 1080 1081 1082 1083 1084 1085 1086 1087 1088 1089 1090 1091 1092 1093 1094 1095 1096 1097 1098 1099 1100 1101 1102 1103 1104 1105 1106 1107 1108 1109 1110 1111 1112 1113 1114 1115 1116 1117 1118 1119 1120 1121 1122 1123 1124 1125 1126 1127 1128 1129 1130 1131 1132 1133 1134 1135 1136 1137 1138 1139 1140 1141 1142 1143 1144 1145 1146 1147 1148 1149 1150 1151 1152 1153 1154 1155 1156 1157 1158 1159 1160 1161 1162 1163 1164 1165 1166 1167 1168 1169 1170 1171 1172 1173 1174 1175 1176 1177 1178 1179 1180 1181 1182 1183 1184 1185 1186 1187 1188 1189 1190 1191 1192 1193 1194 1195 1196 1197 1198 1199 1200 1201 1202 1203 1204 1205 1206 1207 1208 1209 1210 1211 1212 1213 1214 1215 1216 1217 1218 1219 1220 1221 1222 1223 1224 1225 | |
push_to_algolia_for_rq ¶
Source code in components/es/public/blueprints/admin_tools.py
show_command ¶
Source code in components/es/public/blueprints/admin_tools.py
sync_medical_services ¶
Source code in components/es/public/blueprints/admin_tools.py
data_consistency_blueprint ¶
data_consistency_blueprint
module-attribute
¶
register_blueprint ¶
Source code in components/es/public/blueprints/data_consistency_blueprint.py
es_core_blueprint ¶
es_core_blueprint
module-attribute
¶
es_core_blueprint = CustomBlueprint(
"es-core",
__name__,
cli_group=None,
template_folder="templates",
static_folder="static",
static_url_path="/static",
)
register_blueprint ¶
Source code in components/es/public/blueprints/es_core_blueprint.py
13 14 15 16 17 18 19 20 21 22 23 24 25 26 27 28 29 30 31 32 33 34 35 36 37 38 39 40 41 42 43 44 45 46 47 48 49 50 51 52 53 54 55 56 57 58 59 60 61 62 63 64 65 66 67 68 69 70 71 72 73 74 75 76 77 78 79 80 81 82 83 84 85 86 87 88 89 90 91 92 93 94 95 96 97 98 99 100 101 102 103 104 105 106 107 108 109 110 111 112 113 114 115 | |
components.es.public.clinic ¶
adapter ¶
EsClinicAdapter ¶
Bases: ClinicAdapter
get_allowlist_of_dermatology_medical_admins_ids ¶
get_app_base_user_data ¶
Source code in components/es/public/clinic/adapter.py
get_app_user_available_health_services ¶
Source code in components/es/public/clinic/adapter.py
get_app_user_data ¶
Source code in components/es/public/clinic/adapter.py
get_booking_session_package ¶
Source code in components/es/public/clinic/adapter.py
get_coverage_status ¶
get_last_active_id_verification_request_for_user ¶
ES implementation of getting the last active ID verification request for a user. Since Spain doesn't support ID verification for the clinic, this will fail if we try to call it.
Source code in components/es/public/clinic/adapter.py
has_access_to_orientation_call ¶
Source code in components/es/public/clinic/adapter.py
has_app_user_permission ¶
Source code in components/es/public/clinic/adapter.py
is_app_user_admin_of_company ¶
Source code in components/es/public/clinic/adapter.py
release_date_of_conversations_created_for_therapy_sessions
class-attribute
instance-attribute
¶
request_id_verification_request_for_user ¶
ES implementation of getting or requesting ID verification for a clinic user. Since Spain doesn't support ID verification for clinic users, this will raise a NotImplementedError if it's called.
Source code in components/es/public/clinic/adapter.py
should_request_id_verification_for_user ¶
ES implementation of checking if ID verification should be requested for a clinic user. Since Spain doesn't support ID verification for clinic users, this will always return False.
Source code in components/es/public/clinic/adapter.py
update_app_user_phone ¶
Source code in components/es/public/clinic/adapter.py
update_app_user_ssn ¶
upload_invoice_as_insurance_document ¶
Source code in components/es/public/clinic/adapter.py
user_has_24_hour_response_guarantee ¶
validate_session_duration ¶
Source code in components/es/public/clinic/adapter.py
MIN_APP_VERSION_FOR_ORIENTATION_CALL
module-attribute
¶
PHYSIOTHERAPY_SESSION_PRICE_FOR_USER_WITHOUT_ACCESS_IN_CENTS
module-attribute
¶
clinic_eligibility ¶
This module contains the query to get the current or upcoming period of eligibility to the clinic restricted services.
NOTE: the logic could be reused by other services than the Clinic, provided the country-specific rules are the same. If yes, feel free to rename the file and query to a more generic name.
get_coverage_status ¶
Return the start and optionally the end date of the current or upcoming period of eligibility to the clinic restricted services.
Source code in components/es/public/clinic/clinic_eligibility.py
components.es.public.command_log ¶
get_command_logs ¶
Source code in components/es/public/command_log.py
components.es.public.company ¶
get_account_ids_from_company_ids ¶
Extract account IDs list from company IDs.
Source code in components/es/public/company.py
get_companies ¶
Source code in components/es/public/company.py
get_company_display_name ¶
get_company_id_of_user ¶
Source code in components/es/public/company.py
get_company_id_to_account_id ¶
Source code in components/es/public/company.py
get_company_ids_for_account_id ¶
Source code in components/es/public/company.py
get_company_period_at_date ¶
Retrieve the validity period for a specific company at the provided date.
This function loads the CompanyPayrollPeriod for the given company_id at the specified at_date, then returns the current_period from that object.
:param company_id: The UUID of the company. :param at_date: The date at which to retrieve the company period. :return: A ValidityPeriod instance representing the current period for the specified company at the given date.
Source code in components/es/public/company.py
get_employees_invite_emails ¶
Source code in components/es/public/company.py
get_user_admined_company_ids ¶
is_company ¶
is_employee_in_one_of_companies ¶
Source code in components/es/public/company.py
components.es.public.contracting ¶
legal_documents ¶
get_cp_individual_data_from_individual_legal_document_info ¶
Returns the generated CpIndividualData from the instance of IndividualLegalDocumentsInfo provided.
Args:
legal_documents_info (UUID): The health contract id of the member's health contract.
Returns:
(CpIndividualData): The data class containing particular conditions data
Source code in components/es/public/contracting/legal_documents.py
get_sepa_mandate_data_from_individual_legal_document_info ¶
Returns the generated SepaMandateData from the instance of IndividualLegalDocumentsInfo provided.
Args:
legal_documents_info (UUID): The health contract id of the member's health contract.
Returns:
(SepaMandateData): The data class containing the information needed to generate
a SEPA mandate.
Source code in components/es/public/contracting/legal_documents.py
components.es.public.customer_health_partner ¶
employees_count ¶
get_employees_count ¶
Source code in components/es/public/customer_health_partner/employees_count.py
get_admin_traits ¶
get_admin_traits_to_notify ¶
Return the list of AdminTraits for admins who should be notified about the well-being assessment report.
Source code in components/es/public/customer_health_partner/get_admin_traits.py
get_company_ids_for_account_company_ids ¶
get_company_ids_for_account_company_ids ¶
Source code in components/es/public/customer_health_partner/get_company_ids_for_account_company_ids.py
components.es.public.employment ¶
es_country_gateway ¶
EsCountryGateway ¶
Bases: CountryGateway[EsExtendedValues]
Spanish implementation of the Employment Component's CountryGateway
are_companies_in_same_account ¶
Source code in components/es/public/employment/es_country_gateway.py
get_account_name ¶
get_company_information ¶
Source code in components/es/public/employment/es_country_gateway.py
get_employee_identifier_for_country ¶
get_employment_consumers ¶
Gets all employment consumers contributed by this country.
Notes: 1. ALL Employment Consumers will be called regardless of the country of origin. 2. The function that will be called must have all local code as LOCAL imports - otherwise, this breaks Canada (where loading non-CA models is forbidden)
Source code in components/es/public/employment/es_country_gateway.py
get_upstream_retry_handler ¶
Source code in components/es/public/employment/es_country_gateway.py
get_user_admined_company_ids ¶
Source code in components/es/public/employment/es_country_gateway.py
get_user_full_name ¶
Source code in components/es/public/employment/es_country_gateway.py
es_extended_values ¶
EsEmploymentDeclaration
module-attribute
¶
EsExtendedValues ¶
components.es.public.employment_consumer ¶
Note: Do not import local country code here, do it in the internal component after checking the country code.
es_health_affiliation_employment_change_consumer ¶
Source code in components/es/public/employment_consumer.py
components.es.public.enrollment ¶
BaseEnrollment
dataclass
¶
BaseEnrollment(
id,
user_id,
type,
beneficiary_type,
subscription_ref,
is_individual,
start_date=isodate_field(),
version_start_date=isodate_field(),
coverage_start_date=isodate_field(),
end_date=optional_isodate_field(),
is_cancelled=False,
insurance_configuration=None,
healthy_benefits_configuration=None,
)
BaseEnrollmentType ¶
Bases: AlanBaseEnum
get_user_active_base_enrollments ¶
Return a list of user active enrollments, to insurance, or any healthy benefit. Enrollments starting in the future are NOT returned. If include_dependents is True, all enrollments on the user's insurance policy are returned. Note: we don't have healthy benefits for dependents yet.
Source code in components/es/internal/business_logic/enrollment/queries/base_enrollment.py
components.es.public.entities ¶
BaseEnrollmentType ¶
Bases: AlanBaseEnum
EsCompany
dataclass
¶
EsUserDetails
dataclass
¶
EsUserDetails(
id,
first_name,
last_name,
email,
birth_date=optional_isodate_field(),
gender=None,
insurance_profile_id=None,
)
Bases: DataClassJsonMixin
ManzanaServiceConfigurationKey ¶
OptionType ¶
Bases: AlanBaseEnum
ProductServiceConfigurationKey
module-attribute
¶
components.es.public.events ¶
subscription ¶
subscribe_to_es_global_events ¶
Events subscriptions that should be listened by every runtime for Spain.
Source code in components/es/public/events/subscription.py
subscribe_to_events ¶
All event subscriptions for Spain should be done here.
Source code in components/es/public/events/subscription.py
components.es.public.feature ¶
get_feature_metadata_value ¶
Source code in components/es/public/feature.py
is_feature_active ¶
Check if a feature is active :param feature_name: the name of the feature :return: true if the feature with this name is found and active
Source code in components/es/public/feature.py
is_user_alaner ¶
Checks if a user is an Alan employee based on their user ID.
In the Spanish context, a user is considered an Alan employee if either: - They have an active AlanEmployee entry associated with their account - They have an active employment contract with "Marmot Iberia company" (Alan Spain)
This dual check is necessary because Alan employees typically have two accounts: 1. An AlanEmployee account 2. A personal account for using the Alan App
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
UUID
|
The unique identifier of the user to check |
required |
Returns:
| Name | Type | Description |
|---|---|---|
bool |
bool
|
True if the user is an Alan employee, False otherwise |
Note
The function performs a database query joining the EsUser table with EsAlanEmployee and EsEmployment tables to check both conditions.
Source code in components/es/public/feature.py
components.es.public.global_customer_dashboard ¶
admin ¶
AdminInvitation
dataclass
¶
CAN_INVITE_ADMINS_DATA
module-attribute
¶
CAN_INVITE_ADMINS_DATA = [
{
"company": "eb3eca81-52bf-4906-8bb8-5e36a2fc90fe",
"enabledForUsers": [
"809bf2c1-ae3b-4be8-be93-ac8509c2e1e2",
"4825942c-8f57-44ec-b50b-49d431c48a21",
"67859a35-30f3-47fb-bba7-df5340a60628",
"c34243b3-6743-41a7-9a98-916481213892",
"c43c2323-cf93-4f74-a552-c63fa0b0c185",
],
},
{
"company": "af18ef59-0772-440f-8dd9-6caf506415b3",
"enabledForUsers": [
"809bf2c1-ae3b-4be8-be93-ac8509c2e1e2",
"4825942c-8f57-44ec-b50b-49d431c48a21",
"67859a35-30f3-47fb-bba7-df5340a60628",
"c34243b3-6743-41a7-9a98-916481213892",
"c43c2323-cf93-4f74-a552-c63fa0b0c185",
],
},
{
"company": "375b96ba-9b3b-4ef7-9149-6aab10eb3bf5",
"enabledForUsers": [
"809bf2c1-ae3b-4be8-be93-ac8509c2e1e2",
"4825942c-8f57-44ec-b50b-49d431c48a21",
"67859a35-30f3-47fb-bba7-df5340a60628",
"c34243b3-6743-41a7-9a98-916481213892",
"c43c2323-cf93-4f74-a552-c63fa0b0c185",
],
},
{
"company": "f640ef11-7204-4716-9a58-4e58c69103a6",
"enabledForUsers": [
"809bf2c1-ae3b-4be8-be93-ac8509c2e1e2",
"4825942c-8f57-44ec-b50b-49d431c48a21",
"67859a35-30f3-47fb-bba7-df5340a60628",
"c34243b3-6743-41a7-9a98-916481213892",
"c43c2323-cf93-4f74-a552-c63fa0b0c185",
],
},
{
"company": "e1e611b7-b04f-41e0-824c-0fc5ce1c6ff6",
"enabledForUsers": [
"809bf2c1-ae3b-4be8-be93-ac8509c2e1e2",
"4825942c-8f57-44ec-b50b-49d431c48a21",
"67859a35-30f3-47fb-bba7-df5340a60628",
"c34243b3-6743-41a7-9a98-916481213892",
"c43c2323-cf93-4f74-a552-c63fa0b0c185",
],
},
{
"company": "cd52c2b0-818c-4774-8eb7-8c9b45af0e97",
"enabledForUsers": [
"809bf2c1-ae3b-4be8-be93-ac8509c2e1e2",
"4825942c-8f57-44ec-b50b-49d431c48a21",
"67859a35-30f3-47fb-bba7-df5340a60628",
"c34243b3-6743-41a7-9a98-916481213892",
"c43c2323-cf93-4f74-a552-c63fa0b0c185",
],
},
{
"company": "3f57c053-470d-4704-b5fd-d3f04bf1c033",
"enabledForUsers": [
"809bf2c1-ae3b-4be8-be93-ac8509c2e1e2",
"4825942c-8f57-44ec-b50b-49d431c48a21",
"67859a35-30f3-47fb-bba7-df5340a60628",
"c34243b3-6743-41a7-9a98-916481213892",
"c43c2323-cf93-4f74-a552-c63fa0b0c185",
],
},
{
"company": "b82212d5-ed23-42a8-b483-4f443ec81b2c",
"enabledForUsers": [
"809bf2c1-ae3b-4be8-be93-ac8509c2e1e2",
"4825942c-8f57-44ec-b50b-49d431c48a21",
"67859a35-30f3-47fb-bba7-df5340a60628",
"c34243b3-6743-41a7-9a98-916481213892",
"c43c2323-cf93-4f74-a552-c63fa0b0c185",
],
},
]
edit_admin_entities ¶
Source code in components/es/public/global_customer_dashboard/admin.py
get_active_or_future_subscriptions_for_company ¶
Source code in components/es/public/global_customer_dashboard/admin.py
get_admin ¶
Source code in components/es/public/global_customer_dashboard/admin.py
get_admined_entities_for_entity_selector_es ¶
Retrieves a list of admined entities for a given user in the context of the Entity Selector (ES).
This function determines whether the 'admin_accounts' feature is enabled for the user and, based on that, fetches the admined entities accordingly, using either single companies only or including accounts.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
str
|
The unique identifier of the user for whom admined entities are being retrieved. |
required |
Returns:
| Type | Description |
|---|---|
list[AdminedEntityForEntitySelector]
|
list[AdminedEntityForEntitySelector]: A list of admined entities that the user has administrative access to |
list[AdminedEntityForEntitySelector]
|
within the Entity Selector context. |
Source code in components/es/public/global_customer_dashboard/admin.py
get_admined_entities_query_api_es ¶
Get Spain concrete instance of AdminedEntitiesQueryApi, bound to ES models
Source code in components/es/public/global_customer_dashboard/admin.py
get_admined_entity_from_id_es ¶
Source code in components/es/public/global_customer_dashboard/admin.py
get_admins_for_companies ¶
Returns the list of admins to show on the global customer dashboard, for the companies provided as input.
WARNING: This method does not take into account any potential EsAccountAdmin.
Source code in components/es/public/global_customer_dashboard/admin.py
get_common_companies_for_admins ¶
Returns the companies that two admins have in common. If the two admins are the same, it returns all the companies the admin has access to. Else it returns the companies that both admins have access to.
Source code in components/es/public/global_customer_dashboard/admin.py
get_companies_by_account_id ¶
Return list of companies ids, within a given account id
Parameters: - account_id (UUID): The unique identifier of the account for which companies are to be retrieved.
Raises:
- BaseError.missing_resource: If the account with the given account_id does not exist or cannot be found.
Source code in components/es/public/global_customer_dashboard/admin.py
get_company_details ¶
Source code in components/es/public/global_customer_dashboard/admin.py
get_company_signed_documents ¶
For now in Spain we have 2 different subscriptions for Insurance and Healthy benefits This function returns list of documents for both types of subscription
Source code in components/es/public/global_customer_dashboard/admin.py
get_invitation_details ¶
Returns the details of a pending admin invitation, by ID
Source code in components/es/public/global_customer_dashboard/admin.py
get_onboarded_employees ¶
Source code in components/es/public/global_customer_dashboard/admin.py
get_or_download_signed_document ¶
Source code in components/es/public/global_customer_dashboard/admin.py
get_pending_admin_invitations_for_companies ¶
get_pending_admin_invitations_for_companies(
company_ids,
sort_filter,
sort_direction,
cursor=None,
limit=None,
)
Source code in components/es/public/global_customer_dashboard/admin.py
get_pending_onboardings_for_admined_entity_selector_es ¶
Source code in components/es/public/global_customer_dashboard/admin.py
get_user_actively_admined_companies_ids ¶
Returns the list of company admins that user currently administrates. Companies with non active subscription are not included.
Source code in components/es/public/global_customer_dashboard/admin.py
healthy_benefits_subscription_to_customer_subscription ¶
Source code in components/es/public/global_customer_dashboard/admin.py
promote_user_to_admin ¶
Source code in components/es/public/global_customer_dashboard/admin.py
remove_admin ¶
Source code in components/es/public/global_customer_dashboard/admin.py
remove_admin_invitation ¶
send_admin_invitation_email ¶
user_can_admin_entities ¶
Source code in components/es/public/global_customer_dashboard/admin.py
user_can_invite_admins ¶
Source code in components/es/public/global_customer_dashboard/admin.py
customer_health_partner ¶
get_company_ids_by_external_ids ¶
Get company ids by external ids (Tax number: CIF also called NIF)
:param external_ids: set[str] - The external ids to get the company ids for. :return: dict[str, str | None] - A dictionary mapping external ids to company ids.
Source code in components/es/public/global_customer_dashboard/customer_health_partner.py
get_company_name_from_companies ¶
Source code in components/es/public/global_customer_dashboard/customer_health_partner.py
get_company_names_by_ids ¶
Source code in components/es/public/global_customer_dashboard/customer_health_partner.py
get_user_email_from_id ¶
get_user_info_from_id ¶
Source code in components/es/public/global_customer_dashboard/customer_health_partner.py
get_wellbeing_assessment_feature_summary ¶
Source code in components/es/public/global_customer_dashboard/customer_health_partner.py
employee ¶
cancel_employee_transfer ¶
Deletes an employee transfer. :param transfer_id: the id of the employee transfer to cancel :raises BaseErrorCode.missing_resource: If the transfer does not exist
Source code in components/es/public/global_customer_dashboard/employee.py
get_employee_scheduled_transfer_or_none ¶
Get the scheduled transfer for an employee.
:param user_id: The user id of the employee. :param company_id: The company id of the employee. :return: The scheduled transfer, or None if there is no scheduled transfer. :raises BaseErrorCode.invalid_arguments: If the scheduled transfer is not for the provided company as initial company
Source code in components/es/public/global_customer_dashboard/employee.py
schedule_employee_transfer ¶
schedule_employee_transfer(
user_id,
current_company_id,
destination_company_id,
at_date,
*,
should_cancel_initial_employment=False,
should_execute_transfer_immediately_if_at_date_is_past=True,
commit,
dry_run
)
Schedule an employee transfer.
The transfer will be executed immediately in a queue, in case the at_date is prior to today, unless you specify differently using
setting the should_execute_transfer_immediately_if_at_date_is_past to False.
:param user_id: The user id of the employee to transfer.. :param current_company_id: The id of the company the employee is currently employed at. :param destination_company_id: The id of the company to transfer the employee to. :param at_date: The date when the transfer will occur. Should be in the future. :param should_cancel_initial_employment: Whether the initial employment should be cancelled. :param should_execute_transfer_immediately_if_at_date_is_past: Whether the transfer should be executed immediately if the at_date is in the past. :param commit: Whether the transfer should be committed. Useful only if at_date is in the past. :param dry_run: Whether the transfer should execute the external side effects. Useful only if at_date is in the past. :return: The created employee transfer.
Source code in components/es/public/global_customer_dashboard/employee.py
update_employee_transfer_date ¶
Updates the transfer date of an employee transfer. :param transaction_id: the id of the employee transfer to update :param new_transfer_date: the new transfer date :raises BaseErrorCode.missing_resource: If the transfer does not exist
Source code in components/es/public/global_customer_dashboard/employee.py
employee_enrollments ¶
get_employee_enrollments ¶
Retrieve list of all active enrollments for an employee at a given date Raises an error if the user is not employed by the company at the given date
Source code in components/es/public/global_customer_dashboard/employee_enrollments.py
member ¶
AdditionalParamsHealthInsuranceOnly ¶
AdditionalParamsHealthyBenefits ¶
Bases: TypedDict
CSVHeaderDefinition
dataclass
¶
CSV_HEADERS_DEFINITIONS
module-attribute
¶
CSV_HEADERS_DEFINITIONS = [
CSVHeaderDefinition(
field_name="email",
order=1,
header_by_lang={
"es": "Correo electrónico del empleado (mismo correo que para el seguro)",
"en": "Employee email (Match email used for insurance)",
},
),
CSVHeaderDefinition(
field_name="annual_salary",
order=2,
header_by_lang={
"es": "Salario bruto anual (redondeado al entero más cercano, ej: 41852)",
"en": "Gross annual salary (Rounded to the nearest integer, ex: 41852)",
},
),
CSVHeaderDefinition(
field_name="hiring_date",
order=3,
header_by_lang={
"es": "Fecha de contratación (AAAA-MM-DD)",
"en": "Hiring date (YYYY-MM-DD)",
},
),
CSVHeaderDefinition(
field_name="tax_regime",
order=4,
header_by_lang={
"es": "Régimen fiscal (opciones disponibles: General / Navarra / Vizcaya y Guipuzcoa / Alava)",
"en": "Tax regime (Available choices: General / Navarre / Biscay and Gipuzkoa / Alava)",
},
),
CSVHeaderDefinition(
field_name="lang",
order=5,
header_by_lang={
"es": "Idioma (es / en)",
"en": "Language (en / es)",
},
),
CSVHeaderDefinition(
field_name="payroll_id",
order=6,
header_by_lang={
"es": "ID de empleado (opcional)",
"en": "Employee ID (optional)",
},
required=False,
),
]
EditEmployeeInvitationParams ¶
EsEmployeeDetails
dataclass
¶
EsEmployeeDetails(
first_name,
last_name,
email,
enrollments,
offboarding_email_sent,
hiring_date=isodate_field(),
offboarding_email_send_date=optional_isodate_field(),
employment_end_date=optional_isodate_field(),
insurance_period=None,
gender=None,
annual_salary_label=None,
tax_regime=None,
payroll_id=None,
)
HEADERS_BY_LANG
module-attribute
¶
HEADERS_BY_LANG = {
"es": [
"Correo electrónico del empleado (mismo correo que para el seguro)",
"Salario bruto anual (redondeado al entero más cercano, ej: 41852)",
"Fecha de contratación (AAAA-MM-DD)",
"Régimen fiscal (opciones disponibles: General / Navarra / Vizcaya y Guipuzcoa / Alava)",
"Idioma (es / en)",
],
"en": [
"Employee email (Match email used for insurance)",
"Gross annual salary (Rounded to the nearest integer, ex: 41852)",
"Hiring date (YYYY-MM-DD)",
"Tax regime (Available choices: General / Navarre / Biscay and Gipuzkoa / Alava)",
"Language (en / es)",
],
}
LINEAR_SPAIN_ENG_ON_CALL_LABEL
module-attribute
¶
LINEAR_SPAIN_TEAM_ID
module-attribute
¶
MemberInvitationParams
dataclass
¶
PAYROLL_HEADER_BY_LANG
module-attribute
¶
TEMPLATE_NAME_BY_LANG
module-attribute
¶
TEMPLATE_NAME_BY_LANG = {
"es": "invitacion_beneficios_modelo.csv",
"en": "invitation_benefits_template.csv",
}
UpdateEmployeeDetailsParams2 ¶
anonymize_salary ¶
Anonymize the salary of an employee.
Returns: - str: Returns "..." if the salary is anonymized. - None: Returns None if the salary input is None.
Source code in components/es/public/global_customer_dashboard/member.py
cancel_employee_invitation ¶
Cancel a pending employee invitation by ID.
Attempts to cancel the invitation through two possible sources: 1. Employee onboarding system (EsEmployeeOnboardingModelBroker) 2. Employment component blocked movements (from ES admin dashboard)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
company_id
|
UUID
|
UUID of the company the invitation belongs to |
required |
invitation_id
|
UUID
|
UUID of the invitation to cancel |
required |
Raises:
| Type | Description |
|---|---|
missing_resource
|
If no invitation found with the given ID |
Returns:
| Type | Description |
|---|---|
None
|
None |
Source code in components/es/public/global_customer_dashboard/member.py
check_employee_bulk_invitation_csv ¶
Check the validity of the employee bulk invitation CSV file.
Source code in components/es/public/global_customer_dashboard/member.py
create_bulk_members_invitations ¶
Source code in components/es/public/global_customer_dashboard/member.py
create_bulk_members_invitations_json ¶
Source code in components/es/public/global_customer_dashboard/member.py
create_member_invitation ¶
Create a new member invitation in the company. - Creates EmployeeOnboarding in ES - Sends an email to the employee with the invitation link
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
company_id
|
str
|
The ID of the company. |
required |
invite_email
|
str
|
The email address of the employee to invite. |
required |
start_date
|
date
|
The start date for the employee's coverage. |
required |
additional_params
|
AdditionalParamsHealthyBenefits | AdditionalParamsHealthInsuranceOnly
|
Additional parameters for the invitation. |
required |
Returns:
| Name | Type | Description |
|---|---|---|
tuple |
CustomerDashboardEmployeesInvitationResponses
|
A tuple containing: - CustomerDashboardEmployeeInvitation: The invitation details if successful. - CustomerDashboardEmployeeInvitationError: The error details if the invitation failed. |
Source code in components/es/public/global_customer_dashboard/member.py
create_member_invitations ¶
Create new member invitations in the company. For each invitation: - Creates EmployeeOnboarding in ES - Sends an email to the employee with the invitation link
Returns a tuple of two lists: - A list of CustomerDashboardEmployeeInvitation objects for successfully invited employees - A list of CustomerDashboardEmployeeInvitationError objects for failed invitations
Source code in components/es/public/global_customer_dashboard/member.py
520 521 522 523 524 525 526 527 528 529 530 531 532 533 534 535 536 537 538 539 540 541 542 543 544 545 546 547 548 549 550 551 552 553 554 555 556 557 558 559 560 561 562 563 564 565 566 567 568 569 570 571 572 573 574 575 576 577 578 579 580 581 582 583 584 585 586 587 588 589 590 591 592 593 594 595 596 597 598 599 600 601 602 603 604 605 606 607 608 609 610 611 612 613 614 615 616 617 618 619 620 621 622 623 624 625 626 627 628 629 630 631 632 633 634 635 636 637 638 639 640 641 642 643 644 645 646 647 648 649 650 651 652 653 654 655 656 657 658 659 660 661 | |
edit_employee_invitation ¶
Edit an employee invitation by ID.
Attempts to edit the invitation through the Employee onboarding system (EsEmployeeOnboardingModelBroker)
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
invitation_id
|
UUID
|
UUID of the invitation to edit |
required |
company_id
|
UUID
|
UUID of the company the invitation belongs to |
required |
additional_params
|
EditEmployeeInvitationParams
|
dict containing the fields to update |
required |
Raises:
| Type | Description |
|---|---|
missing_resource
|
If no invitation found with the given ID |
Returns:
| Type | Description |
|---|---|
None
|
None |
Source code in components/es/public/global_customer_dashboard/member.py
902 903 904 905 906 907 908 909 910 911 912 913 914 915 916 917 918 919 920 921 922 923 924 925 926 927 928 929 930 931 932 933 934 935 936 937 938 939 940 941 942 943 944 945 946 947 948 949 950 951 952 953 954 955 956 957 958 959 960 961 962 963 964 965 966 967 968 969 970 971 972 973 974 975 976 977 978 979 980 981 982 983 984 985 986 987 988 989 990 991 992 993 994 995 996 997 | |
generate_bulk_invitation_template ¶
Source code in components/es/public/global_customer_dashboard/member.py
get_csv_field_names_by_order ¶
Get all field names from CSV header definitions sorted by their order.
Source code in components/es/public/global_customer_dashboard/member.py
get_csv_headers_by_lang ¶
Source code in components/es/public/global_customer_dashboard/member.py
get_employee_details ¶
Retrieve comprehensive employee details for a user within a Spanish company.
Fetches and aggregates employee information including personal details, employment status, enrollments, insurance periods, and healthy benefits profiles. This is used in the global customer dashboard to display member information.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
UUID
|
The unique identifier of the user/employee. |
required |
company_id
|
UUID
|
The unique identifier of the company. |
required |
Returns:
| Type | Description |
|---|---|
EmployeeDetails[EsEmployeeDetails]
|
EmployeeDetails containing the user's personal information, employment details, |
EmployeeDetails[EsEmployeeDetails]
|
enrollments, salary information, and insurance period. |
Raises:
| Type | Description |
|---|---|
missing_resource
|
If no employment is found for the user in the specified company. |
Source code in components/es/public/global_customer_dashboard/member.py
207 208 209 210 211 212 213 214 215 216 217 218 219 220 221 222 223 224 225 226 227 228 229 230 231 232 233 234 235 236 237 238 239 240 241 242 243 244 245 246 247 248 249 250 251 252 253 254 255 256 257 258 259 260 261 262 263 264 265 266 267 268 269 270 271 272 273 274 275 276 277 278 279 280 281 282 283 284 285 286 287 288 289 290 291 292 293 294 295 296 297 298 299 300 301 302 303 304 305 306 307 308 309 310 311 312 313 314 315 316 317 318 319 320 321 322 | |
map_es_employee_invitation_result_to_employee_invitation_result ¶
Source code in components/es/public/global_customer_dashboard/member.py
update_employee_details ¶
Update the details of an employee in a Spanish company.
This function handles updating employee information tax regime and annual salary.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
UUID
|
UUID of the employee to update |
required |
company_id
|
UUID
|
UUID of the Spanish company where the employee works |
required |
details
|
UpdateEmployeeDetailsParams2
|
Dictionary containing the employee details to update: - tax_regime: Tax regime to apply to the employee - annual_salary: New annual salary (optional, will use existing if None) |
required |
commit
|
bool
|
Whether to commit the database transaction (default: True) |
True
|
Returns:
| Type | Description |
|---|---|
EmployeeDetails[EsEmployeeDetails]
|
Updated EmployeeDetails object containing the employee's current information |
Raises:
| Type | Description |
|---|---|
missing_resource
|
If no employment is found for the user in the company |
invalid_arguments
|
If annual salary is not provided, and cannot be inferred from existing profile |
Note
- Annual salary defaults to current profile value if not provided
- Updates are applied to the next payroll period start date
Source code in components/es/public/global_customer_dashboard/member.py
348 349 350 351 352 353 354 355 356 357 358 359 360 361 362 363 364 365 366 367 368 369 370 371 372 373 374 375 376 377 378 379 380 381 382 383 384 385 386 387 388 389 390 391 392 393 394 395 396 397 398 399 400 401 402 403 404 405 406 407 408 409 410 411 412 413 414 415 416 417 418 419 420 421 422 423 424 425 426 427 428 429 430 431 432 433 434 435 436 437 438 439 440 441 442 443 444 445 | |
components.es.public.helpers ¶
flask_admin_link ¶
extend_flask_admin_config ¶
Extend the Flask Admin configuration with custom formatters for cross-component links.
This is useful to improve navigation between component models that don't have direct dependencies, for example those using opaque reference strings instead of foreign keys or typed IDs. Those kinds of references are typically app-dependent.
Source code in components/es/public/helpers/flask_admin_link.py
format_entity_name_for_link ¶
link_to_company ¶
link_to_contract ¶
link_to_employment_detail ¶
link_to_entity ¶
link_to_health_contract_version ¶
link_to_policy ¶
front_end ¶
FRONT_END_PATHS
module-attribute
¶
FRONT_END_PATHS = dict(
MARMOT_URL="/marmot",
DEPENDENT_INVITE_URL="/partner-onboarding",
LOGIN_URL="/login",
PASSWORD_RESET_BASE_URL="/password_reset",
APP_URL="/dashboard",
UNSUBSCRIBE_URL="/unsubscribe",
MARMOT_ACCOUNT_URL="/TODO-TODO-TODO",
MARMOT_COMPANY_URL="/marmot/company/",
MARMOT_USER_URL="/marmot/user/",
CUSTOMER_ADMIN_ONBOARDING_INVITE_URL="/onboarding/customer-admin-onboarding",
ONBOARDING_RESEND_EMAIL_URL_EN="/en/onboarding/resend-email",
ONBOARDING_RESEND_EMAIL_URL_ES="/es/onboarding/resend-email",
)
init_data_loader ¶
init_data_loader ¶
Create the base data to be populated in fresh local DBs.
Executed by "flask data init".
Please edit the README.md file in components/es when editing this file.
Source code in components/es/public/helpers/init_data_loader.py
components.es.public.scim_api ¶
adapter ¶
EsScimAdapter ¶
Bases: GenericScimAdapter
SCIM adapter for es_api.
Source code in components/es/public/scim_api/adapter.py
create_app_user ¶
Create a user with the given first and last name. and returns the user ID.
Source code in components/es/public/scim_api/adapter.py
get_scim_users_data ¶
Returns the first and last name of users from a list of AlanEmployee objects.
Source code in components/es/public/scim_api/adapter.py
get_user_data ¶
Returns user's first and last name by user_id.
Source code in components/es/public/scim_api/adapter.py
test ¶
test_adapter ¶
adapter ¶
profile_service ¶
test_create_app_user ¶
Test create_app_user creates a new user correctly.
Source code in components/es/public/scim_api/test/test_adapter.py
test_get_scim_users_data ¶
Test get_scim_users_data returns correct mapping of user data.
Source code in components/es/public/scim_api/test/test_adapter.py
test_get_user_data ¶
Test get_user_data returns correct user identity.
Source code in components/es/public/scim_api/test/test_adapter.py
components.es.public.services ¶
push_notifications ¶
get_push_notification_logs_for_user ¶
Return a list of all the push notification logs ever created for the given user and notification names.
Source code in components/es/public/services/push_notifications.py
get_push_notification_tokens_for_user ¶
Returns list of active push notification tokens for a user, that we can send push notifications to Filters tokens with has_permission=True or has_permission=None
Source code in components/es/public/services/push_notifications.py
push_notification_sender_async ¶
Source code in components/es/internal/push_notifications/push_notification_sender.py
push_notification_sender_sync ¶
Source code in components/es/internal/push_notifications/push_notification_sender.py
components.es.public.test_data_generator ¶
get_test_data_generation_config ¶
Source code in components/es/internal/admin_tools/test_data_generator/test_data_generation_config.py
components.es.public.user ¶
get_alan_employee_email_for_user_id ¶
Get Alan employee email for user id
Source code in components/es/public/user.py
get_user ¶
get_user_address ¶
Source code in components/es/public/user.py
get_user_details ¶
Get user details from user id
Source code in components/es/public/user.py
get_user_details_from_insurance_profiles ¶
Get user details from insurance profiles