def get_latest_diagnosis_author_sub_kind(job_seeker): """ Build a human readable sub category, e.g. - Employeur ACI - Employeur ETTI - Prescripteur PE - Prescripteur ML """ latest_diagnosis = get_latest_diagnosis(job_seeker) if latest_diagnosis: author_kind = get_choice(choices=AUTHOR_KIND_CHOICES, key=latest_diagnosis.author_kind) author_sub_kind = None if (latest_diagnosis.author_kind == EligibilityDiagnosis.AUTHOR_KIND_SIAE_STAFF and latest_diagnosis.author_siae): author_sub_kind = latest_diagnosis.author_siae.kind elif (latest_diagnosis.author_kind == EligibilityDiagnosis.AUTHOR_KIND_PRESCRIBER and latest_diagnosis.author_prescriber_organization): author_sub_kind = latest_diagnosis.author_prescriber_organization.kind return f"{author_kind} {author_sub_kind}" return None
}, { "name": "type", "type": "varchar", "comment": "Type organisation (abrégé)", "fn": lambda o: ORGANIZATION_KIND_TO_READABLE_KIND.get(o.kind, o.kind), }, { "name": "type_complet", "type": "varchar", "comment": "Type organisation (détaillé)", "fn": lambda o: get_choice(choices=PrescriberOrganization.Kind.choices, key=o.kind), }, { "name": "habilitée", "type": "boolean", "comment": "Organisation habilitée par le Préfet", "fn": lambda o: o.is_authorized, }, ] TABLE_COLUMNS += get_address_columns(comment_suffix=" de cette organisation") TABLE_COLUMNS += [ { "name": "date_inscription", "type": "date",
def get_job_application_origin(ja): if ja.sender_kind == JobApplication.SENDER_KIND_PRESCRIBER: if ja.is_sent_by_authorized_prescriber: return "Prescripteur habilité" return "Orienteur" return get_choice(choices=SENDER_KIND_CHOICES, key=ja.sender_kind)
}, { "name": "date_candidature", "type": "date", "comment": "Date de la candidature", "fn": lambda o: o.created_at, }, { "name": "état", "type": "varchar", "comment": "Etat de la candidature", "fn": lambda o: get_choice(choices=JobApplicationWorkflow.STATE_CHOICES, key=o.state), }, { "name": "origine", "type": "varchar", "comment": ("Origine de la candidature (employeur, candidat, prescripteur habilité, orienteur)" ), "fn": get_job_application_origin, }, { "name": "origine_détaillée",
}, { "name": "date_diagnostic", "type": "date", "comment": "Date du dernier diagnostic", "fn": lambda o: getattr(get_latest_diagnosis(o), "created_at", None), }, { "name": "type_auteur_diagnostic", "type": "varchar", "comment": "Type auteur du dernier diagnostic", "fn": lambda o: get_choice(choices=AUTHOR_KIND_CHOICES, key=get_latest_diagnosis(o).author_kind) if get_latest_diagnosis(o) else None, }, { "name": "sous_type_auteur_diagnostic", "type": "varchar", "comment": "Sous type auteur du dernier diagnostic", "fn": get_latest_diagnosis_author_sub_kind, }, { "name": "type_structure_dernière_embauche", "type": "varchar", "comment": "Type de la structure destinataire de la dernière embauche du candidat", "fn": lambda o: get_hiring_siae(o).kind if get_hiring_siae(o) else None,
"name": "type", "type": "varchar", "comment": "Type de structure (EI, ETTI, ACI, GEIQ etc..)", "fn": lambda o: o.kind, }, { "name": "siret", "type": "varchar", "comment": "SIRET de la structure", "fn": lambda o: o.siret }, { "name": "source", "type": "varchar", "comment": "Source des données de la structure", "fn": lambda o: get_choice(choices=Siae.SOURCE_CHOICES, key=o.source), }, ] TABLE_COLUMNS += get_address_columns(comment_suffix=" de la structure") TABLE_COLUMNS += [ { "name": "date_inscription", "type": "date", "comment": "Date inscription du premier compte employeur", "fn": get_siae_first_join_date, }, { "name": "total_membres", "type": "integer",