From 1336a40d4689a2964eaca2483cd75d754b12d026 Mon Sep 17 00:00:00 2001 From: HAEKADI Date: Tue, 27 Feb 2024 08:40:05 +0100 Subject: [PATCH 1/5] feat: add est_siae filter --- aio/aio-proxy/aio_proxy/request/search_params_model.py | 2 ++ 1 file changed, 2 insertions(+) diff --git a/aio/aio-proxy/aio_proxy/request/search_params_model.py b/aio/aio-proxy/aio_proxy/request/search_params_model.py index 289aa61b..e6226256 100644 --- a/aio/aio-proxy/aio_proxy/request/search_params_model.py +++ b/aio/aio-proxy/aio_proxy/request/search_params_model.py @@ -64,6 +64,7 @@ class SearchParams(BaseModel): type_personne: str | None = None etat_administratif_unite_legale: str | None = None nature_juridique_unite_legale: list | None = None + est_siae: bool | None = None matching_size: int = 10 lat: float | None = None lon: float | None = None @@ -209,6 +210,7 @@ def field_must_be_in_valid_list(cls, value: str, info) -> str: "est_service_public", "minimal", "est_societe_mission", + "est_siae", mode="before", ) def convert_str_to_bool(cls, boolean: str, info) -> bool: From ca823824ca61d5b712d61af810fedab8ff5a13ae Mon Sep 17 00:00:00 2001 From: HAEKADI Date: Tue, 27 Feb 2024 08:40:26 +0100 Subject: [PATCH 2/5] add siae filer to search --- aio/aio-proxy/aio_proxy/search/text_search.py | 1 + 1 file changed, 1 insertion(+) diff --git a/aio/aio-proxy/aio_proxy/search/text_search.py b/aio/aio-proxy/aio_proxy/search/text_search.py index 26db441d..3274fd74 100755 --- a/aio/aio-proxy/aio_proxy/search/text_search.py +++ b/aio/aio-proxy/aio_proxy/search/text_search.py @@ -81,6 +81,7 @@ def build_es_search_text_query(es_search_builder): "est_uai", "etat_administratif_unite_legale", "est_societe_mission", + "est_siae", ], ) From b29225662cc5be5bd9ccaed99781e1507b5ee3d5 Mon Sep 17 00:00:00 2001 From: HAEKADI Date: Tue, 27 Feb 2024 08:40:43 +0100 Subject: [PATCH 3/5] feat: add siae fields to payload --- aio/aio-proxy/aio_proxy/response/formatters/complements.py | 4 ++++ aio/aio-proxy/aio_proxy/response/unite_legale_model.py | 2 ++ 2 files changed, 6 insertions(+) diff --git a/aio/aio-proxy/aio_proxy/response/formatters/complements.py b/aio/aio-proxy/aio_proxy/response/formatters/complements.py index eb271bb6..20fbc0f9 100644 --- a/aio/aio-proxy/aio_proxy/response/formatters/complements.py +++ b/aio/aio-proxy/aio_proxy/response/formatters/complements.py @@ -30,12 +30,14 @@ def get_field(field, default=None): liste_id_organisme_formation = get_field("liste_id_organisme_formation") est_rge = get_field("est_rge") est_service_public = get_field("est_service_public") + est_siae = get_field("est_siae") est_societe_mission = format_insee_bool(get_field("est_societe_mission")) est_uai = get_field("est_uai") identifiant_association = get_field("identifiant_association_unite_legale") statut_entrepreneur_spectacle = get_field( "statut_entrepreneur_spectacle", ) + type_siae = get_field("type_siae") return Complements( collectivite_territoriale=collectivite_territoriale, convention_collective_renseignee=convention_collective_renseignee, @@ -50,9 +52,11 @@ def get_field(field, default=None): est_qualiopi=est_qualiopi, liste_id_organisme_formation=liste_id_organisme_formation, est_rge=est_rge, + est_siae=est_siae, est_service_public=est_service_public, est_societe_mission=est_societe_mission, est_uai=est_uai, identifiant_association=identifiant_association, statut_entrepreneur_spectacle=statut_entrepreneur_spectacle, + type_siae=type_siae, ) diff --git a/aio/aio-proxy/aio_proxy/response/unite_legale_model.py b/aio/aio-proxy/aio_proxy/response/unite_legale_model.py index 0f6c3672..1c859290 100644 --- a/aio/aio-proxy/aio_proxy/response/unite_legale_model.py +++ b/aio/aio-proxy/aio_proxy/response/unite_legale_model.py @@ -104,10 +104,12 @@ class Complements(BaseModel): liste_id_organisme_formation: list | None = None est_rge: bool = False est_service_public: bool = False + est_siae: bool = False est_societe_mission: bool = False est_uai: bool = False identifiant_association: str | None = None statut_entrepreneur_spectacle: str | None = None + type_siae: str | None = None class UniteLegaleResponse(BaseModel): From c5ecd088c70b9e7fad20cbe9c8c775843c01f2ee Mon Sep 17 00:00:00 2001 From: HAEKADI Date: Tue, 27 Feb 2024 08:43:02 +0100 Subject: [PATCH 4/5] tests: add siae e2e test --- aio/aio-proxy/aio_proxy/tests/e2e_tests/test_api.py | 7 +++++++ 1 file changed, 7 insertions(+) diff --git a/aio/aio-proxy/aio_proxy/tests/e2e_tests/test_api.py b/aio/aio-proxy/aio_proxy/tests/e2e_tests/test_api.py index 6d2f3b85..d9a77eb2 100755 --- a/aio/aio-proxy/aio_proxy/tests/e2e_tests/test_api.py +++ b/aio/aio-proxy/aio_proxy/tests/e2e_tests/test_api.py @@ -600,3 +600,10 @@ def test_epci(api_response_tester): response.json()["results"][0]["matching_etablissements"][0]["epci"] == "248100737" ) + + +def test_siae_filter(api_response_tester): + path = "search?est_siae=true" + api_response_tester.assert_api_response_code_200(path) + api_response_tester.test_number_of_results(path, 1) + api_response_tester.test_field_value(path, 0, "complements.est_siae", True) From 9f916f07dbbdbbc65533d2698c616c073d75c9de Mon Sep 17 00:00:00 2001 From: HAEKADI Date: Tue, 27 Feb 2024 08:51:28 +0100 Subject: [PATCH 5/5] docs: add siae fields to swagger --- aio/aio-proxy/aio_proxy/doc/open-api.yml | 23 ++++++++++++++++++++++- 1 file changed, 22 insertions(+), 1 deletion(-) diff --git a/aio/aio-proxy/aio_proxy/doc/open-api.yml b/aio/aio-proxy/aio_proxy/doc/open-api.yml index d15cb333..c2849a7b 100755 --- a/aio/aio-proxy/aio_proxy/doc/open-api.yml +++ b/aio/aio-proxy/aio_proxy/doc/open-api.yml @@ -292,6 +292,16 @@ paths: enum: - true - false + - name: est_siae + in: query + description: >- + Uniquement les structures d'insertion par l'activité économique (SIAE). + required: false + schema: + type: boolean + enum: + - true + - false - name: est_service_public in: query description: >- @@ -1216,6 +1226,12 @@ paths: Entreprise ayant au moins un établissement RGE (source : ADEME) example: false + est_siae: + type: boolean + description: >- + Structure d'insertion par l'activité économique + (source : Marché de l'Inclusion) + example: false est_service_public: type: boolean description: >- @@ -1245,7 +1261,7 @@ paths: example: null description: >- Numéro au Répertoire National des Associations (RNA) - (source : base SIRENE). + (source : base SIRENE) statut_bio: type: boolean description: >- @@ -1258,6 +1274,11 @@ paths: Statut des établissements ayant fait une demande de licence d'entrepreneur du spectacle (source: Ministère de la Culture) + type_siae: + type: string + description: >- + Type de structure de l'inclusion + (source: Marché de l'Inclusion) total_results: type: integer page: