Skip to content

Commit

Permalink
feat: add date fields to etablissements mapping
Browse files Browse the repository at this point in the history
  • Loading branch information
Hajar AIT EL KADI committed Nov 8, 2023
1 parent 8c2fd35 commit 62b63b5
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 1 deletion.
6 changes: 6 additions & 0 deletions data_preprocessing/etablissements.py
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,8 @@ def download_stock(departement):
"siret",
"dateCreationEtablissement",
"trancheEffectifsEtablissement",
"anneeEffectifsEtablissement",
"dateDernierTraitementEtablissement",
"activitePrincipaleRegistreMetiersEtablissement",
"etablissementSiege",
"numeroVoieEtablissement",
Expand Down Expand Up @@ -96,6 +98,8 @@ def download_flux(data_dir):
"siret",
"dateCreationEtablissement",
"trancheEffectifsEtablissement",
"anneeEffectifsEtablissement",
"dateDernierTraitementEtablissement",
"activitePrincipaleRegistreMetiersEtablissement",
"etablissementSiege",
"numeroVoieEtablissement",
Expand Down Expand Up @@ -151,6 +155,8 @@ def preprocess_etablissements_data(siret_file_type, departement=None, data_dir=N
columns={
"dateCreationEtablissement": "date_creation",
"trancheEffectifsEtablissement": "tranche_effectif_salarie",
"anneeEffectifsEtablissement": "annee_tranche_effectif_salarie",
"dateDernierTraitementEtablissement": "date_mise_a_jour",
"activitePrincipaleRegistreMetiersEtablissement": "activite_principale"
"_registre_metier",
"etablissementSiege": "est_siege",
Expand Down
4 changes: 4 additions & 0 deletions elasticsearch/mapping_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -100,6 +100,7 @@ class EtablissementMapping(InnerDoc):
activite_principale = Text()
activite_principale_registre_metier = Keyword()
adresse = Text(analyzer=annuaire_analyzer)
annee_tranche_effectif_salarie = Date()
cedex = Keyword()
cedex_2 = Text()
code_pays_etranger = Text()
Expand All @@ -116,6 +117,7 @@ class EtablissementMapping(InnerDoc):
complement_adresse_2 = Text()
date_creation = Date()
date_debut_activite = Date()
date_mise_a_jour = Date()
departement = Keyword()
distribution_speciale = Text()
distribution_speciale_2 = Text()
Expand Down Expand Up @@ -161,6 +163,7 @@ class SiegeMapping(InnerDoc):
activite_principale = Text()
activite_principale_registre_metier = Keyword()
adresse = Text(analyzer=annuaire_analyzer)
annee_tranche_effectif_salarie = Date()
cedex = Keyword()
cedex_2 = Text()
code_pays_etranger = Text()
Expand All @@ -173,6 +176,7 @@ class SiegeMapping(InnerDoc):
complement_adresse_2 = Text()
date_creation = Date()
date_debut_activite = Date()
date_mise_a_jour = Date()
departement = Keyword()
distribution_speciale = Text()
distribution_speciale_2 = Text()
Expand Down
2 changes: 2 additions & 0 deletions sqlite/queries/create_table_etabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
siret TEXT PRIMARY KEY,
date_creation,
tranche_effectif_salarie,
annee_tranche_effectif_salarie,
date_mise_a_jour,
activite_principale_registre_metier,
est_siege,
numero_voie,
Expand Down
2 changes: 2 additions & 0 deletions sqlite/queries/create_table_flux_etabs.py
Original file line number Diff line number Diff line change
Expand Up @@ -4,6 +4,8 @@
siret TEXT PRIMARY KEY,
date_creation,
tranche_effectif_salarie,
annee_tranche_effectif_salarie,
date_mise_a_jour,
activite_principale_registre_metier,
est_siege,
numero_voie,
Expand Down
14 changes: 13 additions & 1 deletion sqlite/queries/select_fields_to_index.py
Original file line number Diff line number Diff line change
Expand Up @@ -129,6 +129,8 @@
'siren', siren,
'siret', siret,
'tranche_effectif_salarie',tranche_effectif_salarie,
'annee_tranche_effectif_salarie',annee_tranche_effectif_salarie,
'date_mise_a_jour', date_mise_a_jour,
'type_voie',type_voie,
'type_voie_2',type_voie_2
)
Expand Down Expand Up @@ -186,7 +188,11 @@
s.numero_voie_2 as numero_voie_2,
s.siren as siren,
s.siret as siret,
s.tranche_effectif_salarie as tranche_effectif_salarie,
s.tranche_effectif_salarie as
tranche_effectif_salarie,
s.annee_tranche_effectif_salarie as
annee_tranche_effectif_salarie,
s.date_mise_a_jour as date_mise_a_jour,
s.type_voie as type_voie,
s.type_voie_2 as type_voie_2
FROM siret s
Expand Down Expand Up @@ -242,6 +248,9 @@
'siren', siren,
'siret', siret,
'tranche_effectif_salarie',tranche_effectif_salarie,
'annee_tranche_effectif_salarie',
annee_tranche_effectif_salarie,
'date_mise_a_jour', date_mise_a_jour,
'type_voie',type_voie,
'type_voie_2',type_voie_2
)
Expand Down Expand Up @@ -300,6 +309,9 @@
s.siren as siren,
s.siret as siret,
s.tranche_effectif_salarie as tranche_effectif_salarie,
s.annee_tranche_effectif_salarie as
annee_tranche_effectif_salarie,
s.date_mise_a_jour as date_mise_a_jour,
s.type_voie as type_voie,
s.type_voie_2 as type_voie_2
FROM siretsiege as s
Expand Down

0 comments on commit 62b63b5

Please sign in to comment.