Skip to content

Commit

Permalink
Fix simpledb budget lowest_level for income
Browse files Browse the repository at this point in the history
  • Loading branch information
akariv committed Dec 15, 2024
1 parent c9308d3 commit fd7d572
Showing 1 changed file with 5 additions and 5 deletions.
10 changes: 5 additions & 5 deletions datapackage_pipelines_budgetkey/pipelines/simpledb/process.py
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,8 @@

import dataflows as DF

def lowest_level(row):
return row['level'] == 4 or (row['level'] == 3 and row['is_proposal'])
def lowest_level(row, max_level=4):
return row['level'] == max_level or (row['level'] == max_level-1 and row['is_proposal'])

def clean_lines(text: str):
prefix = ''
Expand Down Expand Up @@ -378,7 +378,7 @@ def debug_source(source, debug):
'מסים עקיפים',
],
type='string',
default=lambda row: None if not lowest_level(row) else json.loads(row['func_cls_json'][0])[3],
default=lambda row: None if not lowest_level(row, 3) else json.loads(row['func_cls_json'][0])[3],
),
dict(
name='economic_class_primary',
Expand All @@ -393,7 +393,7 @@ def debug_source(source, debug):
'הכנסות המדינה - בנק ישראל',
],
type='string',
default=lambda row: None if not lowest_level(row) else json.loads(row['econ_cls_json'][0])[1],
default=lambda row: None if not lowest_level(row, 3) else json.loads(row['econ_cls_json'][0])[1],
),
dict(
name='economic_class_secondary',
Expand All @@ -411,7 +411,7 @@ def debug_source(source, debug):
'מענקים בטחוניים',
],
type='string',
default=lambda row: None if not lowest_level(row) else json.loads(row['econ_cls_json'][0])[3],
default=lambda row: None if not lowest_level(row, 3) else json.loads(row['econ_cls_json'][0])[3],
),
],
search=dict(
Expand Down

0 comments on commit fd7d572

Please sign in to comment.