Skip to content
GitLab
Explore
Sign in
Register
Primary navigation
Search or go to…
Project
leximpact-prepare-data
Manage
Activity
Members
Labels
Plan
Issues
Issue boards
Milestones
Wiki
Code
Merge requests
Repository
Branches
Commits
Tags
Repository graph
Compare revisions
Snippets
Build
Pipelines
Jobs
Pipeline schedules
Artifacts
Deploy
Releases
Package registry
Container registry
Model registry
Operate
Environments
Terraform modules
Monitor
Incidents
Service Desk
Analyze
Value stream analytics
Contributor analytics
CI/CD analytics
Repository analytics
Model experiments
Help
Help
Support
GitLab documentation
Compare GitLab plans
GitLab community forum
Contribute to GitLab
Provide feedback
Keyboard shortcuts
?
Snippets
Groups
Projects
Show more breadcrumbs
leximpact
Simulateur socio-fiscal
Budget
leximpact-prepare-data
Commits
6accb083
Commit
6accb083
authored
4 months ago
by
clallemand
Browse files
Options
Downloads
Patches
Plain Diff
intègre le vieillissement dans la pipeline
parent
a0d5ade3
Branches
Branches containing commit
No related tags found
1 merge request
!151
Modifie la pipeline
Changes
2
Show whitespace changes
Inline
Side-by-side
Showing
2 changed files
leximpact_prepare_data/pipeline_survey_scenario.py
+1
-1
1 addition, 1 deletion
leximpact_prepare_data/pipeline_survey_scenario.py
leximpact_prepare_data/run_pipeline.py
+42
-6
42 additions, 6 deletions
leximpact_prepare_data/run_pipeline.py
with
43 additions
and
7 deletions
leximpact_prepare_data/pipeline_survey_scenario.py
+
1
−
1
View file @
6accb083
...
@@ -9,7 +9,7 @@
...
@@ -9,7 +9,7 @@
from
openfisca_core.taxbenefitsystems
import
TaxBenefitSystem
from
openfisca_core.taxbenefitsystems
import
TaxBenefitSystem
from
openfisca_survey_manager.input_dataframe_generator
import
set_table_in_survey
from
openfisca_survey_manager.input_dataframe_generator
import
set_table_in_survey
from
openfisca_survey_manager
import
default_config_files_directory
from
openfisca_survey_manager
.paths
import
default_config_files_directory
from
leximpact_prepare_data.scenario_tools.helpers_survey_scenario
import
get_copules
from
leximpact_prepare_data.scenario_tools.helpers_survey_scenario
import
get_copules
...
...
This diff is collapsed.
Click to expand it.
leximpact_prepare_data/run_pipeline.py
+
42
−
6
View file @
6accb083
...
@@ -5,6 +5,8 @@
...
@@ -5,6 +5,8 @@
from
leximpact_prepare_data.pipeline_tax_and_benefit_system
import
pipeline_tbs
from
leximpact_prepare_data.pipeline_tax_and_benefit_system
import
pipeline_tbs
import
os
import
os
import
click
import
click
import
pandas
as
pd
from
openfisca_survey_manager.input_dataframe_generator
import
set_table_in_survey
config
=
Configuration
(
project_folder
=
"
leximpact-prepare-data
"
)
config
=
Configuration
(
project_folder
=
"
leximpact-prepare-data
"
)
aggregates_path
=
config
.
get
(
"
AGREGATS_PATH
"
)
aggregates_path
=
config
.
get
(
"
AGREGATS_PATH
"
)
...
@@ -18,7 +20,7 @@
...
@@ -18,7 +20,7 @@
@click.option
(
@click.option
(
"
-erfs
"
,
"
-erfs
"
,
"
--annee_erfs
"
,
"
--annee_erfs
"
,
default
=
201
9
,
default
=
20
2
1
,
help
=
"
ERFS-FPR year
"
,
help
=
"
ERFS-FPR year
"
,
show_default
=
True
,
show_default
=
True
,
type
=
int
,
type
=
int
,
...
@@ -29,7 +31,7 @@
...
@@ -29,7 +31,7 @@
@click.option
(
@click.option
(
"
-calcul
"
,
"
-calcul
"
,
"
--annee_de_calcul
"
,
"
--annee_de_calcul
"
,
default
=
202
2
,
default
=
202
5
,
help
=
"
POTE year
"
,
help
=
"
POTE year
"
,
show_default
=
True
,
show_default
=
True
,
type
=
int
,
type
=
int
,
...
@@ -37,22 +39,56 @@
...
@@ -37,22 +39,56 @@
def
run_pipeline
(
annee_erfs
,
annee_pote
,
annee_de_calcul
):
def
run_pipeline
(
annee_erfs
,
annee_pote
,
annee_de_calcul
):
log
.
debug
(
"
Create FranceTaxBenefitSystem
"
)
log
.
debug
(
"
Create FranceTaxBenefitSystem
"
)
annee_pote
=
str
(
annee_pote
)
# Instanciation du scenario
# Instanciation du scenario
pipeline_survey_scenario
=
PipelineErfsSurveyScenario
(
pipeline_survey_scenario
=
PipelineErfsSurveyScenario
(
config_files_directory
=
config_files_directory
,
config_files_directory
=
config_files_directory
,
annee_donnees
=
annee_erfs
,
annee_donnees
=
annee_erfs
,
period
=
annee_
de_calcul
,
period
=
annee_
pote
,
baseline_tax_benefit_system
=
pipeline_tbs
,
baseline_tax_benefit_system
=
pipeline_tbs
,
collection
=
"
openfisca_erfs_fpr
"
,
collection
=
"
openfisca_erfs_fpr
"
,
survey_name
=
f
"
openfisca_erfs_fpr_
{
annee_erfs
}
"
,
survey_name
=
f
"
openfisca_erfs_fpr_
{
annee_erfs
}
"
,
)
)
pipeline_survey_scenario
.
build_imputation
(
year
=
annee_pote
)
pipeline_survey_scenario
.
build_imputation
(
year
=
str
(
annee_pote
)
)
pipeline_survey_scenario
.
save_current_survey
(
pipeline_survey_scenario
.
save_current_survey
(
variables
=
pipeline_survey_scenario
.
used_as_input_variables
,
variables
=
pipeline_survey_scenario
.
used_as_input_variables
,
collection
=
"
leximpact
"
,
collection
=
"
leximpact
"
,
survey_name
=
f
"
leximpact_
{
annee_de_calcul
}
"
,
survey_name
=
f
"
leximpact_
{
annee_pote
}
"
,
period
=
annee_de_calcul
,
)
del
pipeline_survey_scenario
survey_scenario
=
PipelineErfsSurveyScenario
(
period
=
annee_de_calcul
,
period
=
annee_de_calcul
,
annee_donnees
=
annee_pote
,
collection
=
"
leximpact
"
,
survey_name
=
f
"
leximpact_
{
annee_pote
}
"
,
config_files_directory
=
config_files_directory
,
baseline_tax_benefit_system
=
pipeline_tbs
,
)
for
year
in
[
annee_de_calcul
,
annee_de_calcul
-
1
,
annee_de_calcul
-
2
]:
variables
=
survey_scenario
.
used_as_input_variables
if
year
in
[
annee_de_calcul
-
1
,
annee_de_calcul
-
2
]:
variables
=
variables
+
[
"
rfr
"
]
data_frame_by_entity
=
survey_scenario
.
simulations
[
"
baseline
"
].
create_data_frame_by_entity
(
variables
=
variables
,
period
=
year
,
index
=
True
)
collection
=
"
leximpact
"
survey_name
=
f
"
leximpact_
{
annee_de_calcul
}
"
for
entity
,
input_dataframe
in
data_frame_by_entity
.
items
():
assert
isinstance
(
input_dataframe
,
pd
.
DataFrame
)
print
(
f
"
set_table_in_survey of
{
entity
}
for
{
year
}
in
{
collection
}
.
{
survey_name
}
"
)
set_table_in_survey
(
input_dataframe
,
entity
,
period
=
year
,
collection
=
collection
,
survey_name
=
survey_name
,
config_files_directory
=
survey_scenario
.
data
[
"
config_files_directory
"
],
source_format
=
"
parquet
"
,
)
)
This diff is collapsed.
Click to expand it.
Preview
0%
Loading
Try again
or
attach a new file
.
Cancel
You are about to add
0
people
to the discussion. Proceed with caution.
Finish editing this message first!
Save comment
Cancel
Please
register
or
sign in
to comment