-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
laurinehu
committed
May 13, 2024
1 parent
9f717da
commit bdf5086
Showing
7 changed files
with
121 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,10 @@ | ||
select | ||
salarie_asp."hash_numéro_pass_iae" as "hash_numéro_pass_iae", | ||
salarie_asp.salarie_id as id_salarie_asp, | ||
candidat_emploi.id as id_candidat_emplois, | ||
candidat_emploi.hash_nir as hash_nir | ||
from {{ source('fluxIAE', 'fluxIAE_Salarie') }} as salarie_asp | ||
left join {{ source('emplois', 'pass_agréments') }} as pass | ||
on salarie_asp."hash_numéro_pass_iae" = pass."hash_numéro_pass_iae" | ||
left join {{ ref('candidats') }} as candidat_emploi | ||
on candidat_emploi.id = pass.id_candidat |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
select | ||
emi.emi_pph_id as pph_id, | ||
emi.emi_ctr_id as ctr_id, | ||
emi.emi_date_fin_reelle as date_fin_reelle, | ||
rms.rms_libelle as motif_de_sortie | ||
from {{ ref("fluxIAE_EtatMensuelIndiv_v2") }} as emi | ||
left join {{ ref("fluxIAE_RefMotifSort_v2") }} as rms | ||
on emi.emi_motif_sortie_id = rms.rms_id | ||
where emi.emi_date_fin_reelle is not null | ||
group by | ||
emi.emi_pph_id, | ||
emi.emi_ctr_id, | ||
emi.emi_date_fin_reelle, | ||
emi.emi_motif_sortie_id, | ||
rms.rms_libelle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,14 @@ | ||
select | ||
ctr.contrat_id_pph, | ||
ctr.contrat_id_structure, | ||
ref_mesure.type_structure_emplois as type_structure, | ||
max(ctr.contrat_date_sortie_definitive) as date_sortie | ||
-- array_agg(motif_sortie.rms_libelle) as motifs_sortie | ||
from {{ ref('fluxIAE_ContratMission_v2') }} as ctr | ||
left join {{ ref('ref_mesure_dispositif_asp') }} as ref_mesure | ||
on ref_mesure.af_mesure_dispositif_code = ctr.contrat_mesure_disp_code | ||
where ctr.contrat_date_sortie_definitive is not null | ||
group by | ||
ctr.contrat_id_pph, | ||
ctr.contrat_id_structure, | ||
ref_mesure.type_structure_emplois |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,30 @@ | ||
select | ||
candidats.hash_nir as nir_emplois, | ||
ft_candidats.nir_hash as nir_ft, | ||
candidats.id_candidat_emplois as id_candidat_emplois, | ||
candidats.id_salarie_asp as id_salarie_asp, | ||
sorties.date_sortie, | ||
sorties.type_structure, | ||
msct.motif_de_sortie | ||
from {{ ref('candidats_pk') }} as candidats | ||
left join {{ ref('fluxIAE_Salarie_v2') }} as salarie_asp | ||
on salarie_asp.salarie_id = candidats.id_salarie_asp | ||
left join {{ source('emplois', 'pass_agréments') }} as pass | ||
on pass."hash_numéro_pass_iae" = candidats."hash_numéro_pass_iae" | ||
-- pour filtrer les candidats non ft | ||
left join {{ ref('ft_candidats_nord') }} as ft_candidats | ||
on ft_candidats.nir_hash = candidats.hash_nir | ||
-- pour récupérer la sortie | ||
left join {{ ref('sorties_definitives') }} as sorties | ||
on sorties.contrat_id_pph = candidats.id_salarie_asp | ||
-- pour récupérer le motif de sortie | ||
left join {{ ref('motif_sortie_contrat_termine') }} as msct | ||
on sorties.contrat_id_pph = msct.pph_id and sorties.date_sortie = msct.date_fin_reelle | ||
-- on ne garde que les candidats : | ||
-- - du nord | ||
-- - un pass IAE a été attribué entre le 1 janvier 2021 et le 30 juin 2023. | ||
where | ||
salarie_asp.salarie_code_dpt = '059' | ||
and pass."date_début" > '2021-01-01' | ||
and pass."date_début" < '2023-06-30' | ||
and sorties.date_sortie is not null |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
select | ||
candidats.hash_nir as nir_emplois, | ||
ft_candidats.nir_hash as nir_ft, | ||
candidats.id_candidat_emplois as id_candidat_emplois, | ||
candidats.id_salarie_asp as id_salarie_asp, | ||
sorties.date_sortie, | ||
sorties.type_structure, | ||
msct.motif_de_sortie | ||
from {{ source('oneshot', 'ft_iae_nord') }} as ft_candidats | ||
left join {{ ref('candidats_pk') }} as candidats | ||
on candidats.hash_nir = ft_candidats.nir_hash | ||
-- ici on croise avec les sorties définitives | ||
-- duplication des candidats parceque certains candidats ont plusieurs sorties | ||
left join {{ ref('sorties_definitives') }} as sorties | ||
on sorties.contrat_id_pph = candidats.id_salarie_asp | ||
-- pour récupérer le motif de sortie | ||
left join {{ ref('motif_sortie_contrat_termine') }} as msct | ||
on sorties.contrat_id_pph = msct.pph_id and sorties.date_sortie = msct.date_fin_reelle |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,25 @@ | ||
select | ||
ft.id_salarie_asp, | ||
ft.id_salarie_emplois, | ||
ft.date_sortie, | ||
ft.type_structure, | ||
ft.motif_de_sortie, | ||
nir_corresp.nir, | ||
case when nir_hash is not null then 'oui' else 'non' end as ft | ||
from {{ ref("xpnord_sorties_candidats_ft") }} as ft | ||
left join {{ ref("nir_corresp") }} as nir_corresp | ||
on nir_corresp.hash_nir = ft.nir_ft | ||
where ft.date_sortie is not null | ||
union | ||
select | ||
ft.id_salarie_asp, | ||
ft.id_salarie_emplois, | ||
ft.date_sortie, | ||
ft.type_structure, | ||
ft.motif_de_sortie, | ||
nir_corresp.nir | ||
case when nir_hash is not null then 'oui' else 'non' end as ft | ||
from {{ ref("xpnord_sorties_candidats_asp") }} as ft | ||
left join {{ ref("nir_corresp") }} as nir_corresp | ||
on nir_corresp.hash_nir = ft.nir_emplois | ||
where ft.date_sortie is not null |