Skip to content

Commit

Permalink
feat: siege and more fields (#143)
Browse files Browse the repository at this point in the history
* feat: siege and more fields

* boost siege / use boost using number of etablissement

* boost main label

* update name... and use multimatch

* fix siegeEtablissement when false

* fix entreprise search

* fix tests

* log index in test

* use correct index name

* add test for siege, ready to go

* update yarn lock
  • Loading branch information
rmelisson authored Jan 27, 2022
1 parent 28bc98b commit e786683
Show file tree
Hide file tree
Showing 10 changed files with 1,177 additions and 1,012 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,7 @@ jobs:
env:
ELASTICSEARCH_URL: ${{ secrets.ELASTICSEARCH_URL }}
ELASTICSEARCH_API_KEY: ${{ secrets.ELASTICSEARCH_API_KEY }}
ELASTICSEARCH_INDEX_NAME: search-entreprises
run: |
cd api
yarn
Expand Down
8 changes: 8 additions & 0 deletions api/openapi.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -78,6 +78,14 @@ paths:
value: true
default: true
type: boolean
- in: "query"
name: "matchingLimit"
description: "Nombre d'établissements connexes inclus dans la réponse, -1 pour tous les établissements"
required: false
example: 100
value: 100
default: 20
type: integer
responses:
"500":
description: "Unexpexted error occured"
Expand Down
158 changes: 118 additions & 40 deletions api/src/__tests__/__snapshots__/api.test.ts.snap
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,9 @@

exports[`Test entreprise search correct siren 1`] = `
Object {
"activitePrincipale": "Fabrication et rechapage de pneumatiques",
"caractereEmployeurUniteLegale": "O",
"categorieJuridiqueUniteLegale": "5308",
"conventions": Array [
Object {
"etat": "VIGUEUR_ETEN",
Expand All @@ -25,8 +27,23 @@ Object {
"url": "https://www.legifrance.gouv.fr/affichIDCC.do?idConvention=KALICONT000005635173",
},
],
"dateCreationUniteLegale": "1955-01-01",
"etablissements": 133,
"etatAdministratifUniteLegale": "A",
"firstMatchingEtablissement": Object {
"activitePrincipaleEtablissement": "22.11Z",
"address": "PLACE DES CARMES DECHAUX 63000 CLERMONT-FERRAND",
"categorieEntreprise": "GE",
"codeCommuneEtablissement": "63113",
"etablissementSiege": true,
"etatAdministratifEtablissement": "A",
"idccs": Array [
"0045",
"9999",
"1486",
],
"siret": "85520050700017",
},
"highlightLabel": "MANUFACTURE FRANCAISE DES PNEUMATIQUES MICHELIN",
"label": "MANUFACTURE FRANCAISE DES PNEUMATIQUES MICHELIN",
"matching": 133,
Expand All @@ -38,9 +55,12 @@ Object {
exports[`Test etablissement search correct siret 1`] = `
Object {
"activitePrincipale": "Traitement de données, hébergement et activités connexes",
"activitePrincipaleEtablissement": "63.11Z",
"address": "107 RUE SERVIENT 69003 LYON",
"caractereEmployeurUniteLegale": "O",
"categorieEntreprise": "GE",
"categorieJuridiqueUniteLegale": "5308",
"codeCommuneEtablissement": "69383",
"conventions": Array [
Object {
"etat": "VIGUEUR_ETEN",
Expand All @@ -53,6 +73,8 @@ Object {
"url": "https://www.legifrance.gouv.fr/affichIDCC.do?idConvention=KALICONT000005635597",
},
],
"dateCreationUniteLegale": "1955-01-01",
"etablissementSiege": false,
"etablissements": 133,
"etatAdministratifEtablissement": "A",
"etatAdministratifUniteLegale": "A",
Expand All @@ -73,143 +95,198 @@ Object {
"activitePrincipale": "Fabrication et rechapage de pneumatiques",
"allMatchingEtablissements": Array [
Object {
"activitePrincipaleEtablissement": "22.11Z",
"address": "7 AVENUE DU PRÉSIDENT RENÉ COTY 10600 LA CHAPELLE-SAINT-LUC",
"codeCommuneEtablissement": "10081",
"etablissementSiege": false,
"idccs": Array [
"0045",
],
"siret": "85520050701171",
},
Object {
"address": "PLACE ALEXANDRE DIEU 18230 SAINT-DOULCHARD",
"activitePrincipaleEtablissement": "71.20B",
"address": "ROUTE D’ARLES 13300 SALON-DE-PROVENCE",
"codeCommuneEtablissement": "13103",
"etablissementSiege": false,
"idccs": Array [
"0045",
"9999",
],
"siret": "85520050701106",
"siret": "85520050703094",
},
Object {
"address": "ZAC DE L’ARNAHURT 33650 LA BRÈDE",
"activitePrincipaleEtablissement": "22.11Z",
"address": "RUE DE CHARLIEU 42300 ROANNE",
"codeCommuneEtablissement": "42187",
"etablissementSiege": false,
"idccs": Array [
"0045",
],
"siret": "85520050702823",
"siret": "85520050701445",
},
Object {
"address": "RUE DE CHARLIEU 42300 ROANNE",
"activitePrincipaleEtablissement": "22.11Z",
"address": "16 RUE DE TOUTLEMONDE 49300 CHOLET",
"codeCommuneEtablissement": "49099",
"etablissementSiege": false,
"idccs": Array [
"0045",
"9999",
],
"siret": "85520050701445",
"siret": "85520050700710",
},
Object {
"address": "ZI BLAVOZY-ST GERM LAPRADE 43700 BLAVOZY",
"activitePrincipaleEtablissement": "63.11Z",
"address": "107 RUE SERVIENT 69003 LYON",
"codeCommuneEtablissement": "69383",
"etablissementSiege": false,
"idccs": Array [
"0045",
"9999",
],
"siret": "85520050701866",
"siret": "85520050703169",
},
Object {
"address": "AVENUE EDOUARD MICHELIN 56000 VANNES",
"activitePrincipaleEtablissement": "22.11Z",
"address": "ROUTE DE NANTES 85000 LA ROCHE-SUR-YON",
"codeCommuneEtablissement": "85191",
"etablissementSiege": false,
"idccs": Array [
"0045",
"9999",
],
"siret": "85520050700637",
"siret": "85520050701379",
},
Object {
"address": "ZA PLATEAU D’HERIN 59220 ROUVIGNIES",
"activitePrincipaleEtablissement": "25.93Z",
"address": "RUE DU XAY 88190 GOLBEY",
"codeCommuneEtablissement": "88209",
"etablissementSiege": false,
"idccs": Array [
"0045",
],
"siret": "85520050703086",
"siret": "85520050700108",
},
Object {
"address": "107 RUE SERVIENT 69003 LYON",
"activitePrincipaleEtablissement": "58.11Z",
"address": "27 COURS DE L’ILE SEGUIN 92100 BOULOGNE-BILLANCOURT",
"codeCommuneEtablissement": "92012",
"etablissementSiege": false,
"idccs": Array [
"0045",
"1486",
"9999",
],
"siret": "85520050703169",
"siret": "85520050703144",
},
Object {
"address": "21 RUE MARCELLIN BERTHELOT 86000 POITIERS",
"activitePrincipaleEtablissement": "22.11Z",
"address": "PLACE ALEXANDRE DIEU 18230 SAINT-DOULCHARD",
"codeCommuneEtablissement": "18205",
"etablissementSiege": false,
"idccs": Array [
"0045",
"9999",
],
"siret": "85520050700132",
"siret": "85520050701106",
},
Object {
"address": "ROUTE D’ARLES 13300 SALON-DE-PROVENCE",
"activitePrincipaleEtablissement": "45.31Z",
"address": "ZAC DE L’ARNAHURT 33650 LA BRÈDE",
"codeCommuneEtablissement": "33213",
"etablissementSiege": false,
"idccs": Array [
"0045",
],
"siret": "85520050703094",
"siret": "85520050702823",
},
Object {
"activitePrincipaleEtablissement": "22.11Z",
"address": "1 RUE GUTENBERG 37300 JOUÉ-LÈS-TOURS",
"codeCommuneEtablissement": "37122",
"etablissementSiege": false,
"idccs": Array [
"0045",
"9999",
],
"siret": "85520050700850",
},
Object {
"address": "16 RUE DE TOUTLEMONDE 49300 CHOLET",
"activitePrincipaleEtablissement": "22.11Z",
"address": "ZI BLAVOZY-ST GERM LAPRADE 43700 BLAVOZY",
"codeCommuneEtablissement": "43032",
"etablissementSiege": false,
"idccs": Array [
"0045",
"9999",
],
"siret": "85520050700710",
"siret": "85520050701866",
},
Object {
"address": "PLACE DES CARMES DECHAUX 63000 CLERMONT-FERRAND",
"activitePrincipaleEtablissement": "25.93Z",
"address": "AVENUE EDOUARD MICHELIN 56000 VANNES",
"codeCommuneEtablissement": "56260",
"etablissementSiege": false,
"idccs": Array [
"0045",
"1486",
"9999",
],
"siret": "85520050700017",
"siret": "85520050700637",
},
Object {
"address": "ZI DE FELET 63300 THIERS",
"activitePrincipaleEtablissement": "52.10B",
"address": "ZA PLATEAU D’HERIN 59220 ROUVIGNIES",
"codeCommuneEtablissement": "59515",
"etablissementSiege": false,
"idccs": Array [
"0045",
],
"siret": "85520050702278",
"siret": "85520050703086",
},
Object {
"address": "USINE MICHELIN DE BLANZY LA FIOLLE (ZONE INDUSTRIELLE) BLANZY",
"activitePrincipaleEtablissement": "22.11Z",
"address": "PLACE DES CARMES DECHAUX 63000 CLERMONT-FERRAND",
"codeCommuneEtablissement": "63113",
"etablissementSiege": true,
"idccs": Array [
"0045",
"1486",
"9999",
],
"siret": "85520050700306",
"siret": "85520050700017",
},
Object {
"address": "ROUTE DE NANTES 85000 LA ROCHE-SUR-YON",
"activitePrincipaleEtablissement": "22.11Z",
"address": "ZI DE FELET 63300 THIERS",
"codeCommuneEtablissement": "63430",
"etablissementSiege": false,
"idccs": Array [
"0045",
"9999",
],
"siret": "85520050701379",
"siret": "85520050702278",
},
Object {
"address": "RUE DU XAY 88190 GOLBEY",
"activitePrincipaleEtablissement": "22.11Z",
"address": "USINE MICHELIN DE BLANZY LA FIOLLE (ZONE INDUSTRIELLE) BLANZY",
"codeCommuneEtablissement": "71040",
"etablissementSiege": false,
"idccs": Array [
"0045",
"9999",
],
"siret": "85520050700108",
"siret": "85520050700306",
},
Object {
"address": "27 COURS DE L’ILE SEGUIN 92100 BOULOGNE-BILLANCOURT",
"activitePrincipaleEtablissement": "52.10B",
"address": "21 RUE MARCELLIN BERTHELOT 86000 POITIERS",
"codeCommuneEtablissement": "86194",
"etablissementSiege": false,
"idccs": Array [
"0045",
"1486",
"9999",
],
"siret": "85520050703144",
"siret": "85520050700132",
},
],
"caractereEmployeurUniteLegale": "O",
"categorieJuridiqueUniteLegale": "5308",
"conventions": Array [
Object {
"etat": "VIGUEUR_ETEN",
Expand All @@ -232,9 +309,10 @@ Object {
"url": "https://www.legifrance.gouv.fr/affichIDCC.do?idConvention=KALICONT000005635173",
},
],
"dateCreationUniteLegale": "1955-01-01",
"etablissements": 133,
"etatAdministratifUniteLegale": "A",
"highlightLabel": "MANUFACTURE FRANCAISE DES PNEUMATIQUES <b><u>MICHELIN</b></u>",
"highlightLabel": "MANUFACTURE FRANCAISE DES PNEUMATIQUES <b><u>MICHELIN</u></b>",
"label": "MANUFACTURE FRANCAISE DES PNEUMATIQUES MICHELIN",
"matching": 18,
"simpleLabel": "MANUFACTURE FRANCAISE DES PNEUMATIQUES MICHELIN",
Expand Down
Loading

0 comments on commit e786683

Please sign in to comment.