Skip to content

Commit 9072b4d

Browse files
committed
Add first experiment
1 parent a02457a commit 9072b4d

3 files changed

Lines changed: 40 additions & 0 deletions

File tree

dev/dev.py

Lines changed: 18 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,18 @@
1+
from openfisca_core.simulation_builder import SimulationBuilder
2+
from openfisca_germany import CountryTaxBenefitSystem
3+
4+
system = CountryTaxBenefitSystem()
5+
6+
population = {
7+
"persons": {
8+
"Alice": {
9+
"salary": { "2025-07": 5000 },
10+
},
11+
"Bob": {
12+
"salary": { "2025-07": 3000 },
13+
}
14+
}
15+
}
16+
17+
sim = SimulationBuilder().build_from_entities(system, population)
18+
print(sim.calculate("dev_benefit", "2025-07"))
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
description: Multiplier for the dev benefit
2+
metadata:
3+
reference: https://example.org/simple-benefit
4+
5+
values:
6+
2025-01-01:
7+
value: 2.0
Lines changed: 15 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,15 @@
1+
from openfisca_core.periods import MONTH
2+
from openfisca_core.variables import Variable
3+
from openfisca_germany.entities import Person
4+
5+
class dev_benefit(Variable):
6+
value_type = float
7+
entity = Person
8+
definition_period = MONTH
9+
label = "Dev benefit"
10+
reference = "https://example.org/simple_benefit"
11+
12+
def formula(person, period, parameters):
13+
salary = person("salary", period)
14+
multiplier = parameters(period).benefits.dev_multiplier
15+
return salary * multiplier

0 commit comments

Comments
 (0)