Skip to content

Commit

Permalink
Supprime le calcul de la distance
Browse files Browse the repository at this point in the history
  • Loading branch information
Thomas Guillet committed Apr 1, 2021
1 parent 3d39691 commit 0467693
Show file tree
Hide file tree
Showing 6 changed files with 2 additions and 35 deletions.
1 change: 1 addition & 0 deletions .gitignore
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@ build
.idea*
.tags*
*.egg-info
*.pickle
*.pyc
*.pyo
.DS_Store
Expand Down
Binary file removed openfisca_france/assets/lonlat_communes.pickle
Binary file not shown.
24 changes: 0 additions & 24 deletions openfisca_france/model/prestations/bourses_superieur.py
Original file line number Diff line number Diff line change
Expand Up @@ -135,30 +135,6 @@ class bourse_criteres_sociaux_distance_domicile_familial(Variable):
label = "Distance entre le lieu d'étude et le domicile familial pour le calcul la bourse sur critères sociaux de l'enseignement supérieur"
definition_period = MONTH

def formula(individu, period):
depcom_coords = get_communes_coords(individu.menage('depcom', period))
domicile_familial_coords = get_communes_coords(individu('bourse_criteres_sociaux_commune_domicile_familial', period))

try:
from haversine import haversine_vector, Unit
distances = haversine_vector(depcom_coords, domicile_familial_coords, Unit.KILOMETERS)
return [distance if distance != float('nan') else -1 for distance in distances]
except ModuleNotFoundError:
return -1
else:
raise


class bourse_criteres_sociaux_commune_domicile_familial(Variable):
entity = Individu
value_type = str
max_length = 5
label = "Commune du domicile familial pour la bourse sur critères sociaux de l'enseignement supérieur"
definition_period = MONTH

def formula(individu, period):
return individu.menage('depcom', period)


class bourse_criteres_sociaux_nombre_enfants_a_charge(Variable):
entity = Famille
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
distance_domicile_familial:
reference: https://www.education.gouv.fr/bo/20/Hebdo25/ESRS2013435C.htm
metadata:
type: single_amount
brackets:
Expand Down
4 changes: 0 additions & 4 deletions setup.py
Original file line number Diff line number Diff line change
Expand Up @@ -38,14 +38,10 @@
"taxipp": [
"pandas >= 0.13",
],
"bourse_criteres_sociaux": [
"haversine >= 2.3.0"
],
"dev": [
"autopep8 ==1.5.4",
"flake8 >=3.8.0,<3.9.0",
"flake8-print",
"haversine >= 2.3.0",
"pytest >= 5.0.0, < 7.0.0",
"scipy >= 0.17", # Only used to test de_net_a_brut reform
"requests >= 2.8",
Expand Down
7 changes: 0 additions & 7 deletions tests/formulas/bourses_superieur/bourse_criteres_sociaux.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -18,13 +18,6 @@
output:
bourse_criteres_sociaux_points_de_charge_distance_domicile_familial: [0, 1, 2]

- period: 2021-03
input:
depcom: [69123, 69123, 33122]
bourse_criteres_sociaux_commune_domicile_familial: [75056, 69123, 38185]
output: # Valeurs de test post-déterminées
bourse_criteres_sociaux_distance_domicile_familial: [388, 0, 507]

- period: 2021-03
input:
bourse_criteres_sociaux_nombre_enfants_a_charge: [4]
Expand Down

0 comments on commit 0467693

Please sign in to comment.