Skip to content

Commit

Permalink
transform conditionally requirent extraction to be used in ods_tools (#…
Browse files Browse the repository at this point in the history
  • Loading branch information
sstruzik authored Jun 12, 2023
1 parent 6348a34 commit 81d14d3
Showing 1 changed file with 11 additions and 2 deletions.
13 changes: 11 additions & 2 deletions docker/extract_spec.py
Original file line number Diff line number Diff line change
Expand Up @@ -262,8 +262,17 @@ def get_cr_field(cr_field_df):
Returns:
conditional requirement dict
"""

return cr_field_df.to_dict(orient='records')
cr_to_field = cr_field_df.groupby('Required Field')['Input Field Name'].apply(list).to_dict()
cr_field = {}
for cr, fields in cr_to_field.items():
for field in fields:
cur_cr_field = set(fields)
for i in range(cr.count('-') + 1):
cur_cr_field |= set(cr_to_field.get(cr.rsplit('-', i)[0], []))
if len(cur_cr_field) > 1: # we remove field that provide no extra requirement
cr_field[field] = list(cur_cr_field)

return cr_field


def extract_valid_value_range(valid_value_range, dtype):
Expand Down

0 comments on commit 81d14d3

Please sign in to comment.