Api reference
components.clinic.public.business_logic ¶
gdpr_compliance ¶
delete_member_data ¶
Delete all clinic data related to a specific member.
Source code in components/clinic/public/business_logic/gdpr_compliance.py
get_profiles_ready_for_deletion ¶
Return a list of inactive global profile IDs that are ready for deletion. We use global profile IDs, because user IDs are not unique between apps (FR/ES/BE)
in the clinic, we define a member as "ready for deletion" in https://github.com/alan-eu/Topics/discussions/31845?sort=old#discussioncomment-15755603 ⧉
The summary of the properties we are interested in: +----------------------------+-----------------------------------------------+-----------------------------------------------+ | Entity Name | Properties Checked | Rationale for Properties Checked | +============================+===============================================+===============================================+ | Medical Conversations | created_at (time of last medical conversation | The user sending a message clearly denotes an | | | part sent by user) | intentional interaction with our health | | | | services. | +----------------------------+-----------------------------------------------+-----------------------------------------------+ | Therapist Booking Sessions | ends_at (time of most recent therapist booking | A session is a clear intention of interaction | | | session where the user was the attending member | with our health services; the time it ends is | | | (clinic_user field)) | when that interaction ended. Sometimes followed| | | | by a medical conversation (covered above). | +----------------------------+-----------------------------------------------+-----------------------------------------------+ | Health Programs | last_updated_at (time of most recent health | This property is updated with any interaction | | | program progress created by the user; denoted by| with a health program. Some interactions may | | | app_id and user_id) | not truly be “program” interactions (e.g., a | | | | rating), but we don’t have a better way to | | | | differentiate between actions, and this catches| | | | them all. | +----------------------------+-----------------------------------------------+-----------------------------------------------+
Returns:
| Type | Description |
|---|---|
list[UUID]
|
List[uuid.UUID]: List of global profile IDs ready for deletion |
Source code in components/clinic/public/business_logic/gdpr_compliance.py
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 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 195 196 197 198 199 200 201 202 203 204 205 206 207 208 209 210 211 212 213 214 215 216 217 218 219 | |
get_subset_of_clinic_user_ids_with_recent_health_program_interactions ¶
get_subset_of_clinic_user_ids_with_recent_health_program_interactions(
feature_users, feature_user_key_to_clinic_user_id
)
Return the subset of clinic user IDs whose corresponding feature users have had health program interactions in the last CLINIC_RETENTION_PERIOD_IN_YEARS years.
Checks the last_updated_at time of the most recent health program progress for each feature user, then maps active feature users back to clinic user IDs.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
feature_users
|
list[FeatureUser]
|
List of feature users to check |
required |
feature_user_key_to_clinic_user_id
|
dict[tuple[str, str], UUID]
|
Mapping of (app_id, app_user_id) to clinic user ID |
required |
Source code in components/clinic/public/business_logic/gdpr_compliance.py
get_subset_of_clinic_user_ids_with_recent_medical_conversation_interactions ¶
Return clinic user IDs that had medical conversation interactions within retention period.
Uses batched IN clauses to avoid overwhelming PostgreSQL with large queries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
clinic_user_ids
|
list[UUID]
|
List of clinic user IDs to check |
required |
Source code in components/clinic/public/business_logic/gdpr_compliance.py
get_subset_of_clinic_user_ids_with_recent_session_interactions ¶
Return clinic user IDs that had therapist booking sessions within retention period.
Uses batched IN clauses to avoid overwhelming PostgreSQL with large queries.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
clinic_user_ids
|
list[UUID]
|
List of clinic user IDs to check |
required |
Source code in components/clinic/public/business_logic/gdpr_compliance.py
get_user_ids_ready_for_deletion ¶
Return inactive feature users ready for deletion, bypassing global profiles.
Same retention logic as get_profiles_ready_for_deletion but operates entirely with app user IDs, avoiding the N+1 profile→feature_user resolution.
Returns:
| Type | Description |
|---|---|
list[FeatureUser]
|
Feature users whose clinic data is ready for deletion. |
Source code in components/clinic/public/business_logic/gdpr_compliance.py
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 323 324 325 326 | |
insi_identity ¶
is_identity_verified_for_user ¶
Check if the user's identity is verified.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app_user
|
FeatureUser
|
The application user whose identity is to be checked. |
required |
Returns: bool: True if the user's identity is verified, False otherwise.
Source code in components/clinic/public/business_logic/insi_identity.py
medical_conversation ¶
get_first_medical_conversation_for_member ¶
Retrieves the first medical conversation for a given member.
This function acts as a proxy to the internal business logic function
get_first_medical_conversation_for_member to fetch the first medical
conversation associated with the provided app_user.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
app_user
|
FeatureUser
|
The user for whom the first medical conversation is to be retrieved. |
required |
Returns:
| Type | Description |
|---|---|
Optional[MedicalConversation]
|
Optional[MedicalConversation]: The first medical conversation for the given member, or None if no conversation is found. |
Source code in components/clinic/public/business_logic/medical_conversation.py
mark_conversation_as_deleted ¶
Source code in components/clinic/public/business_logic/medical_conversation.py
therapist_booking_session ¶
get_past_sessions_that_need_invoice_generation_count_for_user ¶
Counts the number of past reimbursed therapist booking sessions waiting for invoicing for a specific user and session type. sessions that are waiting for invoicing are those that are not refunded, are confirmed, and have a valid credit. They ended between now and 2 days ago. (default_delay_in_hours is 48)
Arguments: feature_user (FeatureUser): The user for whom upcoming sessions need to be counted. session_type (TherapistBookingSessionType): The type of therapist session to filter by.
Returns: int: The count of done reimbursed therapist booking sessions matching the provided user and session type.
Source code in components/clinic/public/business_logic/therapist_booking_session.py
get_upcoming_reimbursed_therapist_booking_session_count_for_user ¶
Counts the number of upcoming reimbursed therapist booking sessions for a specific user and session type. Only counts sessions that are not refunded, are confirmed, have a valid credit, and are scheduled for a future date.
Arguments: feature_user (FeatureUser): The user for whom upcoming sessions need to be counted. session_type (TherapistBookingSessionType): The type of therapist session to filter by.
Returns: int: The count of upcoming reimbursed therapist booking sessions matching the provided user and session type.
Source code in components/clinic/public/business_logic/therapist_booking_session.py
user ¶
app_user_has_upcoming_availability_for_alan_consultations ¶
app_user_has_upcoming_availability_for_alan_consultations(
member_app_user,
locale=None,
availability_threshold_in_hours=24,
medical_admins_ids=None,
)
Returns true if the given member is able to book an Alan consultation within the following upcoming parameters: - next availability is within the next availability threshold in hours (24 hours by default)
Source code in components/clinic/public/business_logic/user.py
get_clinic_user_for_french_user ¶
Source code in components/clinic/public/business_logic/user.py
get_medical_admin_for_user ¶
Source code in components/clinic/public/business_logic/user.py
has_app_user_access_to_orientation ¶
Source code in components/clinic/public/business_logic/user.py
update_clinic_consent_for_user ¶
Update the clinic user consent
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
actor_user
|
FeatureUser
|
The actor feature user |
required |
has_given_consent
|
bool
|
The user has given his consent |
required |
delete_existing_data
|
Optional[bool]
|
Has to delete existing data status |
True
|
Source code in components/clinic/public/business_logic/user.py
validate_child_dependent ¶
validate_child_dependent_and_get_feature_user ¶
Validate that a child is a dependent of the current user and return a FeatureUser for the child.
Parameters:
| Name | Type | Description | Default |
|---|---|---|---|
parent_user
|
FeatureUser
|
The current user (parent) |
required |
child_app_user_id
|
str
|
The ID of the child to validate |
required |
Source code in components/clinic/public/business_logic/validate_child_dependent.py
components.clinic.public.commands ¶
app_group ¶
register_clinic_commands ¶
Source code in components/clinic/public/commands/app_group.py
booking ¶
notifications ¶
notify_all_scheduled_messages ¶
Source code in components/clinic/public/commands/booking/notifications.py
sessions ¶
backfill_missing_session_user_lang ¶
Backfill user_lang on sessions where it's missing, using each user's current app lang.
Source code in components/clinic/public/commands/booking/sessions.py
cancel_all_future_sessions_for_medical_admin_as_medical_admin ¶
Cancels all future sessions for a given medical admin as if the same medical admin is cancelling them themselves. This is useful when a medical admin is departing Alan, and we want all the members with booked sessions to receive the appropriate notifications for the cancellation.
Source code in components/clinic/public/commands/booking/sessions.py
delete_test_sessions ¶
Source code in components/clinic/public/commands/booking/sessions.py
expire_booking_invites ¶
Source code in components/clinic/public/commands/booking/sessions.py
generate_past_sessions_invoice ¶
Source code in components/clinic/public/commands/booking/sessions.py
generate_sessions_invoices ¶
Source code in components/clinic/public/commands/booking/sessions.py
push_metadata_to_doctor_ai_for_recent_ended_sessions_booked_from_mo ¶
Push the metadata of recent ended sessions (<48 hours ago) booked from Mo to Doctor AI.
Source code in components/clinic/public/commands/booking/sessions.py
refund_payment_not_linked_to_session ¶
Source code in components/clinic/public/commands/booking/sessions.py
therapists ¶
update_cached_next_availability ¶
Source code in components/clinic/public/commands/booking/therapists.py
clinic_invoices ¶
generate_fake_clinic_invoices ¶
Source code in components/clinic/public/commands/clinic_invoices.py
sync_clinic_monthly_invoice_lines_from_turing ¶
Source code in components/clinic/public/commands/clinic_invoices.py
end_to_end_test ¶
gdpr_compliance ¶
get_user_ids_ready_for_deletion ¶
Return feature users whose clinic data is ready for GDPR deletion.
Source code in components/clinic/public/commands/gdpr_compliance.py
medical_admins ¶
backfill_medical_admin_synced_ans_data ¶
This temporary command creates ANS data for medical admins that have a medical_identifier but don't have associated ANS data yet.
TODO: @sarah.louahem Remove this command once run in prod - we now create ANS data automatically.
Source code in components/clinic/public/commands/medical_admins.py
create_medical_admins ¶
Source code in components/clinic/public/commands/medical_admins.py
create_medical_chat_bot ¶
Source code in components/clinic/public/commands/medical_admins.py
set_offline_inactive_medical_admin ¶
Source code in components/clinic/public/commands/medical_admins.py
sync_medical_admin_ans_data ¶
Sync medical admin ANS data with the ANS FHIR API.
This command checks all stored medical admin ANS data and updates records that have older versions than what's available in the ANS FHIR API.
Source code in components/clinic/public/commands/medical_admins.py
medical_admins_dataset ¶
MedicalAdminData
dataclass
¶
MedicalAdminData(
first_name,
last_name,
onboarding_status,
accessible_conversation_specialties,
apps_displayed_in,
has_access_to_app_ids,
access_types,
specialty,
country,
languages,
description=None,
experiences=None,
answers_to_proactive_conversation_topics=None,
prod_id=None,
dato_id=None,
first_message_body=None,
avatar=None,
clinic_role=None,
)
answers_to_proactive_conversation_topics
class-attribute
instance-attribute
¶
MedicalAdminExperienceData
dataclass
¶
RAW_MEDICAL_ADMINS
module-attribute
¶
RAW_MEDICAL_ADMINS = [
MedicalAdminData(
first_name="Augustin",
last_name="Beaucote",
specialty=GENERAL_PRACTITIONER,
avatar="http://eu.alan.uploads.s3.eu-central-1.amazonaws.com/manual_upload/9d775ac221a84812a3cc18bae63b7766_doctor_beaucote_headshot.jpg",
description="Je suis médecin généraliste et immunologue et j’ai rejoint Alan début 2020 pour développer les services de santé.\nJ’ai fait mes études en région parisienne à la faculté du Kremlin Bicêtre avant de rejoindre la région de Montpellier en 2015, où j’ai été interne pendant 3 ans.\nJ’ai choisi de me spécialiser en immunologie et j’ai fait des remplacements en cabinet de médecine générale et aux urgences adultes et pédiatriques.",
experiences=[
MedicalAdminExperienceData(
title="Immunothérapies ciblées des maladies",
subtitle="Faculté de médecine de Montpellier",
index=3,
),
MedicalAdminExperienceData(
title="Master 2, Génome et différenciation cellulaire - Hématopoïèse",
subtitle="Université Paris Diderot et IGMM",
index=2,
),
MedicalAdminExperienceData(
title="DESC 2 d'immunologie clinique",
subtitle="Université de Montpellier",
index=1,
),
MedicalAdminExperienceData(
title="Doctorat en Médecine Générale",
subtitle="Faculté de médecine de Montpellier",
index=0,
),
],
apps_displayed_in=[alan_insurance],
accessible_conversation_specialties=[
GENERAL_MEDICINE,
PEDIATRICS,
CHILDCARE,
DIETETICS,
DERMATOLOGY,
PHYSIOTHERAPY,
GYNECOLOGY,
],
clinic_role=CLINIC_ADMIN,
has_access_to_app_ids=[ALAN_FR],
access_types=[CHAT],
answers_to_proactive_conversation_topics=[
SLEEP,
STRESS,
],
country=france,
languages=[french, english],
onboarding_status=COMPLETED,
),
MedicalAdminData(
first_name="Clara",
last_name="Poncelet",
specialty=MIDWIFE,
first_message_body="Je suis Clara, je suis sage-femme, j’exerce en Suisse dans une structure hospitalière et en France comme sage-femme libérale. Je suis aussi maman d’une petite fille depuis fin 2020 !",
avatar="http://eu.alan.uploads.s3.eu-central-1.amazonaws.com/manual_upload/3fec273f3a484072b50029a7ee7a0440_clara_poncelet.jpg",
description="Je suis sage-femme depuis 2015 et heureuse nouvelle arrivée chez Alan.\nCes cinq dernières années sont marquées par mes voyages régionaux car j’ai choisi d’exercer dans différents grands centres hospitaliers afin d’enrichir ma formation.\nDepuis 2019 je fais des remplacements en libéral pour un accompagnement semi-global et j’exerce en Suisse dans une structure hospitalière. Je me forme dans les domaines ouverts aux sages-femmes dès que j’en ai l’occasion pour adapter mes pratiques.\nJe suis maman d’une petite fille depuis fin 2020.",
experiences=[
MedicalAdminExperienceData(
title="Diplôme de sage-femme en 2015",
subtitle="Université de Bourgogne à Dijon",
index=0,
)
],
accessible_conversation_specialties=[GYNECOLOGY],
apps_displayed_in=[alan_insurance],
has_access_to_app_ids=[ALAN_FR],
access_types=[CHAT],
country=france,
languages=[french, english],
onboarding_status=COMPLETED,
),
MedicalAdminData(
first_name="Barbara",
last_name="Dezileaux",
specialty=GENERAL_PRACTITIONER,
avatar="http://eu.alan.uploads.s3.eu-central-1.amazonaws.com/manual_upload/8b28ef4ffbea476c93565ad2d3cd4eb7_doctor_dezileaux_headshot.jpg",
description="Médecin généraliste, j’ai choisi de rejoindre les équipes d’Alan car j’apprécie leur démarche d’aide et de conseil envers leurs utilisateurs.\nJe suis diplômée depuis 2015, après avoir réalisé mes études à Bordeaux puis mon internat à Lille.\nJ’exerce depuis en cabinet libéral et en clinique dans différentes régions de France.\nJ’ai à cœur de me former en continu, en particulier sur les sujets de la maternité et de la périnatalité qui me passionnent.",
experiences=[
MedicalAdminExperienceData(
title="Doctorat en Médecine Générale",
subtitle="Faculté de médecine de Lille",
index=0,
)
],
accessible_conversation_specialties=[
GENERAL_MEDICINE,
PEDIATRICS,
CHILDCARE,
DIETETICS,
DERMATOLOGY,
PHYSIOTHERAPY,
GYNECOLOGY,
],
apps_displayed_in=[alan_insurance],
access_types=[CHAT],
has_access_to_app_ids=[ALAN_FR],
country=france,
languages=[french, english],
onboarding_status=COMPLETED,
),
MedicalAdminData(
first_name="Marion",
last_name="Cosson",
specialty=GENERAL_PRACTITIONER,
clinic_role=CLINIC_ADMIN,
apps_displayed_in=[],
has_access_to_app_ids=[ALAN_FR],
accessible_conversation_specialties=[
GENERAL_MEDICINE,
PEDIATRICS,
CHILDCARE,
DIETETICS,
DERMATOLOGY,
PHYSIOTHERAPY,
GYNECOLOGY,
],
access_types=[CHAT],
country=france,
languages=[french, english, spanish],
onboarding_status=COMPLETED,
),
MedicalAdminData(
first_name="Pauline",
last_name="Lotte",
specialty=CHILDCARE_NURSE,
avatar="http://eu.alan.uploads.s3.eu-central-1.amazonaws.com/manual_upload/9a0297eaf92f4f88a763c9fe3c954983_pauline-lotte.jpg",
description="Je suis infirmière puéricultrice depuis 2007 et installée en libéral depuis 2018. J'interviens chez Alan en tant que spécialiste du sommeil.\nAprès 10 ans de pratique en hôpital pédiatrique et 1 an en direction de crèche, j'ai choisi de travailler en indépendante pour accompagner les parents au plus près de leur quotidien avec bébé.\nJe me suis spécialisée dans plusieurs domaines, et plus spécialement le sommeil du tout-petit.\nJe suis maman d'une petite fille depuis 2019.",
experiences=[
MedicalAdminExperienceData(
title="2006 - Diplôme d'Etat d'Infirmière",
subtitle="IFSI de Reims",
index=10,
),
MedicalAdminExperienceData(
title="2007 - Diplôme d'Etat de Puéricultrice",
subtitle="Ecole de puéricultrice de Reims",
index=9,
),
MedicalAdminExperienceData(
title="2013 - Diplôme Universitaire de prise en charge de la douleur de l'enfant",
subtitle=None,
index=8,
),
MedicalAdminExperienceData(
title="2019 - Instructrice Dunstan Baby Langage",
subtitle="Dunstan Baby Langage France",
index=7,
),
MedicalAdminExperienceData(
title="2019 - Educateur Montessori",
subtitle="Enfance Positive",
index=6,
),
MedicalAdminExperienceData(
title="2020 - Animateur de Signes Associés à la Parole",
subtitle="Eveil et Signes",
index=5,
),
MedicalAdminExperienceData(
title="2020 - Formation Nutrition pédiatrique",
subtitle="EPM nutrition",
index=4,
),
MedicalAdminExperienceData(
title="2020 - Formation au sommeil du bébé de 0 à 5 ans",
subtitle="M. Bilodeau",
index=3,
),
MedicalAdminExperienceData(
title="2020 - Comprendre et accompagner le sommeil de l'enfant",
subtitle="Mandy Roman",
index=2,
),
MedicalAdminExperienceData(
title="2021 - Formation consultation du sommeil, alimentation et rythmes de 0 à 6 ans en avril 2021",
subtitle="Prosom",
index=1,
),
MedicalAdminExperienceData(
title="2021 - Formation sommeil du tout petit et accompagnement parental",
subtitle="Ingrid Bayot",
index=0,
),
],
apps_displayed_in=[alan_insurance],
accessible_conversation_specialties=[CHILDCARE],
has_access_to_app_ids=[ALAN_FR],
access_types=[CHAT],
country=france,
languages=[dutch, english],
onboarding_status=COMPLETED,
),
MedicalAdminData(
first_name="Margaux",
last_name="Degen",
specialty=PSYCHOLOGIST,
accessible_conversation_specialties=[
PSYCHOLOGY,
THERAPY,
],
apps_displayed_in=[alan_insurance],
has_access_to_app_ids=[ALAN_FR],
access_types=[VIDEO],
country=france,
languages=[french, english],
onboarding_status=COMPLETED,
dato_id="148187763",
),
MedicalAdminData(
first_name="Emile",
last_name="Montrois",
specialty=PSYCHOLOGIST,
accessible_conversation_specialties=[
PSYCHOLOGY,
THERAPY,
],
access_types=[VIDEO],
apps_displayed_in=[alan_insurance],
has_access_to_app_ids=[ALAN_FR],
country=france,
languages=[french, english],
onboarding_status=COMPLETED,
dato_id="148184344",
),
MedicalAdminData(
first_name="Florian",
last_name="Ghiazza",
specialty=PHYSIOTHERAPIST,
accessible_conversation_specialties=[
PHYSIOTHERAPY,
BACK_PAIN,
EMERGENCY_PHYSIOTHERAPY,
],
access_types=[CHAT, VIDEO],
apps_displayed_in=[alan_insurance],
has_access_to_app_ids=[ALAN_FR],
country=france,
languages=[french, english],
onboarding_status=COMPLETED,
dato_id="OTiPilFASx-0yBrP2HtLrQ",
prod_id="b65af61b-c455-4c5f-a678-164d165d1f45",
),
MedicalAdminData(
first_name="Diego",
last_name="Ferral-Toro",
specialty=PHYSIOTHERAPIST,
accessible_conversation_specialties=[
PHYSIOTHERAPY,
BACK_PAIN,
EMERGENCY_PHYSIOTHERAPY,
],
access_types=[CHAT, VIDEO],
apps_displayed_in=[alan_insurance],
has_access_to_app_ids=[ALAN_ES],
country=spain,
languages=[spanish, english],
onboarding_status=COMPLETED,
dato_id="XSdL4ehETM-owb_20xEmhg",
prod_id="18eb92d9-3271-4286-91dc-a4e1a8ac5de2",
),
MedicalAdminData(
first_name="Diane",
last_name="Coomans",
specialty=PHYSIOTHERAPIST,
accessible_conversation_specialties=[
PHYSIOTHERAPY,
BACK_PAIN,
EMERGENCY_PHYSIOTHERAPY,
],
access_types=[CHAT, VIDEO],
apps_displayed_in=[alan_insurance],
has_access_to_app_ids=[ALAN_BE],
country=belgium,
languages=[dutch, english],
onboarding_status=COMPLETED,
dato_id="OXi_GJK7TziPCWlkkFWQCw",
prod_id="59ce8029-2aa1-4ff5-81b1-25156ebcf5f1",
),
MedicalAdminData(
first_name="Robin",
last_name="Vervaeke",
specialty=PHYSIOTHERAPIST,
accessible_conversation_specialties=[
PHYSIOTHERAPY,
BACK_PAIN,
EMERGENCY_PHYSIOTHERAPY,
],
access_types=[CHAT, VIDEO],
apps_displayed_in=[alan_insurance],
has_access_to_app_ids=[ALAN_FR, ALAN_ES, ALAN_BE],
country=france,
languages=[french, english],
onboarding_status=COMPLETED,
dato_id="R03pRAdAR1-Hq7_B4A0pAw",
prod_id="59584887-47a7-464d-86c7-4f1a15299eaa",
),
MedicalAdminData(
first_name="Olivier",
last_name="Delarras",
specialty=GENERAL_PRACTITIONER,
accessible_conversation_specialties=[
GENERAL_MEDICINE,
CONSULTATION,
PEDIATRICS,
CHILDCARE,
DIETETICS,
DERMATOLOGY,
PHYSIOTHERAPY,
GYNECOLOGY,
],
access_types=[CHAT, VIDEO],
apps_displayed_in=[alan_insurance],
has_access_to_app_ids=[ALAN_FR, ALAN_ES, ALAN_BE],
country=france,
languages=[french, english],
onboarding_status=COMPLETED,
dato_id="RunHY9MqRXOl4ti7fuhoTw",
prod_id="3c7c88e9-0794-4d23-9a32-002e75ca1f60",
),
]
medical_conversation ¶
close_old_answered_medical_conversations ¶
Source code in components/clinic/public/commands/medical_conversation.py
create_fake_conversations ¶
Create fake conversations for testing purposes only - count: number of fake conversations to create - specialty: medical specialty of the fake conversations to create - app: app of the fake conversations to create - is_closed: whether the fake conversations should be closed or not
Source code in components/clinic/public/commands/medical_conversation.py
erase_all_conversation_data ¶
Source code in components/clinic/public/commands/medical_conversation.py
notify_stale_consultation_conversations ¶
Notify members in stale consultation conversations (36h without HP reply post-TLC).
Source code in components/clinic/public/commands/medical_conversation.py
resolve_closable_conversations ¶
Source code in components/clinic/public/commands/medical_conversation.py
send_pending_proactive_conversations ¶
Source code in components/clinic/public/commands/medical_conversation.py
update_active_after_for_conversations ¶
This command will update the active_after field on conversations. It's helpful for: - computing it the first time - resetting it from time to time, if we have a bug and we want to fix the values
Source code in components/clinic/public/commands/medical_conversation.py
setup ¶
setup ¶
Bootstrap a local Alan Clinic environment end-to-end.
Wipes and re-creates encryption keys, medical admins, the medical chat bot, and the booking next-availability cache. Optionally generates fake conversations.
Prints a checklist of remaining manual steps (worker, frontend, Marmot HP setup).
Source code in components/clinic/public/commands/setup.py
unread_message_reminders ¶
send_medical_conversations_unread_message_reminders ¶
Source code in components/clinic/public/commands/unread_message_reminders.py
user ¶
archive_clinic_user_data ¶
Archive a clinic user's data to S3 without deleting them.
Runs collect → encrypt → upload → mapping in dry-run mode by default. Pass --execute to perform the actual archive.
Usage
flask clinic archive_clinic_user_data
Source code in components/clinic/public/commands/user.py
clear_stripe_customer_ids ¶
Clears all stripe_customer_id values from clinic_user table. Only runs in non-production environments. Usage: flask clinic clear_stripe_customer_ids flask clinic clear_stripe_customer_ids --execute
Source code in components/clinic/public/commands/user.py
delete_clinic_data_for_user ¶
Delete a clinic user and all associated data for non-medical admin users.
Source code in components/clinic/public/commands/user.py
inspect_archive ¶
Fetch, decrypt, and print a mapping file and its referenced archive. Dev only.
Usage
flask clinic inspect_archive
Example
flask clinic inspect_archive mapping_clinic-456_20260331_120000.csv.enc
Source code in components/clinic/public/commands/user.py
components.clinic.public.dependencies ¶
TherapySessionConfiguration
dataclass
¶
TherapySessionConfiguration(
duration,
price_multiplier,
credit_multiplier,
force_same_length_slot=False,
available_for_booking=True,
)
Bases: DataClassJsonMixin
Configuration for a therapy session duration variant.
Attributes:
| Name | Type | Description |
|---|---|---|
duration |
int
|
Session duration in minutes |
price_multiplier |
int
|
Multiplier applied to the base session price |
credit_multiplier |
int
|
Multiplier applied to the session credit count |
force_same_length_slot |
bool
|
Force google calendar slots to match session duration |
available_for_booking |
bool
|
Whether this configuration is visible for booking |
components.clinic.public.entities ¶
available_health_service ¶
AvailableHealthService
dataclass
¶
AvailableHealthService(
name,
has_access=None,
is_recommended=None,
has_upcoming_availability=None,
)
Bases: DataClassJsonMixin
Available health service available for a clinic user
external_onboarding_user ¶
ExternalOnboardingUserData
dataclass
¶
ExternalOnboardingUserData(
email,
first_name,
last_name,
phone_number,
password,
prehashed_password,
gender_str,
date_of_birth,
social_security_number,
place_of_birth_name,
place_of_birth_postal_code,
terms_accepted,
refresh_token_type,
client_id=None,
birth_last_name=None,
)
External onboarding user data. Attributes: email: The email of the user. first_name: The first name of the user. last_name: The last name of the user. phone_number: The phone number of the user. password: The password of the user. prehashed_password: The prehashed password of the user. gender_str: The gender of the user. date_of_birth: The date of birth of the user. social_security_number: The social security number of the user. place_of_birth_name: The name of the place of birth of the user. place_of_birth_postal_code: The postal code of the place of birth of the user. terms_accepted: Whether the user has accepted the terms and conditions. refresh_token_type: The refresh token type of the user. client_id: The Keycloak client ID for email verification flow. birth_last_name: The birth last name of the user (maiden name). Defaults to last_name if not provided.
components.clinic.public.enums ¶
available_health_service_name ¶
available_shop_product_types ¶
pricing ¶
ClinicInvoiceAmountCurrency ¶
Bases: AlanBaseEnum
format_amount ¶
Source code in components/clinic/internal/enums/clinic_invoice_amount_currency.py
regions ¶
CaAdministrativeAreas ¶
Bases: AlanBaseEnum
Canadian provinces and territories.
Used to specify which administrative regions a medical admin is licensed to operate in. Values use ISO 3166-2:CA codes (CA- prefix + 2-letter region code). -
components.clinic.public.events ¶
subscription ¶
subscribe_to_events ¶
All event subscriptions for the Clinic should be done here.