From 442ba973df9163e3d4416b4f54c651013389b095 Mon Sep 17 00:00:00 2001 From: Shamzic Date: Tue, 1 Oct 2024 18:05:26 +0200 Subject: [PATCH] =?UTF-8?q?feat:=20mod=C3=A9lisation=20de=20la=20mutuelle?= =?UTF-8?q?=20communale=20de=20montpellier?= MIME-Version: 1.0 Content-Type: text/plain; charset=UTF-8 Content-Transfer-Encoding: 8bit --- .../communes/montpellier/eligibilite.py | 10 ++++++++++ .../montpellier/montpellier_mutuelle_communale.py | 15 +++++++++++++++ .../montpellier_mutuelle_communale.yml | 7 +++++++ 3 files changed, 32 insertions(+) create mode 100644 openfisca_france_local/communes/montpellier/eligibilite.py create mode 100644 openfisca_france_local/communes/montpellier/montpellier_mutuelle_communale.py create mode 100644 tests/communes/montpellier/montpellier_mutuelle_communale.yml diff --git a/openfisca_france_local/communes/montpellier/eligibilite.py b/openfisca_france_local/communes/montpellier/eligibilite.py new file mode 100644 index 00000000..a28e4568 --- /dev/null +++ b/openfisca_france_local/communes/montpellier/eligibilite.py @@ -0,0 +1,10 @@ +from openfisca_france.model.base import Menage, MONTH, Variable + +class montpellier_eligibilite_residence(Variable): + value_type = bool + entity = Menage + definition_period = MONTH + label = "Éligibilité résidentielle d'un ménage aux dipositifs de Montpellier" + + def formula(menage, period): + return menage('depcom', period) == b'34172' diff --git a/openfisca_france_local/communes/montpellier/montpellier_mutuelle_communale.py b/openfisca_france_local/communes/montpellier/montpellier_mutuelle_communale.py new file mode 100644 index 00000000..d097a278 --- /dev/null +++ b/openfisca_france_local/communes/montpellier/montpellier_mutuelle_communale.py @@ -0,0 +1,15 @@ +from openfisca_france.model.base import Variable, MONTH, not_, Famille + +class montpellier_mutuelle_communale(Variable): + value_type = bool + entity = Famille + definition_period = MONTH + label = "Mutuelle communale de la ville de Montpellier" + reference = [ + "https://www.montpellier.fr/4884-mutuelle-communale.htm" + ] + + def formula(famille, period): + eligibilite_residentielle = famille.demandeur.menage('montpellier_eligibilite_residence', period) + eligibilite_css = famille('css_cmu_acs_eligibilite', period) + return eligibilite_residentielle & not_(eligibilite_css) diff --git a/tests/communes/montpellier/montpellier_mutuelle_communale.yml b/tests/communes/montpellier/montpellier_mutuelle_communale.yml new file mode 100644 index 00000000..dcd2d4d8 --- /dev/null +++ b/tests/communes/montpellier/montpellier_mutuelle_communale.yml @@ -0,0 +1,7 @@ +- name: "Égibilité à la mutuelle communale de Montpellier" + period: 2024-10 + input: + depcom: ["34172", "34172", "68400", "68400"] + css_cmu_acs_eligibilite: [False, True, True, False] + output: + montpellier_mutuelle_communale: [True, False, False, False]