From 199bbd01a8f6c4a1a89124230aa7a678c9397912 Mon Sep 17 00:00:00 2001 From: Vidar Strandseter Date: Fri, 19 Apr 2024 12:49:54 +0200 Subject: [PATCH] Moved checkbox-flattening in flatten.py --- src/altinn/flatten.py | 12 ++++++------ 1 file changed, 6 insertions(+), 6 deletions(-) diff --git a/src/altinn/flatten.py b/src/altinn/flatten.py index 8be78aa..0a9549a 100644 --- a/src/altinn/flatten.py +++ b/src/altinn/flatten.py @@ -331,12 +331,6 @@ def isee_transform( final_df = pd.concat([final_df, tag_df], axis=0, ignore_index=True) - if checkbox_vars is not None: - for checkbox_var in checkbox_vars: - final_df = _transform_checkbox_var( - final_df, checkbox_var, unique_code - ) - final_df["IDENT_NR"] = xml_dict[root_element]["InternInfo"]["enhetsIdent"] final_df["VERSION_NR"] = _extract_angiver_id(file_path) final_df["DELREG_NR"] = xml_dict[root_element]["InternInfo"]["delregNr"] @@ -361,6 +355,12 @@ def isee_transform( final_df["LEVELS"] = final_df.apply(_create_levels_col, axis=1) + if checkbox_vars is not None: + for checkbox_var in checkbox_vars: + final_df = _transform_checkbox_var( + final_df, checkbox_var, unique_code + ) + if mapping is not None: final_df["FELTNAVN"] = final_df["FELTNAVN"].replace(mapping)