API Reference¶
components.ca.public.auth ¶
authorization ¶
AuthorizationStrategies ¶
Authorization strategies for CA
CaAlanerAdminStrategy ¶
Bases: AlanerAdminStrategy
AlanerAdminStrategy for CA (see class AlanerAdminStrategy in shared/iam/authorization.py)
Source code in components/ca/public/auth/authorization.py
CaAuthenticatedStrategy ¶
Bases: AuthenticatedStrategy
AuthenticatedStrategy for CA (see class AuthenticatedStrategy in shared/iam/authorization.py)
Source code in components/ca/public/auth/authorization.py
CaOpenStrategy ¶
Bases: OpenStrategy
OpenStrategy for CA (see class OpenStrategy in shared/iam/authorization.py)
Source code in components/ca/public/auth/authorization.py
CaOwnerOnlyStrategy ¶
Bases: OwnerOnlyStrategy
OwnerOnlyStrategy for CA (see class OwnerOnlyStrategy in shared/iam/authorization.py)
Source code in components/ca/public/auth/authorization.py
components.ca.public.blueprints ¶
admin_api_blueprint ¶
admin_tools ¶
CaAdminToolsBlueprint ¶
Bases: AdminToolsBlueprint, ServerSideAdminToolBlueprint
route ¶
Source code in components/ca/public/blueprints/admin_tools.py
admin_tools_blueprint
module-attribute
¶
config_usage ¶
Default admin tools: see shared admin tools
Source code in components/ca/public/blueprints/admin_tools.py
customize_email ¶
Customize an email template
Source code in components/ca/public/blueprints/admin_tools.py
document_previews ¶
Default admin tools: see shared admin tools
Source code in components/ca/public/blueprints/admin_tools.py
index ¶
Default admin tools: see shared admin tools
init_blueprint ¶
Initialize the admin tools blueprint
Source code in components/ca/public/blueprints/admin_tools.py
list_api_endpoints ¶
Default admin tools: see shared admin tools
Source code in components/ca/public/blueprints/admin_tools.py
list_commands ¶
Default admin tools: see shared admin tools
Source code in components/ca/public/blueprints/admin_tools.py
list_email ¶
Default admin tools: see shared admin tools
Source code in components/ca/public/blueprints/admin_tools.py
load_admin_tools_blueprint ¶
marmot_account_company_placeholder_creation ¶
Marmot admin tools: account and company placeholder creation
Source code in components/ca/public/blueprints/admin_tools.py
marmot_company_admin_invitation ¶
Marmot admin tools: company admin invitation
Source code in components/ca/public/blueprints/admin_tools.py
marmot_company_creation ¶
Marmot admin tools: company creation
Source code in components/ca/public/blueprints/admin_tools.py
marmot_contract_amendment ¶
Marmot admin tools: contract amendment
Source code in components/ca/public/blueprints/admin_tools.py
marmot_contract_creation ¶
Marmot admin tools: contract creation
Source code in components/ca/public/blueprints/admin_tools.py
marmot_create_reimbursement_request ¶
Marmot admin tools: create reimbursement request
Source code in components/ca/public/blueprints/admin_tools.py
marmot_create_settlement ¶
Marmot admin tools: create settlement
Source code in components/ca/public/blueprints/admin_tools.py
marmot_employee_invitation ¶
Marmot admin tools: employee invitation
Source code in components/ca/public/blueprints/admin_tools.py
marmot_employee_termination ¶
Marmot admin tools: employee termination
Source code in components/ca/public/blueprints/admin_tools.py
marmot_exemption_review ¶
Marmot admin tools: exemption review
Source code in components/ca/public/blueprints/admin_tools.py
marmot_impersonate ¶
Marmot admin tools: create settlement
Source code in components/ca/public/blueprints/admin_tools.py
marmot_manual_exemption ¶
Marmot admin tools: manual exemption
Source code in components/ca/public/blueprints/admin_tools.py
marmot_onboarding_invitation ¶
Marmot admin tools: onboarding invitation
Source code in components/ca/public/blueprints/admin_tools.py
marmot_upload_exemption_justification ¶
Marmot admin tools: upload exemption justification
Source code in components/ca/public/blueprints/admin_tools.py
show_command ¶
Default admin tools: see shared admin tools
Source code in components/ca/public/blueprints/admin_tools.py
upload_file ¶
Default admin tools: see shared admin tools
Source code in components/ca/public/blueprints/admin_tools.py
view_email ¶
View an email template
Source code in components/ca/public/blueprints/admin_tools.py
ca_core_blueprint ¶
ca_core_blueprint
module-attribute
¶
ca_core_blueprint = CustomBlueprint(
"ca-core",
__name__,
cli_group=None,
template_folder="templates",
static_folder="static",
static_url_path="/static",
)
components.ca.public.claim_management ¶
api ¶
upload_therapy_invoice_as_claim ¶
Upload a therapy invoice to Telus and create local claim records.
- Uploads document + creates claim in Telus (external)
- Creates CaInsuranceDocument + IN_PROGRESS CaReimbursementRequest, notifies ops via Intercom
Source code in components/ca/public/claim_management/api.py
components.ca.public.clinic ¶
adapter ¶
CaClinicAdapter ¶
Bases: ClinicAdapter
Adapter for the CA clinic
alan_company_address
class-attribute
instance-attribute
¶
alan_company_display_name
class-attribute
instance-attribute
¶
alan_company_registration_label
class-attribute
instance-attribute
¶
alan_company_registration_number
class-attribute
instance-attribute
¶
create_external_user ¶
Create an external teleconsultation user profile with onboarding data for CA.
Source code in components/ca/public/clinic/adapter.py
get_app_base_user_data ¶
Get base user data for the CA clinic.
Source code in components/ca/public/clinic/adapter.py
get_app_user_available_health_services ¶
Get available health services for the user.
Source code in components/ca/public/clinic/adapter.py
get_app_user_data ¶
Get the user data for the CA clinic
Source code in components/ca/public/clinic/adapter.py
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 116 117 118 119 120 121 122 123 124 125 126 127 128 129 130 131 132 133 134 135 136 137 138 139 140 141 142 143 144 145 146 147 148 149 150 151 152 153 154 155 156 157 158 159 160 161 162 163 164 165 166 167 168 169 170 171 172 173 174 175 176 177 178 179 180 181 182 183 184 185 186 187 188 189 190 191 192 193 194 | |
get_booking_session_package ¶
Get the booking session package for the specified session type.
Source code in components/ca/public/clinic/adapter.py
get_coverage_status ¶
Get the coverage status for the user.
Source code in components/ca/public/clinic/adapter.py
get_inactive_profile_ids_since ¶
get_inactive_user_ids_since ¶
get_last_active_id_verification_request_for_user ¶
CA implementation of getting the last active ID verification request for a user. Since CA doesn't support ID verification for the clinic, this will raise a NotImplementedError if it's called.
Source code in components/ca/public/clinic/adapter.py
get_orientation_survey_url ¶
has_access_to_orientation_call ¶
Check if user has access to orientation calls.
has_app_user_permission ¶
Check if user has the specified permission.
Source code in components/ca/public/clinic/adapter.py
is_app_user_admin_of_company ¶
Check if user is admin of the specified company.
Source code in components/ca/public/clinic/adapter.py
is_orientation_session_mandatory ¶
request_id_verification_request_for_user ¶
CA implementation of getting or requesting ID verification for a clinic user. Since CA doesn't support ID verification for clinic users, this will raise a NotImplementedError if it's called.
Source code in components/ca/public/clinic/adapter.py
should_request_id_verification_for_user ¶
Since CA doesn't support ID verification for clinic users, this will always return False.
should_send_orientation_survey_to_member
class-attribute
instance-attribute
¶
stripe_api_key
class-attribute
instance-attribute
¶
stripe_api_key_secret_name
class-attribute
instance-attribute
¶
stripe_webhook_secret
class-attribute
instance-attribute
¶
stripe_webhook_secret_name
class-attribute
instance-attribute
¶
therapy_refundable_cancellation_limit_in_hours ¶
Get the therapy refundable cancellation limit in hours.
update_app_user_phone ¶
Update the user's phone number.
Source code in components/ca/public/clinic/adapter.py
update_app_user_ssn ¶
upload_invoice_as_insurance_document ¶
Upload an invoice as an insurance document.
Source code in components/ca/public/clinic/adapter.py
user_has_24_hour_response_guarantee ¶
validate_session_duration ¶
Validate the session duration.
Source code in components/ca/public/clinic/adapter.py
ProfileWithUserIdAndEnrollmentType
dataclass
¶
clinic_eligibility ¶
get_coverage_status ¶
Return the start and optionally the end date of the current or upcoming period of eligibility for a user.
Source code in components/ca/public/clinic/clinic_eligibility.py
components.ca.public.command_log ¶
queries ¶
get_command_logs ¶
Get command logs from the database
Source code in components/ca/public/command_log/queries.py
components.ca.public.contracting ¶
company ¶
get_account_ids_from_company_ids ¶
Get account IDs from company IDs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
company_ids
|
Iterable[str]
|
Iterable of company ID strings (UUID format) |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Sorted list of unique account ID strings |
Source code in components/ca/public/contracting/company.py
get_company_id_of_user ¶
Source code in components/ca/public/contracting/company.py
get_company_ids_from_user_enrollments ¶
Get all company IDs where the user has an active enrollment.
Covers all member types (primary, partner, child) by querying through Enrollment -> Policy -> Subscription.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
user_id
|
str
|
The user ID as a string (UUID format) |
required |
Returns:
| Type | Description |
|---|---|
list[str]
|
Sorted list of unique company IDs as strings |
Source code in components/ca/public/contracting/company.py
provinces ¶
CaProvince ¶
PROVINCE_CODE_TO_CA_PROVINCE
module-attribute
¶
PROVINCE_CODE_TO_CA_PROVINCE = {
"CA-AB": alberta,
"CA-BC": british_columbia,
"CA-MB": manitoba,
"CA-NB": new_brunswick,
"CA-NL": newfoundland_and_labrador,
"CA-NS": nova_scotia,
"CA-NT": northwest_territories,
"CA-NU": nunavut,
"CA-ON": ontario,
"CA-PE": prince_edward_island,
"CA-QC": quebec,
"CA-SK": saskatchewan,
"CA-YT": yukon,
}
PROVINCE_TO_ENGLISH_NAME
module-attribute
¶
PROVINCE_TO_ENGLISH_NAME = {
alberta: "Alberta",
british_columbia: "British Columbia",
manitoba: "Manitoba",
new_brunswick: "New Brunswick",
newfoundland_and_labrador: "Newfoundland and Labrador",
nova_scotia: "Nova Scotia",
northwest_territories: "Northwest Territories",
nunavut: "Nunavut",
ontario: "Ontario",
prince_edward_island: "Prince Edward Island",
quebec: "Quebec",
saskatchewan: "Saskatchewan",
yukon: "Yukon",
}
PROVINCE_TO_FRENCH_NAME
module-attribute
¶
PROVINCE_TO_FRENCH_NAME = {
alberta: "Alberta",
british_columbia: "Colombie-Britannique",
manitoba: "Manitoba",
new_brunswick: "Nouveau-Brunswick",
newfoundland_and_labrador: "Terre-Neuve-et-Labrador",
nova_scotia: "Nouvelle-Écosse",
northwest_territories: "Territoires du Nord-Ouest",
nunavut: "Nunavut",
ontario: "Ontario",
prince_edward_island: "Île-du-Prince-Édouard",
quebec: "Québec",
saskatchewan: "Saskatchewan",
yukon: "Yukon",
}
components.ca.public.employment ¶
ca_country_gateway ¶
CaCountryGateway ¶
Bases: CountryGateway[CaExtendedValues]
Canadian implementation of the Employment Component's CountryGateway
are_companies_in_same_account ¶
Source code in components/ca/public/employment/ca_country_gateway.py
get_account_name ¶
Source code in components/ca/public/employment/ca_country_gateway.py
get_company_information ¶
Source code in components/ca/public/employment/ca_country_gateway.py
get_employee_email_from_extended_values ¶
Retrieves the employee email from CA extended values.
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/ca/public/employment/ca_country_gateway.py
get_upstream_retry_handler ¶
get_user_admined_company_ids ¶
get_user_full_name ¶
Source code in components/ca/public/employment/ca_country_gateway.py
ca_extended_values ¶
employment_consumer ¶
Note: Do not import local country code here, do it in the internal component after checking the country code.
ca_health_affiliation_employment_change_consumer ¶
Consumer for employment changes
Source code in components/ca/public/employment/employment_consumer.py
components.ca.public.events ¶
beneficiary_created ¶
subscription ¶
subscribe_to_ca_global_events ¶
Events subscriptions that should be listened by every runtime for Canada.
Source code in components/ca/public/events/subscription.py
1 2 3 4 5 6 7 8 9 10 11 12 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 116 117 118 119 120 121 122 123 | |
subscribe_to_events ¶
components.ca.public.helpers ¶
anonymization ¶
front_end ¶
FRONT_END_PATHS
module-attribute
¶
FRONT_END_PATHS = dict(
APP_URL="/dashboard",
UNSUBSCRIBE_URL="/unsubscribe",
LOGIN_URL="/login",
PASSWORD_RESET_BASE_URL="/password_reset",
DEPENDENT_INVITE_URL="/password_creation",
MARMOT_URL="/marmot",
MARMOT_CLAIM_MANAGEMENT="/marmot/claim_management",
MARMOT_ACCOUNT_URL="/TODO-TODO-TODO",
MARMOT_USER_URL="/marmot/user/",
MARMOT_COMPANY_URL="/marmot/ca/company/",
EMPLOYEE_SIGNUP_URL="/ca/employee-onboarding",
EMPLOYEE_DEEPLINK_URL="/employee_onboarding",
CA_EMPLOYEE_ONBOARDING_URL="/onboarding",
CA_EMPLOYEE_ONBOARDING_DEEPLINK_URL="/global_onboarding",
EXEMPTION_ONBOARDING_URL="/exemption_onboarding",
COMPANY_ADMIN_ONBOARDING_INVITE_URL="/onboarding/company_admin_signup",
CUSTOMER_ADMIN_ONBOARDING_INVITE_URL="/onboarding/customer-admin-onboarding",
PARTNER_ONBOARDING_INVITE_URL="/ca/partner-onboarding",
PARTNER_DEEPLINK_URL="/partner_onboarding",
)
init_data_loader ¶
init_data_loader ¶
Create the base data to be populated in fresh local DBs.
Executed by "flask data init".
Source code in components/ca/public/helpers/init_data_loader.py
load_all_mailers ¶
load_all_mailers ¶
Loads all CA mailers, this helps setup register_sample_template_args for the admin tools
Source code in components/ca/public/helpers/load_all_mailers.py
templating ¶
configure_templating ¶
Inspired from https://github.com/alan-eu/alan-apps/blob/main/backend/components/fr/internal/helpers/templating.py#L46 ⧉
Source code in components/ca/public/helpers/templating.py
components.ca.public.rwam ¶
components.ca.public.scim_api ¶
adapter ¶
CaScimAdapter ¶
Bases: GenericScimAdapter
SCIM adapter for ca_api.
Source code in components/ca/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/ca/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/ca/public/scim_api/adapter.py
get_user_data ¶
Returns user's first and last name by user_id.
Source code in components/ca/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/ca/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/ca/public/scim_api/test/test_adapter.py
test_get_user_data ¶
Test get_user_data returns correct user identity.